You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ma...@apache.org on 2016/09/30 15:26:14 UTC
[14/52] [partial] activemq-artemis git commit: ARTEMIS-765 Improve
Checkstyle
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ConsumerReceiveWithTimeoutTest.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ConsumerReceiveWithTimeoutTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ConsumerReceiveWithTimeoutTest.java
index 03ed8df..8a6df60 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ConsumerReceiveWithTimeoutTest.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ConsumerReceiveWithTimeoutTest.java
@@ -6,7 +6,7 @@
* (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
+ * 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,
@@ -71,8 +71,7 @@ public class ConsumerReceiveWithTimeoutTest extends TestSupport {
Thread.sleep(10000);
MessageProducer producer = session.createProducer(queue);
producer.send(session.createTextMessage("Hello"));
- }
- catch (Exception e) {
+ } catch (Exception e) {
e.printStackTrace();
}
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/CreateConsumerButDontStartConnectionWarningTest.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/CreateConsumerButDontStartConnectionWarningTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/CreateConsumerButDontStartConnectionWarningTest.java
index 185fc48..18998e6 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/CreateConsumerButDontStartConnectionWarningTest.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/CreateConsumerButDontStartConnectionWarningTest.java
@@ -6,7 +6,7 @@
* (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
+ * 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,
@@ -37,8 +37,7 @@ public class CreateConsumerButDontStartConnectionWarningTest extends JmsQueueSen
protected void assertMessagesAreReceived() throws JMSException {
try {
Thread.sleep(1000);
- }
- catch (InterruptedException e) {
+ } catch (InterruptedException e) {
LOG.warn("Caught: " + e, e);
}
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/EmbeddedBrokerAndConnectionTestSupport.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/EmbeddedBrokerAndConnectionTestSupport.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/EmbeddedBrokerAndConnectionTestSupport.java
index 1a3dab7..5c45e40 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/EmbeddedBrokerAndConnectionTestSupport.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/EmbeddedBrokerAndConnectionTestSupport.java
@@ -6,7 +6,7 @@
* (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
+ * 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,
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/EmbeddedBrokerTestSupport.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/EmbeddedBrokerTestSupport.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/EmbeddedBrokerTestSupport.java
index 9096c06..02d6fd6 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/EmbeddedBrokerTestSupport.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/EmbeddedBrokerTestSupport.java
@@ -6,7 +6,7 @@
* (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
+ * 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,
@@ -16,6 +16,11 @@
*/
package org.apache.activemq;
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.Destination;
+import java.io.File;
+
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.config.impl.ConfigurationImpl;
import org.apache.activemq.artemis.core.server.JournalType;
@@ -29,11 +34,6 @@ import org.apache.activemq.command.ActiveMQTopic;
import org.junit.rules.TemporaryFolder;
import org.springframework.jms.core.JmsTemplate;
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.Destination;
-import java.io.File;
-
/**
* A useful base class which creates and closes an embedded broker
*/
@@ -81,8 +81,7 @@ public abstract class EmbeddedBrokerTestSupport extends CombinationTestSupport {
try {
artemisBroker.stop();
artemisBroker = null;
- }
- catch (Exception e) {
+ } catch (Exception e) {
}
}
temporaryFolder.delete();
@@ -141,8 +140,7 @@ public abstract class EmbeddedBrokerTestSupport extends CombinationTestSupport {
protected ActiveMQDestination createDestination(String subject) {
if (useTopic) {
return new ActiveMQTopic(subject);
- }
- else {
+ } else {
return new ActiveMQQueue(subject);
}
}
@@ -163,7 +161,6 @@ public abstract class EmbeddedBrokerTestSupport extends CombinationTestSupport {
return new ActiveMQConnectionFactory(bindAddress);
}
-
public EmbeddedJMS createArtemisBroker() throws Exception {
Configuration config0 = createConfig("localhost", 0);
EmbeddedJMS newbroker = new EmbeddedJMS().setConfiguration(config0).setJmsConfiguration(new JMSConfigurationImpl());
@@ -172,14 +169,14 @@ public abstract class EmbeddedBrokerTestSupport extends CombinationTestSupport {
protected Configuration createConfig(final String hostAddress, final int serverID) throws Exception {
ConfigurationImpl configuration = new ConfigurationImpl().setJMXManagementEnabled(false).
- setSecurityEnabled(false).setJournalMinFiles(2).setJournalFileSize(1000 * 1024).setJournalType(JournalType.NIO).
- setJournalDirectory(getJournalDir(serverID, false)).
- setBindingsDirectory(getBindingsDir(serverID, false)).
- setPagingDirectory(getPageDir(serverID, false)).
- setLargeMessagesDirectory(getLargeMessagesDir(serverID, false)).
- setJournalCompactMinFiles(0).
- setJournalCompactPercentage(0).
- setClusterPassword(CLUSTER_PASSWORD);
+ setSecurityEnabled(false).setJournalMinFiles(2).setJournalFileSize(1000 * 1024).setJournalType(JournalType.NIO).
+ setJournalDirectory(getJournalDir(serverID, false)).
+ setBindingsDirectory(getBindingsDir(serverID, false)).
+ setPagingDirectory(getPageDir(serverID, false)).
+ setLargeMessagesDirectory(getLargeMessagesDir(serverID, false)).
+ setJournalCompactMinFiles(0).
+ setJournalCompactPercentage(0).
+ setClusterPassword(CLUSTER_PASSWORD);
configuration.addAddressesSetting("#", new AddressSettings().setAutoCreateJmsQueues(true).setAutoDeleteJmsQueues(true));
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ExclusiveConsumerStartupDestinationTest.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ExclusiveConsumerStartupDestinationTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ExclusiveConsumerStartupDestinationTest.java
index 1e0555c..db8eb5f 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ExclusiveConsumerStartupDestinationTest.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ExclusiveConsumerStartupDestinationTest.java
@@ -6,7 +6,7 @@
* (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
+ * 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,
@@ -90,8 +90,7 @@ public class ExclusiveConsumerStartupDestinationTest extends EmbeddedBrokerTestS
// Verify exclusive consumer receives the message.
assertNotNull(exclusiveConsumer.receive(100));
assertNull(fallbackConsumer.receive(100));
- }
- finally {
+ } finally {
fallbackSession.close();
senderSession.close();
conn.close();
@@ -146,8 +145,7 @@ public class ExclusiveConsumerStartupDestinationTest extends EmbeddedBrokerTestS
assertNotNull("Should have received a message", exclusiveConsumer2.receive(100));
assertNull("Should not have received a message", fallbackConsumer.receive(100));
- }
- finally {
+ } finally {
fallbackSession.close();
senderSession.close();
conn.close();
@@ -196,8 +194,7 @@ public class ExclusiveConsumerStartupDestinationTest extends EmbeddedBrokerTestS
assertNotNull(fallbackConsumer.receive(100));
- }
- finally {
+ } finally {
fallbackSession.close();
senderSession.close();
conn.close();
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ExclusiveConsumerTest.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ExclusiveConsumerTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ExclusiveConsumerTest.java
index 4142f93..409451b 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ExclusiveConsumerTest.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ExclusiveConsumerTest.java
@@ -6,7 +6,7 @@
* (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
+ * 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,
@@ -90,8 +90,7 @@ public class ExclusiveConsumerTest extends TestCase {
assertNotNull(exclusiveConsumer.receive(100));
assertNull(fallbackConsumer.receive(100));
- }
- finally {
+ } finally {
fallbackSession.close();
senderSession.close();
conn.close();
@@ -130,8 +129,7 @@ public class ExclusiveConsumerTest extends TestCase {
assertNotNull(exclusiveConsumer.receive(100));
assertNull(fallbackConsumer.receive(100));
- }
- finally {
+ } finally {
fallbackSession.close();
senderSession.close();
conn.close();
@@ -186,8 +184,7 @@ public class ExclusiveConsumerTest extends TestCase {
assertNotNull(exclusiveConsumer2.receive(100));
assertNull(fallbackConsumer.receive(100));
- }
- finally {
+ } finally {
fallbackSession.close();
senderSession.close();
conn.close();
@@ -243,8 +240,7 @@ public class ExclusiveConsumerTest extends TestCase {
assertNotNull(exclusiveConsumer2.receive(1000));
assertNull(fallbackConsumer.receive(100));
- }
- finally {
+ } finally {
fallbackSession.close();
senderSession.close();
conn.close();
@@ -293,8 +289,7 @@ public class ExclusiveConsumerTest extends TestCase {
assertNotNull(fallbackConsumer.receive(100));
- }
- finally {
+ } finally {
fallbackSession.close();
senderSession.close();
conn.close();
@@ -352,8 +347,7 @@ public class ExclusiveConsumerTest extends TestCase {
assertNotNull(exclusiveConsumer.receive(100));
assertNull(fallbackConsumer.receive(100));
- }
- finally {
+ } finally {
fallbackSession.close();
senderSession.close();
conn.close();
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ExpiryHogTest.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ExpiryHogTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ExpiryHogTest.java
index c3aac48..cc67e80 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ExpiryHogTest.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ExpiryHogTest.java
@@ -6,7 +6,7 @@
* (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
+ * 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,
@@ -16,10 +16,10 @@
*/
package org.apache.activemq;
-import java.util.concurrent.TimeUnit;
import javax.jms.ConnectionFactory;
import javax.jms.Session;
import javax.jms.TextMessage;
+import java.util.concurrent.TimeUnit;
import org.apache.activemq.broker.BrokerService;
import org.apache.activemq.broker.region.policy.PolicyEntry;
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JMSConsumerTest.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JMSConsumerTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JMSConsumerTest.java
index 6274890..f62052c 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JMSConsumerTest.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JMSConsumerTest.java
@@ -6,7 +6,7 @@
* (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
+ * 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,
@@ -16,16 +16,6 @@
*/
package org.apache.activemq;
-import java.lang.Thread.UncaughtExceptionHandler;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicInteger;
-
import javax.jms.BytesMessage;
import javax.jms.DeliveryMode;
import javax.jms.Message;
@@ -38,6 +28,15 @@ import javax.jms.Topic;
import javax.management.MBeanServer;
import javax.management.MBeanServerInvocationHandler;
import javax.management.ObjectName;
+import java.lang.Thread.UncaughtExceptionHandler;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
import junit.framework.Test;
@@ -168,8 +167,7 @@ public class JMSConsumerTest extends JmsTestSupport {
// ack every 200
message.acknowledge();
}
- }
- catch (Exception e) {
+ } catch (Exception e) {
LOG.error("Exception on close or ack:", e);
exceptions.put(Thread.currentThread(), e);
}
@@ -403,8 +401,7 @@ public class JMSConsumerTest extends JmsTestSupport {
got2Done.countDown();
}
tm.acknowledge();
- }
- catch (Throwable e) {
+ } catch (Throwable e) {
e.printStackTrace();
}
}
@@ -440,8 +437,7 @@ public class JMSConsumerTest extends JmsTestSupport {
if (counter.get() == 4) {
done2.countDown();
}
- }
- catch (Throwable e) {
+ } catch (Throwable e) {
LOG.error("unexpected ex onMessage: ", e);
}
}
@@ -493,8 +489,7 @@ public class JMSConsumerTest extends JmsTestSupport {
connection.close();
got2Done.countDown();
}
- }
- catch (Throwable e) {
+ } catch (Throwable e) {
e.printStackTrace();
}
}
@@ -528,8 +523,7 @@ public class JMSConsumerTest extends JmsTestSupport {
if (counter.get() == 4) {
done2.countDown();
}
- }
- catch (Throwable e) {
+ } catch (Throwable e) {
LOG.error("unexpected ex onMessage: ", e);
}
}
@@ -928,8 +922,7 @@ public class JMSConsumerTest extends JmsTestSupport {
String destName = destination.getPhysicalName();
if (destination.isQueue()) {
return createJMSQueueControl(destName);
- }
- else {
+ } else {
return createJMSTopicControl(destName);
}
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JMSDurableTopicRedeliverTest.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JMSDurableTopicRedeliverTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JMSDurableTopicRedeliverTest.java
index 5baee6c..0b5dc1c 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JMSDurableTopicRedeliverTest.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JMSDurableTopicRedeliverTest.java
@@ -6,7 +6,7 @@
* (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
+ * 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,
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JMSExclusiveConsumerTest.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JMSExclusiveConsumerTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JMSExclusiveConsumerTest.java
index 38dabfd..88345b5 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JMSExclusiveConsumerTest.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JMSExclusiveConsumerTest.java
@@ -6,7 +6,7 @@
* (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
+ * 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,
@@ -113,8 +113,7 @@ public class JMSExclusiveConsumerTest extends JmsTestSupport {
m = consumer2.receive(1000);
assertNotNull(m);
}
- }
- else {
+ } else {
// Consumer 1 should get all the messages.
for (int i = 0; i < 3; i++) {
m = consumer1.receive(1000);
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JMSIndividualAckTest.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JMSIndividualAckTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JMSIndividualAckTest.java
index 3416251..8c12f52 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JMSIndividualAckTest.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JMSIndividualAckTest.java
@@ -6,7 +6,7 @@
* (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
+ * 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,
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JMSMessageTest.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JMSMessageTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JMSMessageTest.java
index e38f92f..83fe513 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JMSMessageTest.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JMSMessageTest.java
@@ -6,7 +6,7 @@
* (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
+ * 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,
@@ -16,11 +16,6 @@
*/
package org.apache.activemq;
-import java.net.URISyntaxException;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Vector;
-
import javax.jms.BytesMessage;
import javax.jms.ConnectionFactory;
import javax.jms.DeliveryMode;
@@ -34,6 +29,10 @@ import javax.jms.ObjectMessage;
import javax.jms.Session;
import javax.jms.StreamMessage;
import javax.jms.TextMessage;
+import java.net.URISyntaxException;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Vector;
import junit.framework.Test;
@@ -180,8 +179,7 @@ public class JMSMessageTest extends JmsTestSupport {
try {
message.readByte();
fail("Expected exception not thrown.");
- }
- catch (MessageEOFException e) {
+ } catch (MessageEOFException e) {
}
}
@@ -214,8 +212,7 @@ public class JMSMessageTest extends JmsTestSupport {
try {
message.readByte();
fail("Should have received NumberFormatException");
- }
- catch (NumberFormatException e) {
+ } catch (NumberFormatException e) {
}
assertEquals("This is a test to see how it works.", message.readString());
@@ -225,8 +222,7 @@ public class JMSMessageTest extends JmsTestSupport {
try {
message.readByte();
fail("Should have received MessageEOFException");
- }
- catch (MessageEOFException e) {
+ } catch (MessageEOFException e) {
}
}
assertNull(consumer.receiveNoWait());
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JMSQueueRedeliverTest.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JMSQueueRedeliverTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JMSQueueRedeliverTest.java
index f924621..ed42f21 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JMSQueueRedeliverTest.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JMSQueueRedeliverTest.java
@@ -6,7 +6,7 @@
* (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
+ * 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,
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JMSUsecaseTest.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JMSUsecaseTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JMSUsecaseTest.java
index 534e190..a1a20db 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JMSUsecaseTest.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JMSUsecaseTest.java
@@ -6,7 +6,7 @@
* (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
+ * 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,
@@ -16,8 +16,6 @@
*/
package org.apache.activemq;
-import java.util.Enumeration;
-
import javax.jms.DeliveryMode;
import javax.jms.Message;
import javax.jms.MessageConsumer;
@@ -26,6 +24,7 @@ import javax.jms.Queue;
import javax.jms.QueueBrowser;
import javax.jms.Session;
import javax.jms.TextMessage;
+import java.util.Enumeration;
import junit.framework.Test;
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JMSXAConsumerTest.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JMSXAConsumerTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JMSXAConsumerTest.java
index fa6877d..a7c2cd6 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JMSXAConsumerTest.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JMSXAConsumerTest.java
@@ -6,7 +6,7 @@
* (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
+ * 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,
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsAutoAckListenerTest.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsAutoAckListenerTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsAutoAckListenerTest.java
index 0b5ea63..42e2c9f 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsAutoAckListenerTest.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsAutoAckListenerTest.java
@@ -6,7 +6,7 @@
* (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
+ * 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,
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsAutoAckTest.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsAutoAckTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsAutoAckTest.java
index c2b00e9..4537dde 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsAutoAckTest.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsAutoAckTest.java
@@ -6,7 +6,7 @@
* (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
+ * 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,
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsBenchmark.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsBenchmark.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsBenchmark.java
index be59cd1..9d90b8b 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsBenchmark.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsBenchmark.java
@@ -6,7 +6,7 @@
* (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
+ * 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,
@@ -16,15 +16,6 @@
*/
package org.apache.activemq;
-import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.concurrent.Callable;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.Semaphore;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicInteger;
-
import javax.jms.BytesMessage;
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
@@ -35,6 +26,14 @@ import javax.jms.MessageConsumer;
import javax.jms.MessageListener;
import javax.jms.MessageProducer;
import javax.jms.Session;
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.concurrent.Callable;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.Semaphore;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
import junit.framework.Test;
@@ -153,8 +152,7 @@ public class JmsBenchmark extends JmsTestSupport {
public void run() {
try {
producer.call();
- }
- catch (Throwable e) {
+ } catch (Throwable e) {
e.printStackTrace();
workerError[0] = e;
}
@@ -168,8 +166,7 @@ public class JmsBenchmark extends JmsTestSupport {
public void run() {
try {
consumer.call();
- }
- catch (Throwable e) {
+ } catch (Throwable e) {
e.printStackTrace();
workerError[0] = e;
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsClientAckListenerTest.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsClientAckListenerTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsClientAckListenerTest.java
index a707a96..b0f42f6 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsClientAckListenerTest.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsClientAckListenerTest.java
@@ -6,7 +6,7 @@
* (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
+ * 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,
@@ -123,8 +123,7 @@ public class JmsClientAckListenerTest extends TestSupport implements MessageList
if (!dontAck) {
try {
message.acknowledge();
- }
- catch (Exception e) {
+ } catch (Exception e) {
e.printStackTrace();
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsClientAckTest.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsClientAckTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsClientAckTest.java
index 4a86d9c..79a5abc 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsClientAckTest.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsClientAckTest.java
@@ -6,7 +6,7 @@
* (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
+ * 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,
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsConnectionStartStopTest.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsConnectionStartStopTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsConnectionStartStopTest.java
index e599071..5c3c326 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsConnectionStartStopTest.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsConnectionStartStopTest.java
@@ -6,7 +6,7 @@
* (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
+ * 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,
@@ -16,12 +16,6 @@
*/
package org.apache.activemq;
-import java.util.Random;
-import java.util.Vector;
-import java.util.concurrent.SynchronousQueue;
-import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
-
import javax.jms.Connection;
import javax.jms.JMSException;
import javax.jms.Message;
@@ -30,6 +24,11 @@ import javax.jms.MessageProducer;
import javax.jms.Session;
import javax.jms.TextMessage;
import javax.jms.Topic;
+import java.util.Random;
+import java.util.Vector;
+import java.util.concurrent.SynchronousQueue;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
/**
*
@@ -123,8 +122,7 @@ public class JmsConnectionStartStopTest extends TestSupport {
try {
TimeUnit.MILLISECONDS.sleep(rand.nextInt(10));
stoppedConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
- }
- catch (Exception e) {
+ } catch (Exception e) {
exceptions.add(e);
}
}
@@ -137,8 +135,7 @@ public class JmsConnectionStartStopTest extends TestSupport {
TimeUnit.MILLISECONDS.sleep(rand.nextInt(10));
stoppedConnection.start();
stoppedConnection.stop();
- }
- catch (Exception e) {
+ } catch (Exception e) {
exceptions.add(e);
}
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsConsumerResetActiveListenerTest.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsConsumerResetActiveListenerTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsConsumerResetActiveListenerTest.java
index 1361b79..194b09f 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsConsumerResetActiveListenerTest.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsConsumerResetActiveListenerTest.java
@@ -6,7 +6,7 @@
* (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
+ * 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,
@@ -16,11 +16,6 @@
*/
package org.apache.activemq;
-import java.util.Vector;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicBoolean;
-
import javax.jms.Connection;
import javax.jms.DeliveryMode;
import javax.jms.Destination;
@@ -31,6 +26,10 @@ import javax.jms.MessageListener;
import javax.jms.MessageProducer;
import javax.jms.Session;
import javax.jms.TextMessage;
+import java.util.Vector;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
import junit.framework.TestCase;
@@ -74,12 +73,10 @@ public class JmsConsumerResetActiveListenerTest extends TestCase {
try {
consumer.setMessageListener(this);
results.add(message);
- }
- catch (JMSException e) {
+ } catch (JMSException e) {
results.add(e);
}
- }
- else {
+ } else {
results.add(message);
}
latch.countDown();
@@ -126,12 +123,10 @@ public class JmsConsumerResetActiveListenerTest extends TestCase {
MessageConsumer anotherConsumer = session.createConsumer(dest);
anotherConsumer.setMessageListener(this);
results.add(message);
- }
- catch (JMSException e) {
+ } catch (JMSException e) {
results.add(e);
}
- }
- else {
+ } else {
results.add(message);
}
latch.countDown();
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsCreateConsumerInOnMessageTest.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsCreateConsumerInOnMessageTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsCreateConsumerInOnMessageTest.java
index f487937..707063d 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsCreateConsumerInOnMessageTest.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsCreateConsumerInOnMessageTest.java
@@ -6,7 +6,7 @@
* (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
+ * 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,
@@ -94,8 +94,7 @@ public class JmsCreateConsumerInOnMessageTest extends TestSupport implements Mes
synchronized (lock) {
lock.notify();
}
- }
- catch (Exception ex) {
+ } catch (Exception ex) {
ex.printStackTrace();
assertTrue(false);
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsDurableQueueWildcardSendReceiveTest.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsDurableQueueWildcardSendReceiveTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsDurableQueueWildcardSendReceiveTest.java
index 309fec9..7fd4a94 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsDurableQueueWildcardSendReceiveTest.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsDurableQueueWildcardSendReceiveTest.java
@@ -6,7 +6,7 @@
* (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
+ * 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,
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsDurableTopicSelectorTest.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsDurableTopicSelectorTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsDurableTopicSelectorTest.java
index 7db52ae..871fd02 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsDurableTopicSelectorTest.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsDurableTopicSelectorTest.java
@@ -6,7 +6,7 @@
* (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
+ * 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,
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsDurableTopicSendReceiveTest.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsDurableTopicSendReceiveTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsDurableTopicSendReceiveTest.java
index 978f31c..f54e1f5 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsDurableTopicSendReceiveTest.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsDurableTopicSendReceiveTest.java
@@ -6,7 +6,7 @@
* (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
+ * 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,
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsDurableTopicTransactionTest.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsDurableTopicTransactionTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsDurableTopicTransactionTest.java
index d827778..065e9de 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsDurableTopicTransactionTest.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsDurableTopicTransactionTest.java
@@ -6,7 +6,7 @@
* (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
+ * 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,
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsDurableTopicWildcardSendReceiveTest.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsDurableTopicWildcardSendReceiveTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsDurableTopicWildcardSendReceiveTest.java
index b913726..89c64e1 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsDurableTopicWildcardSendReceiveTest.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsDurableTopicWildcardSendReceiveTest.java
@@ -6,7 +6,7 @@
* (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
+ * 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,
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsMessageConsumerTest.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsMessageConsumerTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsMessageConsumerTest.java
index e74c13a..6e2c814 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsMessageConsumerTest.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsMessageConsumerTest.java
@@ -6,7 +6,7 @@
* (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
+ * 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,
@@ -16,14 +16,6 @@
*/
package org.apache.activemq;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
import javax.jms.Connection;
import javax.jms.Destination;
import javax.jms.Message;
@@ -31,6 +23,8 @@ import javax.jms.MessageConsumer;
import javax.jms.MessageListener;
import javax.jms.MessageProducer;
import javax.jms.Session;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
import org.apache.activemq.broker.BrokerService;
import org.junit.After;
@@ -39,6 +33,11 @@ import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
public class JmsMessageConsumerTest {
private BrokerService brokerService;
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsMultipleBrokersTestSupport.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsMultipleBrokersTestSupport.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsMultipleBrokersTestSupport.java
index a826b0a..665782f 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsMultipleBrokersTestSupport.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsMultipleBrokersTestSupport.java
@@ -6,7 +6,7 @@
* (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
+ * 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,
@@ -16,6 +16,18 @@
*/
package org.apache.activemq;
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.DeliveryMode;
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.QueueBrowser;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.jms.Topic;
import java.net.URI;
import java.util.ArrayList;
import java.util.Arrays;
@@ -30,19 +42,6 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicInteger;
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.DeliveryMode;
-import javax.jms.Destination;
-import javax.jms.JMSException;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Queue;
-import javax.jms.QueueBrowser;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import javax.jms.Topic;
-
import org.apache.activemq.advisory.ConsumerEvent;
import org.apache.activemq.advisory.ConsumerEventSource;
import org.apache.activemq.advisory.ConsumerListener;
@@ -133,8 +132,7 @@ public class JmsMultipleBrokersTestSupport extends CombinationTestSupport {
localBroker.addNetworkConnector(connector);
maxSetupTime = 2000;
return connector;
- }
- else {
+ } else {
throw new Exception("Remote broker has no registered connectors.");
}
@@ -433,8 +431,7 @@ public class JmsMultipleBrokersTestSupport extends CombinationTestSupport {
latch.await(timeout, TimeUnit.MILLISECONDS);
assertTrue("Expected at least " + count + " consumers to connect, but only " + actualConnected.get() + " connectect within " + timeout + " ms", actualConnected.get() >= count);
- }
- finally {
+ } finally {
ces.stop();
conn.close();
brokerItem.connections.remove(conn);
@@ -489,8 +486,7 @@ public class JmsMultipleBrokersTestSupport extends CombinationTestSupport {
msg.setText(initText + str);
// Do not pad message text
- }
- else {
+ } else {
msg.setText(initText);
}
@@ -503,8 +499,7 @@ public class JmsMultipleBrokersTestSupport extends CombinationTestSupport {
dest = new ActiveMQTopic(name);
destinations.put(name, dest);
return (ActiveMQDestination) dest;
- }
- else {
+ } else {
dest = new ActiveMQQueue(name);
destinations.put(name, dest);
return (ActiveMQDestination) dest;
@@ -654,10 +649,8 @@ public class JmsMultipleBrokersTestSupport extends CombinationTestSupport {
Connection c = connections.remove(0);
try {
c.close();
- }
- catch (ConnectionClosedException e) {
- }
- catch (JMSException e) {
+ } catch (ConnectionClosedException e) {
+ } catch (JMSException e) {
}
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsMultipleClientsTestSupport.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsMultipleClientsTestSupport.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsMultipleClientsTestSupport.java
index 5ee575e..288514d 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsMultipleClientsTestSupport.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsMultipleClientsTestSupport.java
@@ -6,7 +6,7 @@
* (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
+ * 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,
@@ -16,16 +16,6 @@
*/
package org.apache.activemq;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.atomic.AtomicInteger;
-
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.DeliveryMode;
@@ -36,6 +26,15 @@ import javax.jms.MessageProducer;
import javax.jms.Session;
import javax.jms.TextMessage;
import javax.jms.TopicSubscriber;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicInteger;
import org.apache.activemq.broker.BrokerFactory;
import org.apache.activemq.broker.BrokerService;
@@ -50,7 +49,7 @@ import org.junit.rules.TestName;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
/**
* Test case support used to test multiple message comsumers and message
@@ -98,8 +97,7 @@ public class JmsMultipleClientsTestSupport {
public void run() {
try {
sendMessages(factory.createConnection(), dest, msgCount);
- }
- catch (Exception e) {
+ } catch (Exception e) {
e.printStackTrace();
}
@@ -121,8 +119,7 @@ public class JmsMultipleClientsTestSupport {
}
// Use serialized send
- }
- else {
+ } else {
for (int i = 0; i < producerCount; i++) {
sendMessages(factory.createConnection(), dest, msgCount);
}
@@ -158,8 +155,7 @@ public class JmsMultipleClientsTestSupport {
msg.setText(initText + str);
// Do not pad message text
- }
- else {
+ } else {
msg.setText(initText);
}
@@ -175,8 +171,7 @@ public class JmsMultipleClientsTestSupport {
for (int i = 0; i < consumerCount; i++) {
if (durable && topic) {
consumer = createDurableSubscriber(factory.createConnection(), dest, "consumer" + (i + 1));
- }
- else {
+ } else {
consumer = createMessageConsumer(factory.createConnection(), dest);
}
MessageIdList list = new MessageIdList();
@@ -219,8 +214,7 @@ public class JmsMultipleClientsTestSupport {
if (topic) {
destination = new ActiveMQTopic("Topic" + name);
return (ActiveMQDestination) destination;
- }
- else {
+ } else {
destination = new ActiveMQQueue("Queue" + name);
return (ActiveMQDestination) destination;
}
@@ -246,8 +240,7 @@ public class JmsMultipleClientsTestSupport {
Connection conn = iter.next();
try {
conn.close();
- }
- catch (Throwable e) {
+ } catch (Throwable e) {
}
}
if (broker != null) { // FIXME remove
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueBrowserTest.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueBrowserTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueBrowserTest.java
index 6a3cd19..4d5d921 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueBrowserTest.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueBrowserTest.java
@@ -6,7 +6,7 @@
* (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
+ * 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,
@@ -16,10 +16,6 @@
*/
package org.apache.activemq;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.List;
-
import javax.jms.Message;
import javax.jms.MessageConsumer;
import javax.jms.MessageProducer;
@@ -29,6 +25,9 @@ import javax.jms.TextMessage;
import javax.management.ObjectName;
import javax.management.openmbean.CompositeData;
import javax.management.openmbean.TabularData;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.List;
import junit.framework.Test;
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueCompositeSendReceiveTest.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueCompositeSendReceiveTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueCompositeSendReceiveTest.java
index 1910321..03f9675 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueCompositeSendReceiveTest.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueCompositeSendReceiveTest.java
@@ -6,7 +6,7 @@
* (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
+ * 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,
@@ -86,8 +86,7 @@ public class JmsQueueCompositeSendReceiveTest extends JmsTopicSendReceiveTest {
if (durable) {
LOG.info("Creating durable consumer");
consumer = consumeSession.createDurableSubscriber((Topic) consumerDestination, getName());
- }
- else {
+ } else {
consumer = consumeSession.createConsumer(consumerDestination);
}
consumer.setMessageListener(this);
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueRequestReplyTest.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueRequestReplyTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueRequestReplyTest.java
index 839a9b4..f379426 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueRequestReplyTest.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueRequestReplyTest.java
@@ -6,7 +6,7 @@
* (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
+ * 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,
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueSelectorTest.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueSelectorTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueSelectorTest.java
index ff2d521..2a4c0b4 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueSelectorTest.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueSelectorTest.java
@@ -6,7 +6,7 @@
* (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
+ * 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,
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueSendReceiveTest.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueSendReceiveTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueSendReceiveTest.java
index f007190..d88df8a 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueSendReceiveTest.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueSendReceiveTest.java
@@ -6,7 +6,7 @@
* (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
+ * 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,
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueSendReceiveTwoConnectionsStartBeforeBrokerTest.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueSendReceiveTwoConnectionsStartBeforeBrokerTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueSendReceiveTwoConnectionsStartBeforeBrokerTest.java
index b60c091..c15dd1f 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueSendReceiveTwoConnectionsStartBeforeBrokerTest.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueSendReceiveTwoConnectionsStartBeforeBrokerTest.java
@@ -6,7 +6,7 @@
* (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
+ * 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,
@@ -39,8 +39,7 @@ public class JmsQueueSendReceiveTwoConnectionsStartBeforeBrokerTest extends JmsQ
LOG.info("Lets wait: " + delayBeforeStartingBroker + " millis before creating the broker");
try {
Thread.sleep(delayBeforeStartingBroker);
- }
- catch (InterruptedException e) {
+ } catch (InterruptedException e) {
e.printStackTrace();
}
@@ -50,8 +49,7 @@ public class JmsQueueSendReceiveTwoConnectionsStartBeforeBrokerTest extends JmsQ
broker.setPersistent(false);
broker.addConnector("tcp://localhost:61616");
broker.start();
- }
- catch (Exception e) {
+ } catch (Exception e) {
LOG.info("Caught: " + e);
errors.add(e);
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueSendReceiveTwoConnectionsTest.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueSendReceiveTwoConnectionsTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueSendReceiveTwoConnectionsTest.java
index 01eda1d..4f020a0 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueSendReceiveTwoConnectionsTest.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueSendReceiveTwoConnectionsTest.java
@@ -6,7 +6,7 @@
* (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
+ * 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,
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueSendReceiveUsingTwoSessionsTest.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueSendReceiveUsingTwoSessionsTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueSendReceiveUsingTwoSessionsTest.java
index e5f0738..272536b 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueSendReceiveUsingTwoSessionsTest.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueSendReceiveUsingTwoSessionsTest.java
@@ -6,7 +6,7 @@
* (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
+ * 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,
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueTopicCompositeSendReceiveTest.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueTopicCompositeSendReceiveTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueTopicCompositeSendReceiveTest.java
index 28173b8..6343792 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueTopicCompositeSendReceiveTest.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueTopicCompositeSendReceiveTest.java
@@ -6,7 +6,7 @@
* (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
+ * 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,
@@ -47,8 +47,7 @@ public class JmsQueueTopicCompositeSendReceiveTest extends JmsTopicSendReceiveTe
if (durable) {
LOG.info("Creating durable consumer");
consumer2 = consumeSession.createDurableSubscriber((Topic) consumerDestination2, getName());
- }
- else {
+ } else {
consumer2 = consumeSession.createConsumer(consumerDestination2);
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueTransactionTest.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueTransactionTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueTransactionTest.java
index e464b7c..f91c67a 100755
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueTransactionTest.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueTransactionTest.java
@@ -6,7 +6,7 @@
* (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
+ * 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,
@@ -35,201 +35,202 @@ import org.slf4j.LoggerFactory;
*
*/
public class JmsQueueTransactionTest extends JmsTransactionTestSupport {
- private static final Logger LOG = LoggerFactory.getLogger(JmsQueueTransactionTest.class);
-
- /**
- * @see org.apache.activemq.JmsTransactionTestSupport#getJmsResourceProvider()
- */
- @Override
- protected JmsResourceProvider getJmsResourceProvider() {
- JmsResourceProvider p = new JmsResourceProvider();
- p.setTopic(false);
- return p;
- }
-
- /**
- * Tests if the the connection gets reset, the messages will still be
- * received.
- *
- * @throws Exception
- */
- public void testReceiveTwoThenCloseConnection() throws Exception {
- Message[] outbound = new Message[] {session.createTextMessage("First Message"), session.createTextMessage("Second Message")};
-
- // lets consume any outstanding messages from previous test runs
- beginTx();
- while (consumer.receive(1000) != null) {
- }
- commitTx();
-
- beginTx();
- producer.send(outbound[0]);
- producer.send(outbound[1]);
- commitTx();
-
- LOG.info("Sent 0: " + outbound[0]);
- LOG.info("Sent 1: " + outbound[1]);
-
- ArrayList<Message> messages = new ArrayList<>();
- beginTx();
- Message message = consumer.receive(2000);
- assertEquals(outbound[0], message);
-
- message = consumer.receive(2000);
- assertNotNull(message);
- assertEquals(outbound[1], message);
-
- // Close and reopen connection.
- reconnect();
-
- // Consume again.. the previous message should
- // get redelivered.
- beginTx();
- message = consumer.receive(2000);
- assertNotNull("Should have re-received the first message again!", message);
- messages.add(message);
- assertEquals(outbound[0], message);
-
- message = consumer.receive(5000);
- assertNotNull("Should have re-received the second message again!", message);
- messages.add(message);
- assertEquals(outbound[1], message);
- commitTx();
-
- Message inbound[] = new Message[messages.size()];
- messages.toArray(inbound);
-
- assertTextMessagesEqual("Rollback did not work", outbound, inbound);
- }
-
- /**
- * Tests sending and receiving messages with two sessions(one for producing
- * and another for consuming).
- *
- * @throws Exception
- */
- public void testSendReceiveInSeperateSessionTest() throws Exception {
- session.close();
- int batchCount = 10;
-
- for (int i = 0; i < batchCount; i++) {
- // Session that sends messages
- {
- Session session = resourceProvider.createSession(connection);
- this.session = session;
- MessageProducer producer = resourceProvider.createProducer(session, destination);
- // consumer = resourceProvider.createConsumer(session,
- // destination);
- beginTx();
- producer.send(session.createTextMessage("Test Message: " + i));
- commitTx();
- session.close();
- }
-
- // Session that consumes messages
- {
- Session session = resourceProvider.createSession(connection);
- this.session = session;
- MessageConsumer consumer = resourceProvider.createConsumer(session, destination);
-
- beginTx();
- TextMessage message = (TextMessage)consumer.receive(1000 * 5);
- assertNotNull("Received only " + i + " messages in batch ", message);
- assertEquals("Test Message: " + i, message.getText());
-
- commitTx();
- session.close();
- }
- }
- }
-
- /**
- * Tests the queue browser. Browses the messages then the consumer tries to
- * receive them. The messages should still be in the queue even when it was
- * browsed.
- *
- * @throws Exception
- */
- public void testReceiveBrowseReceive() throws Exception {
- Message[] outbound = new Message[] {session.createTextMessage("First Message"), session.createTextMessage("Second Message"), session.createTextMessage("Third Message")};
-
- // lets consume any outstanding messages from previous test runs
- beginTx();
- while (consumer.receive(1000) != null) {
- }
- commitTx();
-
- beginTx();
- producer.send(outbound[0]);
- producer.send(outbound[1]);
- producer.send(outbound[2]);
- commitTx();
-
- // Get the first.
- beginTx();
- assertEquals(outbound[0], consumer.receive(1000));
- consumer.close();
- commitTx();
-
- beginTx();
- QueueBrowser browser = session.createBrowser((Queue)destination);
- Enumeration enumeration = browser.getEnumeration();
-
- // browse the second
- assertTrue("should have received the second message", enumeration.hasMoreElements());
- assertEquals(outbound[1], (Message)enumeration.nextElement());
-
- // browse the third.
- assertTrue("Should have received the third message", enumeration.hasMoreElements());
- assertEquals(outbound[2], (Message)enumeration.nextElement());
-
- LOG.info("Check for more...");
- // There should be no more.
- boolean tooMany = false;
- while (enumeration.hasMoreElements()) {
- LOG.info("Got extra message: " + ((TextMessage)enumeration.nextElement()).getText());
- tooMany = true;
- }
- assertFalse(tooMany);
- LOG.info("close browser...");
- browser.close();
-
- LOG.info("reopen and consume...");
- // Re-open the consumer.
- consumer = resourceProvider.createConsumer(session, destination);
- // Receive the second.
- assertEquals(outbound[1], consumer.receive(1000));
- // Receive the third.
- assertEquals(outbound[2], consumer.receive(1000));
- consumer.close();
-
- commitTx();
- }
-
- public void testCloseConsumer() throws Exception {
- Destination dest = session.createQueue(getSubject() + "?consumer.prefetchSize=0");
- producer = session.createProducer(dest);
- beginTx();
- producer.send(session.createTextMessage("message 1"));
- producer.send(session.createTextMessage("message 2"));
- commitTx();
-
- beginTx();
- consumer = session.createConsumer(dest);
- Message message1 = consumer.receive(1000);
- String text1 = ((TextMessage)message1).getText();
- assertNotNull(message1);
- assertEquals("message 1", text1);
-
- consumer.close();
-
- consumer = session.createConsumer(dest);
-
- Message message2 = consumer.receive(1000);
- String text2 = ((TextMessage)message2).getText();
- assertNotNull(message2);
- assertEquals("message 2", text2);
- commitTx();
- }
+
+ private static final Logger LOG = LoggerFactory.getLogger(JmsQueueTransactionTest.class);
+
+ /**
+ * @see org.apache.activemq.JmsTransactionTestSupport#getJmsResourceProvider()
+ */
+ @Override
+ protected JmsResourceProvider getJmsResourceProvider() {
+ JmsResourceProvider p = new JmsResourceProvider();
+ p.setTopic(false);
+ return p;
+ }
+
+ /**
+ * Tests if the the connection gets reset, the messages will still be
+ * received.
+ *
+ * @throws Exception
+ */
+ public void testReceiveTwoThenCloseConnection() throws Exception {
+ Message[] outbound = new Message[]{session.createTextMessage("First Message"), session.createTextMessage("Second Message")};
+
+ // lets consume any outstanding messages from previous test runs
+ beginTx();
+ while (consumer.receive(1000) != null) {
+ }
+ commitTx();
+
+ beginTx();
+ producer.send(outbound[0]);
+ producer.send(outbound[1]);
+ commitTx();
+
+ LOG.info("Sent 0: " + outbound[0]);
+ LOG.info("Sent 1: " + outbound[1]);
+
+ ArrayList<Message> messages = new ArrayList<>();
+ beginTx();
+ Message message = consumer.receive(2000);
+ assertEquals(outbound[0], message);
+
+ message = consumer.receive(2000);
+ assertNotNull(message);
+ assertEquals(outbound[1], message);
+
+ // Close and reopen connection.
+ reconnect();
+
+ // Consume again.. the previous message should
+ // get redelivered.
+ beginTx();
+ message = consumer.receive(2000);
+ assertNotNull("Should have re-received the first message again!", message);
+ messages.add(message);
+ assertEquals(outbound[0], message);
+
+ message = consumer.receive(5000);
+ assertNotNull("Should have re-received the second message again!", message);
+ messages.add(message);
+ assertEquals(outbound[1], message);
+ commitTx();
+
+ Message inbound[] = new Message[messages.size()];
+ messages.toArray(inbound);
+
+ assertTextMessagesEqual("Rollback did not work", outbound, inbound);
+ }
+
+ /**
+ * Tests sending and receiving messages with two sessions(one for producing
+ * and another for consuming).
+ *
+ * @throws Exception
+ */
+ public void testSendReceiveInSeperateSessionTest() throws Exception {
+ session.close();
+ int batchCount = 10;
+
+ for (int i = 0; i < batchCount; i++) {
+ // Session that sends messages
+ {
+ Session session = resourceProvider.createSession(connection);
+ this.session = session;
+ MessageProducer producer = resourceProvider.createProducer(session, destination);
+ // consumer = resourceProvider.createConsumer(session,
+ // destination);
+ beginTx();
+ producer.send(session.createTextMessage("Test Message: " + i));
+ commitTx();
+ session.close();
+ }
+
+ // Session that consumes messages
+ {
+ Session session = resourceProvider.createSession(connection);
+ this.session = session;
+ MessageConsumer consumer = resourceProvider.createConsumer(session, destination);
+
+ beginTx();
+ TextMessage message = (TextMessage) consumer.receive(1000 * 5);
+ assertNotNull("Received only " + i + " messages in batch ", message);
+ assertEquals("Test Message: " + i, message.getText());
+
+ commitTx();
+ session.close();
+ }
+ }
+ }
+
+ /**
+ * Tests the queue browser. Browses the messages then the consumer tries to
+ * receive them. The messages should still be in the queue even when it was
+ * browsed.
+ *
+ * @throws Exception
+ */
+ public void testReceiveBrowseReceive() throws Exception {
+ Message[] outbound = new Message[]{session.createTextMessage("First Message"), session.createTextMessage("Second Message"), session.createTextMessage("Third Message")};
+
+ // lets consume any outstanding messages from previous test runs
+ beginTx();
+ while (consumer.receive(1000) != null) {
+ }
+ commitTx();
+
+ beginTx();
+ producer.send(outbound[0]);
+ producer.send(outbound[1]);
+ producer.send(outbound[2]);
+ commitTx();
+
+ // Get the first.
+ beginTx();
+ assertEquals(outbound[0], consumer.receive(1000));
+ consumer.close();
+ commitTx();
+
+ beginTx();
+ QueueBrowser browser = session.createBrowser((Queue) destination);
+ Enumeration enumeration = browser.getEnumeration();
+
+ // browse the second
+ assertTrue("should have received the second message", enumeration.hasMoreElements());
+ assertEquals(outbound[1], (Message) enumeration.nextElement());
+
+ // browse the third.
+ assertTrue("Should have received the third message", enumeration.hasMoreElements());
+ assertEquals(outbound[2], (Message) enumeration.nextElement());
+
+ LOG.info("Check for more...");
+ // There should be no more.
+ boolean tooMany = false;
+ while (enumeration.hasMoreElements()) {
+ LOG.info("Got extra message: " + ((TextMessage) enumeration.nextElement()).getText());
+ tooMany = true;
+ }
+ assertFalse(tooMany);
+ LOG.info("close browser...");
+ browser.close();
+
+ LOG.info("reopen and consume...");
+ // Re-open the consumer.
+ consumer = resourceProvider.createConsumer(session, destination);
+ // Receive the second.
+ assertEquals(outbound[1], consumer.receive(1000));
+ // Receive the third.
+ assertEquals(outbound[2], consumer.receive(1000));
+ consumer.close();
+
+ commitTx();
+ }
+
+ public void testCloseConsumer() throws Exception {
+ Destination dest = session.createQueue(getSubject() + "?consumer.prefetchSize=0");
+ producer = session.createProducer(dest);
+ beginTx();
+ producer.send(session.createTextMessage("message 1"));
+ producer.send(session.createTextMessage("message 2"));
+ commitTx();
+
+ beginTx();
+ consumer = session.createConsumer(dest);
+ Message message1 = consumer.receive(1000);
+ String text1 = ((TextMessage) message1).getText();
+ assertNotNull(message1);
+ assertEquals("message 1", text1);
+
+ consumer.close();
+
+ consumer = session.createConsumer(dest);
+
+ Message message2 = consumer.receive(1000);
+ String text2 = ((TextMessage) message2).getText();
+ assertNotNull(message2);
+ assertEquals("message 2", text2);
+ commitTx();
+ }
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueWildcardSendReceiveTest.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueWildcardSendReceiveTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueWildcardSendReceiveTest.java
index 9a6dcb1..e986023 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueWildcardSendReceiveTest.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueWildcardSendReceiveTest.java
@@ -6,7 +6,7 @@
* (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
+ * 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,
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsRedeliveredTest.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsRedeliveredTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsRedeliveredTest.java
index 03a7614..abd5e61 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsRedeliveredTest.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsRedeliveredTest.java
@@ -6,7 +6,7 @@
* (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
+ * 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,
@@ -16,7 +16,6 @@
*/
package org.apache.activemq;
-import java.util.concurrent.TimeUnit;
import javax.jms.Connection;
import javax.jms.DeliveryMode;
import javax.jms.Destination;
@@ -28,6 +27,7 @@ import javax.jms.Queue;
import javax.jms.Session;
import javax.jms.TextMessage;
import javax.jms.Topic;
+import java.util.concurrent.TimeUnit;
import junit.framework.Test;
import junit.framework.TestCase;