Merged the intergation test part that uses Fusesource MQTT client
This commit is contained in:
+29
-4
@@ -64,6 +64,20 @@
|
|||||||
<version>1.9.0</version>
|
<version>1.9.0</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.fusesource.mqtt-client</groupId>
|
||||||
|
<artifactId>mqtt-client</artifactId>
|
||||||
|
<!-- <version>1.4-SNAPSHOT</version>-->
|
||||||
|
<version>1.3</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.fusesource.hawtbuf</groupId>
|
||||||
|
<artifactId>hawtbuf</artifactId>
|
||||||
|
<version>1.9</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
@@ -107,10 +121,21 @@
|
|||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
<!-- <repositories>
|
<repositories>
|
||||||
<repository>
|
<!-- <repository>
|
||||||
<id>Fusesource Releases</id>
|
<id>Fusesource Releases</id>
|
||||||
<url>http://repo.fusesource.com/nexus/content/repositories/snapshots</url>
|
<url>http://repo.fusesource.com/nexus/content/repositories/snapshots</url>
|
||||||
</repository>
|
</repository>-->
|
||||||
</repositories>-->
|
<!-- <repository>
|
||||||
|
<id>fusesource.snapshots</id>
|
||||||
|
<name>FuseSource Snapshot Repository</name>
|
||||||
|
<url>http://repo.fusesource.com/nexus/content/repositories/snapshots</url>
|
||||||
|
<snapshots>
|
||||||
|
<enabled>true</enabled>
|
||||||
|
</snapshots>
|
||||||
|
<releases>
|
||||||
|
<enabled>false</enabled>
|
||||||
|
</releases>
|
||||||
|
</repository>-->
|
||||||
|
</repositories>
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import java.util.concurrent.TimeUnit;
|
|||||||
import org.dna.mqtt.moquette.client.Client;
|
import org.dna.mqtt.moquette.client.Client;
|
||||||
import org.dna.mqtt.moquette.client.IPublishCallback;
|
import org.dna.mqtt.moquette.client.IPublishCallback;
|
||||||
import org.dna.mqtt.moquette.proto.messages.AbstractMessage;
|
import org.dna.mqtt.moquette.proto.messages.AbstractMessage;
|
||||||
|
import org.fusesource.mqtt.client.*;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
@@ -41,6 +42,25 @@ public class ServerIntegrationTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSubscribe_FSClient() throws Exception {
|
||||||
|
// startServer();
|
||||||
|
MQTT mqtt = new MQTT();
|
||||||
|
mqtt.setHost("localhost", Server.PORT);
|
||||||
|
mqtt.setClientId("TestClient");
|
||||||
|
FutureConnection connection = mqtt.futureConnection();
|
||||||
|
connection.connect().await();
|
||||||
|
|
||||||
|
Topic[] topics = {new Topic("/topic", QoS.AT_MOST_ONCE)};
|
||||||
|
Future<byte[]> futSub = connection.subscribe(topics);
|
||||||
|
|
||||||
|
connection.publish("/topic", "Test my payload".getBytes(), QoS.AT_MOST_ONCE, false).await();
|
||||||
|
|
||||||
|
byte[] qoses = futSub.await();
|
||||||
|
assertEquals(1, qoses.length);
|
||||||
|
connection.disconnect().await();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSubscribe() throws IOException, InterruptedException {
|
public void testSubscribe() throws IOException, InterruptedException {
|
||||||
|
|||||||
Reference in New Issue
Block a user