未验证 提交 cfdbc4ac 编写于 作者: J Jason Song 提交者: GitHub

Merge pull request #965 from nobodyiam/more-test-for-pr962

add xml config test for PR #962
......@@ -92,6 +92,24 @@ public class XmlConfigPlaceholderTest extends AbstractSpringIntegrationTest {
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;
......
<?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>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册