Skip to content

Commit

Permalink
Merge pull request apolloconfig#965 from nobodyiam/more-test-for-pr962
Browse files Browse the repository at this point in the history
add xml config test for PR apolloconfig#962
  • Loading branch information
nobodyiam authored Feb 9, 2018
2 parents a3c3aba + 1681ec3 commit cfdbc4a
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,24 @@ public void testMultiplePropertySourcesWithSameProperties() throws Exception {
check("spring/XmlConfigPlaceholderTest3.xml", someTimeout, someBatch);
}

@Test
public void testMultiplePropertySourcesWithSameProperties2() throws Exception {
int someTimeout = 1000;
int anotherTimeout = someTimeout + 1;
int someBatch = 2000;

Config application = mock(Config.class);
when(application.getProperty(eq(TIMEOUT_PROPERTY), anyString())).thenReturn(String.valueOf(someTimeout));
when(application.getProperty(eq(BATCH_PROPERTY), anyString())).thenReturn(String.valueOf(someBatch));
mockConfig(ConfigConsts.NAMESPACE_APPLICATION, application);

Config fxApollo = mock(Config.class);
when(fxApollo.getProperty(eq(TIMEOUT_PROPERTY), anyString())).thenReturn(String.valueOf(anotherTimeout));
mockConfig(FX_APOLLO_NAMESPACE, fxApollo);

check("spring/XmlConfigPlaceholderTest6.xml", anotherTimeout, someBatch);
}

@Test
public void testMultiplePropertySourcesWithSamePropertiesWithWeight() throws Exception {
int someTimeout = 1000;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:apollo="http://www.ctrip.com/schema/apollo"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.ctrip.com/schema/apollo http://www.ctrip.com/schema/apollo.xsd">
<apollo:config namespaces="FX.apollo,application"/>

<bean class="com.ctrip.framework.apollo.spring.XmlConfigPlaceholderTest.TestXmlBean">
<property name="timeout" value="${timeout:100}"/>
<property name="batch" value="${batch:200}"/>
</bean>
</beans>

0 comments on commit cfdbc4a

Please sign in to comment.