You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@edgent.apache.org by qu...@apache.org on 2016/05/27 17:33:38 UTC
[4/5] incubator-quarks git commit: [QUARKS-181] Add globalization
tests
http://git-wip-us.apache.org/repos/asf/incubator-quarks/blob/46d7ac2e/connectors/wsclient-javax.websocket/src/test/java/quarks/tests/connectors/wsclient/javax/websocket/WebSocketClientTest.java
----------------------------------------------------------------------
diff --git a/connectors/wsclient-javax.websocket/src/test/java/quarks/tests/connectors/wsclient/javax/websocket/WebSocketClientTest.java b/connectors/wsclient-javax.websocket/src/test/java/quarks/tests/connectors/wsclient/javax/websocket/WebSocketClientTest.java
index 62be082..be29765 100644
--- a/connectors/wsclient-javax.websocket/src/test/java/quarks/tests/connectors/wsclient/javax/websocket/WebSocketClientTest.java
+++ b/connectors/wsclient-javax.websocket/src/test/java/quarks/tests/connectors/wsclient/javax/websocket/WebSocketClientTest.java
@@ -53,6 +53,10 @@ public class WebSocketClientTest extends ConnectorTestBase {
boolean isExternalServer;// = true;
int wsServerPort = !isExternalServer ? 0 : 49460;
String wsUriPath = "/echo"; // match what WsServerEcho is using
+ private final static String str1 = "one";
+ private final static String str2 = "two";
+ private final static String str3 = "three-post-reconnect";
+ private final static String str4 = "four";
@After
public void cleanup() {
@@ -124,9 +128,102 @@ public class WebSocketClientTest extends ConnectorTestBase {
private String getStorePath(String storeLeaf) {
return TestRepoPath.getPath("connectors", "wsclient-javax.websocket", "src", "test", "keystores", storeLeaf);
}
-
+
@Test
public void testBasicStaticStuff() {
+ testBasicStaticStuff(str1, str2);
+ }
+
+ @Test(expected = IllegalStateException.class)
+ public void testTooManySendersNeg() {
+ testTooManySendersNeg(str1, str2);
+ }
+
+ @Test
+ public void testJson() throws Exception {
+ testJson(str1, str2);
+ }
+
+ @Test
+ public void testString() throws Exception {
+ testString(str1, str2);
+ }
+
+ @Test
+ public void testBytes() throws Exception {
+ testBytes(str1, str2);
+ }
+
+ @Test
+ public void testReconnect() throws Exception {
+ testReconnect(str1, str2, str3, str4);
+ }
+
+ @Test
+ public void testReconnectBytes() throws Exception {
+ testReconnectBytes(str1, str2, str3, str4);
+ }
+
+ @Test
+ public void testSslClientAuthSystemProperty() throws Exception {
+ testSslClientAuthSystemProperty(str1, str2);
+ }
+
+ @Test
+ public void testSsl() throws Exception {
+ testSsl(str1, str2);
+ }
+
+ @Test
+ public void testSslReconnect() throws Exception {
+ testSslReconnect(str1, str2, str3, str4);
+ }
+
+ @Test
+ public void testSslNeg() throws Exception {
+ testSslNeg(str1, str2);
+ }
+
+ @Test
+ public void testSslClientAuth() throws Exception {
+ testSslClientAuth(str1, str2);
+ }
+
+ @Test
+ public void testSslClientAuthDefault() throws Exception {
+ testSslClientAuthDefault(str1, str2);
+ }
+
+ @Test
+ public void testSslClientAuthMy2ndCertNeg() throws Exception {
+ testSslClientAuthMy2ndCertNeg(str1, str2);
+ }
+
+ @Test
+ public void testSslClientAuthMy3rdCert() throws Exception {
+ testSslClientAuthMy3rdCert(str1, str2);
+ }
+
+ @Test
+ public void testSslClientAuthNeg() throws Exception {
+ testSslClientAuthNeg(str1, str2);
+ }
+
+ @Test
+ public void testPublicServer() throws Exception {
+ testPublicServer(str1, str2);
+ }
+
+ @Test
+ public void testSslPublicServer() throws Exception {
+ testSslPublicServer(str1, str2);
+ }
+
+ public void testSslPublicServerBadTrustStoreSystemPropertyNeg() throws Exception {
+ testSslPublicServerBadTrustStoreSystemPropertyNeg(str1, str2);
+ }
+
+ public void testBasicStaticStuff(String str1, String str2) {
Topology t = newTopology("testBasicStaticStuff");
Properties config = getConfig();
@@ -135,14 +232,14 @@ public class WebSocketClientTest extends ConnectorTestBase {
TStream<String> s1 = wsClient1.receiveString();
assertNotNull("s1", s1);
- TSink<String> sink1 = wsClient1.sendString(t.strings("one", "two"));
+ TSink<String> sink1 = wsClient1.sendString(t.strings(str1, str2));
assertNotNull("sink1", sink1);
WebSocketClient wsClient2 = new Jsr356WebSocketClient(t, config);
TStream<String> s2 = wsClient2.receiveString();
assertNotSame("s1 s2", s1, s2);
- TSink<String> sink2 = wsClient2.sendString(t.strings("one", "two"));
+ TSink<String> sink2 = wsClient2.sendString(t.strings(str1, str2));
assertNotSame("sink1 sink2", sink1, sink2);
}
@@ -198,11 +295,10 @@ public class WebSocketClientTest extends ConnectorTestBase {
new Jsr356WebSocketClient(t, config);
}
- @Test(expected = IllegalStateException.class)
- public void testTooManySendersNeg() {
+ public void testTooManySendersNeg(String str1, String str2) {
Topology t = newTopology("testTooManySendersNeg");
- TStream<String> s1 = t.strings("one", "two");
- TStream<String> s2 = t.strings("one", "two");
+ TStream<String> s1 = t.strings(str1, str2);
+ TStream<String> s2 = t.strings(str1, str2);
Properties config = getConfig();
WebSocketClient wsClient = new Jsr356WebSocketClient(t, config);
@@ -222,8 +318,7 @@ public class WebSocketClientTest extends ConnectorTestBase {
TStream<String> s2 = wsClient.receiveString(); // should throw
}
- @Test
- public void testJson() throws Exception {
+ public void testJson(String str1, String str2) throws Exception {
Topology t = newTopology("testJson");
System.out.println("===== "+t.getName());
@@ -233,8 +328,8 @@ public class WebSocketClientTest extends ConnectorTestBase {
WebSocketClient wsClient = new Jsr356WebSocketClient(t, config);
String[] expected = new String[] {
- "{\"id\":\"id1\",\"value\":27}",
- "{\"id\":\"id2\",\"value\":13}"
+ "{\"id\":\"" + str1 + "\",\"value\":27}",
+ "{\"id\":\"" + str2 + "\",\"value\":13}"
};
TStream<JsonObject> s = t.strings(expected)
@@ -248,8 +343,7 @@ public class WebSocketClientTest extends ConnectorTestBase {
completeAndValidate("", t, rcvd, SEC_TMO, expected);
}
- @Test
- public void testString() throws Exception {
+ public void testString(String str1, String str2) throws Exception {
Topology t = newTopology("testString");
System.out.println("===== "+t.getName());
@@ -258,7 +352,7 @@ public class WebSocketClientTest extends ConnectorTestBase {
Properties config = getConfig();
WebSocketClient wsClient = new Jsr356WebSocketClient(t, config);
- String[] expected = new String[] { "one", "two" };
+ String[] expected = new String[] { str1, str2 };
TStream<String> s = t.strings(expected);
s = PlumbingStreams.blockingOneShotDelay(s, 2, TimeUnit.SECONDS);
@@ -269,8 +363,7 @@ public class WebSocketClientTest extends ConnectorTestBase {
completeAndValidate("", t, rcvd, SEC_TMO, expected);
}
- @Test
- public void testBytes() throws Exception {
+ public void testBytes(String str1, String str2) throws Exception {
Topology t = newTopology("testBytes");
System.out.println("===== "+t.getName());
@@ -279,7 +372,7 @@ public class WebSocketClientTest extends ConnectorTestBase {
Properties config = getConfig();
WebSocketClient wsClient = new Jsr356WebSocketClient(t, config);
- String[] expected = new String[] { "one", "two" };
+ String[] expected = new String[] { str1, str2 };
TStream<byte[]> s = t.strings(expected)
.map(tup -> tup.getBytes());
@@ -292,8 +385,7 @@ public class WebSocketClientTest extends ConnectorTestBase {
completeAndValidate("", t, rcvd, SEC_TMO, expected);
}
- @Test
- public void testReconnect() throws Exception {
+ public void testReconnect(String str1, String str2, String str3, String str4) throws Exception {
/*
* It's becomming apparent that the reconnect series of tests
* aren't reliable so skip them for ci. See jira QUARKS-122 for
@@ -309,7 +401,7 @@ public class WebSocketClientTest extends ConnectorTestBase {
Properties config = getConfig();
WebSocketClient wsClient = new Jsr356WebSocketClient(t, config);
- String[] expected = new String[] { "one", "two", "three-post-reconnect", "four" };
+ String[] expected = new String[] { str1, str2, str3, str4 };
TStream<String> s = t.strings(expected);
s = PlumbingStreams.blockingOneShotDelay(s, 2, TimeUnit.SECONDS);
@@ -337,8 +429,7 @@ public class WebSocketClientTest extends ConnectorTestBase {
completeAndValidate("", t, rcvd, SEC_TMO + 10, expected);
}
- @Test
- public void testReconnectBytes() throws Exception {
+ public void testReconnectBytes(String str1, String str2, String str3, String str4) throws Exception {
/*
* It's becomming apparent that the reconnect series of tests
* aren't reliable so skip them for ci. See jira QUARKS-122 for
@@ -354,7 +445,7 @@ public class WebSocketClientTest extends ConnectorTestBase {
Properties config = getConfig();
WebSocketClient wsClient = new Jsr356WebSocketClient(t, config);
- String[] expected = new String[] { "one", "two", "three-post-reconnect", "four" };
+ String[] expected = new String[] { str1, str2, str3, str4 };
TStream<byte[]> s = t.strings(expected).map(tup -> tup.getBytes());
s = PlumbingStreams.blockingOneShotDelay(s, 2, TimeUnit.SECONDS);
@@ -431,7 +522,7 @@ public class WebSocketClientTest extends ConnectorTestBase {
WebSocketClient wsClient = new Jsr356WebSocketClient(t, config);
- String[] expected = new String[] { "one", "two" };
+ String[] expected = new String[] { str1, str2 };
TStream<String> s = t.strings(expected);
s = PlumbingStreams.blockingOneShotDelay(s, 2, TimeUnit.SECONDS);
@@ -446,8 +537,7 @@ public class WebSocketClientTest extends ConnectorTestBase {
}
}
- @Test
- public void testSslClientAuthSystemProperty() throws Exception {
+ public void testSslClientAuthSystemProperty(String str1, String str2) throws Exception {
Topology t = newTopology("testSslClientAuthSystemProperty");
System.out.println("===== "+t.getName());
@@ -465,7 +555,7 @@ public class WebSocketClientTest extends ConnectorTestBase {
WebSocketClient wsClient = new Jsr356WebSocketClient(t, config);
- String[] expected = new String[] { "one", "two" };
+ String[] expected = new String[] { str1, str2 };
TStream<String> s = t.strings(expected);
s = PlumbingStreams.blockingOneShotDelay(s, 2, TimeUnit.SECONDS);
@@ -480,8 +570,7 @@ public class WebSocketClientTest extends ConnectorTestBase {
}
}
- @Test
- public void testSsl() throws Exception {
+ public void testSsl(String str1, String str2) throws Exception {
Topology t = newTopology("testSsl");
System.out.println("===== "+t.getName());
@@ -494,7 +583,7 @@ public class WebSocketClientTest extends ConnectorTestBase {
WebSocketClient wsClient = new Jsr356WebSocketClient(t, config);
- String[] expected = new String[] { "one", "two" };
+ String[] expected = new String[] { str1, str2 };
TStream<String> s = t.strings(expected);
s = PlumbingStreams.blockingOneShotDelay(s, 2, TimeUnit.SECONDS);
@@ -505,8 +594,7 @@ public class WebSocketClientTest extends ConnectorTestBase {
completeAndValidate("", t, rcvd, SEC_TMO, expected);
}
- @Test
- public void testSslReconnect() throws Exception {
+ public void testSslReconnect(String str1, String str2, String str3, String str4) throws Exception {
/*
* It's becomming apparent that the reconnect series of tests
* aren't reliable so skip them for ci. See jira QUARKS-122 for
@@ -522,7 +610,7 @@ public class WebSocketClientTest extends ConnectorTestBase {
Properties config = getWssConfig();
WebSocketClient wsClient = new Jsr356WebSocketClient(t, config);
- String[] expected = new String[] { "one", "two", "three-post-reconnect", "four" };
+ String[] expected = new String[] { str1, str2, str3, str4 };
TStream<String> s = t.strings(expected);
s = PlumbingStreams.blockingOneShotDelay(s, 2, TimeUnit.SECONDS);
@@ -549,8 +637,7 @@ public class WebSocketClientTest extends ConnectorTestBase {
completeAndValidate("", t, rcvd, SEC_TMO + 10, expected);
}
- @Test
- public void testSslNeg() throws Exception {
+ public void testSslNeg(String str1, String str2) throws Exception {
Topology t = newTopology("testSslNeg");
System.out.println("===== "+t.getName());
@@ -569,7 +656,7 @@ public class WebSocketClientTest extends ConnectorTestBase {
WebSocketClient wsClient = new Jsr356WebSocketClient(t, config);
- String[] expected = new String[] { "one", "two" };
+ String[] expected = new String[] { str1, str2 };
TStream<String> s = t.strings(expected);
s = PlumbingStreams.blockingOneShotDelay(s, 2, TimeUnit.SECONDS);
@@ -580,8 +667,7 @@ public class WebSocketClientTest extends ConnectorTestBase {
completeAndValidate("", t, rcvd, SEC_TMO, new String[0]); //rcv nothing
}
- @Test
- public void testSslClientAuth() throws Exception {
+ public void testSslClientAuth(String str1, String str2) throws Exception {
Topology t = newTopology("testSslClientAuth");
System.out.println("===== "+t.getName());
@@ -594,7 +680,7 @@ public class WebSocketClientTest extends ConnectorTestBase {
WebSocketClient wsClient = new Jsr356WebSocketClient(t, config);
- String[] expected = new String[] { "one", "two" };
+ String[] expected = new String[] { str1, str2 };
TStream<String> s = t.strings(expected);
s = PlumbingStreams.blockingOneShotDelay(s, 2, TimeUnit.SECONDS);
@@ -605,8 +691,7 @@ public class WebSocketClientTest extends ConnectorTestBase {
completeAndValidate("", t, rcvd, SEC_TMO, expected);
}
- @Test
- public void testSslClientAuthDefault() throws Exception {
+ public void testSslClientAuthDefault(String str1, String str2) throws Exception {
Topology t = newTopology("testSslClientAuthDefault");
System.out.println("===== "+t.getName());
@@ -621,7 +706,7 @@ public class WebSocketClientTest extends ConnectorTestBase {
WebSocketClient wsClient = new Jsr356WebSocketClient(t, config);
- String[] expected = new String[] { "one", "two" };
+ String[] expected = new String[] { str1, str2 };
TStream<String> s = t.strings(expected);
s = PlumbingStreams.blockingOneShotDelay(s, 2, TimeUnit.SECONDS);
@@ -632,8 +717,7 @@ public class WebSocketClientTest extends ConnectorTestBase {
completeAndValidate("", t, rcvd, SEC_TMO, expected);
}
- @Test
- public void testSslClientAuthMy2ndCertNeg() throws Exception {
+ public void testSslClientAuthMy2ndCertNeg(String str1, String str2) throws Exception {
Topology t = newTopology("testSslClientAuthMy2ndCertNeg");
System.out.println("===== "+t.getName());
@@ -648,7 +732,7 @@ public class WebSocketClientTest extends ConnectorTestBase {
WebSocketClient wsClient = new Jsr356WebSocketClient(t, config);
- String[] expected = new String[] { "one", "two" };
+ String[] expected = new String[] { str1, str2 };
TStream<String> s = t.strings(expected);
s = PlumbingStreams.blockingOneShotDelay(s, 2, TimeUnit.SECONDS);
@@ -659,8 +743,7 @@ public class WebSocketClientTest extends ConnectorTestBase {
completeAndValidate("", t, rcvd, SEC_TMO, new String[0]); // rcv nothing
}
- @Test
- public void testSslClientAuthMy3rdCert() throws Exception {
+ public void testSslClientAuthMy3rdCert(String str1, String str2) throws Exception {
Topology t = newTopology("testSslClientAuthMy3rdCert");
System.out.println("===== "+t.getName());
@@ -675,7 +758,7 @@ public class WebSocketClientTest extends ConnectorTestBase {
WebSocketClient wsClient = new Jsr356WebSocketClient(t, config);
- String[] expected = new String[] { "one", "two" };
+ String[] expected = new String[] { str1, str2 };
TStream<String> s = t.strings(expected);
s = PlumbingStreams.blockingOneShotDelay(s, 2, TimeUnit.SECONDS);
@@ -686,8 +769,7 @@ public class WebSocketClientTest extends ConnectorTestBase {
completeAndValidate("", t, rcvd, SEC_TMO, expected);
}
- @Test
- public void testSslClientAuthNeg() throws Exception {
+ public void testSslClientAuthNeg(String str1, String str2) throws Exception {
Topology t = newTopology("testSslClientAuthNeg");
System.out.println("===== "+t.getName());
@@ -706,7 +788,7 @@ public class WebSocketClientTest extends ConnectorTestBase {
WebSocketClient wsClient = new Jsr356WebSocketClient(t, config);
- String[] expected = new String[] { "one", "two" };
+ String[] expected = new String[] { str1, str2 };
TStream<String> s = t.strings(expected);
s = PlumbingStreams.blockingOneShotDelay(s, 2, TimeUnit.SECONDS);
@@ -735,8 +817,7 @@ public class WebSocketClientTest extends ConnectorTestBase {
}
}
- @Test
- public void testPublicServer() throws Exception {
+ public void testPublicServer(String str1, String str2) throws Exception {
Topology t = newTopology("testPublicServer");
System.out.println("===== "+t.getName());
@@ -750,7 +831,7 @@ public class WebSocketClientTest extends ConnectorTestBase {
WebSocketClient wsClient = new Jsr356WebSocketClient(t, config);
- String[] expected = new String[] { "one", "two" };
+ String[] expected = new String[] { str1, str2 };
TStream<String> s = t.strings(expected);
s = PlumbingStreams.blockingOneShotDelay(s, 2, TimeUnit.SECONDS);
@@ -761,8 +842,7 @@ public class WebSocketClientTest extends ConnectorTestBase {
completeAndValidate("", t, rcvd, SEC_TMO, expected);
}
- @Test
- public void testSslPublicServer() throws Exception {
+ public void testSslPublicServer(String str1, String str2) throws Exception {
Topology t = newTopology("testSslPublicServer");
System.out.println("===== "+t.getName());
@@ -782,7 +862,7 @@ public class WebSocketClientTest extends ConnectorTestBase {
WebSocketClient wsClient = new Jsr356WebSocketClient(t, config);
- String[] expected = new String[] { "one", "two" };
+ String[] expected = new String[] { str1, str2 };
TStream<String> s = t.strings(expected);
s = PlumbingStreams.blockingOneShotDelay(s, 2, TimeUnit.SECONDS);
@@ -793,7 +873,7 @@ public class WebSocketClientTest extends ConnectorTestBase {
completeAndValidate("", t, rcvd, SEC_TMO, expected);
}
- public void testSslPublicServerBadTrustStoreSystemPropertyNeg() throws Exception {
+ public void testSslPublicServerBadTrustStoreSystemPropertyNeg(String str1, String str2) throws Exception {
Topology t = newTopology("testSslPublicServerBadTrustStoreSystemPropertyNeg");
System.out.println("===== "+t.getName());
@@ -819,7 +899,7 @@ public class WebSocketClientTest extends ConnectorTestBase {
WebSocketClient wsClient = new Jsr356WebSocketClient(t, config);
- String[] expected = new String[] { "one", "two" };
+ String[] expected = new String[] { str1, str2 };
TStream<String> s = t.strings(expected);
s = PlumbingStreams.blockingOneShotDelay(s, 2, TimeUnit.SECONDS);