-
Notifications
You must be signed in to change notification settings - Fork 26.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Migrate tests to JUnit5 * remove spring default qos-enable
- Loading branch information
1 parent
c0b1d49
commit 9e249cf
Showing
21 changed files
with
251 additions
and
334 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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", | ||
|
@@ -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()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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; | ||
|
@@ -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 | ||
|
@@ -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")); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 0 additions & 34 deletions
34
...dubbo-spring-boot-autoconfigure/src/test/java/org/apache/dubbo/spring/boot/TestSuite.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.