From 51c5450916e80e682a9a5773e6f06f5931a518ab Mon Sep 17 00:00:00 2001 From: chengyouling Date: Thu, 2 Jan 2025 10:47:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=B5=8B=E8=AF=95=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../transmit/wrapper/CallableWrapperTest.java | 6 ++++-- .../RunnableAndCallableWrapperTest.java | 18 ++++++++++++------ .../transmit/wrapper/RunnableWrapperTest.java | 6 ++++-- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/sermant-plugins/sermant-router/router-transmit-plugin/src/test/java/io/sermant/router/transmit/wrapper/CallableWrapperTest.java b/sermant-plugins/sermant-router/router-transmit-plugin/src/test/java/io/sermant/router/transmit/wrapper/CallableWrapperTest.java index 445b4de8d5..8870f60090 100644 --- a/sermant-plugins/sermant-router/router-transmit-plugin/src/test/java/io/sermant/router/transmit/wrapper/CallableWrapperTest.java +++ b/sermant-plugins/sermant-router/router-transmit-plugin/src/test/java/io/sermant/router/transmit/wrapper/CallableWrapperTest.java @@ -46,8 +46,10 @@ public void testCanTransmit() throws Exception { Assert.assertEquals(obj, wrapper.call()); - Assert.assertNull(ThreadLocalUtils.getRequestData()); - Assert.assertNull(ThreadLocalUtils.getRequestTag()); + Assert.assertTrue(ThreadLocalUtils.getRequestData() == null + || ThreadLocalUtils.getRequestData().getPath() == null); + Assert.assertTrue(ThreadLocalUtils.getRequestTag() == null + || ThreadLocalUtils.getRequestTag().getTag().isEmpty()); } @Test diff --git a/sermant-plugins/sermant-router/router-transmit-plugin/src/test/java/io/sermant/router/transmit/wrapper/RunnableAndCallableWrapperTest.java b/sermant-plugins/sermant-router/router-transmit-plugin/src/test/java/io/sermant/router/transmit/wrapper/RunnableAndCallableWrapperTest.java index 64785497c5..afc542bbb5 100644 --- a/sermant-plugins/sermant-router/router-transmit-plugin/src/test/java/io/sermant/router/transmit/wrapper/RunnableAndCallableWrapperTest.java +++ b/sermant-plugins/sermant-router/router-transmit-plugin/src/test/java/io/sermant/router/transmit/wrapper/RunnableAndCallableWrapperTest.java @@ -39,13 +39,17 @@ public void testRunCanTransmit() { Assert.assertNotNull(ThreadLocalUtils.getRequestTag()); }, null, new RequestTag(null), new RequestData(null, null, null), false); - Assert.assertNull(ThreadLocalUtils.getRequestData()); - Assert.assertNull(ThreadLocalUtils.getRequestTag()); + Assert.assertTrue(ThreadLocalUtils.getRequestData() == null + || ThreadLocalUtils.getRequestData().getPath() == null); + Assert.assertTrue(ThreadLocalUtils.getRequestTag() == null + || ThreadLocalUtils.getRequestTag().getTag().isEmpty()); wrapper.run(); - Assert.assertNull(ThreadLocalUtils.getRequestData()); - Assert.assertNull(ThreadLocalUtils.getRequestTag()); + Assert.assertTrue(ThreadLocalUtils.getRequestData() == null + || ThreadLocalUtils.getRequestData().getPath() == null); + Assert.assertTrue(ThreadLocalUtils.getRequestTag() == null + || ThreadLocalUtils.getRequestTag().getTag().isEmpty()); } @Test @@ -85,8 +89,10 @@ public void testCallCanTransmit() throws Exception { Assert.assertEquals(obj, wrapper.call()); - Assert.assertNull(ThreadLocalUtils.getRequestData()); - Assert.assertNull(ThreadLocalUtils.getRequestTag()); + Assert.assertTrue(ThreadLocalUtils.getRequestData() == null + || ThreadLocalUtils.getRequestData().getPath() == null); + Assert.assertTrue(ThreadLocalUtils.getRequestTag() == null + || ThreadLocalUtils.getRequestTag().getTag().isEmpty()); } @Test diff --git a/sermant-plugins/sermant-router/router-transmit-plugin/src/test/java/io/sermant/router/transmit/wrapper/RunnableWrapperTest.java b/sermant-plugins/sermant-router/router-transmit-plugin/src/test/java/io/sermant/router/transmit/wrapper/RunnableWrapperTest.java index ef7b8da4ac..ad088b7590 100644 --- a/sermant-plugins/sermant-router/router-transmit-plugin/src/test/java/io/sermant/router/transmit/wrapper/RunnableWrapperTest.java +++ b/sermant-plugins/sermant-router/router-transmit-plugin/src/test/java/io/sermant/router/transmit/wrapper/RunnableWrapperTest.java @@ -44,8 +44,10 @@ public void testCanTransmit() { wrapper.run(); - Assert.assertNull(ThreadLocalUtils.getRequestData()); - Assert.assertNull(ThreadLocalUtils.getRequestTag()); + Assert.assertTrue(ThreadLocalUtils.getRequestData() == null + || ThreadLocalUtils.getRequestData().getPath() == null); + Assert.assertTrue(ThreadLocalUtils.getRequestTag() == null + || ThreadLocalUtils.getRequestTag().getTag().isEmpty()); } @Test