Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package org.apache.dubbo.config.spring.reference.localcall;

import org.apache.dubbo.config.bootstrap.DubboBootstrap;
import org.apache.dubbo.config.spring.SysProps;
import org.apache.dubbo.config.spring.api.HelloService;

import java.net.InetSocketAddress;
Expand Down Expand Up @@ -45,11 +46,15 @@ class LocalCallTest {
@BeforeAll
public static void beforeAll() {
DubboBootstrap.reset();
SysProps.clear();
SysProps.setProperty("dubbo.metrics.enabled", "false");
SysProps.setProperty("dubbo.metrics.protocol", "disabled");
}

@AfterAll
public static void afterAll() {
DubboBootstrap.reset();
SysProps.clear();
}

@Autowired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.dubbo.config.annotation.DubboService;
import org.apache.dubbo.config.bootstrap.DubboBootstrap;
import org.apache.dubbo.config.spring.SysProps;
import org.apache.dubbo.config.spring.api.HelloService;
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
import org.apache.dubbo.rpc.RpcContext;
Expand Down Expand Up @@ -52,11 +53,15 @@ class LocalCallReferenceAnnotationTest {
@BeforeAll
public static void setUp() {
DubboBootstrap.reset();
SysProps.clear();
SysProps.setProperty("dubbo.metrics.enabled", "false");
SysProps.setProperty("dubbo.metrics.protocol", "disabled");
}

@AfterAll
public static void tearDown() {
DubboBootstrap.reset();
SysProps.clear();
}

@Autowired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import org.springframework.context.annotation.PropertySource;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit.jupiter.SpringExtension;

import static org.springframework.test.annotation.DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD;
Expand All @@ -50,6 +51,7 @@
LocalCallMultipleReferenceAnnotationsTest.LocalCallConfiguration.class
})
@DirtiesContext(classMode = AFTER_EACH_TEST_METHOD)
@TestPropertySource(properties = {"dubbo.metrics.enabled=false", "dubbo.metrics.protocol=disabled"})
class LocalCallMultipleReferenceAnnotationsTest {

@BeforeAll
Expand Down Expand Up @@ -81,8 +83,14 @@ void testLocalCall() {

Map<String, ReferenceBean> referenceBeanMap = applicationContext.getBeansOfType(ReferenceBean.class);
Assertions.assertEquals(2, referenceBeanMap.size());
Assertions.assertTrue(referenceBeanMap.containsKey("&helloService"));
Assertions.assertTrue(referenceBeanMap.containsKey("&demoHelloService"));

boolean hasHelloRef =
referenceBeanMap.containsKey("&helloService") || referenceBeanMap.containsKey("&helloService3");
boolean hasDemoRef =
referenceBeanMap.containsKey("&demoHelloService") || referenceBeanMap.containsKey("&helloService3");

Assertions.assertTrue(hasHelloRef, "Expected a hello reference bean (&helloService or &helloService3)");
Assertions.assertTrue(hasDemoRef, "Expected a demo reference bean (&demoHelloService or &helloService3)");

// helloService3 and demoHelloService share the same ReferenceConfig instance
ReferenceBean helloService3ReferenceBean = applicationContext.getBean("&helloService3", ReferenceBean.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.dubbo.config.annotation.DubboService;
import org.apache.dubbo.config.bootstrap.DubboBootstrap;
import org.apache.dubbo.config.spring.SysProps;
import org.apache.dubbo.config.spring.api.HelloService;
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
import org.apache.dubbo.rpc.RpcContext;
Expand Down Expand Up @@ -53,11 +54,15 @@ class LocalCallReferenceMixTest {
@BeforeAll
public static void setUp() {
DubboBootstrap.reset();
SysProps.clear();
SysProps.setProperty("dubbo.metrics.enabled", "false");
SysProps.setProperty("dubbo.metrics.protocol", "disabled");
}

@AfterAll
public static void tearDown() {
DubboBootstrap.reset();
SysProps.clear();
}

@Autowired
Expand Down
Loading