From d93632b5853400b26f34504e032f4a1979cca4d6 Mon Sep 17 00:00:00 2001 From: zero88 Date: Mon, 5 Aug 2024 11:46:58 +0700 Subject: [PATCH] refactor(:core:test): fix test --- .../java/cloud/playio/qwe/QWEConfigTest.java | 17 +++++++++-------- .../playio/qwe/utils/NetworkUtilsTest.java | 6 ++++-- core/src/test/resources/def-system-cfg.json | 5 ++--- core/src/test/resources/full-system-cfg.json | 5 ++--- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/core/src/test/java/cloud/playio/qwe/QWEConfigTest.java b/core/src/test/java/cloud/playio/qwe/QWEConfigTest.java index cdea4c15..eebedfc1 100644 --- a/core/src/test/java/cloud/playio/qwe/QWEConfigTest.java +++ b/core/src/test/java/cloud/playio/qwe/QWEConfigTest.java @@ -9,6 +9,7 @@ import io.vertx.core.eventbus.DeliveryOptions; import io.vertx.core.json.DecodeException; import io.vertx.core.json.JsonObject; + import cloud.playio.qwe.QWEConfig.QWEDeployConfig; import cloud.playio.qwe.exceptions.ConfigException; @@ -94,10 +95,10 @@ public void test_blank() { Assertions.assertNotNull(cfg.getAppConfig().dataDir()); Assertions.assertTrue(cfg.getAppConfig().other().isEmpty()); Assertions.assertNotNull(cfg.getDeployConfig()); - JsonHelper.assertJson(new JsonObject("{\"worker\":false,\"workerPoolSize\":20," + - "\"maxWorkerExecuteTime\":60000000000,\"ha\":false,\"instances\":1," + - "\"maxWorkerExecuteTimeUnit\":\"NANOSECONDS\"}"), - cfg.getDeployConfig().toJson()); + JsonHelper.assertJson(new JsonObject( + "{\"worker\":false,\"workerPoolSize\":20,\"threadingModel\":\"EVENT_LOOP\"," + + "\"maxWorkerExecuteTime\":60000000000,\"ha\":false,\"instances\":1," + + "\"maxWorkerExecuteTimeUnit\":\"NANOSECONDS\"}"), cfg.getDeployConfig().toJson()); Assertions.assertNull(cfg.getBootConfig()); } @@ -110,10 +111,10 @@ public void test_blank_with_app_cfg() { Assertions.assertEquals(1, config.getAppConfig().other().size()); Assertions.assertEquals(1, config.getAppConfig().lookup("hello")); Assertions.assertNotNull(config.getDeployConfig()); - JsonHelper.assertJson(new JsonObject("{\"worker\":false,\"workerPoolSize\":20," + - "\"maxWorkerExecuteTime\":60000000000,\"ha\":false,\"instances\":1," + - "\"maxWorkerExecuteTimeUnit\":\"NANOSECONDS\"}"), - config.getDeployConfig().toJson()); + JsonHelper.assertJson(new JsonObject( + "{\"worker\":false,\"workerPoolSize\":20,\"threadingModel\":\"EVENT_LOOP\"," + + "\"maxWorkerExecuteTime\":60000000000,\"ha\":false,\"instances\":1," + + "\"maxWorkerExecuteTimeUnit\":\"NANOSECONDS\"}"), config.getDeployConfig().toJson()); Assertions.assertNull(config.getBootConfig()); } diff --git a/core/src/test/java/cloud/playio/qwe/utils/NetworkUtilsTest.java b/core/src/test/java/cloud/playio/qwe/utils/NetworkUtilsTest.java index 22c688e7..2252db71 100644 --- a/core/src/test/java/cloud/playio/qwe/utils/NetworkUtilsTest.java +++ b/core/src/test/java/cloud/playio/qwe/utils/NetworkUtilsTest.java @@ -9,7 +9,9 @@ public class NetworkUtilsTest { @Test public void test_get_public_ipv4() { - Assertions.assertNotNull(NetworkUtils.getPublicIpv4()); + final String address = NetworkUtils.getPublicIpv4(); + System.out.println(address); + Assertions.assertNotNull(address); } @Test @@ -18,8 +20,8 @@ public void test_get_socket_ipv4_address() { Assertions.assertNotNull(address); Assertions.assertEquals("127.0.0.1", address.getHostName()); Assertions.assertEquals("127.0.0.1", address.getHostString()); - Assertions.assertEquals("127.0.0.1:9090", address.toString()); Assertions.assertEquals(9090, address.getPort()); + Assertions.assertEquals("127.0.0.1/:9090", address.toString()); } } diff --git a/core/src/test/resources/def-system-cfg.json b/core/src/test/resources/def-system-cfg.json index 9103bdff..ef4b6c29 100644 --- a/core/src/test/resources/def-system-cfg.json +++ b/core/src/test/resources/def-system-cfg.json @@ -24,9 +24,8 @@ "crlValues": [], "enabledCipherSuites": [], "enabledSecureTransportProtocols": [ - "TLSv1", - "TLSv1.1", - "TLSv1.2" + "TLSv1.2", + "TLSv1.3" ], "idleTimeout": 0, "idleTimeoutUnit": "SECONDS", diff --git a/core/src/test/resources/full-system-cfg.json b/core/src/test/resources/full-system-cfg.json index 0d2ba70c..be1a08e6 100644 --- a/core/src/test/resources/full-system-cfg.json +++ b/core/src/test/resources/full-system-cfg.json @@ -36,9 +36,8 @@ "crlValues": [], "useAlpn": false, "enabledSecureTransportProtocols": [ - "TLSv1", - "TLSv1.1", - "TLSv1.2" + "TLSv1.2", + "TLSv1.3" ], "tcpFastOpen": false, "tcpCork": false,