lovepoem closed pull request #1809: [Dubbo-1684] add unit test for dubbo spring
config
URL: https://github.com/apache/incubator-dubbo/pull/1809
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/.codecov.yml b/.codecov.yml
index bd786c139e..3d04ce5daf 100644
--- a/.codecov.yml
+++ b/.codecov.yml
@@ -6,4 +6,5 @@ coverage:
threshold: 0.1%
ignore:
- "dubbo-demo/.*"
- - "dubbo-common/src/main/java/com/alibaba/dubbo/common/json/*.java" #
internal JSON impl is deprecate, ignore test coverage for them
\ No newline at end of file
+ - "dubbo-common/src/main/java/com/alibaba/dubbo/common/json/*.java" #
internal JSON impl is deprecate, ignore test coverage for them
+ -
"dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/AnnotationBean.java"
# Deprecated
\ No newline at end of file
diff --git
a/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/ConfigTest.java
b/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/ConfigTest.java
index 80de429007..86c37be085 100644
---
a/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/ConfigTest.java
+++
b/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/ConfigTest.java
@@ -46,7 +46,7 @@
import com.alibaba.dubbo.rpc.RpcException;
import com.alibaba.dubbo.rpc.service.GenericException;
import com.alibaba.dubbo.rpc.service.GenericService;
-import junit.framework.Assert;
+import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.springframework.beans.factory.BeanCreationException;
diff --git
a/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/ServiceBeanTest.java
b/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/ServiceBeanTest.java
new file mode 100644
index 0000000000..11f70558e5
--- /dev/null
+++
b/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/ServiceBeanTest.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.alibaba.dubbo.config.spring;
+
+import com.alibaba.dubbo.config.annotation.Service;
+import org.junit.Assert;
+import org.junit.Test;
+
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.mockito.Mockito.mock;
+
+public class ServiceBeanTest {
+ @Test
+ public void testGetService() {
+ TestService service = mock(TestService.class);
+ ServiceBean serviceBean = new ServiceBean(service);
+
+ Service beanService = serviceBean.getService();
+ Assert.assertThat(beanService, not(nullValue()));
+ }
+
+ abstract class TestService implements Service {
+
+ }
+}
\ No newline at end of file
diff --git
a/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/beans/factory/annotation/ReferenceAnnotationBeanPostProcessorTest.java
b/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/beans/factory/annotation/ReferenceAnnotationBeanPostProcessorTest.java
index 01dbc5317d..a1b5807cbf 100644
---
a/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/beans/factory/annotation/ReferenceAnnotationBeanPostProcessorTest.java
+++
b/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/beans/factory/annotation/ReferenceAnnotationBeanPostProcessorTest.java
@@ -36,6 +36,10 @@
import java.util.Map;
import static
com.alibaba.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor.BEAN_NAME;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.hamcrest.MatcherAssert.assertThat;
/**
* {@link ReferenceAnnotationBeanPostProcessor} Test
@@ -174,6 +178,25 @@ public void testGetInjectedMethodReferenceBeanMap() {
}
+ @Test
+ public void testModuleInfo() {
+ AnnotationConfigApplicationContext context = new
AnnotationConfigApplicationContext(TestBean.class);
+
+ ReferenceAnnotationBeanPostProcessor beanPostProcessor =
context.getBean(BEAN_NAME,
+ ReferenceAnnotationBeanPostProcessor.class);
+
+
+ Map<InjectionMetadata.InjectedElement, ReferenceBean<?>>
referenceBeanMap =
+ beanPostProcessor.getInjectedMethodReferenceBeanMap();
+
+ for (Map.Entry<InjectionMetadata.InjectedElement, ReferenceBean<?>>
entry : referenceBeanMap.entrySet()) {
+ ReferenceBean<?> referenceBean = entry.getValue();
+
+
assertThat(referenceBean.getModule().getName(),is("defaultModule"));
+ assertThat(referenceBean.getMonitor(), not(nullValue()));
+ }
+ }
+
private static class AncestorBean {
diff --git
a/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/schema/DubboNamespaceHandlerTest.java
b/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/schema/DubboNamespaceHandlerTest.java
new file mode 100644
index 0000000000..7b8665247f
--- /dev/null
+++
b/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/schema/DubboNamespaceHandlerTest.java
@@ -0,0 +1,160 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.alibaba.dubbo.config.spring.schema;
+
+import com.alibaba.dubbo.config.ApplicationConfig;
+import com.alibaba.dubbo.config.ModuleConfig;
+import com.alibaba.dubbo.config.MonitorConfig;
+import com.alibaba.dubbo.config.ProtocolConfig;
+import com.alibaba.dubbo.config.ProviderConfig;
+import com.alibaba.dubbo.config.spring.ConfigTest;
+import com.alibaba.dubbo.config.spring.ServiceBean;
+import com.alibaba.dubbo.config.spring.api.DemoService;
+import com.alibaba.dubbo.config.spring.impl.DemoServiceImpl;
+import org.junit.Test;
+import org.springframework.beans.factory.BeanCreationException;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+import java.util.Map;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.junit.Assert.assertThat;
+
+public class DubboNamespaceHandlerTest {
+ @Test
+ public void testProviderXml() {
+ ClassPathXmlApplicationContext ctx = new
ClassPathXmlApplicationContext(ConfigTest.class.getPackage().getName().replace('.',
'/') + "/demo-provider.xml");
+ ctx.start();
+
+ ProtocolConfig protocolConfig = ctx.getBean(ProtocolConfig.class);
+ assertThat(protocolConfig, not(nullValue()));
+ assertThat(protocolConfig.getName(), is("dubbo"));
+ assertThat(protocolConfig.getPort(), is(20813));
+
+ ApplicationConfig applicationConfig =
ctx.getBean(ApplicationConfig.class);
+ assertThat(applicationConfig, not(nullValue()));
+ assertThat(applicationConfig.getName(), is("demo-provider"));
+
+ DemoService service = ctx.getBean(DemoService.class);
+ assertThat(service, not(nullValue()));
+ }
+
+ @Test
+ public void testMultiProtocol() {
+ ClassPathXmlApplicationContext ctx = new
ClassPathXmlApplicationContext(ConfigTest.class.getPackage().getName().replace('.',
'/') + "/multi-protocol.xml");
+ ctx.start();
+
+ Map<String, ProtocolConfig> protocolConfigMap =
ctx.getBeansOfType(ProtocolConfig.class);
+ assertThat(protocolConfigMap.size(), is(2));
+
+ ProtocolConfig rmiProtocolConfig = protocolConfigMap.get("rmi");
+ assertThat(rmiProtocolConfig.getPort(), is(10991));
+
+ ProtocolConfig dubboProtocolConfig = protocolConfigMap.get("dubbo");
+ assertThat(dubboProtocolConfig.getPort(), is(20881));
+ }
+
+ @Test
+ public void testDefaultProtocol() {
+ ClassPathXmlApplicationContext ctx = new
ClassPathXmlApplicationContext(ConfigTest.class.getPackage().getName().replace('.',
'/') + "/override-protocol.xml");
+ ctx.start();
+
+ ProtocolConfig protocolConfig = ctx.getBean(ProtocolConfig.class);
+ assertThat(protocolConfig.getName(), is("dubbo"));
+ }
+
+ @Test
+ public void testCustomParameter() {
+ ClassPathXmlApplicationContext ctx = new
ClassPathXmlApplicationContext(ConfigTest.class.getPackage().getName().replace('.',
'/') + "/customize-parameter.xml");
+ ctx.start();
+
+ ProtocolConfig protocolConfig = ctx.getBean(ProtocolConfig.class);
+ assertThat(protocolConfig.getParameters().size(), is(1));
+ assertThat(protocolConfig.getParameters().get("protocol-paramA"),
is("protocol-paramA"));
+
+ ServiceBean serviceBean = ctx.getBean(ServiceBean.class);
+ assertThat(serviceBean.getParameters().size(), is(1));
+ assertThat(serviceBean.getParameters().get("service-paramA"),
is("service-paramA"));
+ }
+
+
+ @Test
+ public void testDelayFixedTime() {
+ ClassPathXmlApplicationContext ctx = new
ClassPathXmlApplicationContext(ConfigTest.class.getPackage().getName().replace('.',
'/') + "/delay-fixed-time.xml");
+ ctx.start();
+
+ assertThat(ctx.getBean(ServiceBean.class).getDelay(), is(300));
+ }
+
+ @Test
+ public void testTimeoutConfig() {
+ ClassPathXmlApplicationContext ctx = new
ClassPathXmlApplicationContext(ConfigTest.class.getPackage().getName().replace('.',
'/') + "/provider-nested-service.xml");
+ ctx.start();
+
+ Map<String, ProviderConfig> providerConfigMap =
ctx.getBeansOfType(ProviderConfig.class);
+
+
assertThat(providerConfigMap.get("com.alibaba.dubbo.config.ProviderConfig").getTimeout(),
is(2000));
+ }
+
+ @Test
+ public void testMonitor() {
+ ClassPathXmlApplicationContext ctx = new
ClassPathXmlApplicationContext(ConfigTest.class.getPackage().getName().replace('.',
'/') + "/provider-with-monitor.xml");
+ ctx.start();
+
+ assertThat(ctx.getBean(MonitorConfig.class), not(nullValue()));
+ }
+
+ @Test(expected = BeanCreationException.class)
+ public void testMultiMonitor() {
+ ClassPathXmlApplicationContext ctx = new
ClassPathXmlApplicationContext(ConfigTest.class.getPackage().getName().replace('.',
'/') + "/multi-monitor.xml");
+ ctx.start();
+ }
+
+ @Test(expected = BeanCreationException.class)
+ public void testMultiProviderConfig() {
+ ClassPathXmlApplicationContext ctx = new
ClassPathXmlApplicationContext(ConfigTest.class.getPackage().getName().replace('.',
'/') + "/provider-multi.xml");
+ ctx.start();
+ }
+
+ @Test
+ public void testModuleInfo() {
+ ClassPathXmlApplicationContext ctx = new
ClassPathXmlApplicationContext(ConfigTest.class.getPackage().getName().replace('.',
'/') + "/provider-with-module.xml");
+ ctx.start();
+
+ ModuleConfig moduleConfig = ctx.getBean(ModuleConfig.class);
+ assertThat(moduleConfig.getName(), is("test-module"));
+ }
+
+ @Test(expected = BeanCreationException.class)
+ public void testNotificationWithWrongBean() {
+ ClassPathXmlApplicationContext ctx = new
ClassPathXmlApplicationContext(ConfigTest.class.getPackage().getName().replace('.',
'/') + "/consumer-notification.xml");
+ ctx.start();
+ }
+
+ @Test
+ public void testProperty() {
+ ClassPathXmlApplicationContext ctx = new
ClassPathXmlApplicationContext(ConfigTest.class.getPackage().getName().replace('.',
'/') + "/service-class.xml");
+ ctx.start();
+
+ ServiceBean serviceBean = ctx.getBean(ServiceBean.class);
+
+ String prefix = ((DemoServiceImpl) serviceBean.getRef()).getPrefix();
+ assertThat(prefix, is("welcome:"));
+ }
+}
\ No newline at end of file
diff --git
a/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/status/DataSourceStatusCheckerTest.java
b/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/status/DataSourceStatusCheckerTest.java
new file mode 100644
index 0000000000..27ef3802d0
--- /dev/null
+++
b/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/status/DataSourceStatusCheckerTest.java
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.alibaba.dubbo.config.spring.status;
+
+import com.alibaba.dubbo.common.status.Status;
+import com.alibaba.dubbo.config.spring.ServiceBean;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Answers;
+import org.mockito.Mock;
+import org.springframework.context.ApplicationContext;
+
+import javax.sql.DataSource;
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+import static org.mockito.ArgumentMatchers.anyBoolean;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.BDDMockito.given;
+import static org.mockito.Mockito.mock;
+import static org.mockito.MockitoAnnotations.initMocks;
+
+public class DataSourceStatusCheckerTest {
+ private DataSourceStatusChecker dataSourceStatusChecker;
+
+ @Mock
+ private ApplicationContext applicationContext;
+
+ @Before
+ public void setUp() throws Exception {
+ initMocks(this);
+ this.dataSourceStatusChecker = new DataSourceStatusChecker();
+ new ServiceBean<Object>().setApplicationContext(applicationContext);
+ }
+
+ @Test
+ public void testWithoutApplicationContext() {
+ Status status = dataSourceStatusChecker.check();
+
+ assertThat(status.getLevel(), is(Status.Level.UNKNOWN));
+ }
+
+ @Test
+ public void testWithoutDatasource() {
+ Map<String, DataSource> map = new HashMap<String, DataSource>();
+ given(applicationContext.getBeansOfType(eq(DataSource.class),
anyBoolean(), anyBoolean())).willReturn(map);
+
+ Status status = dataSourceStatusChecker.check();
+
+ assertThat(status.getLevel(), is(Status.Level.UNKNOWN));
+ }
+
+ @Test
+ public void testWithDatasourceHasNextResult() throws SQLException {
+ Map<String, DataSource> map = new HashMap<String, DataSource>();
+ DataSource dataSource = mock(DataSource.class);
+ Connection connection = mock(Connection.class,
Answers.RETURNS_DEEP_STUBS);
+ given(dataSource.getConnection()).willReturn(connection);
+ given(connection.getMetaData().getTypeInfo().next()).willReturn(true);
+
+ map.put("mockDatabase", dataSource);
+ given(applicationContext.getBeansOfType(eq(DataSource.class),
anyBoolean(), anyBoolean())).willReturn(map);
+ Status status = dataSourceStatusChecker.check();
+
+ assertThat(status.getLevel(), is(Status.Level.OK));
+ }
+
+ @Test
+ public void testWithDatasourceNotHasNextResult() throws SQLException {
+ Map<String, DataSource> map = new HashMap<String, DataSource>();
+ DataSource dataSource = mock(DataSource.class);
+ Connection connection = mock(Connection.class,
Answers.RETURNS_DEEP_STUBS);
+ given(dataSource.getConnection()).willReturn(connection);
+ given(connection.getMetaData().getTypeInfo().next()).willReturn(false);
+
+ map.put("mockDatabase", dataSource);
+ given(applicationContext.getBeansOfType(eq(DataSource.class),
anyBoolean(), anyBoolean())).willReturn(map);
+ Status status = dataSourceStatusChecker.check();
+
+ assertThat(status.getLevel(), is(Status.Level.ERROR));
+ }
+}
\ No newline at end of file
diff --git
a/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/status/SpringStatusCheckerTest.java
b/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/status/SpringStatusCheckerTest.java
new file mode 100644
index 0000000000..1a57925c18
--- /dev/null
+++
b/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/status/SpringStatusCheckerTest.java
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.alibaba.dubbo.config.spring.status;
+
+import com.alibaba.dubbo.common.status.Status;
+import com.alibaba.dubbo.config.spring.ServiceBean;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.Lifecycle;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+import static org.mockito.BDDMockito.given;
+import static org.mockito.Mockito.mock;
+import static org.mockito.MockitoAnnotations.initMocks;
+
+public class SpringStatusCheckerTest {
+ private SpringStatusChecker springStatusChecker;
+
+ @Mock
+ private ApplicationContext applicationContext;
+
+ @Before
+ public void setUp() throws Exception {
+ initMocks(this);
+ this.springStatusChecker = new SpringStatusChecker();
+ new ServiceBean<Object>().setApplicationContext(applicationContext);
+ }
+
+ @Test
+ public void testWithoutApplicationContext() {
+ Status status = springStatusChecker.check();
+
+ assertThat(status.getLevel(), is(Status.Level.UNKNOWN));
+ }
+
+ @Test
+ public void testWithLifeCycleRunning() {
+ ApplicationLifeCycle applicationLifeCycle =
mock(ApplicationLifeCycle.class);
+ new ServiceBean<Object>().setApplicationContext(applicationLifeCycle);
+ given(applicationLifeCycle.getConfigLocations()).willReturn(new
String[]{"test1", "test2"});
+ given(applicationLifeCycle.isRunning()).willReturn(true);
+
+ Status status = springStatusChecker.check();
+
+ assertThat(status.getLevel(), is(Status.Level.OK));
+ assertThat(status.getMessage(), is("test1,test2"));
+ }
+
+ @Test
+ public void testWithoutLifeCycleRunning() {
+ ApplicationLifeCycle applicationLifeCycle =
mock(ApplicationLifeCycle.class);
+ new ServiceBean<Object>().setApplicationContext(applicationLifeCycle);
+ given(applicationLifeCycle.isRunning()).willReturn(false);
+
+ Status status = springStatusChecker.check();
+
+ assertThat(status.getLevel(), is(Status.Level.ERROR));
+ }
+
+ interface ApplicationLifeCycle extends Lifecycle, ApplicationContext {
+ String[] getConfigLocations();
+ }
+}
\ No newline at end of file
diff --git
a/dubbo-config/dubbo-config-spring/src/test/resources/META-INF/spring/dubbo-annotation-consumer.xml
b/dubbo-config/dubbo-config-spring/src/test/resources/META-INF/spring/dubbo-annotation-consumer.xml
index d73c1e98bf..f69cc74ca7 100644
---
a/dubbo-config/dubbo-config-spring/src/test/resources/META-INF/spring/dubbo-annotation-consumer.xml
+++
b/dubbo-config/dubbo-config-spring/src/test/resources/META-INF/spring/dubbo-annotation-consumer.xml
@@ -26,5 +26,8 @@
<!-- 连接注册中心配置 -->
<dubbo:registry address="N/A"/>
+ <dubbo:monitor version="1.1"/>
+ <dubbo:module name="defaultModule"/>
+ <dubbo:consumer version="1.2.0"/>
</beans>
\ No newline at end of file
diff --git
a/dubbo-config/dubbo-config-spring/src/test/resources/com/alibaba/dubbo/config/spring/consumer-notification.xml
b/dubbo-config/dubbo-config-spring/src/test/resources/com/alibaba/dubbo/config/spring/consumer-notification.xml
new file mode 100644
index 0000000000..f6b7ccc8d7
--- /dev/null
+++
b/dubbo-config/dubbo-config-spring/src/test/resources/com/alibaba/dubbo/config/spring/consumer-notification.xml
@@ -0,0 +1,32 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:dubbo="http://dubbo.apache.org/schema/dubbo"
+ xmlns="http://www.springframework.org/schema/beans"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
+ http://dubbo.apache.org/schema/dubbo
http://dubbo.apache.org/schema/dubbo/dubbo.xsd
+ ">
+
+ <!-- current application configuration -->
+ <dubbo:application name="demo-consumer"/>
+
+ <!-- service reference configuration -->
+ <dubbo:reference id="demoService"
interface="com.alibaba.dubbo.config.spring.api.DemoService">
+ <dubbo:method name="sayName" onreturn="notify.getBox"
onthrow="notify.getBox" oninvoke="notify.getBox"/>
+ </dubbo:reference>
+
+</beans>
\ No newline at end of file
diff --git
a/dubbo-config/dubbo-config-spring/src/test/resources/com/alibaba/dubbo/config/spring/delay-fixed-time.xml
b/dubbo-config/dubbo-config-spring/src/test/resources/com/alibaba/dubbo/config/spring/delay-fixed-time.xml
index d083bd2f8d..0fc5cb2ae3 100644
---
a/dubbo-config/dubbo-config-spring/src/test/resources/com/alibaba/dubbo/config/spring/delay-fixed-time.xml
+++
b/dubbo-config/dubbo-config-spring/src/test/resources/com/alibaba/dubbo/config/spring/delay-fixed-time.xml
@@ -21,15 +21,12 @@
http://dubbo.apache.org/schema/dubbo
http://dubbo.apache.org/schema/dubbo/dubbo.xsd
">
- <!-- 当前应用信息配置 -->
<dubbo:application name="demo-provider"/>
- <!-- 连接注册中心配置 -->
- <dubbo:registry address="127.0.0.1:4548"/>
+ <dubbo:registry address="N/A"/>
<dubbo:protocol name="dubbo" port="20883"/>
- <!-- 暴露服务配置 -->
<dubbo:service interface="com.alibaba.dubbo.config.spring.api.DemoService"
ref="demoService" delay="300"/>
<bean id="demoService"
class="com.alibaba.dubbo.config.spring.impl.DemoServiceImpl"/>
diff --git
a/dubbo-config/dubbo-config-spring/src/test/resources/com/alibaba/dubbo/config/spring/multi-monitor.xml
b/dubbo-config/dubbo-config-spring/src/test/resources/com/alibaba/dubbo/config/spring/multi-monitor.xml
new file mode 100644
index 0000000000..badcc2ab95
--- /dev/null
+++
b/dubbo-config/dubbo-config-spring/src/test/resources/com/alibaba/dubbo/config/spring/multi-monitor.xml
@@ -0,0 +1,39 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:dubbo="http://dubbo.apache.org/schema/dubbo"
+ xmlns="http://www.springframework.org/schema/beans"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
+ http://dubbo.apache.org/schema/dubbo
http://dubbo.apache.org/schema/dubbo/dubbo.xsd
+ ">
+
+ <dubbo:application name="service-class"/>
+
+ <dubbo:registry address="N/A"/>
+
+ <dubbo:protocol name="dubbo" port="20887"/>
+
+ <dubbo:provider timeout="2000"/>
+
+ <dubbo:service id="serviceConfig"
interface="com.alibaba.dubbo.config.spring.api.DemoService" ref="demoService"/>
+
+ <dubbo:monitor version="1.1"/>
+ <dubbo:monitor version="1.2"/>
+
+ <bean id="demoService"
class="com.alibaba.dubbo.config.spring.impl.DemoServiceImpl"/>
+
+</beans>
\ No newline at end of file
diff --git
a/dubbo-config/dubbo-config-spring/src/test/resources/com/alibaba/dubbo/config/spring/provider-multi.xml
b/dubbo-config/dubbo-config-spring/src/test/resources/com/alibaba/dubbo/config/spring/provider-multi.xml
new file mode 100644
index 0000000000..6a2d2e9e33
--- /dev/null
+++
b/dubbo-config/dubbo-config-spring/src/test/resources/com/alibaba/dubbo/config/spring/provider-multi.xml
@@ -0,0 +1,45 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:dubbo="http://dubbo.apache.org/schema/dubbo"
+ xmlns="http://www.springframework.org/schema/beans"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
+ http://dubbo.apache.org/schema/dubbo
http://dubbo.apache.org/schema/dubbo/dubbo.xsd
+ ">
+
+ <dubbo:application name="service-class"/>
+
+ <dubbo:registry address="N/A"/>
+
+ <dubbo:protocol name="dubbo" port="20887"/>
+
+ <dubbo:provider timeout="2000"/>
+
+ <dubbo:service id="serviceConfig"
interface="com.alibaba.dubbo.config.spring.api.DemoService" ref="demoService"/>
+
+ <dubbo:provider timeout="1000" default="true" delay="1000">
+ <dubbo:service id="serviceConfig2"
interface="com.alibaba.dubbo.config.spring.api.DemoService" ref="demoService"
+ group="demo2"/>
+ </dubbo:provider>
+ <dubbo:provider default="true" delay="500">
+ <dubbo:service
interface="com.alibaba.dubbo.config.spring.api.DemoService" ref="demoService"
+ group="demo2"/>
+ </dubbo:provider>
+
+ <bean id="demoService"
class="com.alibaba.dubbo.config.spring.impl.DemoServiceImpl"/>
+
+</beans>
\ No newline at end of file
diff --git
a/dubbo-config/dubbo-config-spring/src/test/resources/com/alibaba/dubbo/config/spring/provider-with-module.xml
b/dubbo-config/dubbo-config-spring/src/test/resources/com/alibaba/dubbo/config/spring/provider-with-module.xml
new file mode 100644
index 0000000000..faaee83a58
--- /dev/null
+++
b/dubbo-config/dubbo-config-spring/src/test/resources/com/alibaba/dubbo/config/spring/provider-with-module.xml
@@ -0,0 +1,43 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:dubbo="http://dubbo.apache.org/schema/dubbo"
+ xmlns="http://www.springframework.org/schema/beans"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
+ http://dubbo.apache.org/schema/dubbo
http://dubbo.apache.org/schema/dubbo/dubbo.xsd
+ ">
+
+ <dubbo:application name="service-class"/>
+
+ <dubbo:registry address="N/A"/>
+
+ <dubbo:protocol name="dubbo" port="20887"/>
+
+ <dubbo:provider timeout="2000"/>
+
+ <dubbo:service id="serviceConfig"
interface="com.alibaba.dubbo.config.spring.api.DemoService" ref="demoService"/>
+
+ <!-- nested configuration -->
+ <dubbo:provider timeout="1000">
+ <dubbo:service id="serviceConfig2"
interface="com.alibaba.dubbo.config.spring.api.DemoService" ref="demoService"
+ group="demo2"/>
+ </dubbo:provider>
+ <dubbo:module name="test-module" version="1.1"/>
+
+ <bean id="demoService"
class="com.alibaba.dubbo.config.spring.impl.DemoServiceImpl"/>
+
+</beans>
\ No newline at end of file
diff --git
a/dubbo-config/dubbo-config-spring/src/test/resources/com/alibaba/dubbo/config/spring/provider-with-monitor.xml
b/dubbo-config/dubbo-config-spring/src/test/resources/com/alibaba/dubbo/config/spring/provider-with-monitor.xml
new file mode 100644
index 0000000000..86c860ecd7
--- /dev/null
+++
b/dubbo-config/dubbo-config-spring/src/test/resources/com/alibaba/dubbo/config/spring/provider-with-monitor.xml
@@ -0,0 +1,37 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:dubbo="http://dubbo.apache.org/schema/dubbo"
+ xmlns="http://www.springframework.org/schema/beans"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
+ http://dubbo.apache.org/schema/dubbo
http://dubbo.apache.org/schema/dubbo/dubbo.xsd
+ ">
+
+ <dubbo:application name="service-class"/>
+
+ <dubbo:registry address="N/A"/>
+
+ <dubbo:protocol name="dubbo" port="20887"/>
+
+ <dubbo:provider timeout="2000"/>
+
+ <dubbo:service id="serviceConfig"
interface="com.alibaba.dubbo.config.spring.api.DemoService" ref="demoService"/>
+ <dubbo:monitor default="true"/>
+
+ <bean id="demoService"
class="com.alibaba.dubbo.config.spring.impl.DemoServiceImpl"/>
+
+</beans>
\ No newline at end of file
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]