Skip to content

Commit

Permalink
test: add Apollo mock test case
Browse files Browse the repository at this point in the history
  • Loading branch information
slievrly committed Aug 18, 2024
1 parent 93030e6 commit 1910d55
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion changes/zh-cn/2.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
- [[#6608](https://github.com/apache/incubator-seata/pull/6608)] 添加sql-parser-core模块测试用例
- [[#6647](https://github.com/apache/incubator-seata/pull/6647)] 增加saga模块的测试用例覆盖率
- [[#6695](https://github.com/apache/incubator-seata/pull/6695)] 多版本协议的旧版本(< 0.7.1)客户端测试用例
- [[#6764](https://github.com/apache/incubator-seata/pull/6764)] z增加 Apollo Mock 测试用例
- [[#6764](https://github.com/apache/incubator-seata/pull/6764)] 增加 Apollo Mock 测试用例



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,31 @@
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;

/**
* The type Apollo configuration test.
*/
public class ApolloConfigurationTest {

private static final int PORT = 8081;
private static ApolloMockServer apolloMockServer;

private static ApolloConfiguration apolloConfiguration;

/**
* Sets up.
*
* @throws IOException the io exception
*/
@BeforeAll
public static void setUp() throws IOException {
System.setProperty("seataEnv", "test");
apolloMockServer = new ApolloMockServer(PORT);
apolloConfiguration = ApolloConfiguration.getInstance();
}

/**
* Test get config.
*/
@Test
public void testGetConfig() {
String value = apolloConfiguration.getConfig("seata.test");
Expand All @@ -52,6 +63,9 @@ public void testGetConfig() {
Assertions.assertEquals("default", value);
}

/**
* Test update config.
*/
@Test
public void testUpdateConfig() {
Assertions.assertThrows(NotSupportYetException.class, () -> {
Expand All @@ -65,6 +79,9 @@ public void testUpdateConfig() {
});
}

/**
* Test listener.
*/
@Test
public void testListener() {
ConfigurationChangeListener listener = new ConfigurationChangeListener() {
Expand All @@ -82,6 +99,11 @@ public void onChangeEvent(ConfigurationChangeEvent event) {

}

/**
* Tear down.
*
* @throws IOException the io exception
*/
@AfterAll
public static void tearDown() throws IOException {
System.clearProperty("seataEnv");
Expand Down

0 comments on commit 1910d55

Please sign in to comment.