mirror of https://github.com/apache/activemq.git
add patch for: https://issues.apache.org/jira/browse/AMQ-4338
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1448470 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6bf22224dd
commit
6e8bd45180
|
@ -29,7 +29,6 @@ import javax.jms.Session;
|
||||||
import javax.jms.TextMessage;
|
import javax.jms.TextMessage;
|
||||||
import org.apache.activemq.ActiveMQConnection;
|
import org.apache.activemq.ActiveMQConnection;
|
||||||
import org.apache.activemq.ActiveMQConnectionFactory;
|
import org.apache.activemq.ActiveMQConnectionFactory;
|
||||||
import org.apache.activemq.AutoFailTestSupport;
|
|
||||||
import org.apache.activemq.broker.BrokerService;
|
import org.apache.activemq.broker.BrokerService;
|
||||||
import org.apache.activemq.broker.TransportConnector;
|
import org.apache.activemq.broker.TransportConnector;
|
||||||
import org.apache.activemq.command.ActiveMQMessage;
|
import org.apache.activemq.command.ActiveMQMessage;
|
||||||
|
@ -55,11 +54,9 @@ public abstract class AbstractMQTTTest {
|
||||||
protected BrokerService brokerService;
|
protected BrokerService brokerService;
|
||||||
protected LinkedList<Throwable> exceptions = new LinkedList<Throwable>();
|
protected LinkedList<Throwable> exceptions = new LinkedList<Throwable>();
|
||||||
protected int numberOfMessages;
|
protected int numberOfMessages;
|
||||||
AutoFailTestSupport autoFailTestSupport = new AutoFailTestSupport() {};
|
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void startBroker() throws Exception {
|
public void startBroker() throws Exception {
|
||||||
autoFailTestSupport.startAutoFailThread();
|
|
||||||
exceptions.clear();
|
exceptions.clear();
|
||||||
brokerService = new BrokerService();
|
brokerService = new BrokerService();
|
||||||
brokerService.setPersistent(false);
|
brokerService.setPersistent(false);
|
||||||
|
@ -73,10 +70,9 @@ public abstract class AbstractMQTTTest {
|
||||||
if (brokerService != null) {
|
if (brokerService != null) {
|
||||||
brokerService.stop();
|
brokerService.stop();
|
||||||
}
|
}
|
||||||
autoFailTestSupport.stopAutoFailThread();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test(timeout=30000)
|
||||||
public void testSendAndReceiveMQTT() throws Exception {
|
public void testSendAndReceiveMQTT() throws Exception {
|
||||||
addMQTTConnector();
|
addMQTTConnector();
|
||||||
brokerService.start();
|
brokerService.start();
|
||||||
|
@ -119,7 +115,7 @@ public abstract class AbstractMQTTTest {
|
||||||
publishProvider.disconnect();
|
publishProvider.disconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test(timeout=30000)
|
||||||
public void testSendAtMostOnceReceiveExactlyOnce() throws Exception {
|
public void testSendAtMostOnceReceiveExactlyOnce() throws Exception {
|
||||||
/**
|
/**
|
||||||
* Although subscribing with EXACTLY ONCE, the message gets published
|
* Although subscribing with EXACTLY ONCE, the message gets published
|
||||||
|
@ -142,7 +138,7 @@ public abstract class AbstractMQTTTest {
|
||||||
provider.disconnect();
|
provider.disconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test(timeout=30000)
|
||||||
public void testSendAtLeastOnceReceiveExactlyOnce() throws Exception {
|
public void testSendAtLeastOnceReceiveExactlyOnce() throws Exception {
|
||||||
addMQTTConnector();
|
addMQTTConnector();
|
||||||
brokerService.start();
|
brokerService.start();
|
||||||
|
@ -160,7 +156,7 @@ public abstract class AbstractMQTTTest {
|
||||||
provider.disconnect();
|
provider.disconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test(timeout=30000)
|
||||||
public void testSendAtLeastOnceReceiveAtMostOnce() throws Exception {
|
public void testSendAtLeastOnceReceiveAtMostOnce() throws Exception {
|
||||||
addMQTTConnector();
|
addMQTTConnector();
|
||||||
brokerService.start();
|
brokerService.start();
|
||||||
|
@ -179,7 +175,7 @@ public abstract class AbstractMQTTTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test(timeout=30000)
|
||||||
public void testSendAndReceiveAtMostOnce() throws Exception {
|
public void testSendAndReceiveAtMostOnce() throws Exception {
|
||||||
addMQTTConnector();
|
addMQTTConnector();
|
||||||
brokerService.start();
|
brokerService.start();
|
||||||
|
@ -197,7 +193,7 @@ public abstract class AbstractMQTTTest {
|
||||||
provider.disconnect();
|
provider.disconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test(timeout=30000)
|
||||||
public void testSendAndReceiveAtLeastOnce() throws Exception {
|
public void testSendAndReceiveAtLeastOnce() throws Exception {
|
||||||
addMQTTConnector();
|
addMQTTConnector();
|
||||||
brokerService.start();
|
brokerService.start();
|
||||||
|
@ -215,7 +211,7 @@ public abstract class AbstractMQTTTest {
|
||||||
provider.disconnect();
|
provider.disconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test(timeout=30000)
|
||||||
public void testSendAndReceiveExactlyOnce() throws Exception {
|
public void testSendAndReceiveExactlyOnce() throws Exception {
|
||||||
addMQTTConnector();
|
addMQTTConnector();
|
||||||
brokerService.start();
|
brokerService.start();
|
||||||
|
@ -231,14 +227,14 @@ public abstract class AbstractMQTTTest {
|
||||||
String payload = "Test Message: " + i;
|
String payload = "Test Message: " + i;
|
||||||
publisher.publish("foo", payload.getBytes(), EXACTLY_ONCE);
|
publisher.publish("foo", payload.getBytes(), EXACTLY_ONCE);
|
||||||
byte[] message = subscriber.receive(5000);
|
byte[] message = subscriber.receive(5000);
|
||||||
assertNotNull("Should get a message", message);
|
assertNotNull("Should get a message + ["+ i + "]", message);
|
||||||
assertEquals(payload, new String(message));
|
assertEquals(payload, new String(message));
|
||||||
}
|
}
|
||||||
subscriber.disconnect();
|
subscriber.disconnect();
|
||||||
publisher.disconnect();
|
publisher.disconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test(timeout=30000)
|
||||||
public void testSendAndReceiveLargeMessages() throws Exception {
|
public void testSendAndReceiveLargeMessages() throws Exception {
|
||||||
byte[] payload = new byte[1024 * 32];
|
byte[] payload = new byte[1024 * 32];
|
||||||
for (int i = 0; i < payload.length; i++){
|
for (int i = 0; i < payload.length; i++){
|
||||||
|
@ -266,7 +262,7 @@ public abstract class AbstractMQTTTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test(timeout=30000)
|
||||||
public void testSendMQTTReceiveJMS() throws Exception {
|
public void testSendMQTTReceiveJMS() throws Exception {
|
||||||
addMQTTConnector();
|
addMQTTConnector();
|
||||||
TransportConnector openwireTransport = brokerService.addConnector("tcp://localhost:0");
|
TransportConnector openwireTransport = brokerService.addConnector("tcp://localhost:0");
|
||||||
|
@ -297,7 +293,7 @@ public abstract class AbstractMQTTTest {
|
||||||
provider.disconnect();
|
provider.disconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test(timeout=30000)
|
||||||
public void testSendJMSReceiveMQTT() throws Exception {
|
public void testSendJMSReceiveMQTT() throws Exception {
|
||||||
addMQTTConnector();
|
addMQTTConnector();
|
||||||
TransportConnector openwireTransport = brokerService.addConnector("tcp://localhost:0");
|
TransportConnector openwireTransport = brokerService.addConnector("tcp://localhost:0");
|
||||||
|
|
|
@ -25,7 +25,7 @@ import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
public class MQTTTest extends AbstractMQTTTest {
|
public class MQTTTest extends AbstractMQTTTest {
|
||||||
|
|
||||||
@Test
|
@Test(timeout=30000)
|
||||||
public void testPingKeepsInactivityMonitorAlive() throws Exception {
|
public void testPingKeepsInactivityMonitorAlive() throws Exception {
|
||||||
addMQTTConnector();
|
addMQTTConnector();
|
||||||
brokerService.start();
|
brokerService.start();
|
||||||
|
@ -45,7 +45,7 @@ public class MQTTTest extends AbstractMQTTTest {
|
||||||
connection.disconnect();
|
connection.disconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test(timeout=30000)
|
||||||
public void testTurnOffInactivityMonitor()throws Exception{
|
public void testTurnOffInactivityMonitor()throws Exception{
|
||||||
addMQTTConnector("?transport.useInactivityMonitor=false");
|
addMQTTConnector("?transport.useInactivityMonitor=false");
|
||||||
brokerService.start();
|
brokerService.start();
|
||||||
|
@ -66,7 +66,7 @@ public class MQTTTest extends AbstractMQTTTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test(timeout=30000)
|
||||||
public void testDefaultKeepAliveWhenClientSpecifiesZero() throws Exception {
|
public void testDefaultKeepAliveWhenClientSpecifiesZero() throws Exception {
|
||||||
// default keep alive in milliseconds
|
// default keep alive in milliseconds
|
||||||
addMQTTConnector("?transport.defaultKeepAlive=2000");
|
addMQTTConnector("?transport.defaultKeepAlive=2000");
|
||||||
|
|
Loading…
Reference in New Issue