You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ch...@apache.org on 2007/08/11 02:49:31 UTC
svn commit: r564814 [7/8] - in /activemq/trunk:
activemq-core/src/main/java/org/apache/activemq/
activemq-core/src/main/java/org/apache/activemq/advisory/
activemq-core/src/main/java/org/apache/activemq/broker/
activemq-core/src/main/java/org/apache/ac...
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/policy/DeadLetterTestSupport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/policy/DeadLetterTestSupport.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/policy/DeadLetterTestSupport.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/policy/DeadLetterTestSupport.java Fri Aug 10 17:49:19 2007
@@ -29,11 +29,14 @@
import org.apache.activemq.TestSupport;
import org.apache.activemq.broker.BrokerService;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
/**
* @version $Revision$
*/
public abstract class DeadLetterTestSupport extends TestSupport {
+ private static final Log LOG = LogFactory.getLog(DeadLetterTestSupport.class);
protected int messageCount = 10;
protected long timeToLive;
@@ -80,7 +83,7 @@
protected void makeConsumer() throws JMSException {
Destination destination = getDestination();
- log.info("Consuming from: " + destination);
+ LOG.info("Consuming from: " + destination);
if (durableSubscriber) {
consumer = session.createDurableSubscriber((Topic)destination, destination.toString());
} else {
@@ -91,7 +94,7 @@
protected void makeDlqConsumer() throws JMSException {
dlqDestination = createDlqDestination();
- log.info("Consuming from dead letter on: " + dlqDestination);
+ LOG.info("Consuming from dead letter on: " + dlqDestination);
dlqConsumer = session.createConsumer(dlqDestination);
}
@@ -101,7 +104,7 @@
producer.setDeliveryMode(deliveryMode);
producer.setTimeToLive(timeToLive);
- log.info("Sending " + messageCount + " messages to: " + getDestination());
+ LOG.info("Sending " + messageCount + " messages to: " + getDestination());
for (int i = 0; i < messageCount; i++) {
Message message = createMessage(session, i);
producer.send(message);
@@ -117,7 +120,7 @@
}
protected void assertMessage(Message message, int i) throws Exception {
- log.info("Received message: " + message);
+ LOG.info("Received message: " + message);
assertNotNull("No message received for index: " + i, message);
assertTrue("Should be a TextMessage not: " + message, message instanceof TextMessage);
TextMessage textMessage = (TextMessage)message;
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/policy/IndividualDeadLetterViaXmlTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/policy/IndividualDeadLetterViaXmlTest.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/policy/IndividualDeadLetterViaXmlTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/policy/IndividualDeadLetterViaXmlTest.java Fri Aug 10 17:49:19 2007
@@ -21,6 +21,8 @@
import org.apache.activemq.broker.BrokerService;
import org.apache.activemq.command.ActiveMQQueue;
import org.apache.activemq.xbean.BrokerFactoryBean;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.springframework.core.io.ClassPathResource;
/**
@@ -28,6 +30,7 @@
* @version $Revision$
*/
public class IndividualDeadLetterViaXmlTest extends DeadLetterTest {
+ private static final Log LOG = LogFactory.getLog(IndividualDeadLetterViaXmlTest.class);
protected BrokerService createBroker() throws Exception {
@@ -39,7 +42,7 @@
protected Destination createDlqDestination() {
String queueName = "Test.DLQ." + getClass().getName() + "." + getName();
- log.info("Using queue name: " + queueName);
+ LOG.info("Using queue name: " + queueName);
return new ActiveMQQueue(queueName);
}
}
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/CraigsBugTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/CraigsBugTest.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/CraigsBugTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/CraigsBugTest.java Fri Aug 10 17:49:19 2007
@@ -41,7 +41,7 @@
try {
Session session = conn.createSession(false, 1);
MessageConsumer consumer = session.createConsumer(queue, null);
- Message msg = consumer.receive(1000);
+ consumer.receive(1000);
} catch (JMSException e) {
e.printStackTrace();
}
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/MessageSender.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/MessageSender.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/MessageSender.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/MessageSender.java Fri Aug 10 17:49:19 2007
@@ -1,3 +1,19 @@
+/**
+ * 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.bugs;
import javax.jms.Connection;
@@ -9,7 +25,7 @@
private MessageProducer producer;
private Session session;
- public MessageSender(String queueName,Connection connection, boolean useTransactedSession) throws Exception {
+ public MessageSender(String queueName, Connection connection, boolean useTransactedSession) throws Exception {
session = useTransactedSession ? connection.createSession(true, Session.SESSION_TRANSACTED) : connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
producer = session.createProducer(session.createQueue(queueName));
}
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/Receiver.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/Receiver.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/Receiver.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/Receiver.java Fri Aug 10 17:49:19 2007
@@ -1,5 +1,21 @@
+/**
+ * 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.bugs;
public interface Receiver {
- public void receive(String s) throws Exception;
+ void receive(String s) throws Exception;
}
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/TransactionNotStartedErrorTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/TransactionNotStartedErrorTest.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/TransactionNotStartedErrorTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/TransactionNotStartedErrorTest.java Fri Aug 10 17:49:19 2007
@@ -1,5 +1,4 @@
/**
- *
* 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.
@@ -7,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,
@@ -22,282 +21,266 @@
import javax.jms.Message;
import javax.jms.MessageConsumer;
import javax.jms.MessageListener;
-
import javax.jms.ObjectMessage;
import javax.jms.Session;
-import junit.framework.TestCase;
+import junit.framework.TestCase;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.broker.BrokerService;
-import org.apache.activemq.bugs.Receiver;
-import org.apache.activemq.bugs.MessageSender;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
/*
- * simulate message flow which cause the following exception
- * in the broker (exception logged by client)
- * <p/>
- * 2007-07-24 13:51:23,624 com.easynet.halo.Halo ERROR (LoggingErrorHandler.java: 23) JMS failure
- * javax.jms.JMSException: Transaction 'TX:ID:dmt-53625-1185281414694-1:0:344' has not been started.
- * at org.apache.activemq.broker.TransactionBroker.getTransaction(TransactionBroker.java:230)
- *
- *
- * This appears to be consistent in a MacBook. Haven't been able to replicate it on Windows though
+ * simulate message flow which cause the following exception in the broker
+ * (exception logged by client) <p/> 2007-07-24 13:51:23,624
+ * com.easynet.halo.Halo ERROR (LoggingErrorHandler.java: 23) JMS failure
+ * javax.jms.JMSException: Transaction 'TX:ID:dmt-53625-1185281414694-1:0:344'
+ * has not been started. at
+ * org.apache.activemq.broker.TransactionBroker.getTransaction(TransactionBroker.java:230)
+ * This appears to be consistent in a MacBook. Haven't been able to replicate it
+ * on Windows though
*/
public class TransactionNotStartedErrorTest extends TestCase {
- private static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory
- .getLog(TransactionNotStartedErrorTest.class);
- private String hectorToHalo = "hectorToHalo";
- private String xenaToHalo = "xenaToHalo";
- private String troyToHalo = "troyToHalo";
-
- private String haloToHector = "haloToHector";
- private String haloToXena = "haloToXena";
- private String haloToTroy = "haloToTroy";
-
- private static int counter = 500;
-
- private static int hectorToHaloCtr = 0;
- private static int xenaToHaloCtr = 0;
- private static int troyToHaloCtr = 0;
-
- private static int haloToHectorCtr = 0;
- private static int haloToXenaCtr = 0;
- private static int haloToTroyCtr = 0;
-
- private BrokerService broker;
-
- private Connection hectorConnection;
- private Connection xenaConnection;
- private Connection troyConnection;
- private Connection haloConnection;
-
- private final Object lock = new Object();
-
- public Connection createConnection() throws JMSException {
- ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(
- "tcp://localhost:61616");
- return factory.createConnection();
- }
-
- public Session createSession(Connection connection, boolean transacted)
- throws JMSException {
- return connection.createSession(transacted, Session.AUTO_ACKNOWLEDGE);
- }
-
- public void startBroker() throws Exception {
- broker = new BrokerService();
- broker.setDeleteAllMessagesOnStartup(true);
- broker.setPersistent(true);
- broker.setUseJmx(true);
- broker.addConnector("tcp://localhost:61616").setName("Default");
- broker.start();
- log.info("Starting broker..");
- }
-
- public void tearDown() throws Exception {
- hectorConnection.close();
- xenaConnection.close();
- troyConnection.close();
- haloConnection.close();
- broker.stop();
- }
-
- public void testTransactionNotStartedError() throws Exception {
- startBroker();
- hectorConnection = createConnection();
- Thread hectorThread = buildProducer(hectorConnection, hectorToHalo);
- Receiver hHectorReceiver = new Receiver() {
- public void receive(String s) throws Exception {
- haloToHectorCtr++;
- if (haloToHectorCtr >= counter) {
- synchronized (lock) {
- lock.notifyAll();
- }
- }
- }
- };
- buildReceiver(hectorConnection, haloToHector, false, hHectorReceiver);
-
- troyConnection = createConnection();
- Thread troyThread = buildProducer(troyConnection, troyToHalo);
- Receiver hTroyReceiver = new Receiver() {
- public void receive(String s) throws Exception {
- haloToTroyCtr++;
- if (haloToTroyCtr >= counter) {
- synchronized (lock) {
- lock.notifyAll();
- }
- }
- }
- };
- buildReceiver(hectorConnection, haloToTroy, false, hTroyReceiver);
-
- xenaConnection = createConnection();
- Thread xenaThread = buildProducer(xenaConnection, xenaToHalo);
- Receiver hXenaReceiver = new Receiver() {
- public void receive(String s) throws Exception {
- haloToXenaCtr++;
- if (haloToXenaCtr >= counter) {
- synchronized (lock) {
- lock.notifyAll();
- }
- }
- }
- };
- buildReceiver(xenaConnection, haloToXena, false, hXenaReceiver);
-
- haloConnection = createConnection();
- final MessageSender hectorSender = buildTransactionalProducer(
- haloToHector, haloConnection);
- final MessageSender troySender = buildTransactionalProducer(haloToTroy,
- haloConnection);
- final MessageSender xenaSender = buildTransactionalProducer(haloToXena,
- haloConnection);
- Receiver hectorReceiver = new Receiver() {
- public void receive(String s) throws Exception {
- hectorToHaloCtr++;
- troySender.send("halo to troy because of hector");
- if (hectorToHaloCtr >= counter) {
- synchronized (lock) {
- lock.notifyAll();
- }
- }
- }
- };
- Receiver xenaReceiver = new Receiver() {
- public void receive(String s) throws Exception {
- xenaToHaloCtr++;
- hectorSender.send("halo to hector because of xena");
- if (xenaToHaloCtr >= counter) {
- synchronized (lock) {
- lock.notifyAll();
- }
- }
- }
- };
- Receiver troyReceiver = new Receiver() {
- public void receive(String s) throws Exception {
- troyToHaloCtr++;
- xenaSender.send("halo to xena because of troy");
- if (troyToHaloCtr >= counter) {
- synchronized (lock) {
- lock.notifyAll();
- }
- }
- }
- };
- buildReceiver(haloConnection, hectorToHalo, true, hectorReceiver);
- buildReceiver(haloConnection, xenaToHalo, true, xenaReceiver);
- buildReceiver(haloConnection, troyToHalo, true, troyReceiver);
-
- haloConnection.start();
-
- troyConnection.start();
- troyThread.start();
-
- xenaConnection.start();
- xenaThread.start();
-
- hectorConnection.start();
- hectorThread.start();
- waitForMessagesToBeDelivered();
- //number of messages received should match messages sent
- assertEquals(hectorToHaloCtr, counter);
- log.info("hectorToHalo received " + hectorToHaloCtr + " messages");
- assertEquals(xenaToHaloCtr, counter);
- log.info("xenaToHalo received " + xenaToHaloCtr + " messages");
- assertEquals(troyToHaloCtr, counter);
- log.info("troyToHalo received " + troyToHaloCtr + " messages");
- assertEquals(haloToHectorCtr, counter);
- log.info("haloToHector received " + haloToHectorCtr + " messages");
- assertEquals(haloToXenaCtr, counter);
- log.info("haloToXena received " + haloToXenaCtr + " messages");
- assertEquals(haloToTroyCtr, counter);
- log.info("haloToTroy received " + haloToTroyCtr + " messages");
-
- }
-
- protected void waitForMessagesToBeDelivered() {
- // let's give the listeners enough time to read all messages
- long maxWaitTime = counter * 3000;
- long waitTime = maxWaitTime;
- long start = (maxWaitTime <= 0) ? 0 : System.currentTimeMillis();
-
- synchronized (lock) {
- boolean hasMessages = true;
- while (hasMessages && waitTime >= 0) {
- try {
- lock.wait(200);
- } catch (InterruptedException e) {
- log.error(e);
- }
- //check if all messages have been received
- hasMessages = hectorToHaloCtr < counter
- || xenaToHaloCtr < counter || troyToHaloCtr < counter || haloToHectorCtr < counter
- || haloToXenaCtr < counter || haloToTroyCtr < counter;
- waitTime = maxWaitTime - (System.currentTimeMillis() - start);
- }
- }
- }
-
- public MessageSender buildTransactionalProducer(String queueName,
- Connection connection) throws Exception {
-
- return new MessageSender(queueName, connection, true);
- }
-
- public Thread buildProducer(Connection connection, final String queueName)
- throws Exception {
-
- final Session session = connection.createSession(false,
- Session.AUTO_ACKNOWLEDGE);
- final MessageSender producer = new MessageSender(queueName, connection,
- false);
- Thread thread = new Thread() {
-
- public synchronized void run() {
- for (int i = 0; i < counter; i++) {
- try {
- producer.send(queueName);
- if (session.getTransacted()) {
- session.commit();
- }
-
- } catch (Exception e) {
- throw new RuntimeException("on " + queueName + " send",
- e);
- }
- }
- }
- };
- return thread;
- }
-
- public void buildReceiver(Connection connection, final String queueName,
- boolean transacted, final Receiver receiver) throws Exception {
- final Session session = transacted ? connection.createSession(true,
- Session.SESSION_TRANSACTED) : connection.createSession(false,
- Session.AUTO_ACKNOWLEDGE);
- MessageConsumer inputMessageConsumer = session.createConsumer(session
- .createQueue(queueName));
- MessageListener messageListener = new MessageListener() {
-
- public void onMessage(Message message) {
- try {
- ObjectMessage objectMessage = (ObjectMessage) message;
- String s = (String) objectMessage.getObject();
- receiver.receive(s);
- if (session.getTransacted()) {
- session.commit();
- }
-
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- };
- inputMessageConsumer.setMessageListener(messageListener);
- }
+ private static final Log LOG = LogFactory.getLog(TransactionNotStartedErrorTest.class);
+
+ private static int counter = 500;
+
+ private static int hectorToHaloCtr;
+ private static int xenaToHaloCtr;
+ private static int troyToHaloCtr;
+
+ private static int haloToHectorCtr;
+ private static int haloToXenaCtr;
+ private static int haloToTroyCtr;
+
+ private String hectorToHalo = "hectorToHalo";
+ private String xenaToHalo = "xenaToHalo";
+ private String troyToHalo = "troyToHalo";
+
+ private String haloToHector = "haloToHector";
+ private String haloToXena = "haloToXena";
+ private String haloToTroy = "haloToTroy";
+
+
+ private BrokerService broker;
+
+ private Connection hectorConnection;
+ private Connection xenaConnection;
+ private Connection troyConnection;
+ private Connection haloConnection;
+
+ private final Object lock = new Object();
+
+ public Connection createConnection() throws JMSException {
+ ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory("tcp://localhost:61616");
+ return factory.createConnection();
+ }
+
+ public Session createSession(Connection connection, boolean transacted) throws JMSException {
+ return connection.createSession(transacted, Session.AUTO_ACKNOWLEDGE);
+ }
+
+ public void startBroker() throws Exception {
+ broker = new BrokerService();
+ broker.setDeleteAllMessagesOnStartup(true);
+ broker.setPersistent(true);
+ broker.setUseJmx(true);
+ broker.addConnector("tcp://localhost:61616").setName("Default");
+ broker.start();
+ LOG.info("Starting broker..");
+ }
+
+ public void tearDown() throws Exception {
+ hectorConnection.close();
+ xenaConnection.close();
+ troyConnection.close();
+ haloConnection.close();
+ broker.stop();
+ }
+
+ public void testTransactionNotStartedError() throws Exception {
+ startBroker();
+ hectorConnection = createConnection();
+ Thread hectorThread = buildProducer(hectorConnection, hectorToHalo);
+ Receiver hHectorReceiver = new Receiver() {
+ public void receive(String s) throws Exception {
+ haloToHectorCtr++;
+ if (haloToHectorCtr >= counter) {
+ synchronized (lock) {
+ lock.notifyAll();
+ }
+ }
+ }
+ };
+ buildReceiver(hectorConnection, haloToHector, false, hHectorReceiver);
+
+ troyConnection = createConnection();
+ Thread troyThread = buildProducer(troyConnection, troyToHalo);
+ Receiver hTroyReceiver = new Receiver() {
+ public void receive(String s) throws Exception {
+ haloToTroyCtr++;
+ if (haloToTroyCtr >= counter) {
+ synchronized (lock) {
+ lock.notifyAll();
+ }
+ }
+ }
+ };
+ buildReceiver(hectorConnection, haloToTroy, false, hTroyReceiver);
+
+ xenaConnection = createConnection();
+ Thread xenaThread = buildProducer(xenaConnection, xenaToHalo);
+ Receiver hXenaReceiver = new Receiver() {
+ public void receive(String s) throws Exception {
+ haloToXenaCtr++;
+ if (haloToXenaCtr >= counter) {
+ synchronized (lock) {
+ lock.notifyAll();
+ }
+ }
+ }
+ };
+ buildReceiver(xenaConnection, haloToXena, false, hXenaReceiver);
+
+ haloConnection = createConnection();
+ final MessageSender hectorSender = buildTransactionalProducer(haloToHector, haloConnection);
+ final MessageSender troySender = buildTransactionalProducer(haloToTroy, haloConnection);
+ final MessageSender xenaSender = buildTransactionalProducer(haloToXena, haloConnection);
+ Receiver hectorReceiver = new Receiver() {
+ public void receive(String s) throws Exception {
+ hectorToHaloCtr++;
+ troySender.send("halo to troy because of hector");
+ if (hectorToHaloCtr >= counter) {
+ synchronized (lock) {
+ lock.notifyAll();
+ }
+ }
+ }
+ };
+ Receiver xenaReceiver = new Receiver() {
+ public void receive(String s) throws Exception {
+ xenaToHaloCtr++;
+ hectorSender.send("halo to hector because of xena");
+ if (xenaToHaloCtr >= counter) {
+ synchronized (lock) {
+ lock.notifyAll();
+ }
+ }
+ }
+ };
+ Receiver troyReceiver = new Receiver() {
+ public void receive(String s) throws Exception {
+ troyToHaloCtr++;
+ xenaSender.send("halo to xena because of troy");
+ if (troyToHaloCtr >= counter) {
+ synchronized (lock) {
+ lock.notifyAll();
+ }
+ }
+ }
+ };
+ buildReceiver(haloConnection, hectorToHalo, true, hectorReceiver);
+ buildReceiver(haloConnection, xenaToHalo, true, xenaReceiver);
+ buildReceiver(haloConnection, troyToHalo, true, troyReceiver);
+
+ haloConnection.start();
+
+ troyConnection.start();
+ troyThread.start();
+
+ xenaConnection.start();
+ xenaThread.start();
+
+ hectorConnection.start();
+ hectorThread.start();
+ waitForMessagesToBeDelivered();
+ // number of messages received should match messages sent
+ assertEquals(hectorToHaloCtr, counter);
+ LOG.info("hectorToHalo received " + hectorToHaloCtr + " messages");
+ assertEquals(xenaToHaloCtr, counter);
+ LOG.info("xenaToHalo received " + xenaToHaloCtr + " messages");
+ assertEquals(troyToHaloCtr, counter);
+ LOG.info("troyToHalo received " + troyToHaloCtr + " messages");
+ assertEquals(haloToHectorCtr, counter);
+ LOG.info("haloToHector received " + haloToHectorCtr + " messages");
+ assertEquals(haloToXenaCtr, counter);
+ LOG.info("haloToXena received " + haloToXenaCtr + " messages");
+ assertEquals(haloToTroyCtr, counter);
+ LOG.info("haloToTroy received " + haloToTroyCtr + " messages");
+
+ }
+
+ protected void waitForMessagesToBeDelivered() {
+ // let's give the listeners enough time to read all messages
+ long maxWaitTime = counter * 3000;
+ long waitTime = maxWaitTime;
+ long start = (maxWaitTime <= 0) ? 0 : System.currentTimeMillis();
+
+ synchronized (lock) {
+ boolean hasMessages = true;
+ while (hasMessages && waitTime >= 0) {
+ try {
+ lock.wait(200);
+ } catch (InterruptedException e) {
+ LOG.error(e);
+ }
+ // check if all messages have been received
+ hasMessages = hectorToHaloCtr < counter || xenaToHaloCtr < counter || troyToHaloCtr < counter || haloToHectorCtr < counter || haloToXenaCtr < counter
+ || haloToTroyCtr < counter;
+ waitTime = maxWaitTime - (System.currentTimeMillis() - start);
+ }
+ }
+ }
+
+ public MessageSender buildTransactionalProducer(String queueName, Connection connection) throws Exception {
+
+ return new MessageSender(queueName, connection, true);
+ }
+
+ public Thread buildProducer(Connection connection, final String queueName) throws Exception {
+
+ final Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ final MessageSender producer = new MessageSender(queueName, connection, false);
+ Thread thread = new Thread() {
+
+ public synchronized void run() {
+ for (int i = 0; i < counter; i++) {
+ try {
+ producer.send(queueName);
+ if (session.getTransacted()) {
+ session.commit();
+ }
+
+ } catch (Exception e) {
+ throw new RuntimeException("on " + queueName + " send", e);
+ }
+ }
+ }
+ };
+ return thread;
+ }
+
+ public void buildReceiver(Connection connection, final String queueName, boolean transacted, final Receiver receiver) throws Exception {
+ final Session session = transacted ? connection.createSession(true, Session.SESSION_TRANSACTED) : connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ MessageConsumer inputMessageConsumer = session.createConsumer(session.createQueue(queueName));
+ MessageListener messageListener = new MessageListener() {
+
+ public void onMessage(Message message) {
+ try {
+ ObjectMessage objectMessage = (ObjectMessage)message;
+ String s = (String)objectMessage.getObject();
+ receiver.receive(s);
+ if (session.getTransacted()) {
+ session.commit();
+ }
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ };
+ inputMessageConsumer.setMessageListener(messageListener);
+ }
}
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/command/ActiveMQBytesMessageTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/command/ActiveMQBytesMessageTest.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/command/ActiveMQBytesMessageTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/command/ActiveMQBytesMessageTest.java Fri Aug 10 17:49:19 2007
@@ -27,6 +27,11 @@
* @version $Revision$
*/
public class ActiveMQBytesMessageTest extends TestCase {
+
+ public ActiveMQBytesMessageTest(String name) {
+ super(name);
+ }
+
public static void main(String[] args) {
junit.textui.TestRunner.run(ActiveMQBytesMessageTest.class);
}
@@ -43,15 +48,6 @@
*/
protected void tearDown() throws Exception {
super.tearDown();
- }
-
- /**
- * Constructor for ActiveMQBytesMessageTest.
- *
- * @param arg0
- */
- public ActiveMQBytesMessageTest(String arg0) {
- super(arg0);
}
public void testGetDataStructureType() {
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/command/ActiveMQDestinationTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/command/ActiveMQDestinationTest.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/command/ActiveMQDestinationTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/command/ActiveMQDestinationTest.java Fri Aug 10 17:49:19 2007
@@ -51,7 +51,7 @@
addCombinationValues("destination", new Object[] {new ActiveMQQueue("TEST?k1=v1&k2=v2"),
new ActiveMQTopic("TEST?k1=v1&k2=v2"),
new ActiveMQTempQueue("TEST:1?k1=v1&k2=v2"),
- new ActiveMQTempTopic("TEST:1?k1=v1&k2=v2"),});
+ new ActiveMQTempTopic("TEST:1?k1=v1&k2=v2")});
}
public void testDesintaionOptions() throws IOException {
@@ -62,12 +62,12 @@
}
public void testSorting() throws Exception {
- SortedSet set = new TreeSet();
+ SortedSet<ActiveMQDestination> set = new TreeSet<ActiveMQDestination>();
ActiveMQDestination[] destinations = {new ActiveMQQueue("A"), new ActiveMQQueue("B"),
new ActiveMQTopic("A"), new ActiveMQTopic("B")};
- List expected = Arrays.asList(destinations);
+ List<ActiveMQDestination> expected = Arrays.asList(destinations);
set.addAll(expected);
- List actual = new ArrayList(set);
+ List<ActiveMQDestination> actual = new ArrayList<ActiveMQDestination>(set);
assertEquals("Sorted order", expected, actual);
}
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/command/ActiveMQMapMessageTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/command/ActiveMQMapMessageTest.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/command/ActiveMQMapMessageTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/command/ActiveMQMapMessageTest.java Fri Aug 10 17:49:19 2007
@@ -21,6 +21,7 @@
import java.util.Arrays;
import java.util.Collections;
import java.util.Enumeration;
+import java.util.List;
import javax.jms.JMSException;
import javax.jms.MessageFormatException;
@@ -39,6 +40,15 @@
private String name = "testName";
+ /**
+ * Constructor for ActiveMQMapMessageTest.
+ *
+ * @param name
+ */
+ public ActiveMQMapMessageTest(String name) {
+ super(name);
+ }
+
public static void main(String[] args) {
junit.textui.TestRunner.run(ActiveMQMapMessageTest.class);
}
@@ -57,15 +67,6 @@
super.tearDown();
}
- /**
- * Constructor for ActiveMQMapMessageTest.
- *
- * @param arg0
- */
- public ActiveMQMapMessageTest(String arg0) {
- super(arg0);
- }
-
public void testBytesConversion() throws JMSException, IOException {
ActiveMQMapMessage msg = new ActiveMQMapMessage();
msg.setBoolean("boolean", true);
@@ -316,8 +317,8 @@
msg = (ActiveMQMapMessage)msg.copy();
- Enumeration mapNamesEnum = msg.getMapNames();
- ArrayList mapNamesList = Collections.list(mapNamesEnum);
+ Enumeration<String> mapNamesEnum = msg.getMapNames();
+ List<String> mapNamesList = Collections.list(mapNamesEnum);
assertEquals(mapNamesList.size(), 12);
assertTrue(mapNamesList.contains("boolean"));
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/command/ActiveMQMessageTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/command/ActiveMQMessageTest.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/command/ActiveMQMessageTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/command/ActiveMQMessageTest.java Fri Aug 10 17:49:19 2007
@@ -54,6 +54,15 @@
private int jmsPriority;
private long jmsTimestamp;
private long[] consumerIDs;
+
+ /**
+ * Constructor for ActiveMQMessageTest.
+ *
+ * @param name
+ */
+ public ActiveMQMessageTest(String name) {
+ super(name);
+ }
public static void main(String[] args) {
}
@@ -86,15 +95,6 @@
*/
protected void tearDown() throws Exception {
super.tearDown();
- }
-
- /**
- * Constructor for ActiveMQMessageTest.
- *
- * @param arg0
- */
- public ActiveMQMessageTest(String arg0) {
- super(arg0);
}
public void testGetDataStructureType() {
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/command/ActiveMQObjectMessageTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/command/ActiveMQObjectMessageTest.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/command/ActiveMQObjectMessageTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/command/ActiveMQObjectMessageTest.java Fri Aug 10 17:49:19 2007
@@ -29,6 +29,15 @@
*/
public class ActiveMQObjectMessageTest extends TestCase {
+ /**
+ * Constructor for ActiveMQObjectMessageTest.
+ *
+ * @param name
+ */
+ public ActiveMQObjectMessageTest(String name) {
+ super(name);
+ }
+
public static void main(String[] args) {
junit.textui.TestRunner.run(ActiveMQObjectMessageTest.class);
}
@@ -45,15 +54,6 @@
*/
protected void tearDown() throws Exception {
super.tearDown();
- }
-
- /**
- * Constructor for ActiveMQObjectMessageTest.
- *
- * @param arg0
- */
- public ActiveMQObjectMessageTest(String arg0) {
- super(arg0);
}
public void testBytes() throws JMSException, IOException {
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/command/ActiveMQStreamMessageTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/command/ActiveMQStreamMessageTest.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/command/ActiveMQStreamMessageTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/command/ActiveMQStreamMessageTest.java Fri Aug 10 17:49:19 2007
@@ -30,6 +30,15 @@
*/
public class ActiveMQStreamMessageTest extends TestCase {
+ /**
+ * Constructor for ActiveMQStreamMessageTest.
+ *
+ * @param name
+ */
+ public ActiveMQStreamMessageTest(String name) {
+ super(name);
+ }
+
public static void main(String[] args) {
junit.textui.TestRunner.run(ActiveMQStreamMessageTest.class);
}
@@ -46,15 +55,6 @@
*/
protected void tearDown() throws Exception {
super.tearDown();
- }
-
- /**
- * Constructor for ActiveMQStreamMessageTest.
- *
- * @param arg0
- */
- public ActiveMQStreamMessageTest(String arg0) {
- super(arg0);
}
public void testGetDataStructureType() {
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/demo/DefaultQueueSender.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/demo/DefaultQueueSender.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/demo/DefaultQueueSender.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/demo/DefaultQueueSender.java Fri Aug 10 17:49:19 2007
@@ -34,19 +34,23 @@
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageProducer;
-import javax.jms.QueueSession;
import javax.jms.Session;
import org.apache.activemq.ActiveMQConnectionFactory;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
/**
* A simple queue sender which does not use JNDI
*
* @version $Revision: 1.1 $
*/
-public class DefaultQueueSender {
+public final class DefaultQueueSender {
- private static final org.apache.commons.logging.Log LOG = org.apache.commons.logging.LogFactory.getLog(DefaultQueueSender.class);
+ private static final Log LOG = LogFactory.getLog(DefaultQueueSender.class);
+
+ private DefaultQueueSender() {
+ }
public static void main(String[] args) {
@@ -54,7 +58,6 @@
String text = "Hello World!";
Connection connection = null;
- QueueSession queueSession = null;
if (args.length < 1) {
printUsage();
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/demo/SimpleConsumer.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/demo/SimpleConsumer.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/demo/SimpleConsumer.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/demo/SimpleConsumer.java Fri Aug 10 17:49:19 2007
@@ -42,9 +42,13 @@
*
* @version $Revision: 1.2 $
*/
-public class SimpleConsumer {
+public final class SimpleConsumer {
- private static final org.apache.commons.logging.Log LOG = org.apache.commons.logging.LogFactory.getLog(SimpleConsumer.class);
+ private static final org.apache.commons.logging.Log LOG = org.apache.commons.logging.LogFactory
+ .getLog(SimpleConsumer.class);
+
+ private SimpleConsumer() {
+ }
/**
* @param args the queue used by the example
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/demo/SimpleProducer.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/demo/SimpleProducer.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/demo/SimpleProducer.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/demo/SimpleProducer.java Fri Aug 10 17:49:19 2007
@@ -39,15 +39,21 @@
import javax.naming.InitialContext;
import javax.naming.NamingException;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
/**
* A simple polymorphic JMS producer which can work with Queues or Topics which
* uses JNDI to lookup the JMS connection factory and destination
*
* @version $Revision: 1.2 $
*/
-public class SimpleProducer {
+public final class SimpleProducer {
+
+ private static final Log LOG = LogFactory.getLog(SimpleProducer.class);
- private static final org.apache.commons.logging.Log LOG = org.apache.commons.logging.LogFactory.getLog(SimpleProducer.class);
+ private SimpleProducer() {
+ }
/**
* @param args the destination name to send to and optionally, the number of
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/demo/SimpleQueueReceiver.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/demo/SimpleQueueReceiver.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/demo/SimpleQueueReceiver.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/demo/SimpleQueueReceiver.java Fri Aug 10 17:49:19 2007
@@ -37,9 +37,15 @@
import javax.naming.InitialContext;
import javax.naming.NamingException;
-public class SimpleQueueReceiver {
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
- private static final org.apache.commons.logging.Log LOG = org.apache.commons.logging.LogFactory.getLog(SimpleQueueReceiver.class);
+public final class SimpleQueueReceiver {
+
+ private static final Log LOG = LogFactory.getLog(SimpleQueueReceiver.class);
+
+ private SimpleQueueReceiver() {
+ }
/**
* Main method.
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/demo/SimpleQueueSender.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/demo/SimpleQueueSender.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/demo/SimpleQueueSender.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/demo/SimpleQueueSender.java Fri Aug 10 17:49:19 2007
@@ -40,9 +40,15 @@
import javax.naming.InitialContext;
import javax.naming.NamingException;
-public class SimpleQueueSender {
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
- private static final org.apache.commons.logging.Log LOG = org.apache.commons.logging.LogFactory.getLog(SimpleQueueSender.class);
+public final class SimpleQueueSender {
+
+ private static final Log LOG = LogFactory.getLog(SimpleQueueSender.class);
+
+ private SimpleQueueSender() {
+ }
/**
* Main method.
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/filter/DestinationMapTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/filter/DestinationMapTest.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/filter/DestinationMapTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/filter/DestinationMapTest.java Fri Aug 10 17:49:19 2007
@@ -371,6 +371,7 @@
assertMapValue(destinationName, Arrays.asList(new Object[] {expected1, expected2, expected3, expected4, expected5, expected6}));
}
+ @SuppressWarnings("unchecked")
protected void assertMapValue(ActiveMQDestination destination, Object expected) {
List expectedList = null;
if (expected == null) {
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/jndi/InitialContextTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/jndi/InitialContextTest.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/jndi/InitialContextTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/jndi/InitialContextTest.java Fri Aug 10 17:49:19 2007
@@ -23,13 +23,15 @@
import junit.framework.TestCase;
import org.apache.activemq.ActiveMQConnectionFactory;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
/**
* @version $Revision: 1.3 $
*/
public class InitialContextTest extends TestCase {
- private static final org.apache.commons.logging.Log LOG = org.apache.commons.logging.LogFactory.getLog(InitialContextTest.class);
+ private static final Log LOG = LogFactory.getLog(InitialContextTest.class);
public void testInitialContext() throws Exception {
InitialContext context = new InitialContext();
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/kaha/ListContainerTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/kaha/ListContainerTest.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/kaha/ListContainerTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/kaha/ListContainerTest.java Fri Aug 10 17:49:19 2007
@@ -95,7 +95,8 @@
*/
public void testIterator() throws Exception {
container.addAll(testList);
- for (Iterator<Object> i = testList.iterator(), j = container.iterator(); i.hasNext();) {
+ Iterator<Object> j = container.iterator();
+ for (Iterator<Object> i = testList.iterator(); i.hasNext();) {
assertEquals(i.next(), j.next());
}
for (Iterator<Object> i = container.iterator(); i.hasNext();) {
@@ -117,7 +118,7 @@
*/
public void testContains() throws Exception {
container.addAll(testList);
- for (Iterator<Object> i = testList.iterator(), j = container.iterator(); i.hasNext();) {
+ for (Iterator<Object> i = testList.iterator(); i.hasNext();) {
assertTrue(container.contains(i.next()));
}
}
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/kaha/StoreTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/kaha/StoreTest.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/kaha/StoreTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/kaha/StoreTest.java Fri Aug 10 17:49:19 2007
@@ -70,7 +70,7 @@
*/
public void testGetMapContainer() throws Exception {
String containerId = "test";
- MapContainer container = store.getMapContainer(containerId);
+ MapContainer<Object, String> container = store.getMapContainer(containerId);
container.load();
assertNotNull(container);
store.close();
@@ -86,7 +86,7 @@
*/
public void testDeleteMapContainer() throws Exception {
String containerId = "test";
- MapContainer container = store.getMapContainer(containerId);
+ MapContainer<Object, String> container = store.getMapContainer(containerId);
assertNotNull(container);
store.deleteMapContainer(containerId);
assertFalse(store.doesMapContainerExist(containerId));
@@ -124,7 +124,7 @@
}
public void testBasicAllocations() throws Exception {
- Map testMap = new HashMap();
+ Map<Object, String> testMap = new HashMap<Object, String>();
int count = 1000;
for (int i = 0; i < count; i++) {
String key = "key:" + i;
@@ -138,11 +138,11 @@
String listId = "testList";
String mapId1 = "testMap";
String mapId2 = "testMap2";
- MapContainer mapContainer1 = store.getMapContainer(mapId1);
+ MapContainer<Object, String> mapContainer1 = store.getMapContainer(mapId1);
mapContainer1.load();
mapContainer1.putAll(testMap);
- MapContainer mapContainer2 = store.getMapContainer(mapId2, mapId2);
+ MapContainer<Object, String> mapContainer2 = store.getMapContainer(mapId2, mapId2);
mapContainer2.load();
mapContainer2.putAll(testMap);
@@ -158,20 +158,21 @@
mapContainer2.load();
listContainer = store.getListContainer(listId);
listContainer.load();
- for (Iterator i = testMap.keySet().iterator(); i.hasNext();) {
+ for (Iterator<Object> i = testMap.keySet().iterator(); i.hasNext();) {
Object key = i.next();
Object value = testMap.get(key);
assertTrue(mapContainer1.containsKey(key));
assertEquals(value, mapContainer1.get(key));
}
- for (Iterator i = testMap.keySet().iterator(); i.hasNext();) {
+ for (Iterator<Object> i = testMap.keySet().iterator(); i.hasNext();) {
Object key = i.next();
Object value = testMap.get(key);
assertTrue(mapContainer2.containsKey(key));
assertEquals(value, mapContainer2.get(key));
}
assertEquals(testList.size(), listContainer.size());
- for (Iterator i = testList.iterator(), j = listContainer.iterator(); i.hasNext();) {
+ Iterator j = listContainer.iterator();
+ for (Iterator i = testList.iterator(); i.hasNext();) {
assertEquals(i.next(), j.next());
}
}
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/memory/buffer/MemoryBufferTestSupport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/memory/buffer/MemoryBufferTestSupport.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/memory/buffer/MemoryBufferTestSupport.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/memory/buffer/MemoryBufferTestSupport.java Fri Aug 10 17:49:19 2007
@@ -29,13 +29,13 @@
public abstract class MemoryBufferTestSupport extends TestCase {
private static final Log LOG = LogFactory.getLog(MemoryBufferTestSupport.class);
- protected abstract MessageBuffer createMessageBuffer();
-
protected MessageBuffer buffer = createMessageBuffer();
protected MessageQueue qA = buffer.createMessageQueue();
protected MessageQueue qB = buffer.createMessageQueue();
protected MessageQueue qC = buffer.createMessageQueue();
protected int messageCount;
+
+ protected abstract MessageBuffer createMessageBuffer();
protected void setUp() throws Exception {
buffer = createMessageBuffer();
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/DuplexNetworkTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/DuplexNetworkTest.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/DuplexNetworkTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/DuplexNetworkTest.java Fri Aug 10 17:49:19 2007
@@ -22,8 +22,6 @@
public class DuplexNetworkTest extends SimpleNetworkTest {
- private static final Log LOG = LogFactory.getLog(DuplexNetworkTest.class);
-
protected String getLocalBrokerURI() {
return "org/apache/activemq/network/duplexLocalBroker.xml";
}
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/ForwardingBridgeTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/ForwardingBridgeTest.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/ForwardingBridgeTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/ForwardingBridgeTest.java Fri Aug 10 17:49:19 2007
@@ -38,7 +38,7 @@
addCombinationValues("deliveryMode", new Object[] {new Integer(DeliveryMode.NON_PERSISTENT),
new Integer(DeliveryMode.PERSISTENT)});
addCombinationValues("destinationType", new Object[] {new Byte(ActiveMQDestination.QUEUE_TYPE),
- new Byte(ActiveMQDestination.TOPIC_TYPE),});
+ new Byte(ActiveMQDestination.TOPIC_TYPE)});
}
public void testAddConsumerThenSend() throws Exception {
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/NetworkReconnectTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/NetworkReconnectTest.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/NetworkReconnectTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/NetworkReconnectTest.java Fri Aug 10 17:49:19 2007
@@ -55,7 +55,7 @@
private ActiveMQConnectionFactory producerConnectionFactory;
private ActiveMQConnectionFactory consumerConnectionFactory;
private Destination destination;
- private ArrayList connections = new ArrayList();
+ private ArrayList<Connection> connections = new ArrayList<Connection>();
public void testMultipleProducerBrokerRestarts() throws Exception {
for (int i = 0; i < 10; i++) {
@@ -207,8 +207,8 @@
}
protected void disposeConsumerConnections() {
- for (Iterator iter = connections.iterator(); iter.hasNext();) {
- Connection connection = (Connection)iter.next();
+ for (Iterator<Connection> iter = connections.iterator(); iter.hasNext();) {
+ Connection connection = iter.next();
try {
connection.close();
} catch (Throwable ignore) {
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/SimpleNetworkTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/SimpleNetworkTest.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/SimpleNetworkTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/SimpleNetworkTest.java Fri Aug 10 17:49:19 2007
@@ -45,9 +45,9 @@
public class SimpleNetworkTest extends TestCase {
+ protected static final int MESSAGE_COUNT = 10;
private static final Log LOG = LogFactory.getLog(SimpleNetworkTest.class);
- protected static final int MESSAGE_COUNT = 10;
protected AbstractApplicationContext context;
protected Connection localConnection;
protected Connection remoteConnection;
@@ -139,7 +139,6 @@
doSetUp();
remoteConsumer = remoteSession.createDurableSubscriber(included, consumerName);
for (int i = 0; i < MESSAGE_COUNT; i++) {
- Message test = localSession.createTextMessage("test-" + i);
assertNotNull(remoteConsumer.receive(500));
}
}
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/jms/QueueBridgeTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/jms/QueueBridgeTest.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/jms/QueueBridgeTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/jms/QueueBridgeTest.java Fri Aug 10 17:49:19 2007
@@ -39,9 +39,9 @@
public class QueueBridgeTest extends TestCase implements MessageListener {
+ protected static final int MESSAGE_COUNT = 10;
private static final Log LOG = LogFactory.getLog(QueueBridgeTest.class);
- protected static final int MESSAGE_COUNT = 10;
protected AbstractApplicationContext context;
protected QueueConnection localConnection;
protected QueueConnection remoteConnection;
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/jms/TopicBridgeSpringTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/jms/TopicBridgeSpringTest.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/jms/TopicBridgeSpringTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/jms/TopicBridgeSpringTest.java Fri Aug 10 17:49:19 2007
@@ -38,9 +38,9 @@
public class TopicBridgeSpringTest extends TestCase implements MessageListener {
+ protected static final int MESSAGE_COUNT = 10;
private static final Log LOG = LogFactory.getLog(TopicBridgeSpringTest.class);
- protected static final int MESSAGE_COUNT = 10;
protected AbstractApplicationContext context;
protected TopicConnection localConnection;
protected TopicConnection remoteConnection;
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/DataFileGeneratorTestSupport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/DataFileGeneratorTestSupport.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/DataFileGeneratorTestSupport.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/DataFileGeneratorTestSupport.java Fri Aug 10 17:49:19 2007
@@ -67,7 +67,6 @@
private static final Throwable SINGLETON_EXCEPTION = new Exception("shared exception");
private static final File MODULE_BASE_DIR;
private static final File CONTROL_DIR;
- private static final File CLASS_FILE_DIR;
static {
@@ -81,7 +80,6 @@
}
MODULE_BASE_DIR = basedir;
CONTROL_DIR = new File(MODULE_BASE_DIR, "src/test/resources/openwire-control");
- CLASS_FILE_DIR = new File(MODULE_BASE_DIR, "src/test/java/org/activemq/openwire");
}
private int counter;
@@ -107,16 +105,16 @@
LOG.info("Parsed: " + actual);
- assertBeansEqual("", new HashSet(), expected, actual);
+ assertBeansEqual("", new HashSet<Object>(), expected, actual);
}
- protected void assertBeansEqual(String message, Set comparedObjects, Object expected, Object actual) throws Exception {
+ protected void assertBeansEqual(String message, Set<Object> comparedObjects, Object expected, Object actual) throws Exception {
assertNotNull("Actual object should be equal to: " + expected + " but was null", actual);
if (comparedObjects.contains(expected)) {
return;
}
comparedObjects.add(expected);
- Class type = expected.getClass();
+ Class<? extends Object> type = expected.getClass();
assertEquals("Should be of same type", type, actual.getClass());
BeanInfo beanInfo = Introspector.getBeanInfo(type);
PropertyDescriptor[] descriptors = beanInfo.getPropertyDescriptors();
@@ -138,7 +136,7 @@
}
}
- protected void assertPropertyValuesEqual(String name, Set comparedObjects, Object expectedValue, Object actualValue) throws Exception {
+ protected void assertPropertyValuesEqual(String name, Set<Object> comparedObjects, Object expectedValue, Object actualValue) throws Exception {
String message = "Property " + name + " not equal";
if (expectedValue == null) {
assertNull("Property " + name + " should be null", actualValue);
@@ -160,14 +158,14 @@
}
}
- protected void assertArrayEqual(String message, Set comparedObjects, Object[] expected, Object[] actual) throws Exception {
+ protected void assertArrayEqual(String message, Set<Object> comparedObjects, Object[] expected, Object[] actual) throws Exception {
assertEquals(message + ". Array length", expected.length, actual.length);
for (int i = 0; i < expected.length; i++) {
assertPropertyValuesEqual(message + ". element: " + i, comparedObjects, expected[i], actual[i]);
}
}
- protected void assertPrimitiveArrayEqual(String message, Set comparedObjects, Object expected, Object actual) throws ArrayIndexOutOfBoundsException, IllegalArgumentException,
+ protected void assertPrimitiveArrayEqual(String message, Set<Object> comparedObjects, Object expected, Object actual) throws ArrayIndexOutOfBoundsException, IllegalArgumentException,
Exception {
int length = Array.getLength(expected);
assertEquals(message + ". Array length", length, Array.getLength(actual));
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/perf/InactiveDurableTopicTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/perf/InactiveDurableTopicTest.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/perf/InactiveDurableTopicTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/perf/InactiveDurableTopicTest.java Fri Aug 10 17:49:19 2007
@@ -25,6 +25,7 @@
import javax.jms.Topic;
import javax.jms.TopicSubscriber;
+import junit.framework.Assert;
import junit.framework.AssertionFailedError;
import junit.framework.TestCase;
import org.apache.activemq.ActiveMQConnectionFactory;
@@ -136,7 +137,7 @@
LOG.debug("Sent " + loop + " messages");
}
}
- this.assertEquals(loop, MESSAGE_COUNT);
+ Assert.assertEquals(loop, MESSAGE_COUNT);
publisher.close();
session.close();
connection.stop();
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/perf/MemoryAllocationTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/perf/MemoryAllocationTest.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/perf/MemoryAllocationTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/perf/MemoryAllocationTest.java Fri Aug 10 17:49:19 2007
@@ -39,9 +39,9 @@
*/
public class MemoryAllocationTest extends TestCase {
+ protected static final int MESSAGE_COUNT = 2000;
private static final Log LOG = LogFactory.getLog(MemoryAllocationTest.class);
- protected static final int MESSAGE_COUNT = 2000;
protected BrokerService broker;
protected String bindAddress = "vm://localhost";
protected int topicCount;
@@ -53,7 +53,7 @@
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
Destination dest = session.createTemporaryTopic();
- MessageConsumer mc = session.createConsumer(dest);
+ session.createConsumer(dest);
MessageProducer mp = session.createProducer(dest);
Message msg = session.createTextMessage("test" + i);
mp.send(msg);
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/perf/SimpleTopicTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/perf/SimpleTopicTest.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/perf/SimpleTopicTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/perf/SimpleTopicTest.java Fri Aug 10 17:49:19 2007
@@ -32,7 +32,8 @@
*/
public class SimpleTopicTest extends TestCase {
- private final Log log = LogFactory.getLog(getClass());
+ private static final Log LOG = LogFactory.getLog(SimpleTopicTest.class);
+
protected BrokerService broker;
// protected String
// bindAddress="tcp://localhost:61616?wireFormat.cacheEnabled=true&wireFormat.tightEncodingEnabled=true&jms.useAsyncSend=false";
@@ -66,8 +67,8 @@
Connection con = factory.createConnection();
Session session = con.createSession(false, Session.AUTO_ACKNOWLEDGE);
destination = createDestination(session, destinationName);
- log.info("Testing against destination: " + destination);
- log.info("Running " + numberofProducers + " producer(s) and " + numberOfConsumers + " consumer(s)");
+ LOG.info("Testing against destination: " + destination);
+ LOG.info("Running " + numberofProducers + " producer(s) and " + numberOfConsumers + " consumer(s)");
con.close();
producers = new PerfProducer[numberofProducers];
consumers = new PerfConsumer[numberOfConsumers];
@@ -139,7 +140,7 @@
for (int i = 0; i < numberofProducers; i++) {
producers[i].start();
}
- log.info("Sampling performance " + samepleCount + " times at a " + sampleInternal + " ms interval.");
+ LOG.info("Sampling performance " + samepleCount + " times at a " + sampleInternal + " ms interval.");
for (int i = 0; i < samepleCount; i++) {
Thread.sleep(sampleInternal);
dumpProducerRate();
@@ -162,7 +163,7 @@
totalCount += rate.getTotalCount();
}
int avgRate = totalRate / producers.length;
- log.info("Avg producer rate = " + avgRate + " msg/sec | Total rate = " + totalRate + ", sent = " + totalCount);
+ LOG.info("Avg producer rate = " + avgRate + " msg/sec | Total rate = " + totalRate + ", sent = " + totalCount);
}
protected void dumpConsumerRate() {
@@ -175,7 +176,7 @@
}
if (consumers != null && consumers.length > 0) {
int avgRate = totalRate / consumers.length;
- log.info("Avg consumer rate = " + avgRate + " msg/sec | Total rate = " + totalRate + ", received = " + totalCount);
+ LOG.info("Avg consumer rate = " + avgRate + " msg/sec | Total rate = " + totalRate + ", received = " + totalCount);
}
}
}
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/proxy/ProxyConnectorTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/proxy/ProxyConnectorTest.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/proxy/ProxyConnectorTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/proxy/ProxyConnectorTest.java Fri Aug 10 17:49:19 2007
@@ -29,6 +29,10 @@
public class ProxyConnectorTest extends ProxyTestSupport {
+ public ActiveMQDestination destination;
+ public byte destinationType;
+ public int deliveryMode;
+
public static Test suite() {
return suite(ProxyConnectorTest.class);
}
@@ -37,10 +41,6 @@
junit.textui.TestRunner.run(suite());
}
- public ActiveMQDestination destination;
- public byte destinationType;
- public int deliveryMode;
-
public void setUp() throws Exception {
super.setAutoFail(true);
super.setUp();
@@ -48,7 +48,7 @@
public void initCombosForTestSendAndConsume() {
addCombinationValues("deliveryMode", new Object[] {Integer.valueOf(DeliveryMode.NON_PERSISTENT), Integer.valueOf(DeliveryMode.PERSISTENT)});
- addCombinationValues("destinationType", new Object[] {Byte.valueOf(ActiveMQDestination.TOPIC_TYPE),});
+ addCombinationValues("destinationType", new Object[] {Byte.valueOf(ActiveMQDestination.TOPIC_TYPE)});
}
public void testSendAndConsume() throws Exception {
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/proxy/ProxyTestSupport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/proxy/ProxyTestSupport.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/proxy/ProxyTestSupport.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/proxy/ProxyTestSupport.java Fri Aug 10 17:49:19 2007
@@ -31,7 +31,7 @@
public class ProxyTestSupport extends BrokerTestSupport {
- protected ArrayList connections = new ArrayList();
+ protected ArrayList<StubConnection> connections = new ArrayList<StubConnection>();
protected TransportConnector connector;
@@ -79,8 +79,8 @@
}
protected void tearDown() throws Exception {
- for (Iterator iter = connections.iterator(); iter.hasNext();) {
- StubConnection connection = (StubConnection)iter.next();
+ for (Iterator<StubConnection> iter = connections.iterator(); iter.hasNext();) {
+ StubConnection connection = iter.next();
connection.stop();
iter.remove();
}
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/security/AuthorizationMapTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/security/AuthorizationMapTest.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/security/AuthorizationMapTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/security/AuthorizationMapTest.java Fri Aug 10 17:49:19 2007
@@ -61,7 +61,7 @@
protected AuthorizationMap createAuthorizationMap() {
DefaultAuthorizationMap answer = new DefaultAuthorizationMap();
- List entries = new ArrayList();
+ List<AuthorizationEntry> entries = new ArrayList<AuthorizationEntry>();
AuthorizationEntry entry = new AuthorizationEntry();
entry.setGroupClass("org.apache.activemq.jaas.GroupPrincipal");
@@ -91,7 +91,7 @@
protected AuthorizationMap createAuthorizationMapWithTempDest() {
DefaultAuthorizationMap answer = new DefaultAuthorizationMap();
- List entries = new ArrayList();
+ List<AuthorizationEntry> entries = new ArrayList<AuthorizationEntry>();
AuthorizationEntry entry = new AuthorizationEntry();
entry.setQueue(">");
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/security/JaasCertificateAuthenticationBrokerTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/security/JaasCertificateAuthenticationBrokerTest.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/security/JaasCertificateAuthenticationBrokerTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/security/JaasCertificateAuthenticationBrokerTest.java Fri Aug 10 17:49:19 2007
@@ -57,24 +57,24 @@
super.tearDown();
}
- private void setConfiguration(Set userNames, Set groupNames, boolean loginShouldSucceed) {
- HashMap configOptions = new HashMap();
+ private void setConfiguration(Set<String> userNames, Set<String> groupNames, boolean loginShouldSucceed) {
+ HashMap<String, String> configOptions = new HashMap<String, String>();
String userNamesString;
{
- Iterator iter = userNames.iterator();
- userNamesString = "" + (iter.hasNext() ? (String)iter.next() : "");
+ Iterator<String> iter = userNames.iterator();
+ userNamesString = "" + (iter.hasNext() ? iter.next() : "");
while (iter.hasNext()) {
- userNamesString += "," + (String)iter.next();
+ userNamesString += "," + iter.next();
}
}
String groupNamesString = "";
{
- Iterator iter = groupNames.iterator();
- groupNamesString = "" + (iter.hasNext() ? (String)iter.next() : "");
+ Iterator<String> iter = groupNames.iterator();
+ groupNamesString = "" + (iter.hasNext() ? iter.next() : "");
while (iter.hasNext()) {
- groupNamesString += "," + (String)iter.next();
+ groupNamesString += "," + iter.next();
}
}
@@ -92,10 +92,10 @@
public void testAddConnectionSuccess() {
String dnUserName = "dnUserName";
- HashSet userNames = new HashSet();
+ HashSet<String> userNames = new HashSet<String>();
userNames.add(dnUserName);
- HashSet groupNames = new HashSet();
+ HashSet<String> groupNames = new HashSet<String>();
groupNames.add("testGroup1");
groupNames.add("testGroup2");
groupNames.add("tesetGroup3");
@@ -147,9 +147,9 @@
}
public void testAddConnectionFailure() {
- HashSet userNames = new HashSet();
+ HashSet<String> userNames = new HashSet<String>();
- HashSet groupNames = new HashSet();
+ HashSet<String> groupNames = new HashSet<String>();
groupNames.add("testGroup1");
groupNames.add("testGroup2");
groupNames.add("tesetGroup3");
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/security/LDAPAuthorizationMapTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/security/LDAPAuthorizationMapTest.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/security/LDAPAuthorizationMapTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/security/LDAPAuthorizationMapTest.java Fri Aug 10 17:49:19 2007
@@ -72,7 +72,7 @@
public void testOpen() throws Exception {
DirContext ctx = authMap.open();
- HashSet set = new HashSet();
+ HashSet<String> set = new HashSet<String>();
NamingEnumeration list = ctx.list("ou=destinations,o=ActiveMQ,dc=example,dc=com");
while (list.hasMore()) {
NameClassPair ncp = (NameClassPair) list.next();
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/security/SecurityTestSupport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/security/SecurityTestSupport.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/security/SecurityTestSupport.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/security/SecurityTestSupport.java Fri Aug 10 17:49:19 2007
@@ -186,7 +186,7 @@
public void initCombosForTestUserReceiveFails() {
addCombinationValues("userName", new Object[] {"user"});
addCombinationValues("password", new Object[] {"password"});
- addCombinationValues("destination", new Object[] {new ActiveMQQueue("TEST"), new ActiveMQTopic("TEST"), new ActiveMQQueue("GUEST.BAR"), new ActiveMQTopic("GUEST.BAR"),});
+ addCombinationValues("destination", new Object[] {new ActiveMQQueue("TEST"), new ActiveMQTopic("TEST"), new ActiveMQQueue("GUEST.BAR"), new ActiveMQTopic("GUEST.BAR")});
}
/**
@@ -203,7 +203,7 @@
public void initCombosForTestUserReceiveSucceeds() {
addCombinationValues("userName", new Object[] {"user"});
addCombinationValues("password", new Object[] {"password"});
- addCombinationValues("destination", new Object[] {new ActiveMQQueue("USERS.FOO"), new ActiveMQTopic("USERS.FOO"),});
+ addCombinationValues("destination", new Object[] {new ActiveMQQueue("USERS.FOO"), new ActiveMQTopic("USERS.FOO")});
}
/**
@@ -212,7 +212,7 @@
public void initCombosForTestGuestReceiveSucceeds() {
addCombinationValues("userName", new Object[] {"guest"});
addCombinationValues("password", new Object[] {"password"});
- addCombinationValues("destination", new Object[] {new ActiveMQQueue("GUEST.BAR"), new ActiveMQTopic("GUEST.BAR"),});
+ addCombinationValues("destination", new Object[] {new ActiveMQQueue("GUEST.BAR"), new ActiveMQTopic("GUEST.BAR")});
}
/**
@@ -221,7 +221,7 @@
public void initCombosForTestGuestReceiveFails() {
addCombinationValues("userName", new Object[] {"guest"});
addCombinationValues("password", new Object[] {"password"});
- addCombinationValues("destination", new Object[] {new ActiveMQQueue("TEST"), new ActiveMQTopic("TEST"), new ActiveMQQueue("USERS.FOO"), new ActiveMQTopic("USERS.FOO"),});
+ addCombinationValues("destination", new Object[] {new ActiveMQQueue("TEST"), new ActiveMQTopic("TEST"), new ActiveMQQueue("USERS.FOO"), new ActiveMQTopic("USERS.FOO") });
}
/**
@@ -231,7 +231,7 @@
addCombinationValues("userName", new Object[] {"user"});
addCombinationValues("password", new Object[] {"password"});
addCombinationValues("destination", new Object[] {new ActiveMQQueue("USERS.FOO"), new ActiveMQQueue("GUEST.BAR"), new ActiveMQTopic("USERS.FOO"),
- new ActiveMQTopic("GUEST.BAR"),});
+ new ActiveMQTopic("GUEST.BAR")});
}
/**
@@ -240,7 +240,7 @@
public void initCombosForTestUserSendFails() {
addCombinationValues("userName", new Object[] {"user"});
addCombinationValues("password", new Object[] {"password"});
- addCombinationValues("destination", new Object[] {new ActiveMQQueue("TEST"), new ActiveMQTopic("TEST"),});
+ addCombinationValues("destination", new Object[] {new ActiveMQQueue("TEST"), new ActiveMQTopic("TEST")});
}
/**
@@ -258,6 +258,6 @@
public void initCombosForTestGuestSendSucceeds() {
addCombinationValues("userName", new Object[] {"guest"});
addCombinationValues("password", new Object[] {"password"});
- addCombinationValues("destination", new Object[] {new ActiveMQQueue("GUEST.BAR"), new ActiveMQTopic("GUEST.BAR"),});
+ addCombinationValues("destination", new Object[] {new ActiveMQQueue("GUEST.BAR"), new ActiveMQTopic("GUEST.BAR")});
}
}
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/security/SimpleSecurityBrokerSystemTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/security/SimpleSecurityBrokerSystemTest.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/security/SimpleSecurityBrokerSystemTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/security/SimpleSecurityBrokerSystemTest.java Fri Aug 10 17:49:19 2007
@@ -41,11 +41,11 @@
* @version $Revision$
*/
public class SimpleSecurityBrokerSystemTest extends SecurityTestSupport {
- private static final Log LOG = LogFactory.getLog(SimpleSecurityBrokerSystemTest.class);
static final GroupPrincipal GUESTS = new GroupPrincipal("guests");
static final GroupPrincipal USERS = new GroupPrincipal("users");
static final GroupPrincipal ADMINS = new GroupPrincipal("admins");
+ private static final Log LOG = LogFactory.getLog(SimpleSecurityBrokerSystemTest.class);
public BrokerPlugin authorizationPlugin;
public BrokerPlugin authenticationPlugin;
@@ -108,15 +108,15 @@
static class SimpleAuthenticationFactory implements BrokerPlugin {
public Broker installPlugin(Broker broker) {
- HashMap u = new HashMap();
+ HashMap<String, String> u = new HashMap<String, String>();
u.put("system", "manager");
u.put("user", "password");
u.put("guest", "password");
- HashMap groups = new HashMap();
- groups.put("system", new HashSet(Arrays.asList(new Object[] {ADMINS, USERS})));
- groups.put("user", new HashSet(Arrays.asList(new Object[] {USERS})));
- groups.put("guest", new HashSet(Arrays.asList(new Object[] {GUESTS})));
+ HashMap<String, HashSet<Object>> groups = new HashMap<String, HashSet<Object>>();
+ groups.put("system", new HashSet<Object>(Arrays.asList(new Object[] {ADMINS, USERS})));
+ groups.put("user", new HashSet<Object>(Arrays.asList(new Object[] {USERS})));
+ groups.put("guest", new HashSet<Object>(Arrays.asList(new Object[] {GUESTS})));
return new SimpleAuthenticationBroker(broker, u, groups);
}
@@ -130,8 +130,10 @@
* @see {@link CombinationTestSupport}
*/
public void initCombos() {
- addCombinationValues("authorizationPlugin", new Object[] {new AuthorizationPlugin(createAuthorizationMap()),});
- addCombinationValues("authenticationPlugin", new Object[] {new SimpleAuthenticationFactory(), new JaasAuthenticationPlugin(),});
+ addCombinationValues("authorizationPlugin",
+ new Object[] {new AuthorizationPlugin(createAuthorizationMap())});
+ addCombinationValues("authenticationPlugin", new Object[] {new SimpleAuthenticationFactory(),
+ new JaasAuthenticationPlugin()});
}
protected BrokerService createBroker() throws Exception {
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/security/StubSecurityContext.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/security/StubSecurityContext.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/security/StubSecurityContext.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/security/StubSecurityContext.java Fri Aug 10 17:49:19 2007
@@ -24,7 +24,7 @@
super("");
}
- public Set getPrincipals() {
+ public Set<?> getPrincipals() {
return null;
}
}
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/spring/ConsumerBean.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/spring/ConsumerBean.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/spring/ConsumerBean.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/spring/ConsumerBean.java Fri Aug 10 17:49:19 2007
@@ -28,7 +28,7 @@
public class ConsumerBean extends Assert implements MessageListener {
private static final Log LOG = LogFactory.getLog(ConsumerBean.class);
- private List messages = new ArrayList();
+ private List<Message> messages = new ArrayList<Message>();
private Object semaphore;
private boolean verbose;
@@ -51,8 +51,8 @@
/**
* @return all the messages on the list so far, clearing the buffer
*/
- public synchronized List flushMessages() {
- List answer = new ArrayList(messages);
+ public synchronized List<Message> flushMessages() {
+ List<Message> answer = new ArrayList<Message>(messages);
messages.clear();
return answer;
}