Skip to content
Merged
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
13 changes: 0 additions & 13 deletions dubbo-dependencies-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@
<!-- Test libs -->
<junit_jupiter_version>5.11.3</junit_jupiter_version>
<junit_platform_version>1.11.3</junit_platform_version>
<junit_version>4.13.2</junit_version>
<awaitility_version>4.2.2</awaitility_version>
<hamcrest_version>2.2</hamcrest_version>
<cglib_version>2.2.2</cglib_version>
Expand Down Expand Up @@ -775,18 +774,6 @@
<version>${junit_jupiter_version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>${junit_jupiter_version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit_version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,6 @@
<scope>test</scope>
</dependency>

<!--JUnit Jupiter Engine to depend on the JUnit4 engine and JUnit 4 API -->
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.Assert;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
Expand All @@ -47,6 +46,11 @@
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.web.client.RestTemplate;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

/**
* {@link DubboEndpointAnnotationAutoConfiguration} Test
*
Expand Down Expand Up @@ -112,12 +116,12 @@ class DubboEndpointAnnotationAutoConfigurationTest {
private String actuatorBaseURL;

@BeforeEach
public void init() {
void init() {
DubboBootstrap.reset();
}

@AfterEach
public void destroy() {
void destroy() {
DubboBootstrap.reset();
}

Expand All @@ -128,10 +132,10 @@ void testShutdown() throws Exception {

Map<String, Object> shutdownCounts = (Map<String, Object>) value.get("shutdown.count");

Assert.assertEquals(0, shutdownCounts.get("registries"));
Assert.assertEquals(1, shutdownCounts.get("protocols"));
Assert.assertEquals(1, shutdownCounts.get("services"));
Assert.assertEquals(0, shutdownCounts.get("references"));
assertEquals(0, shutdownCounts.get("registries"));
assertEquals(1, shutdownCounts.get("protocols"));
assertEquals(1, shutdownCounts.get("services"));
assertEquals(0, shutdownCounts.get("references"));
}

@Test
Expand All @@ -140,62 +144,62 @@ void testConfigs() {
Map<String, Map<String, Map<String, Object>>> configsMap = dubboConfigsMetadataEndpoint.configs();

Map<String, Map<String, Object>> beansMetadata = configsMap.get("ApplicationConfig");
Assert.assertEquals(
assertEquals(
"dubbo-demo-application", beansMetadata.get("my-application").get("name"));

beansMetadata = configsMap.get("ConsumerConfig");
Assert.assertTrue(beansMetadata.isEmpty());
assertTrue(beansMetadata.isEmpty());

beansMetadata = configsMap.get("MethodConfig");
Assert.assertTrue(beansMetadata.isEmpty());
assertTrue(beansMetadata.isEmpty());

beansMetadata = configsMap.get("ModuleConfig");
Assert.assertEquals("dubbo-demo-module", beansMetadata.get("my-module").get("name"));
assertEquals("dubbo-demo-module", beansMetadata.get("my-module").get("name"));

beansMetadata = configsMap.get("MonitorConfig");
Assert.assertTrue(beansMetadata.isEmpty());
assertTrue(beansMetadata.isEmpty());

beansMetadata = configsMap.get("ProtocolConfig");
Assert.assertEquals("dubbo", beansMetadata.get("my-protocol").get("name"));
assertEquals("dubbo", beansMetadata.get("my-protocol").get("name"));

beansMetadata = configsMap.get("ProviderConfig");
Assert.assertEquals("127.0.0.1", beansMetadata.get("my-provider").get("host"));
assertEquals("127.0.0.1", beansMetadata.get("my-provider").get("host"));

beansMetadata = configsMap.get("ReferenceConfig");
Assert.assertTrue(beansMetadata.isEmpty());
assertTrue(beansMetadata.isEmpty());

beansMetadata = configsMap.get("RegistryConfig");
Assert.assertEquals("N/A", beansMetadata.get("my-registry").get("address"));
assertEquals("N/A", beansMetadata.get("my-registry").get("address"));

beansMetadata = configsMap.get("ServiceConfig");
Assert.assertFalse(beansMetadata.isEmpty());
assertFalse(beansMetadata.isEmpty());
}

@Test
void testServices() {

Map<String, Map<String, Object>> services = dubboServicesMetadataEndpoint.services();

Assert.assertEquals(1, services.size());
assertEquals(1, services.size());

Map<String, Object> demoServiceMeta = services.get(
"ServiceBean:org.apache.dubbo.spring.boot.actuate.autoconfigure.DubboEndpointAnnotationAutoConfigurationTest$DemoService:1.0.0:");

Assert.assertEquals("1.0.0", demoServiceMeta.get("version"));
assertEquals("1.0.0", demoServiceMeta.get("version"));
}

@Test
void testReferences() {

Map<String, Map<String, Object>> references = dubboReferencesMetadataEndpoint.references();

Assert.assertTrue(!references.isEmpty());
assertFalse(references.isEmpty());
String injectedField =
"private " + DemoService.class.getName() + " " + ConsumerConfiguration.class.getName() + ".demoService";
Map<String, Object> referenceMap = references.get(injectedField);
Assert.assertNotNull(referenceMap);
Assert.assertEquals(DemoService.class, referenceMap.get("interfaceClass"));
Assert.assertEquals(
assertNotNull(referenceMap);
assertEquals(DemoService.class, referenceMap.get("interfaceClass"));
assertEquals(
BaseServiceMetadata.buildServiceKey(
DemoService.class.getName(),
ConsumerConfiguration.DEMO_GROUP,
Expand All @@ -208,19 +212,18 @@ void testProperties() {

SortedMap<String, Object> properties = dubboPropertiesEndpoint.properties();

Assert.assertEquals("my-application", properties.get("dubbo.application.id"));
Assert.assertEquals("dubbo-demo-application", properties.get("dubbo.application.name"));
Assert.assertEquals("my-module", properties.get("dubbo.module.id"));
Assert.assertEquals("dubbo-demo-module", properties.get("dubbo.module.name"));
Assert.assertEquals("my-registry", properties.get("dubbo.registry.id"));
Assert.assertEquals("N/A", properties.get("dubbo.registry.address"));
Assert.assertEquals("my-protocol", properties.get("dubbo.protocol.id"));
Assert.assertEquals("dubbo", properties.get("dubbo.protocol.name"));
Assert.assertEquals("20880", properties.get("dubbo.protocol.port"));
Assert.assertEquals("my-provider", properties.get("dubbo.provider.id"));
Assert.assertEquals("127.0.0.1", properties.get("dubbo.provider.host"));
Assert.assertEquals(
"org.apache.dubbo.spring.boot.actuate.autoconfigure", properties.get("dubbo.scan.basePackages"));
assertEquals("my-application", properties.get("dubbo.application.id"));
assertEquals("dubbo-demo-application", properties.get("dubbo.application.name"));
assertEquals("my-module", properties.get("dubbo.module.id"));
assertEquals("dubbo-demo-module", properties.get("dubbo.module.name"));
assertEquals("my-registry", properties.get("dubbo.registry.id"));
assertEquals("N/A", properties.get("dubbo.registry.address"));
assertEquals("my-protocol", properties.get("dubbo.protocol.id"));
assertEquals("dubbo", properties.get("dubbo.protocol.name"));
assertEquals("20880", properties.get("dubbo.protocol.port"));
assertEquals("my-provider", properties.get("dubbo.provider.id"));
assertEquals("127.0.0.1", properties.get("dubbo.provider.host"));
assertEquals("org.apache.dubbo.spring.boot.actuate.autoconfigure", properties.get("dubbo.scan.basePackages"));
}

@Test
Expand All @@ -235,7 +238,7 @@ void testHttpEndpoints() throws JsonProcessingException {
private void testHttpEndpoint(String actuatorURI, Supplier<Map> resultsSupplier) throws JsonProcessingException {
String actuatorURL = actuatorBaseURL + actuatorURI;
String response = restTemplate.getForObject(actuatorURL, String.class);
Assert.assertEquals(objectMapper.writeValueAsString(resultsSupplier.get()), response);
assertEquals(objectMapper.writeValueAsString(resultsSupplier.get()), response);
}

interface DemoService {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,25 @@

import java.util.Map;

import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.actuate.health.Health;
import org.springframework.boot.actuate.health.Status;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.junit.jupiter.SpringExtension;

import static org.junit.jupiter.api.Assertions.assertEquals;

/**
* {@link DubboHealthIndicator} Test
*
* @see DubboHealthIndicator
* @since 2.7.0
*/
@RunWith(SpringRunner.class)
@ExtendWith(SpringExtension.class)
@TestPropertySource(
properties = {
"dubbo.application.id = my-application-1",
Expand All @@ -54,30 +55,30 @@
@SpringBootTest(classes = {DubboHealthIndicator.class, DubboHealthIndicatorTest.class})
@EnableConfigurationProperties(DubboHealthIndicatorProperties.class)
@EnableDubboConfig
public class DubboHealthIndicatorTest {
class DubboHealthIndicatorTest {

@Autowired
private DubboHealthIndicator dubboHealthIndicator;

@Test
public void testResolveStatusCheckerNamesMap() {
void testResolveStatusCheckerNamesMap() {

Map<String, String> statusCheckerNamesMap = dubboHealthIndicator.resolveStatusCheckerNamesMap();

Assert.assertEquals(5, statusCheckerNamesMap.size());
assertEquals(5, statusCheckerNamesMap.size());

Assert.assertEquals("[email protected]()", statusCheckerNamesMap.get("registry"));
Assert.assertEquals("[email protected]()", statusCheckerNamesMap.get("server"));
Assert.assertEquals("management.health.dubbo.status.defaults", statusCheckerNamesMap.get("memory"));
Assert.assertEquals("management.health.dubbo.status.extras", statusCheckerNamesMap.get("load"));
Assert.assertEquals("management.health.dubbo.status.extras", statusCheckerNamesMap.get("threadpool"));
assertEquals("[email protected]()", statusCheckerNamesMap.get("registry"));
assertEquals("[email protected]()", statusCheckerNamesMap.get("server"));
assertEquals("management.health.dubbo.status.defaults", statusCheckerNamesMap.get("memory"));
assertEquals("management.health.dubbo.status.extras", statusCheckerNamesMap.get("load"));
assertEquals("management.health.dubbo.status.extras", statusCheckerNamesMap.get("threadpool"));
}

@Test
public void testHealth() {
void testHealth() {

Health health = dubboHealthIndicator.health();

Assert.assertEquals(Status.UNKNOWN, health.getStatus());
assertEquals(Status.UNKNOWN, health.getStatus());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

import java.util.Map;

import org.junit.Assert;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
Expand All @@ -32,6 +31,9 @@
import org.springframework.test.context.junit.jupiter.SpringExtension;

import static org.apache.dubbo.common.Version.getVersion;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;

/**
* {@link DubboQosEndpoints} Test
Expand Down Expand Up @@ -64,21 +66,21 @@ void testInvoke() {

Map<String, Object> metadata = dubboQosEndpoints.invoke();

Assert.assertNotNull(metadata.get("timestamp"));
assertNotNull(metadata.get("timestamp"));

Map<String, String> versions = (Map<String, String>) metadata.get("versions");
Map<String, String> urls = (Map<String, String>) metadata.get("urls");

Assert.assertFalse(versions.isEmpty());
Assert.assertFalse(urls.isEmpty());
assertFalse(versions.isEmpty());
assertFalse(urls.isEmpty());

Assert.assertEquals(getVersion(DubboUtils.class, "1.0.0"), versions.get("dubbo-spring-boot"));
Assert.assertEquals(getVersion(), versions.get("dubbo"));
assertEquals(getVersion(DubboUtils.class, "1.0.0"), versions.get("dubbo-spring-boot"));
assertEquals(getVersion(), versions.get("dubbo"));

Assert.assertEquals("https://github.com/apache/dubbo", urls.get("dubbo"));
Assert.assertEquals("[email protected]", urls.get("mailing-list"));
Assert.assertEquals("https://github.com/apache/dubbo-spring-boot-project", urls.get("github"));
Assert.assertEquals("https://github.com/apache/dubbo-spring-boot-project/issues", urls.get("issues"));
Assert.assertEquals("https://github.com/apache/dubbo-spring-boot-project.git", urls.get("git"));
assertEquals("https://github.com/apache/dubbo", urls.get("dubbo"));
assertEquals("[email protected]", urls.get("mailing-list"));
assertEquals("https://github.com/apache/dubbo-spring-boot-project", urls.get("github"));
assertEquals("https://github.com/apache/dubbo-spring-boot-project/issues", urls.get("issues"));
assertEquals("https://github.com/apache/dubbo-spring-boot-project.git", urls.get("git"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -224,12 +224,6 @@
<scope>test</scope>
</dependency>

<!--JUnit Jupiter Engine to depend on the JUnit4 engine and JUnit 4 API -->
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
Expand Down

This file was deleted.

Loading
Loading