Skip to content

Commit a8f3b94

Browse files
Stabilize remaining reference and schema related tests in dubbo-config-spring
1 parent efed26c commit a8f3b94

File tree

4 files changed

+29
-1
lines changed

4 files changed

+29
-1
lines changed

dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/reference/DubboConfigBeanInitializerTest.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,13 @@
5151
DubboConfigBeanInitializerTest.class,
5252
DubboConfigBeanInitializerTest.AppConfiguration.class,
5353
})
54-
@TestPropertySource(properties = {"dubbo.protocol.port=-1", "dubbo.registry.address=${zookeeper.connection.address}"})
54+
@TestPropertySource(
55+
properties = {
56+
"dubbo.protocol.port=-1",
57+
"dubbo.registry.address=${zookeeper.connection.address}",
58+
"dubbo.metrics.enabled = false",
59+
"dubbo.metrics.protocol = disabled"
60+
})
5561
@EnableAspectJAutoProxy(proxyTargetClass = true, exposeProxy = true)
5662
@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD)
5763
class DubboConfigBeanInitializerTest {

dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/reference/registryNA/consumer/DubboXmlConsumerTest.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,32 @@
1616
*/
1717
package org.apache.dubbo.config.spring.reference.registryNA.consumer;
1818

19+
import org.apache.dubbo.config.bootstrap.DubboBootstrap;
20+
import org.apache.dubbo.config.spring.SysProps;
1921
import org.apache.dubbo.config.spring.api.HelloService;
2022

23+
import org.junit.jupiter.api.AfterEach;
2124
import org.junit.jupiter.api.Assertions;
25+
import org.junit.jupiter.api.BeforeEach;
2226
import org.junit.jupiter.api.Test;
2327
import org.springframework.context.support.ClassPathXmlApplicationContext;
2428

2529
class DubboXmlConsumerTest {
2630

31+
@BeforeEach
32+
void setUp() {
33+
DubboBootstrap.reset();
34+
SysProps.clear();
35+
SysProps.setProperty("dubbo.metrics.enabled", "false");
36+
SysProps.setProperty("dubbo.metrics.protocol", "disabled");
37+
}
38+
39+
@AfterEach
40+
void tearDown() {
41+
DubboBootstrap.reset();
42+
SysProps.clear();
43+
}
44+
2745
@Test
2846
void testConsumer() {
2947
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(

dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/schema/GenericServiceTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import org.springframework.context.annotation.ImportResource;
3434
import org.springframework.test.annotation.DirtiesContext;
3535
import org.springframework.test.context.ContextConfiguration;
36+
import org.springframework.test.context.TestPropertySource;
3637
import org.springframework.test.context.junit.jupiter.SpringExtension;
3738

3839
import static org.junit.jupiter.api.Assertions.assertNotNull;
@@ -42,6 +43,7 @@
4243
@ContextConfiguration(classes = GenericServiceTest.class)
4344
@DirtiesContext(classMode = AFTER_EACH_TEST_METHOD)
4445
@ImportResource(locations = "classpath:/META-INF/spring/dubbo-generic-consumer.xml")
46+
@TestPropertySource(properties = {"dubbo.metrics.enabled = false", "dubbo.metrics.protocol = disabled"})
4547
class GenericServiceTest {
4648

4749
@BeforeAll

dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/schema/GenericServiceWithoutInterfaceTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import org.springframework.context.annotation.ImportResource;
3232
import org.springframework.test.annotation.DirtiesContext;
3333
import org.springframework.test.context.ContextConfiguration;
34+
import org.springframework.test.context.TestPropertySource;
3435
import org.springframework.test.context.junit.jupiter.SpringExtension;
3536

3637
import static org.springframework.test.annotation.DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD;
@@ -39,6 +40,7 @@
3940
@ContextConfiguration(classes = GenericServiceWithoutInterfaceTest.class)
4041
@DirtiesContext(classMode = AFTER_EACH_TEST_METHOD)
4142
@ImportResource(locations = "classpath:/META-INF/spring/dubbo-generic-consumer-without-interface.xml")
43+
@TestPropertySource(properties = {"dubbo.metrics.enabled = false", "dubbo.metrics.protocol = disabled"})
4244
class GenericServiceWithoutInterfaceTest {
4345

4446
@BeforeAll

0 commit comments

Comments
 (0)