Skip to content

Commit e2414c8

Browse files
author
Ian Craggs
committed
Add websocket test to basic suite
1 parent 92eca42 commit e2414c8

1 file changed

Lines changed: 21 additions & 2 deletions

File tree

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

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

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2009, 2014 IBM Corp.
2+
* Copyright (c) 2009, 2019 IBM Corp.
33
*
44
* All rights reserved. This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License v1.0
@@ -15,6 +15,8 @@
1515
package org.eclipse.paho.client.mqttv3.test;
1616

1717
import java.net.URI;
18+
import java.util.Arrays;
19+
import java.util.Collection;
1820
import java.util.UUID;
1921
import java.util.logging.Level;
2022
import java.util.logging.Logger;
@@ -31,11 +33,16 @@
3133
import org.junit.Assert;
3234
import org.junit.BeforeClass;
3335
import org.junit.Test;
36+
import org.junit.experimental.categories.Category;
37+
import org.junit.runner.RunWith;
38+
import org.junit.runners.Parameterized;
39+
import org.junit.runners.Parameterized.Parameters;
3440

3541
/**
3642
* This test expects an MQTT Server to be listening on the port
3743
* given by the SERVER_URI property (which is 1883 by default)
3844
*/
45+
@RunWith(Parameterized.class)
3946
public class SendReceiveTest {
4047

4148
static final Class<?> cclass = SendReceiveTest.class;
@@ -45,6 +52,19 @@ public class SendReceiveTest {
4552
private static URI serverURI;
4653
private static MqttClientFactoryPaho clientFactory;
4754
private static String topicPrefix;
55+
56+
@Parameters
57+
public static Collection<Object[]> data() throws Exception {
58+
59+
return Arrays.asList(new Object[][] {
60+
{ TestProperties.getServerURI() }, { TestProperties.getWebSocketServerURI() }
61+
});
62+
63+
}
64+
65+
public SendReceiveTest(URI serverURI) {
66+
this.serverURI = serverURI;
67+
}
4868

4969

5070
/**
@@ -57,7 +77,6 @@ public static void setUpBeforeClass() throws Exception {
5777
String methodName = Utility.getMethodName();
5878
LoggingUtilities.banner(log, cclass, methodName);
5979

60-
serverURI = TestProperties.getServerURI();
6180
clientFactory = new MqttClientFactoryPaho();
6281
clientFactory.open();
6382
topicPrefix = "SendReceiveTest-" + UUID.randomUUID().toString() + "-";

0 commit comments

Comments
 (0)