You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2014/07/30 02:16:19 UTC
git commit: Revert to using non-parameterized tests,
makes it simpler to debug.
Repository: activemq
Updated Branches:
refs/heads/trunk e47e0e046 -> 829a186f2
Revert to using non-parameterized tests, makes it simpler to debug.
Project: http://git-wip-us.apache.org/repos/asf/activemq/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/829a186f
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/829a186f
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/829a186f
Branch: refs/heads/trunk
Commit: 829a186f2a05ac50eef389bea5c407559cdccef0
Parents: e47e0e0
Author: Timothy Bish <ta...@gmail.com>
Authored: Tue Jul 29 20:16:00 2014 -0400
Committer: Timothy Bish <ta...@gmail.com>
Committed: Tue Jul 29 20:16:00 2014 -0400
----------------------------------------------------------------------
.../mqtt/MQTTCompositeQueueRetainedTest.java | 6 ++--
.../activemq/transport/mqtt/MQTTNIOTest.java | 33 ++++++++++++++++++++
.../activemq/transport/mqtt/MQTTSSLTest.java | 33 ++++++++++++++++++++
.../activemq/transport/mqtt/MQTTTest.java | 15 ---------
.../transport/mqtt/MQTTTestSupport.java | 13 +++-----
.../transport/mqtt/PahoMQTTNIOTest.java | 33 ++++++++++++++++++++
.../activemq/transport/mqtt/PahoMQTTTest.java | 14 ---------
7 files changed, 106 insertions(+), 41 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/activemq/blob/829a186f/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTCompositeQueueRetainedTest.java
----------------------------------------------------------------------
diff --git a/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTCompositeQueueRetainedTest.java b/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTCompositeQueueRetainedTest.java
index 33b5039..4b1cc49 100644
--- a/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTCompositeQueueRetainedTest.java
+++ b/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTCompositeQueueRetainedTest.java
@@ -147,7 +147,7 @@ public class MQTTCompositeQueueRetainedTest extends MQTTTestSupport {
bs = message.getContent();
assertEquals(RETAINED, new String(bs.data, bs.offset, bs.length));
assertTrue(message.getBooleanProperty(RetainedMessageSubscriptionRecoveryPolicy.RETAINED_PROPERTY));
- assertNull("Should not get second retained message from " + FORWARD_QUEUE, queueConsumer.receive(5000));
+ assertNull("Should not get second retained message from " + FORWARD_QUEUE, queueConsumer.receive(2000));
// check whether we received retained message on mapped Topic, again
message = (ActiveMQMessage) topicConsumer.receive(5000);
@@ -155,11 +155,11 @@ public class MQTTCompositeQueueRetainedTest extends MQTTTestSupport {
bs = message.getContent();
assertEquals(RETAINED, new String(bs.data, bs.offset, bs.length));
assertTrue(message.getBooleanProperty(RetainedMessageSubscriptionRecoveryPolicy.RETAINED_PROPERTY));
- assertNull("Should not get second retained message from " + FORWARD_TOPIC, topicConsumer.receive(5000));
+ assertNull("Should not get second retained message from " + FORWARD_TOPIC, topicConsumer.receive(2000));
// create second queue consumer and verify that it doesn't trigger message recovery
final MessageConsumer queueConsumer2 = s.createConsumer(jmsQueue);
- assertNull("Second consumer MUST not receive retained message from " + FORWARD_QUEUE, queueConsumer2.receive(5000));
+ assertNull("Second consumer MUST not receive retained message from " + FORWARD_QUEUE, queueConsumer2.receive(2000));
activeMQConnection.close();
provider.disconnect();
http://git-wip-us.apache.org/repos/asf/activemq/blob/829a186f/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTNIOTest.java
----------------------------------------------------------------------
diff --git a/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTNIOTest.java b/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTNIOTest.java
new file mode 100644
index 0000000..abb5d6c
--- /dev/null
+++ b/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTNIOTest.java
@@ -0,0 +1,33 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.transport.mqtt;
+
+/**
+ * Run the basic tests with the NIO Transport.
+ */
+public class MQTTNIOTest extends MQTTTest {
+
+ @Override
+ public String getProtocolScheme() {
+ return "mqtt+nio";
+ }
+
+ @Override
+ public boolean isUseSSL() {
+ return false;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq/blob/829a186f/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTSSLTest.java
----------------------------------------------------------------------
diff --git a/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTSSLTest.java b/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTSSLTest.java
new file mode 100644
index 0000000..609c49d
--- /dev/null
+++ b/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTSSLTest.java
@@ -0,0 +1,33 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.transport.mqtt;
+
+/**
+ * Run the basic tests with the NIO Transport.
+ */
+public class MQTTSSLTest extends MQTTTest {
+
+ @Override
+ public String getProtocolScheme() {
+ return "mqtt+ssl";
+ }
+
+ @Override
+ public boolean isUseSSL() {
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq/blob/829a186f/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTTest.java
----------------------------------------------------------------------
diff --git a/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTTest.java b/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTTest.java
index 3fe3409..e332c48 100644
--- a/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTTest.java
+++ b/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTTest.java
@@ -27,7 +27,6 @@ import static org.junit.Assert.fail;
import java.net.ProtocolException;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Random;
@@ -64,29 +63,15 @@ import org.fusesource.mqtt.client.Tracer;
import org.fusesource.mqtt.codec.MQTTFrame;
import org.fusesource.mqtt.codec.PUBLISH;
import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-@RunWith(Parameterized.class)
public class MQTTTest extends MQTTTestSupport {
private static final Logger LOG = LoggerFactory.getLogger(MQTTTest.class);
private static final int NUM_MESSAGES = 250;
- @Parameters(name= "{index}: scheme({0})")
- public static Collection<Object[]> data() {
- return Arrays.asList(new Object[][] {
- {"mqtt", false},
- {"mqtt+ssl", true},
- {"mqtt+nio", false}
- // TODO - Fails {"mqtt+nio+ssl", true}
- });
- }
-
@Test(timeout = 60 * 1000)
public void testSendAndReceiveMQTT() throws Exception {
final MQTTClientProvider subscriptionProvider = getMQTTClientProvider();
http://git-wip-us.apache.org/repos/asf/activemq/blob/829a186f/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTTestSupport.java
----------------------------------------------------------------------
diff --git a/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTTestSupport.java b/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTTestSupport.java
index d244861..470e273 100644
--- a/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTTestSupport.java
+++ b/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTTestSupport.java
@@ -51,7 +51,6 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.rules.TestName;
-import org.junit.runners.Parameterized.Parameter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -66,12 +65,8 @@ public class MQTTTestSupport {
protected LinkedList<Throwable> exceptions = new LinkedList<Throwable>();
protected boolean persistent;
protected String protocolConfig;
-
- @Parameter(0)
- public String protocolScheme;
-
- @Parameter(1)
- public boolean useSSL;
+ protected String protocolScheme;
+ protected boolean useSSL;
public static final int AT_MOST_ONCE = 0;
public static final int AT_LEAST_ONCE = 1;
@@ -89,9 +84,9 @@ public class MQTTTestSupport {
this.useSSL = false;
}
- public MQTTTestSupport(String connectorScheme, boolean useSsl) {
+ public MQTTTestSupport(String connectorScheme, boolean useSSL) {
this.protocolScheme = connectorScheme;
- this.useSSL = useSsl;
+ this.useSSL = useSSL;
}
public String getName() {
http://git-wip-us.apache.org/repos/asf/activemq/blob/829a186f/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/PahoMQTTNIOTest.java
----------------------------------------------------------------------
diff --git a/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/PahoMQTTNIOTest.java b/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/PahoMQTTNIOTest.java
new file mode 100644
index 0000000..88c8780
--- /dev/null
+++ b/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/PahoMQTTNIOTest.java
@@ -0,0 +1,33 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.transport.mqtt;
+
+/**
+ * Test the NIO transport with this Test group
+ */
+public class PahoMQTTNIOTest extends PahoMQTTTest {
+
+ @Override
+ public String getProtocolScheme() {
+ return "mqtt+nio";
+ }
+
+ @Override
+ public boolean isUseSSL() {
+ return false;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq/blob/829a186f/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/PahoMQTTTest.java
----------------------------------------------------------------------
diff --git a/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/PahoMQTTTest.java b/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/PahoMQTTTest.java
index 17305be..498ea6d 100644
--- a/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/PahoMQTTTest.java
+++ b/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/PahoMQTTTest.java
@@ -20,8 +20,6 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
-import java.util.Arrays;
-import java.util.Collection;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
@@ -36,25 +34,13 @@ import org.apache.activemq.ActiveMQConnection;
import org.eclipse.paho.client.mqttv3.MqttClient;
import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-@RunWith(Parameterized.class)
public class PahoMQTTTest extends MQTTTestSupport {
private static final Logger LOG = LoggerFactory.getLogger(PahoMQTTTest.class);
- @Parameters(name= "{index}: scheme({0})")
- public static Collection<Object[]> data() {
- return Arrays.asList(new Object[][] {
- {"mqtt", false},
- {"mqtt+nio", false}
- });
- }
-
@Test(timeout = 300000)
public void testLotsOfClients() throws Exception {