From 50b256fff2dcf8915e76ce72ff1b3b368b125bb9 Mon Sep 17 00:00:00 2001 From: kexianjun Date: Fri, 25 Jan 2019 00:31:06 +0800 Subject: [PATCH 1/2] fix some unit test failed --- .../org/apache/dubbo/qos/textui/TKvTest.java | 6 +++--- .../org/apache/dubbo/qos/textui/TLadderTest.java | 8 ++++---- .../org/apache/dubbo/qos/textui/TTableTest.java | 16 ++++++++-------- .../rpc/protocol/dubbo/DubboProtocolTest.java | 2 +- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/textui/TKvTest.java b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/textui/TKvTest.java index e681b640f49..e630f71c7b5 100644 --- a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/textui/TKvTest.java +++ b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/textui/TKvTest.java @@ -35,9 +35,9 @@ public void test1() { }); String kv = tKv.rendering(); - assertThat(kv, containsString("ABCDEFGHIJ\n")); - assertThat(kv, containsString("KLMNOPQRST\n")); - assertThat(kv, containsString("UVWXYZ\n")); + assertThat(kv, containsString("ABCDEFGHIJ" + System.lineSeparator())); + assertThat(kv, containsString("KLMNOPQRST" + System.lineSeparator())); + assertThat(kv, containsString("UVWXYZ" + System.lineSeparator())); tTable.addRow("OPTIONS", kv); String table = tTable.rendering(); diff --git a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/textui/TLadderTest.java b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/textui/TLadderTest.java index 7b57edbc3f2..4feb69e55fb 100644 --- a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/textui/TLadderTest.java +++ b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/textui/TLadderTest.java @@ -31,10 +31,10 @@ public void testRendering() throws Exception { ladder.addItem("3"); ladder.addItem("4"); String result = ladder.rendering(); - String expected = "1\n" + - " `-2\n" + - " `-3\n" + - " `-4\n"; + String expected = "1" + System.lineSeparator() + + " `-2" + System.lineSeparator() + + " `-3" + System.lineSeparator() + + " `-4" + System.lineSeparator(); assertThat(result, equalTo(expected)); System.out.println(result); } diff --git a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/textui/TTableTest.java b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/textui/TTableTest.java index 7d91ea8b1ff..abc70292dab 100644 --- a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/textui/TTableTest.java +++ b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/textui/TTableTest.java @@ -28,11 +28,11 @@ public void test1() throws Exception { table.addRow(1, "one", "uno", "un"); table.addRow(2, "two", "dos", "deux"); String result = table.rendering(); - String expected = "+-+---+---+----+\n" + - "|1|one|uno|un |\n" + - "+-+---+---+----+\n" + - "|2|two|dos|deux|\n" + - "+-+---+---+----+\n"; + String expected = "+-+---+---+----+" + System.lineSeparator() + + "|1|one|uno|un |" + System.lineSeparator() + + "+-+---+---+----+" + System.lineSeparator() + + "|2|two|dos|deux|" + System.lineSeparator() + + "+-+---+---+----+" + System.lineSeparator(); assertThat(result, equalTo(expected)); System.out.println(result); } @@ -46,9 +46,9 @@ public void test2() throws Exception { }); table.addRow(1, "abcde", "ABCDE"); String result = table.rendering(); - String expected = "+-+----------+----------+\n" + - "|1| abcde | ABCDE|\n" + - "+-+----------+----------+\n"; + String expected = "+-+----------+----------+" + System.lineSeparator() + + "|1| abcde | ABCDE|" + System.lineSeparator() + + "+-+----------+----------+" + System.lineSeparator(); assertThat(result, equalTo(expected)); System.out.println(result); } diff --git a/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/DubboProtocolTest.java b/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/DubboProtocolTest.java index 61d9b6cc148..e3ad13f0a3b 100644 --- a/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/DubboProtocolTest.java +++ b/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/DubboProtocolTest.java @@ -120,7 +120,7 @@ public void testDubboProtocolWithMina() throws Exception { System.out.println(service.stringLength(buf.toString())); // cast to EchoService - EchoService echo = proxy.getProxy(protocol.refer(EchoService.class, URL.valueOf("dubbo://127.0.0.1:9011/" + DemoService.class.getName() + "?client=mina").addParameter("timeout", 3000l))); + EchoService echo = (EchoService) service; for (int i = 0; i < 10; i++) { assertEquals(echo.$echo(buf.toString()), buf.toString()); assertEquals(echo.$echo("test"), "test"); From b04d633ba239f4075ed5626c8a211375c0e9e9cc Mon Sep 17 00:00:00 2001 From: kexianjun Date: Sat, 26 Jan 2019 23:33:31 +0800 Subject: [PATCH 2/2] revert testDubboProtocolWithMina --- .../org/apache/dubbo/rpc/protocol/dubbo/DubboProtocolTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/DubboProtocolTest.java b/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/DubboProtocolTest.java index e3ad13f0a3b..61d9b6cc148 100644 --- a/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/DubboProtocolTest.java +++ b/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/DubboProtocolTest.java @@ -120,7 +120,7 @@ public void testDubboProtocolWithMina() throws Exception { System.out.println(service.stringLength(buf.toString())); // cast to EchoService - EchoService echo = (EchoService) service; + EchoService echo = proxy.getProxy(protocol.refer(EchoService.class, URL.valueOf("dubbo://127.0.0.1:9011/" + DemoService.class.getName() + "?client=mina").addParameter("timeout", 3000l))); for (int i = 0; i < 10; i++) { assertEquals(echo.$echo(buf.toString()), buf.toString()); assertEquals(echo.$echo("test"), "test");