Skip to content

Commit 422d41f

Browse files
committed
Tweaking some of the tests and adding Travis config to use mqtt.iotree.co.uk
Signed-off-by: James Sutton <james.sutton@uk.ibm.com>
1 parent 94335cd commit 422d41f

7 files changed

Lines changed: 55 additions & 43 deletions

File tree

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
language: java
2+
script: mvn test -Dtest.server_ssl_port=18885 -Dtest.server_uri=tcp://mqtt.iotree.co.uk:1883 -Dtest.server_websocket_uri=ws://mqtt.iotree.co.uk:8080 -B
Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,33 @@
1-
<?xml version="1.0" encoding="UTF-8"?>
2-
<classpath>
3-
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
4-
<attributes>
5-
<attribute name="optional" value="true"/>
6-
<attribute name="maven.pomderived" value="true"/>
7-
</attributes>
8-
</classpathentry>
9-
<classpathentry including="**/*.java" kind="src" path="src/test/resources"/>
10-
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
11-
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
12-
<attributes>
13-
<attribute name="maven.pomderived" value="true"/>
14-
</attributes>
15-
</classpathentry>
16-
<classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.paho.client.mqttv3"/>
17-
<classpathentry kind="src" output="target/classes" path="src/main/java">
18-
<attributes>
19-
<attribute name="optional" value="true"/>
20-
<attribute name="maven.pomderived" value="true"/>
21-
</attributes>
22-
</classpathentry>
23-
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
24-
<attributes>
25-
<attribute name="maven.pomderived" value="true"/>
26-
</attributes>
27-
</classpathentry>
28-
<classpathentry kind="output" path="target/classes"/>
29-
</classpath>
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
4+
<attributes>
5+
<attribute name="optional" value="true"/>
6+
<attribute name="maven.pomderived" value="true"/>
7+
</attributes>
8+
</classpathentry>
9+
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
10+
<attributes>
11+
<attribute name="maven.pomderived" value="true"/>
12+
</attributes>
13+
</classpathentry>
14+
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
15+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
16+
<attributes>
17+
<attribute name="maven.pomderived" value="true"/>
18+
</attributes>
19+
</classpathentry>
20+
<classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.paho.client.mqttv3"/>
21+
<classpathentry kind="src" output="target/classes" path="src/main/java">
22+
<attributes>
23+
<attribute name="optional" value="true"/>
24+
<attribute name="maven.pomderived" value="true"/>
25+
</attributes>
26+
</classpathentry>
27+
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
28+
<attributes>
29+
<attribute name="maven.pomderived" value="true"/>
30+
</attributes>
31+
</classpathentry>
32+
<classpathentry kind="output" path="target/classes"/>
33+
</classpath>
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
eclipse.preferences.version=1
22
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3-
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
3+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
44
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5-
org.eclipse.jdt.core.compiler.compliance=1.6
5+
org.eclipse.jdt.core.compiler.compliance=1.7
66
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
77
org.eclipse.jdt.core.compiler.debug.localVariable=generate
88
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
99
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
1010
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
1111
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
12-
org.eclipse.jdt.core.compiler.source=1.6
12+
org.eclipse.jdt.core.compiler.source=1.7

org.eclipse.paho.client.mqttv3.test/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
<systemPropertyVariables>
5353
<SERVER_URI>${test.server_uri}</SERVER_URI>
5454
<SERVER_SSL_PORT>${test.server_ssl_port}</SERVER_SSL_PORT>
55+
<SERVER_WEBSOCKET_URI>${test.server_websocket_url}</SERVER_WEBSOCKET_URI>
5556
</systemPropertyVariables>
5657
<excludes>
5758
<exclude>${test.exclude}</exclude>

org.eclipse.paho.client.mqttv3.test/src/test/java/org/eclipse/paho/client/mqttv3/test/SSLSessionResumptionTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public static void setUpBeforeClass() throws Exception {
5959
try {
6060
String methodName = Utility.getMethodName();
6161
LoggingUtilities.banner(log, cclass, methodName);
62-
serverURI = "ssl://" + TestProperties.getServerURI().getHost();
62+
serverURI = "ssl://" + TestProperties.getServerURI().getHost() + ":" +TestProperties.getServerSSLPort();
6363
serverHost = TestProperties.getServerURI().getHost();
6464
serverPort = TestProperties.getServerSSLPort();
6565

@@ -80,7 +80,7 @@ public static void setUpBeforeClass() throws Exception {
8080
*/
8181
@Test(timeout=30000)
8282
public void testSSLSessionInvalidated() throws Exception {
83-
// System.setProperty("javax.net.debug", "all");
83+
//System.setProperty("javax.net.debug", "all");
8484

8585
SSLSocketFactory factory = getSocketFactory();
8686

org.eclipse.paho.client.mqttv3.test/src/test/java/org/eclipse/paho/client/mqttv3/test/WebSocketTest.java

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public static void tearDownAfterClass() throws Exception {
9494
/**
9595
* @throws Exception
9696
*/
97-
@Test(timeout=10000)
97+
@Test()
9898
public void testWebSocketConnect() throws Exception {
9999
String methodName = Utility.getMethodName();
100100
LoggingUtilities.banner(log, cclass, methodName);
@@ -182,7 +182,10 @@ public void testWebSocketPubSub() throws Exception {
182182

183183
log.info("Disconnecting...");
184184
client.disconnect();
185-
}
185+
} catch (MqttException exception) {
186+
log.log(Level.SEVERE, "caught exception:", exception);
187+
Assert.fail("Unexpected exception: " + exception);
188+
}
186189
finally {
187190
if (client != null) {
188191
if(client.isConnected()){
@@ -239,9 +242,10 @@ public void largePayloadTest() throws Exception{
239242
log.info("Disconnecting...");
240243
client.disconnect();
241244
log.info("Disconnected...");
242-
} catch (Exception e){
243-
e.printStackTrace();
244-
} finally {
245+
} catch (MqttException exception) {
246+
log.log(Level.SEVERE, "caught exception:", exception);
247+
Assert.fail("Unexpected exception: " + exception);
248+
} finally {
245249
if (client != null) {
246250
if(client.isConnected()){
247251
client.disconnectForcibly();
@@ -274,9 +278,10 @@ public void testBasicAuth() throws Exception {
274278
client = clientFactory.createMqttClient(serverURIWithUserInfo, clientId);
275279
client.connect();
276280
client.disconnect();
277-
} catch (Exception e){
278-
e.printStackTrace();
279-
} finally {
281+
}catch (MqttException exception) {
282+
log.log(Level.SEVERE, "caught exception:", exception);
283+
Assert.fail("Unexpected exception: " + exception);
284+
} finally {
280285
if (client != null) {
281286
if(client.isConnected()){
282287
client.disconnectForcibly();

org.eclipse.paho.client.mqttv3.test/src/test/java/org/eclipse/paho/client/mqttv3/test/client/MqttClientPaho.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import org.eclipse.paho.client.mqttv3.MqttClient;
1818
import org.eclipse.paho.client.mqttv3.MqttClientPersistence;
1919
import org.eclipse.paho.client.mqttv3.MqttException;
20+
import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
2021

2122

2223
/**
@@ -30,7 +31,7 @@ public class MqttClientPaho extends MqttClient {
3031
* @throws MqttException
3132
*/
3233
public MqttClientPaho(String serverURI, String clientId) throws MqttException {
33-
super(serverURI, clientId);
34+
super(serverURI, clientId, new MemoryPersistence());
3435
}
3536

3637
/**

0 commit comments

Comments
 (0)