Test code cleanup

This commit is contained in:
Timothy Bish 2014-07-23 15:57:52 -04:00
parent d223ea979f
commit 93f686c5cf
2 changed files with 26 additions and 34 deletions

View File

@ -16,6 +16,16 @@
*/
package org.apache.activemq.transport.mqtt;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
import javax.jms.Message;
import javax.jms.MessageConsumer;
import javax.jms.MessageListener;
import javax.jms.Session;
import org.apache.activemq.ActiveMQConnection;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.broker.TransportConnector;
@ -25,15 +35,6 @@ import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.jms.Message;
import javax.jms.MessageConsumer;
import javax.jms.MessageListener;
import javax.jms.Session;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
public class PahoMQTNioTTest extends PahoMQTTTest {
private static final Logger LOG = LoggerFactory.getLogger(PahoMQTNioTTest.class);
@ -75,7 +76,8 @@ public class PahoMQTNioTTest extends PahoMQTTTest {
@Override
public void run() {
try {
MqttClient client = new MqttClient("tcp://localhost:" + mqttConnector.getConnectUri().getPort(), Thread.currentThread().getName(), new MemoryPersistence());
MqttClient client = new MqttClient("tcp://localhost:" + mqttConnector.getConnectUri().getPort(), Thread.currentThread().getName(),
new MemoryPersistence());
client.connect();
connectedDoneLatch.countDown();
sendBarrier.await();
@ -113,8 +115,5 @@ public class PahoMQTNioTTest extends PahoMQTTTest {
disconnectDoneLatch.await();
assertNull("Async error: " + asyncError.get(), asyncError.get());
}
}

View File

@ -16,24 +16,19 @@
*/
package org.apache.activemq.transport.mqtt;
import javax.jms.Message;
import javax.jms.MessageConsumer;
import javax.jms.Session;
import org.apache.activemq.ActiveMQConnection;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.broker.TransportConnector;
import org.eclipse.paho.client.mqttv3.MqttClient;
import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.jms.Message;
import javax.jms.MessageConsumer;
import javax.jms.Session;
public class PahoMQTTTest extends AbstractMQTTTest {
private static final Logger LOG = LoggerFactory.getLogger(PahoMQTTTest.class);
@Test(timeout=300000)
public void testSendAndReceiveMQTT() throws Exception {
addMQTTConnector();
@ -55,6 +50,4 @@ public class PahoMQTTTest extends AbstractMQTTTest {
client.disconnect();
client.close();
}
}