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
1515package org .eclipse .paho .client .mqttv3 .test ;
1616
1717import java .net .URI ;
18+ import java .util .Arrays ;
19+ import java .util .Collection ;
1820import java .util .UUID ;
1921import java .util .logging .Level ;
2022import java .util .logging .Logger ;
3133import org .junit .Assert ;
3234import org .junit .BeforeClass ;
3335import 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 )
3946public 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