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 [6/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/main/java/org/apache/activemq/util/TypeConversionSupport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/TypeConversionSupport.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/TypeConversionSupport.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/TypeConversionSupport.java Fri Aug 10 17:49:19 2007
@@ -21,7 +21,7 @@
import org.apache.activemq.command.ActiveMQDestination;
-public class TypeConversionSupport {
+public final class TypeConversionSupport {
static class ConversionKey {
final Class from;
@@ -35,7 +35,7 @@
}
public boolean equals(Object o) {
- ConversionKey x = (ConversionKey) o;
+ ConversionKey x = (ConversionKey)o;
return x.from == from && x.to == to;
}
@@ -48,7 +48,7 @@
Object convert(Object value);
}
- private static final HashMap CONVERSION_MAP = new HashMap();
+ private static final HashMap<ConversionKey, Converter> CONVERSION_MAP = new HashMap<ConversionKey, Converter>();
static {
Converter toStringConverter = new Converter() {
public Object convert(Object value) {
@@ -65,43 +65,43 @@
CONVERSION_MAP.put(new ConversionKey(String.class, Boolean.class), new Converter() {
public Object convert(Object value) {
- return Boolean.valueOf((String) value);
+ return Boolean.valueOf((String)value);
}
});
CONVERSION_MAP.put(new ConversionKey(String.class, Byte.class), new Converter() {
public Object convert(Object value) {
- return Byte.valueOf((String) value);
+ return Byte.valueOf((String)value);
}
});
CONVERSION_MAP.put(new ConversionKey(String.class, Short.class), new Converter() {
public Object convert(Object value) {
- return Short.valueOf((String) value);
+ return Short.valueOf((String)value);
}
});
CONVERSION_MAP.put(new ConversionKey(String.class, Integer.class), new Converter() {
public Object convert(Object value) {
- return Integer.valueOf((String) value);
+ return Integer.valueOf((String)value);
}
});
CONVERSION_MAP.put(new ConversionKey(String.class, Long.class), new Converter() {
public Object convert(Object value) {
- return Long.valueOf((String) value);
+ return Long.valueOf((String)value);
}
});
CONVERSION_MAP.put(new ConversionKey(String.class, Float.class), new Converter() {
public Object convert(Object value) {
- return Float.valueOf((String) value);
+ return Float.valueOf((String)value);
}
});
CONVERSION_MAP.put(new ConversionKey(String.class, Double.class), new Converter() {
public Object convert(Object value) {
- return Double.valueOf((String) value);
+ return Double.valueOf((String)value);
}
});
Converter longConverter = new Converter() {
public Object convert(Object value) {
- return Long.valueOf(((Number) value).longValue());
+ return Long.valueOf(((Number)value).longValue());
}
};
CONVERSION_MAP.put(new ConversionKey(Byte.class, Long.class), longConverter);
@@ -109,13 +109,13 @@
CONVERSION_MAP.put(new ConversionKey(Integer.class, Long.class), longConverter);
CONVERSION_MAP.put(new ConversionKey(Date.class, Long.class), new Converter() {
public Object convert(Object value) {
- return Long.valueOf(((Date) value).getTime());
+ return Long.valueOf(((Date)value).getTime());
}
});
Converter intConverter = new Converter() {
public Object convert(Object value) {
- return Integer.valueOf(((Number) value).intValue());
+ return Integer.valueOf(((Number)value).intValue());
}
};
CONVERSION_MAP.put(new ConversionKey(Byte.class, Integer.class), intConverter);
@@ -123,22 +123,25 @@
CONVERSION_MAP.put(new ConversionKey(Byte.class, Short.class), new Converter() {
public Object convert(Object value) {
- return Short.valueOf(((Number) value).shortValue());
+ return Short.valueOf(((Number)value).shortValue());
}
});
-
+
CONVERSION_MAP.put(new ConversionKey(Float.class, Double.class), new Converter() {
public Object convert(Object value) {
- return new Double(((Number) value).doubleValue());
+ return new Double(((Number)value).doubleValue());
}
});
CONVERSION_MAP.put(new ConversionKey(String.class, ActiveMQDestination.class), new Converter() {
public Object convert(Object value) {
- return ActiveMQDestination.createDestination((String) value, ActiveMQDestination.QUEUE_TYPE);
+ return ActiveMQDestination.createDestination((String)value, ActiveMQDestination.QUEUE_TYPE);
}
});
}
+ private TypeConversionSupport() {
+ }
+
public static Object convert(Object value, Class clazz) {
assert value != null && clazz != null;
@@ -147,7 +150,7 @@
return value;
}
- Converter c = (Converter) CONVERSION_MAP.get(new ConversionKey(value.getClass(), clazz));
+ Converter c = CONVERSION_MAP.get(new ConversionKey(value.getClass(), clazz));
if (c == null) {
return null;
}
Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/URISupport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/URISupport.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/URISupport.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/URISupport.java Fri Aug 10 17:49:19 2007
@@ -123,8 +123,13 @@
}
}
- public static Map<String,String> parseParamters(URI uri) throws URISyntaxException {
- return uri.getQuery() == null ? Collections.EMPTY_MAP : parseQuery(stripPrefix(uri.getQuery(), "?"));
+ public static Map<String, String> parseParamters(URI uri) throws URISyntaxException {
+ return uri.getQuery() == null ? emptyMap() : parseQuery(stripPrefix(uri.getQuery(), "?"));
+ }
+
+ @SuppressWarnings("unchecked")
+ private static Map<String, String> emptyMap() {
+ return Collections.EMPTY_MAP;
}
/**
@@ -138,7 +143,8 @@
* Creates a URI with the given query
*/
public static URI createURIWithQuery(URI uri, String query) throws URISyntaxException {
- return new URI(uri.getScheme(), uri.getUserInfo(), uri.getHost(), uri.getPort(), uri.getPath(), query, uri.getFragment());
+ return new URI(uri.getScheme(), uri.getUserInfo(), uri.getHost(), uri.getPort(), uri.getPath(),
+ query, uri.getFragment());
}
public static CompositeData parseComposite(URI uri) throws URISyntaxException {
@@ -202,7 +208,7 @@
if (params.length() > 0) {
rc.path = stripPrefix(params, "/");
}
- rc.parameters = Collections.EMPTY_MAP;
+ rc.parameters = emptyMap();
}
}
@@ -296,7 +302,8 @@
}
public static URI changeScheme(URI bindAddr, String scheme) throws URISyntaxException {
- return new URI(scheme, bindAddr.getUserInfo(), bindAddr.getHost(), bindAddr.getPort(), bindAddr.getPath(), bindAddr.getQuery(), bindAddr.getFragment());
+ return new URI(scheme, bindAddr.getUserInfo(), bindAddr.getHost(), bindAddr.getPort(), bindAddr
+ .getPath(), bindAddr.getQuery(), bindAddr.getFragment());
}
public static boolean checkParenthesis(String str) {
Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/xbean/BrokerFactoryBean.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/xbean/BrokerFactoryBean.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/xbean/BrokerFactoryBean.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/xbean/BrokerFactoryBean.java Fri Aug 10 17:49:19 2007
@@ -41,7 +41,6 @@
* @version $Revision: 1.1 $
*/
public class BrokerFactoryBean implements FactoryBean, InitializingBean, DisposableBean, ApplicationContextAware {
- private static final Log LOG = LogFactory.getLog(BrokerFactoryBean.class);
static {
PropertyEditorManager.registerEditor(URI.class, URIEditor.class);
Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/xbean/PooledBrokerFactoryBean.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/xbean/PooledBrokerFactoryBean.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/xbean/PooledBrokerFactoryBean.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/xbean/PooledBrokerFactoryBean.java Fri Aug 10 17:49:19 2007
@@ -34,7 +34,7 @@
*/
public class PooledBrokerFactoryBean implements FactoryBean, InitializingBean, DisposableBean {
- static final HashMap SHARED_BROKER_MAP = new HashMap();
+ static final HashMap<String, SharedBroker> SHARED_BROKER_MAP = new HashMap<String, SharedBroker>();
private boolean start;
private Resource config;
@@ -46,7 +46,7 @@
public void afterPropertiesSet() throws Exception {
synchronized (SHARED_BROKER_MAP) {
- SharedBroker sharedBroker = (SharedBroker)SHARED_BROKER_MAP.get(config.getFilename());
+ SharedBroker sharedBroker = SHARED_BROKER_MAP.get(config.getFilename());
if (sharedBroker == null) {
sharedBroker = new SharedBroker();
sharedBroker.factory = new BrokerFactoryBean();
@@ -61,7 +61,7 @@
public void destroy() throws Exception {
synchronized (SHARED_BROKER_MAP) {
- SharedBroker sharedBroker = (SharedBroker)SHARED_BROKER_MAP.get(config.getFilename());
+ SharedBroker sharedBroker = SHARED_BROKER_MAP.get(config.getFilename());
if (sharedBroker != null) {
sharedBroker.refCount--;
if (sharedBroker.refCount == 0) {
@@ -78,7 +78,7 @@
public Object getObject() throws Exception {
synchronized (SHARED_BROKER_MAP) {
- SharedBroker sharedBroker = (SharedBroker)SHARED_BROKER_MAP.get(config.getFilename());
+ SharedBroker sharedBroker = SHARED_BROKER_MAP.get(config.getFilename());
if (sharedBroker != null) {
return sharedBroker.factory.getObject();
}
@@ -86,7 +86,7 @@
return null;
}
- public Class getObjectType() {
+ public Class<BrokerService> getObjectType() {
return BrokerService.class;
}
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/AMQDeadlockTest3.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/AMQDeadlockTest3.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/AMQDeadlockTest3.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/AMQDeadlockTest3.java Fri Aug 10 17:49:19 2007
@@ -18,6 +18,7 @@
import java.net.URI;
import java.util.ArrayList;
+import java.util.List;
import java.util.Random;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
@@ -241,7 +242,7 @@
memoryManager.setLimit(5000000);
brokerService.setMemoryManager(memoryManager);
- final ArrayList policyEntries = new ArrayList();
+ final List<PolicyEntry> policyEntries = new ArrayList<PolicyEntry>();
final PolicyEntry entry = new PolicyEntry();
entry.setQueue(">");
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/ActiveMQMessageAuditTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/ActiveMQMessageAuditTest.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/ActiveMQMessageAuditTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/ActiveMQMessageAuditTest.java Fri Aug 10 17:49:19 2007
@@ -32,6 +32,16 @@
*/
public class ActiveMQMessageAuditTest extends TestCase {
+
+ /**
+ * Constructor for ActiveMQMessageAuditTest.
+ *
+ * @param name
+ */
+ public ActiveMQMessageAuditTest(String name) {
+ super(name);
+ }
+
public static void main(String[] args) {
}
@@ -41,15 +51,6 @@
protected void tearDown() throws Exception {
super.tearDown();
- }
-
- /**
- * Constructor for ActiveMQMessageAuditTest.
- *
- * @param arg0
- */
- public ActiveMQMessageAuditTest(String arg0) {
- super(arg0);
}
/**
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/CombinationTestSupport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/CombinationTestSupport.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/CombinationTestSupport.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/CombinationTestSupport.java Fri Aug 10 17:49:19 2007
@@ -62,22 +62,22 @@
private static final Log LOG = LogFactory.getLog(CombinationTestSupport.class);
- private HashMap comboOptions = new HashMap();
+ private HashMap<String, ComboOption> comboOptions = new HashMap<String, ComboOption>();
private boolean combosEvaluated;
private Map options;
static class ComboOption {
final String attribute;
- final LinkedHashSet values = new LinkedHashSet();
+ final LinkedHashSet<Object> values = new LinkedHashSet<Object>();
- public ComboOption(String attribute, Collection options) {
+ public ComboOption(String attribute, Collection<Object> options) {
this.attribute = attribute;
this.values.addAll(options);
}
}
public void addCombinationValues(String attribute, Object[] options) {
- ComboOption co = (ComboOption)this.comboOptions.get(attribute);
+ ComboOption co = this.comboOptions.get(attribute);
if (co == null) {
this.comboOptions.put(attribute, new ComboOption(attribute, Arrays.asList(options)));
} else {
@@ -129,20 +129,20 @@
}
try {
- ArrayList expandedOptions = new ArrayList();
- expandCombinations(new ArrayList(comboOptions.values()), expandedOptions);
+ ArrayList<HashMap<String, Object>> expandedOptions = new ArrayList<HashMap<String, Object>>();
+ expandCombinations(new ArrayList<ComboOption>(comboOptions.values()), expandedOptions);
if (expandedOptions.isEmpty()) {
combosEvaluated = true;
return new CombinationTestSupport[] {this};
} else {
- ArrayList result = new ArrayList();
+ ArrayList<CombinationTestSupport> result = new ArrayList<CombinationTestSupport>();
// Run the test case for each possible combination
- for (Iterator iter = expandedOptions.iterator(); iter.hasNext();) {
+ for (Iterator<HashMap<String, Object>> iter = expandedOptions.iterator(); iter.hasNext();) {
CombinationTestSupport combo = (CombinationTestSupport)TestSuite.createTest(getClass(), name);
combo.combosEvaluated = true;
- combo.setOptions((Map)iter.next());
+ combo.setOptions(iter.next());
result.add(combo);
}
@@ -157,23 +157,23 @@
}
- private void expandCombinations(List optionsLeft, List expandedCombos) {
+ private void expandCombinations(List<ComboOption> optionsLeft, List<HashMap<String, Object>> expandedCombos) {
if (!optionsLeft.isEmpty()) {
- HashMap map;
+ HashMap<String, Object> map;
if (comboOptions.size() == optionsLeft.size()) {
- map = new HashMap();
+ map = new HashMap<String, Object>();
expandedCombos.add(map);
} else {
- map = (HashMap)expandedCombos.get(expandedCombos.size() - 1);
+ map = expandedCombos.get(expandedCombos.size() - 1);
}
- LinkedList l = new LinkedList(optionsLeft);
- ComboOption comboOption = (ComboOption)l.removeLast();
+ LinkedList<ComboOption> l = new LinkedList<ComboOption>(optionsLeft);
+ ComboOption comboOption = l.removeLast();
int i = 0;
- for (Iterator iter = comboOption.values.iterator(); iter.hasNext();) {
- Object value = (Object)iter.next();
+ for (Iterator<Object> iter = comboOption.values.iterator(); iter.hasNext();) {
+ Object value = iter.next();
if (i != 0) {
- map = new HashMap(map);
+ map = new HashMap<String, Object>(map);
expandedCombos.add(map);
}
map.put(comboOption.attribute, value);
@@ -183,10 +183,10 @@
}
}
- public static Test suite(Class clazz) {
+ public static Test suite(Class<? extends CombinationTestSupport> clazz) {
TestSuite suite = new TestSuite();
- ArrayList names = new ArrayList();
+ ArrayList<String> names = new ArrayList<String>();
Method[] methods = clazz.getMethods();
for (int i = 0; i < methods.length; i++) {
String name = methods[i].getName();
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/ConnectionCleanupTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/ConnectionCleanupTest.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/ConnectionCleanupTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/ConnectionCleanupTest.java Fri Aug 10 17:49:19 2007
@@ -46,7 +46,7 @@
public void testChangeClientID() throws JMSException {
connection.setClientID("test");
- Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
try {
connection.setClientID("test");
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/EmbeddedBrokerTestSupport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/EmbeddedBrokerTestSupport.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/EmbeddedBrokerTestSupport.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/EmbeddedBrokerTestSupport.java Fri Aug 10 17:49:19 2007
@@ -37,8 +37,6 @@
*/
public abstract class EmbeddedBrokerTestSupport extends TestCase {
- private static final Log LOG = LogFactory.getLog(EmbeddedBrokerTestSupport.class);
-
protected BrokerService broker;
// protected String bindAddress = "tcp://localhost:61616";
protected String bindAddress = "vm://localhost";
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JMSConsumerTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JMSConsumerTest.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JMSConsumerTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JMSConsumerTest.java Fri Aug 10 17:49:19 2007
@@ -33,6 +33,8 @@
import junit.framework.Test;
import org.apache.activemq.command.ActiveMQDestination;
import org.apache.activemq.command.ActiveMQQueue;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
/**
* Test cases used to test the JMS message consumer.
@@ -41,7 +43,7 @@
*/
public class JMSConsumerTest extends JmsTestSupport {
- private static final org.apache.commons.logging.Log LOG = org.apache.commons.logging.LogFactory.getLog(JMSConsumerTest.class);
+ private static final Log LOG = LogFactory.getLog(JMSConsumerTest.class);
public ActiveMQDestination destination;
public int deliveryMode;
@@ -487,7 +489,7 @@
ActiveMQConnection connection2 = (ActiveMQConnection)factory.createConnection();
connections.add(connection2);
Session session2 = connection2.createSession(true, 0);
- MessageConsumer consumer2 = session2.createConsumer(destination);
+ session2.createConsumer(destination);
// Only pick up the 2nd messages.
Message message2 = consumer.receive(1000);
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JMSDurableTopicRedeliverTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JMSDurableTopicRedeliverTest.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JMSDurableTopicRedeliverTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JMSDurableTopicRedeliverTest.java Fri Aug 10 17:49:19 2007
@@ -20,12 +20,15 @@
import javax.jms.Session;
import javax.jms.TextMessage;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
/**
* @version $Revision: 1.4 $
*/
public class JMSDurableTopicRedeliverTest extends JmsTopicRedeliverTest {
- private static final org.apache.commons.logging.Log LOG = org.apache.commons.logging.LogFactory.getLog(JMSDurableTopicRedeliverTest.class);
+ private static final Log LOG = LogFactory.getLog(JMSDurableTopicRedeliverTest.class);
protected void setUp() throws Exception {
durable = true;
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JMSExclusiveConsumerTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JMSExclusiveConsumerTest.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JMSExclusiveConsumerTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JMSExclusiveConsumerTest.java Fri Aug 10 17:49:19 2007
@@ -23,7 +23,6 @@
import javax.jms.Session;
import junit.framework.Test;
-
import org.apache.activemq.command.ActiveMQQueue;
/**
@@ -33,6 +32,8 @@
*/
public class JMSExclusiveConsumerTest extends JmsTestSupport {
+ public int deliveryMode;
+
public static Test suite() {
return suite(JMSExclusiveConsumerTest.class);
}
@@ -40,8 +41,6 @@
public static void main(String[] args) {
junit.textui.TestRunner.run(suite());
}
-
- public int deliveryMode;
public void initCombosForTestRoundRobinDispatchOnNonExclusive() {
addCombinationValues("deliveryMode", new Object[] {Integer.valueOf(DeliveryMode.NON_PERSISTENT), Integer.valueOf(DeliveryMode.PERSISTENT)});
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JMSMessageTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JMSMessageTest.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JMSMessageTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JMSMessageTest.java Fri Aug 10 17:49:19 2007
@@ -258,18 +258,19 @@
static class ForeignMessage implements TextMessage {
+ public int deliveryMode;
+
private String messageId;
private long timestamp;
private String correlationId;
private Destination replyTo;
private Destination destination;
- public int deliveryMode;
private boolean redelivered;
private String type;
private long expiration;
private int priority;
private String text;
- HashMap props = new HashMap();
+ private HashMap<String, Object> props = new HashMap<String, Object>();
public String getJMSMessageID() throws JMSException {
return messageId;
@@ -402,7 +403,7 @@
}
public Enumeration getPropertyNames() throws JMSException {
- return new Vector(props.keySet()).elements();
+ return new Vector<String>(props.keySet()).elements();
}
public void setBooleanProperty(String arg0, boolean arg1) throws JMSException {
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JMSUsecaseTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JMSUsecaseTest.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JMSUsecaseTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JMSUsecaseTest.java Fri Aug 10 17:49:19 2007
@@ -34,6 +34,12 @@
public class JMSUsecaseTest extends JmsTestSupport {
+ public ActiveMQDestination destination;
+ public int deliveryMode;
+ public int prefetch;
+ public byte destinationType;
+ public boolean durableConsumer;
+
public static Test suite() {
return suite(JMSUsecaseTest.class);
}
@@ -41,12 +47,6 @@
public static void main(String[] args) {
junit.textui.TestRunner.run(suite());
}
-
- public ActiveMQDestination destination;
- public int deliveryMode;
- public int prefetch;
- public byte destinationType;
- public boolean durableConsumer;
public void initCombosForTestQueueBrowser() {
addCombinationValues("deliveryMode", new Object[] {Integer.valueOf(DeliveryMode.NON_PERSISTENT), Integer.valueOf(DeliveryMode.PERSISTENT)});
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsBenchmark.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsBenchmark.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsBenchmark.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsBenchmark.java Fri Aug 10 17:49:19 2007
@@ -176,7 +176,6 @@
LOG.info("Starting sample: " + SAMPLES + " each lasting " + (SAMPLE_DURATION / 1000.0f) + " seconds");
- long now = System.currentTimeMillis();
for (int i = 0; i < SAMPLES; i++) {
long start = System.currentTimeMillis();
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsCreateConsumerInOnMessageTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsCreateConsumerInOnMessageTest.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsCreateConsumerInOnMessageTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsCreateConsumerInOnMessageTest.java Fri Aug 10 17:49:19 2007
@@ -87,7 +87,7 @@
public void onMessage(Message message) {
try {
testConsumer = consumerSession.createConsumer(topic);
- MessageProducer anotherProducer = consumerSession.createProducer(topic);
+ consumerSession.createProducer(topic);
synchronized (lock) {
lock.notify();
}
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsDurableTopicSendReceiveTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsDurableTopicSendReceiveTest.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsDurableTopicSendReceiveTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsDurableTopicSendReceiveTest.java Fri Aug 10 17:49:19 2007
@@ -26,12 +26,14 @@
import javax.jms.Topic;
import org.apache.activemq.test.JmsTopicSendReceiveTest;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
/**
* @version $Revision: 1.5 $
*/
public class JmsDurableTopicSendReceiveTest extends JmsTopicSendReceiveTest {
- private static final org.apache.commons.logging.Log LOG = org.apache.commons.logging.LogFactory.getLog(JmsDurableTopicSendReceiveTest.class);
+ private static final Log LOG = LogFactory.getLog(JmsDurableTopicSendReceiveTest.class);
protected Connection connection2;
protected Session session2;
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsDurableTopicWildcardSendReceiveTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsDurableTopicWildcardSendReceiveTest.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsDurableTopicWildcardSendReceiveTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsDurableTopicWildcardSendReceiveTest.java Fri Aug 10 17:49:19 2007
@@ -20,14 +20,14 @@
import org.apache.activemq.test.JmsTopicSendReceiveTest;
-
/**
* @version $Revision: 1.2 $
*/
public class JmsDurableTopicWildcardSendReceiveTest extends JmsTopicSendReceiveTest {
/**
- * Sets up a test with a topic destination, durable suscriber and persistent delivery mode.
+ * Sets up a test with a topic destination, durable suscriber and persistent
+ * delivery mode.
*
* @see junit.framework.TestCase#setUp()
*/
@@ -37,18 +37,18 @@
deliveryMode = DeliveryMode.PERSISTENT;
super.setUp();
}
-
+
/**
- * Returns the consumer subject.
+ * Returns the consumer subject.
*/
- protected String getConsumerSubject(){
+ protected String getConsumerSubject() {
return "FOO.>";
}
-
+
/**
- * Returns the producer subject.
+ * Returns the producer subject.
*/
- protected String getProducerSubject(){
+ protected String getProducerSubject() {
return "FOO.BAR.HUMBUG";
}
}
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsMultipleClientsTestSupport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsMultipleClientsTestSupport.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsMultipleClientsTestSupport.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsMultipleClientsTestSupport.java Fri Aug 10 17:49:19 2007
@@ -51,9 +51,8 @@
* @version $Revision$
*/
public class JmsMultipleClientsTestSupport extends CombinationTestSupport {
- private AtomicInteger producerLock;
- protected Map consumers = new HashMap(); // Map of consumer with messages
+ protected Map<MessageConsumer, MessageIdList> consumers = new HashMap<MessageConsumer, MessageIdList>(); // Map of consumer with messages
// received
protected int consumerCount = 1;
protected int producerCount = 1;
@@ -67,9 +66,11 @@
protected BrokerService broker;
protected Destination destination;
- protected List connections = Collections.synchronizedList(new ArrayList());
+ protected List<Connection> connections = Collections.synchronizedList(new ArrayList<Connection>());
protected MessageIdList allMessagesList = new MessageIdList();
+ private AtomicInteger producerLock;
+
protected void startProducers(Destination dest, int msgCount) throws Exception {
startProducers(createConnectionFactory(), dest, msgCount);
}
@@ -219,8 +220,8 @@
}
protected void tearDown() throws Exception {
- for (Iterator iter = connections.iterator(); iter.hasNext();) {
- Connection conn = (Connection)iter.next();
+ for (Iterator<Connection> iter = connections.iterator(); iter.hasNext();) {
+ Connection conn = iter.next();
try {
conn.close();
} catch (Throwable e) {
@@ -236,35 +237,35 @@
* Some helpful assertions for multiple consumers.
*/
protected void assertConsumerReceivedAtLeastXMessages(MessageConsumer consumer, int msgCount) {
- MessageIdList messageIdList = (MessageIdList)consumers.get(consumer);
+ MessageIdList messageIdList = consumers.get(consumer);
messageIdList.assertAtLeastMessagesReceived(msgCount);
}
protected void assertConsumerReceivedAtMostXMessages(MessageConsumer consumer, int msgCount) {
- MessageIdList messageIdList = (MessageIdList)consumers.get(consumer);
+ MessageIdList messageIdList = consumers.get(consumer);
messageIdList.assertAtMostMessagesReceived(msgCount);
}
protected void assertConsumerReceivedXMessages(MessageConsumer consumer, int msgCount) {
- MessageIdList messageIdList = (MessageIdList)consumers.get(consumer);
+ MessageIdList messageIdList = consumers.get(consumer);
messageIdList.assertMessagesReceivedNoWait(msgCount);
}
protected void assertEachConsumerReceivedAtLeastXMessages(int msgCount) {
- for (Iterator i = consumers.keySet().iterator(); i.hasNext();) {
- assertConsumerReceivedAtLeastXMessages((MessageConsumer)i.next(), msgCount);
+ for (Iterator<MessageConsumer> i = consumers.keySet().iterator(); i.hasNext();) {
+ assertConsumerReceivedAtLeastXMessages(i.next(), msgCount);
}
}
protected void assertEachConsumerReceivedAtMostXMessages(int msgCount) {
- for (Iterator i = consumers.keySet().iterator(); i.hasNext();) {
- assertConsumerReceivedAtMostXMessages((MessageConsumer)i.next(), msgCount);
+ for (Iterator<MessageConsumer> i = consumers.keySet().iterator(); i.hasNext();) {
+ assertConsumerReceivedAtMostXMessages(i.next(), msgCount);
}
}
protected void assertEachConsumerReceivedXMessages(int msgCount) {
- for (Iterator i = consumers.keySet().iterator(); i.hasNext();) {
- assertConsumerReceivedXMessages((MessageConsumer)i.next(), msgCount);
+ for (Iterator<MessageConsumer> i = consumers.keySet().iterator(); i.hasNext();) {
+ assertConsumerReceivedXMessages(i.next(), msgCount);
}
}
@@ -273,8 +274,8 @@
// now lets count the individual messages received
int totalMsg = 0;
- for (Iterator i = consumers.keySet().iterator(); i.hasNext();) {
- MessageIdList messageIdList = (MessageIdList)consumers.get(i.next());
+ for (Iterator<MessageConsumer> i = consumers.keySet().iterator(); i.hasNext();) {
+ MessageIdList messageIdList = consumers.get(i.next());
totalMsg += messageIdList.getMessageCount();
}
assertEquals("Total of consumers message count", msgCount, totalMsg);
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsQueueSendReceiveTwoConnectionsStartBeforeBrokerTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsQueueSendReceiveTwoConnectionsStartBeforeBrokerTest.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsQueueSendReceiveTwoConnectionsStartBeforeBrokerTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsQueueSendReceiveTwoConnectionsStartBeforeBrokerTest.java Fri Aug 10 17:49:19 2007
@@ -29,7 +29,7 @@
public class JmsQueueSendReceiveTwoConnectionsStartBeforeBrokerTest extends JmsQueueSendReceiveTwoConnectionsTest {
private static final Log LOG = LogFactory.getLog(JmsQueueSendReceiveTwoConnectionsStartBeforeBrokerTest.class);
- private Queue errors = new ConcurrentLinkedQueue();
+ private Queue<Exception> errors = new ConcurrentLinkedQueue<Exception>();
private int delayBeforeStartingBroker = 1000;
private BrokerService broker;
@@ -77,7 +77,7 @@
broker.stop();
}
if (!errors.isEmpty()) {
- Exception e = (Exception)errors.remove();
+ Exception e = errors.remove();
throw e;
}
}
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsQueueSendReceiveTwoConnectionsTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsQueueSendReceiveTwoConnectionsTest.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsQueueSendReceiveTwoConnectionsTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsQueueSendReceiveTwoConnectionsTest.java Fri Aug 10 17:49:19 2007
@@ -25,8 +25,6 @@
*/
public class JmsQueueSendReceiveTwoConnectionsTest extends JmsTopicSendReceiveWithTwoConnectionsTest {
- private static final Log LOG = LogFactory.getLog(JmsQueueSendReceiveTwoConnectionsTest.class);
-
/**
* Set up the test with a queue and using two connections.
*
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsQueueTransactionTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsQueueTransactionTest.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsQueueTransactionTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsQueueTransactionTest.java Fri Aug 10 17:49:19 2007
@@ -28,12 +28,14 @@
import javax.jms.TextMessage;
import org.apache.activemq.test.JmsResourceProvider;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
/**
* @version $Revision: 1.2 $
*/
public class JmsQueueTransactionTest extends JmsTransactionTestSupport {
- private static final org.apache.commons.logging.Log LOG = org.apache.commons.logging.LogFactory.getLog(JmsQueueTransactionTest.class);
+ private static final Log LOG = LogFactory.getLog(JmsQueueTransactionTest.class);
/**
* @see org.apache.activemq.JmsTransactionTestSupport#getJmsResourceProvider()
@@ -65,7 +67,7 @@
LOG.info("Sent 0: " + outbound[0]);
LOG.info("Sent 1: " + outbound[1]);
- ArrayList messages = new ArrayList();
+ ArrayList<Message> messages = new ArrayList<Message>();
Message message = consumer.receive(1000);
assertEquals(outbound[0], message);
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsSendReceiveTestSupport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsSendReceiveTestSupport.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsSendReceiveTestSupport.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsSendReceiveTestSupport.java Fri Aug 10 17:49:19 2007
@@ -33,11 +33,14 @@
import javax.jms.Session;
import javax.jms.TextMessage;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
/**
* @version $Revision: 1.7 $
*/
public class JmsSendReceiveTestSupport extends TestSupport implements MessageListener {
- private static final org.apache.commons.logging.Log LOG = org.apache.commons.logging.LogFactory.getLog(JmsSendReceiveTestSupport.class);
+ private static final Log LOG = LogFactory.getLog(JmsSendReceiveTestSupport.class);
protected int messageCount = 100;
protected String[] data;
@@ -46,7 +49,7 @@
protected MessageProducer producer;
protected Destination consumerDestination;
protected Destination producerDestination;
- protected List messages = createConcurrentList();
+ protected List<Message> messages = createConcurrentList();
protected boolean topic = true;
protected boolean durable;
protected int deliveryMode = DeliveryMode.PERSISTENT;
@@ -118,12 +121,12 @@
* @param receivedMessages - list of received messages.
* @throws JMSException
*/
- protected void assertMessagesReceivedAreValid(List receivedMessages) throws JMSException {
- List copyOfMessages = Arrays.asList(receivedMessages.toArray());
+ protected void assertMessagesReceivedAreValid(List<Message> receivedMessages) throws JMSException {
+ List<Object> copyOfMessages = Arrays.asList(receivedMessages.toArray());
int counter = 0;
if (data.length != copyOfMessages.size()) {
- for (Iterator iter = copyOfMessages.iterator(); iter.hasNext();) {
+ for (Iterator<Object> iter = copyOfMessages.iterator(); iter.hasNext();) {
TextMessage message = (TextMessage)iter.next();
if (LOG.isInfoEnabled()) {
LOG.info("<== " + counter++ + " = " + message.getText());
@@ -187,7 +190,7 @@
* @param message - message to be consumed.
* @param messageList -list of consumed messages.
*/
- protected void consumeMessage(Message message, List messageList) {
+ protected void consumeMessage(Message message, List<Message> messageList) {
if (verbose) {
if (LOG.isDebugEnabled()) {
LOG.info("Received message: " + message);
@@ -208,8 +211,8 @@
*
* @return List
*/
- protected List createConcurrentList() {
- return Collections.synchronizedList(new ArrayList());
+ protected List<Message> createConcurrentList() {
+ return Collections.synchronizedList(new ArrayList<Message>());
}
/**
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsSendReceiveWithMessageExpirationTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsSendReceiveWithMessageExpirationTest.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsSendReceiveWithMessageExpirationTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsSendReceiveWithMessageExpirationTest.java Fri Aug 10 17:49:19 2007
@@ -28,12 +28,15 @@
import javax.jms.Session;
import javax.jms.Topic;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
/**
*
*/
public class JmsSendReceiveWithMessageExpirationTest extends TestSupport {
- private static final org.apache.commons.logging.Log LOG = org.apache.commons.logging.LogFactory.getLog(JmsSendReceiveWithMessageExpirationTest.class);
+ private static final Log LOG = LogFactory.getLog(JmsSendReceiveWithMessageExpirationTest.class);
protected int messageCount = 100;
protected String[] data;
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsTestSupport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsTestSupport.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsTestSupport.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsTestSupport.java Fri Aug 10 17:49:19 2007
@@ -50,7 +50,7 @@
protected ActiveMQConnection connection;
protected BrokerService broker;
- protected List connections = Collections.synchronizedList(new ArrayList());
+ protected List<Connection> connections = Collections.synchronizedList(new ArrayList<Connection>());
// /////////////////////////////////////////////////////////////////
//
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsTopicRedeliverTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsTopicRedeliverTest.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsTopicRedeliverTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsTopicRedeliverTest.java Fri Aug 10 17:49:19 2007
@@ -26,12 +26,15 @@
import javax.jms.TextMessage;
import javax.jms.Topic;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
/**
* @version $Revision: 1.4 $
*/
public class JmsTopicRedeliverTest extends TestSupport {
- private static final org.apache.commons.logging.Log LOG = org.apache.commons.logging.LogFactory.getLog(JmsTopicRedeliverTest.class);
+ private static final Log LOG = LogFactory.getLog(JmsTopicRedeliverTest.class);
protected Connection connection;
protected Session session;
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsTopicRequestReplyTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsTopicRequestReplyTest.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsTopicRequestReplyTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsTopicRequestReplyTest.java Fri Aug 10 17:49:19 2007
@@ -37,16 +37,16 @@
* @version $Revision: 1.3 $
*/
public class JmsTopicRequestReplyTest extends TestSupport implements MessageListener {
- private final Log log = LogFactory.getLog(getClass());
+ private static final Log LOG = LogFactory.getLog(JmsTopicRequestReplyTest.class);
+ protected boolean useAsyncConsume;
private Connection serverConnection;
private Connection clientConnection;
private MessageProducer replyProducer;
private Session serverSession;
private Destination requestDestination;
- private List failures = new Vector();
+ private List<JMSException> failures = new Vector<JMSException>();
private boolean dynamicallyCreateProducer;
- protected boolean useAsyncConsume;
private String clientSideClientID;
public void testSendAndReceive() throws Exception {
@@ -67,7 +67,7 @@
// replyDestination);
// assertEquals("clientID from the temporary destination must be the
// same", clientSideClientID, value);
- log.info("Both the clientID and destination clientID match properly: " + clientSideClientID);
+ LOG.info("Both the clientID and destination clientID match properly: " + clientSideClientID);
/* build queues */
MessageProducer requestProducer = session.createProducer(requestDestination);
@@ -78,15 +78,15 @@
requestMessage.setJMSReplyTo(replyDestination);
requestProducer.send(requestMessage);
- log.info("Sent request.");
- log.info(requestMessage.toString());
+ LOG.info("Sent request.");
+ LOG.info(requestMessage.toString());
Message msg = replyConsumer.receive(5000);
if (msg instanceof TextMessage) {
TextMessage replyMessage = (TextMessage)msg;
- log.info("Received reply.");
- log.info(replyMessage.toString());
+ LOG.info("Received reply.");
+ LOG.info(replyMessage.toString());
assertEquals("Wrong message content", "Hello: Olivier", replyMessage.getText());
} else {
fail("Should have received a reply by now");
@@ -107,8 +107,8 @@
try {
TextMessage requestMessage = (TextMessage)message;
- log.info("Received request.");
- log.info(requestMessage.toString());
+ LOG.info("Received request.");
+ LOG.info(requestMessage.toString());
Destination replyDestination = requestMessage.getJMSReplyTo();
@@ -130,8 +130,8 @@
replyProducer.send(replyDestination, replyMessage);
}
- log.info("Sent reply.");
- log.info(replyMessage.toString());
+ LOG.info("Sent reply.");
+ LOG.info(replyMessage.toString());
} catch (JMSException e) {
onException(e);
}
@@ -146,7 +146,7 @@
if (message != null) {
onMessage(message);
} else {
- log.error("No message received");
+ LOG.error("No message received");
}
} catch (JMSException e) {
onException(e);
@@ -188,7 +188,7 @@
}
protected void onException(JMSException e) {
- log.info("Caught: " + e);
+ LOG.info("Caught: " + e);
e.printStackTrace();
failures.add(e);
}
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsTopicSelectorTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsTopicSelectorTest.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsTopicSelectorTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsTopicSelectorTest.java Fri Aug 10 17:49:19 2007
@@ -28,11 +28,14 @@
import javax.jms.TextMessage;
import javax.jms.Topic;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
/**
* @version $Revision: 1.2 $
*/
public class JmsTopicSelectorTest extends TestSupport {
- private static final org.apache.commons.logging.Log LOG = org.apache.commons.logging.LogFactory.getLog(JmsTopicSelectorTest.class);
+ private static final Log LOG = LogFactory.getLog(JmsTopicSelectorTest.class);
protected Connection connection;
protected Session session;
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsTopicSendReceiveTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsTopicSendReceiveTest.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsTopicSendReceiveTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsTopicSendReceiveTest.java Fri Aug 10 17:49:19 2007
@@ -23,11 +23,14 @@
import javax.jms.Session;
import javax.jms.Topic;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
/**
* @version $Revision: 1.3 $
*/
public class JmsTopicSendReceiveTest extends JmsSendReceiveTestSupport {
- private static final org.apache.commons.logging.Log LOG = org.apache.commons.logging.LogFactory.getLog(JmsTopicSendReceiveTest.class);
+ private static final Log LOG = LogFactory.getLog(JmsTopicSendReceiveTest.class);
protected Connection connection;
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsTransactionTestSupport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsTransactionTestSupport.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsTransactionTestSupport.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsTransactionTestSupport.java Fri Aug 10 17:49:19 2007
@@ -20,6 +20,7 @@
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.List;
+
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.Destination;
@@ -31,17 +32,20 @@
import javax.jms.ObjectMessage;
import javax.jms.Session;
import javax.jms.TextMessage;
+
import org.apache.activemq.broker.BrokerFactory;
import org.apache.activemq.broker.BrokerService;
import org.apache.activemq.test.JmsResourceProvider;
import org.apache.activemq.test.TestSupport;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
/**
* @version $Revision: 1.9 $
*/
public abstract class JmsTransactionTestSupport extends TestSupport implements MessageListener {
- private static final org.apache.commons.logging.Log LOG = org.apache.commons.logging.LogFactory.getLog(JmsTransactionTestSupport.class);
+ private static final Log LOG = LogFactory.getLog(JmsTransactionTestSupport.class);
private static final int MESSAGE_COUNT = 5;
private static final String MESSAGE_TEXT = "message";
@@ -52,16 +56,15 @@
protected MessageProducer producer;
protected JmsResourceProvider resourceProvider;
protected Destination destination;
-
- // for message listener test
- private List unackMessages = new ArrayList(MESSAGE_COUNT);
- private List ackMessages = new ArrayList(MESSAGE_COUNT);
- private boolean resendPhase;
protected int batchCount = 10;
protected int batchSize = 20;
-
protected BrokerService broker;
+ // for message listener test
+ private List<Message> unackMessages = new ArrayList<Message>(MESSAGE_COUNT);
+ private List<Message> ackMessages = new ArrayList<Message>(MESSAGE_COUNT);
+ private boolean resendPhase;
+
public JmsTransactionTestSupport() {
super();
}
@@ -164,7 +167,7 @@
session.commit();
// receives the first message
- ArrayList messages = new ArrayList();
+ ArrayList<Message> messages = new ArrayList<Message>();
LOG.info("About to consume message 1");
Message message = consumer.receive(1000);
messages.add(message);
@@ -207,7 +210,7 @@
session.commit();
// receives the first message
- ArrayList messages = new ArrayList();
+ ArrayList<Message> messages = new ArrayList<Message>();
LOG.info("About to consume message 1");
Message message = consumer.receive(1000);
messages.add(message);
@@ -251,7 +254,7 @@
session.commit();
// receives the first message
- ArrayList messages = new ArrayList();
+ ArrayList<Message> messages = new ArrayList<Message>();
LOG.info("About to consume message 1");
Message message = consumer.receive(1000);
messages.add(message);
@@ -292,7 +295,7 @@
LOG.info("Sent 0: " + outbound[0]);
LOG.info("Sent 1: " + outbound[1]);
- ArrayList messages = new ArrayList();
+ ArrayList<Message> messages = new ArrayList<Message>();
Message message = consumer.receive(1000);
messages.add(message);
assertEquals(outbound[0], message);
@@ -338,7 +341,7 @@
LOG.info("Sent 0: " + outbound[0]);
LOG.info("Sent 1: " + outbound[1]);
- ArrayList messages = new ArrayList();
+ ArrayList<Message> messages = new ArrayList<Message>();
Message message = consumer.receive(1000);
assertEquals(outbound[0], message);
@@ -470,7 +473,7 @@
}
public void testChangeMutableObjectInObjectMessageThenRollback() throws Exception {
- ArrayList list = new ArrayList();
+ ArrayList<String> list = new ArrayList<String>();
list.add("First");
Message outbound = session.createObjectMessage(list);
outbound.setStringProperty("foo", "abc");
@@ -481,7 +484,7 @@
LOG.info("About to consume message 1");
Message message = consumer.receive(5000);
- List body = assertReceivedObjectMessageWithListBody(message);
+ List<String> body = assertReceivedObjectMessageWithListBody(message);
// now lets try mutate it
try {
@@ -495,18 +498,19 @@
session.rollback();
message = consumer.receive(5000);
- List secondBody = assertReceivedObjectMessageWithListBody(message);
+ List<String> secondBody = assertReceivedObjectMessageWithListBody(message);
assertNotSame("Second call should return a different body", secondBody, body);
session.commit();
}
- protected List assertReceivedObjectMessageWithListBody(Message message) throws JMSException {
+ @SuppressWarnings("unchecked")
+ protected List<String> assertReceivedObjectMessageWithListBody(Message message) throws JMSException {
assertNotNull("Should have received a message!", message);
assertEquals("foo header", "abc", message.getStringProperty("foo"));
assertTrue("Should be an object message but was: " + message, message instanceof ObjectMessage);
ObjectMessage objectMessage = (ObjectMessage)message;
- List body = (List)objectMessage.getObject();
+ List<String> body = (List<String>)objectMessage.getObject();
LOG.info("Received body: " + body);
assertEquals("Size of list should be 1", 1, body.size());
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/LargeMessageTestSupport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/LargeMessageTestSupport.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/LargeMessageTestSupport.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/LargeMessageTestSupport.java Fri Aug 10 17:49:19 2007
@@ -35,6 +35,8 @@
import org.apache.activemq.command.ActiveMQQueue;
import org.apache.activemq.command.ActiveMQTopic;
import org.apache.activemq.util.IdGenerator;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
/**
* @version $Revision: 1.4 $
@@ -44,7 +46,7 @@
protected static final int LARGE_MESSAGE_SIZE = 128 * 1024;
protected static final int MESSAGE_COUNT = 100;
- private static final org.apache.commons.logging.Log LOG = org.apache.commons.logging.LogFactory.getLog(LargeMessageTestSupport.class);
+ private static final Log LOG = LogFactory.getLog(LargeMessageTestSupport.class);
protected Connection producerConnection;
protected Connection consumerConnection;
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/LargeStreamletTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/LargeStreamletTest.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/LargeStreamletTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/LargeStreamletTest.java Fri Aug 10 17:49:19 2007
@@ -58,15 +58,12 @@
private static final int BUFFER_SIZE = 1 * 1024;
private static final int MESSAGE_COUNT = 10 * 1024;
- private AtomicInteger totalRead = new AtomicInteger();
+ protected Exception writerException;
+ protected Exception readerException;
+ private AtomicInteger totalRead = new AtomicInteger();
private AtomicInteger totalWritten = new AtomicInteger();
-
private AtomicBoolean stopThreads = new AtomicBoolean(false);
-
- protected Exception writerException;
-
- protected Exception readerException;
public void testStreamlets() throws Exception {
final ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(BROKER_URL);
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/LoadTestBurnIn.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/LoadTestBurnIn.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/LoadTestBurnIn.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/LoadTestBurnIn.java Fri Aug 10 17:49:19 2007
@@ -51,6 +51,13 @@
public class LoadTestBurnIn extends JmsTestSupport {
private static final transient Log LOG = LogFactory.getLog(LoadTestBurnIn.class);
+ public ActiveMQDestination destination;
+ public int deliveryMode;
+ public byte destinationType;
+ public boolean durableConsumer;
+ public int messageCount = 50000;
+ public int messageSize = 1024;
+
public static Test suite() {
return suite(LoadTestBurnIn.class);
}
@@ -84,14 +91,6 @@
return new ActiveMQConnectionFactory(((TransportConnector)broker.getTransportConnectors().get(0))
.getServer().getConnectURI());
}
-
- public ActiveMQDestination destination;
- public int deliveryMode;
- public byte destinationType;
- public boolean durableConsumer;
-
- public int messageCount = 50000;
- public int messageSize = 1024;
public void initCombosForTestSendReceive() {
addCombinationValues("deliveryMode", new Object[] {Integer.valueOf(DeliveryMode.NON_PERSISTENT),
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/MessageListenerRedeliveryTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/MessageListenerRedeliveryTest.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/MessageListenerRedeliveryTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/MessageListenerRedeliveryTest.java Fri Aug 10 17:49:19 2007
@@ -34,7 +34,7 @@
public class MessageListenerRedeliveryTest extends TestCase {
- private Log log = LogFactory.getLog(getClass());
+ private static final Log LOG = LogFactory.getLog(MessageListenerRedeliveryTest.class);
private Connection connection;
@@ -68,9 +68,9 @@
}
private class TestMessageListener implements MessageListener {
- private Session session;
public int counter;
+ private Session session;
public TestMessageListener(Session session) {
this.session = session;
@@ -78,18 +78,18 @@
public void onMessage(Message message) {
try {
- log.info("Message Received: " + message);
+ LOG.info("Message Received: " + message);
counter++;
if (counter <= 4) {
- log.info("Message Rollback.");
+ LOG.info("Message Rollback.");
session.rollback();
} else {
- log.info("Message Commit.");
+ LOG.info("Message Commit.");
message.acknowledge();
session.commit();
}
} catch (JMSException e) {
- log.error("Error when rolling back transaction");
+ LOG.error("Error when rolling back transaction");
}
}
}
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/SpringTestSupport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/SpringTestSupport.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/SpringTestSupport.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/SpringTestSupport.java Fri Aug 10 17:49:19 2007
@@ -33,8 +33,6 @@
*/
public abstract class SpringTestSupport extends TestCase {
- protected final Log log = LogFactory.getLog(getClass());
-
protected AbstractApplicationContext context;
protected void setUp() throws Exception {
@@ -58,7 +56,7 @@
}
protected void assertSetEquals(String description, Object[] expected, Set actual) {
- Set expectedSet = new HashSet();
+ Set<Object> expectedSet = new HashSet<Object>();
expectedSet.addAll(Arrays.asList(expected));
assertEquals(description, expectedSet, actual);
}
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/TestSupport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/TestSupport.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/TestSupport.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/TestSupport.java Fri Aug 10 17:49:19 2007
@@ -38,7 +38,6 @@
*/
public class TestSupport extends TestCase {
- protected Log log = LogFactory.getLog(getClass());
protected ActiveMQConnectionFactory connectionFactory;
protected boolean topic = true;
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/ZeroPrefetchConsumerTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/ZeroPrefetchConsumerTest.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/ZeroPrefetchConsumerTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/ZeroPrefetchConsumerTest.java Fri Aug 10 17:49:19 2007
@@ -90,8 +90,8 @@
}
// now lets receive it
MessageConsumer consumer = session.createConsumer(queue);
- // noinspection UNUSED_SYMBOL
- MessageConsumer idleConsumer = session.createConsumer(queue);
+
+ session.createConsumer(queue);
TextMessage answer = (TextMessage)consumer.receive(5000);
assertEquals("Should have received a message!", answer.getText(), "Msg1");
if (transacted) {
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/advisory/ConsumerListenerTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/advisory/ConsumerListenerTest.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/advisory/ConsumerListenerTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/advisory/ConsumerListenerTest.java Fri Aug 10 17:49:19 2007
@@ -43,7 +43,7 @@
protected Session consumerSession2;
protected int consumerCounter;
protected ConsumerEventSource consumerEventSource;
- protected BlockingQueue eventQueue = new ArrayBlockingQueue(1000);
+ protected BlockingQueue<ConsumerEvent> eventQueue = new ArrayBlockingQueue<ConsumerEvent>(1000);
private Connection connection;
public void testConsumerEvents() throws Exception {
@@ -131,7 +131,7 @@
}
protected ConsumerEvent waitForConsumerEvent() throws InterruptedException {
- ConsumerEvent answer = (ConsumerEvent)eventQueue.poll(100000, TimeUnit.MILLISECONDS);
+ ConsumerEvent answer = eventQueue.poll(100000, TimeUnit.MILLISECONDS);
assertTrue("Should have received a consumer event!", answer != null);
return answer;
}
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/advisory/ProducerListenerTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/advisory/ProducerListenerTest.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/advisory/ProducerListenerTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/advisory/ProducerListenerTest.java Fri Aug 10 17:49:19 2007
@@ -40,7 +40,7 @@
protected Session consumerSession2;
protected int consumerCounter;
protected ProducerEventSource producerEventSource;
- protected BlockingQueue eventQueue = new ArrayBlockingQueue(1000);
+ protected BlockingQueue<ProducerEvent> eventQueue = new ArrayBlockingQueue<ProducerEvent>(1000);
private Connection connection;
public void testProducerEvents() throws Exception {
@@ -123,7 +123,7 @@
}
protected ProducerEvent waitForProducerEvent() throws InterruptedException {
- ProducerEvent answer = (ProducerEvent)eventQueue.poll(100000, TimeUnit.MILLISECONDS);
+ ProducerEvent answer = eventQueue.poll(100000, TimeUnit.MILLISECONDS);
assertTrue("Should have received a consumer event!", answer != null);
return answer;
}
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/advisory/TempDestDeleteTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/advisory/TempDestDeleteTest.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/advisory/TempDestDeleteTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/advisory/TempDestDeleteTest.java Fri Aug 10 17:49:19 2007
@@ -44,9 +44,9 @@
protected int consumerCounter;
protected ConsumerEventSource topicConsumerEventSource;
+ protected BlockingQueue<ConsumerEvent> eventQueue = new ArrayBlockingQueue<ConsumerEvent>(1000);
+
private ConsumerEventSource queueConsumerEventSource;
-
- protected BlockingQueue eventQueue = new ArrayBlockingQueue(1000);
private Connection connection;
private Session session;
private ActiveMQTempTopic tempTopic;
@@ -141,7 +141,7 @@
}
protected ConsumerEvent waitForConsumerEvent() throws InterruptedException {
- ConsumerEvent answer = (ConsumerEvent)eventQueue.poll(1000, TimeUnit.MILLISECONDS);
+ ConsumerEvent answer = eventQueue.poll(1000, TimeUnit.MILLISECONDS);
assertTrue("Should have received a consumer event!", answer != null);
return answer;
}
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/BrokerTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/BrokerTest.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/BrokerTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/BrokerTest.java Fri Aug 10 17:49:19 2007
@@ -17,6 +17,7 @@
package org.apache.activemq.broker;
import java.util.ArrayList;
+import java.util.List;
import java.util.concurrent.TimeUnit;
import javax.jms.DeliveryMode;
@@ -145,7 +146,7 @@
connection2.send(sessionInfo2);
connection2.request(consumerInfo2);
- ArrayList messages = new ArrayList();
+ List<Message> messages = new ArrayList<Message>();
for (int i = 0; i < 4; i++) {
Message m1 = receiveMessage(connection1);
@@ -154,7 +155,7 @@
}
for (int i = 0; i < 4; i++) {
- Message m1 = (Message)messages.get(i);
+ Message m1 = messages.get(i);
Message m2 = receiveMessage(connection2);
assertNotNull("m2 is null for index: " + i, m2);
assertEquals(m1.getMessageId(), m2.getMessageId());
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/BrokerTestSupport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/BrokerTestSupport.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/BrokerTestSupport.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/BrokerTestSupport.java Fri Aug 10 17:49:19 2007
@@ -64,9 +64,6 @@
*/
public static final boolean FAST_NO_MESSAGE_LEFT_ASSERT = System.getProperty("FAST_NO_MESSAGE_LEFT_ASSERT", "true").equals("true");
- private static final Log LOG = LogFactory.getLog(BrokerTestSupport.class);
-
-
protected RegionBroker regionBroker;
protected BrokerService broker;
protected long idGenerator;
@@ -199,7 +196,6 @@
}
protected XATransactionId createXATransaction(SessionInfo info) throws IOException {
- long id = txGenerator;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream os = new DataOutputStream(baos);
os.writeLong(++txGenerator);
@@ -247,7 +243,7 @@
consumerInfo.setBrowser(true);
connection.send(consumerInfo);
- ArrayList skipped = new ArrayList();
+ ArrayList<Object> skipped = new ArrayList<Object>();
// Now get the messages.
Object m = connection.getDispatchQueue().poll(maxWait, TimeUnit.MILLISECONDS);
@@ -267,7 +263,7 @@
m = connection.getDispatchQueue().poll(maxWait, TimeUnit.MILLISECONDS);
}
- for (Iterator iter = skipped.iterator(); iter.hasNext();) {
+ for (Iterator<Object> iter = skipped.iterator(); iter.hasNext();) {
connection.getDispatchQueue().put(iter.next());
}
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/Main.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/Main.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/Main.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/Main.java Fri Aug 10 17:49:19 2007
@@ -31,17 +31,16 @@
*
* @version $Revision$
*/
-public class Main {
+public final class Main {
protected static boolean createConsumers;
+ private Main() {
+ }
+
/**
* @param args
*/
public static void main(String[] args) {
- String brokerURI = "broker:(tcp://localhost:61616,stomp://localhost:61613)?persistent=false&useJmx=true";
- if (args.length > 0) {
- brokerURI = args[0];
- }
try {
// TODO - this seems to break interceptors for some reason
// BrokerService broker = BrokerFactory.createBroker(new
@@ -71,10 +70,10 @@
Connection connection = new ActiveMQConnectionFactory().createConnection();
connection.start();
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
- MessageConsumer consumer1 = session.createConsumer(new ActiveMQQueue("Orders.IBM"));
- MessageConsumer consumer2 = session.createConsumer(new ActiveMQQueue("Orders.MSFT"), "price > 100");
+ session.createConsumer(new ActiveMQQueue("Orders.IBM"));
+ session.createConsumer(new ActiveMQQueue("Orders.MSFT"), "price > 100");
Session session2 = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
- MessageConsumer consumer3 = session2.createConsumer(new ActiveMQQueue("Orders.MSFT"), "price > 200");
+ session2.createConsumer(new ActiveMQQueue("Orders.MSFT"), "price > 200");
} else {
// Lets wait for the broker
broker.waitUntilStopped();
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/MarshallingBrokerTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/MarshallingBrokerTest.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/MarshallingBrokerTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/MarshallingBrokerTest.java Fri Aug 10 17:49:19 2007
@@ -41,7 +41,7 @@
OpenWireFormat wf2 = new OpenWireFormat();
wf2.setCacheEnabled(true);
- addCombinationValues("wireFormat", new Object[] {wf1, wf2,});
+ addCombinationValues("wireFormat", new Object[] {wf1, wf2, });
}
protected StubConnection createConnection() throws Exception {
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/MessageExpirationTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/MessageExpirationTest.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/MessageExpirationTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/MessageExpirationTest.java Fri Aug 10 17:49:19 2007
@@ -49,7 +49,7 @@
public void initCombosForTestMessagesWaitingForUssageDecreaseExpire() {
addCombinationValues("deliveryMode", new Object[] {Integer.valueOf(DeliveryMode.NON_PERSISTENT), Integer.valueOf(DeliveryMode.PERSISTENT)});
addCombinationValues("destinationType", new Object[] {Byte.valueOf(ActiveMQDestination.TEMP_QUEUE_TYPE), Byte.valueOf(ActiveMQDestination.TEMP_TOPIC_TYPE),
- Byte.valueOf(ActiveMQDestination.QUEUE_TYPE), Byte.valueOf(ActiveMQDestination.TOPIC_TYPE),});
+ Byte.valueOf(ActiveMQDestination.QUEUE_TYPE), Byte.valueOf(ActiveMQDestination.TOPIC_TYPE)});
}
@Override
@@ -148,7 +148,7 @@
* DeliveryMode.PERSISTENT test combination for now.
*/
public void initCombosForTestMessagesInLongTransactionExpire() {
- addCombinationValues("deliveryMode", new Object[] {Integer.valueOf(DeliveryMode.NON_PERSISTENT),});
+ addCombinationValues("deliveryMode", new Object[] {Integer.valueOf(DeliveryMode.NON_PERSISTENT)});
addCombinationValues("destinationType", new Object[] {Byte.valueOf(ActiveMQDestination.QUEUE_TYPE), Byte.valueOf(ActiveMQDestination.TOPIC_TYPE),
Byte.valueOf(ActiveMQDestination.TEMP_QUEUE_TYPE), Byte.valueOf(ActiveMQDestination.TEMP_TOPIC_TYPE)});
}
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/ProgressPrinter.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/ProgressPrinter.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/ProgressPrinter.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/ProgressPrinter.java Fri Aug 10 17:49:19 2007
@@ -21,8 +21,8 @@
private final long total;
private final long interval;
- long percentDone;
- long counter;
+ private long percentDone;
+ private long counter;
public ProgressPrinter(long total, long interval) {
this.total = total;
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/StubBroker.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/StubBroker.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/StubBroker.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/StubBroker.java Fri Aug 10 17:49:19 2007
@@ -45,8 +45,8 @@
import org.apache.activemq.kaha.Store;
public class StubBroker implements Broker {
- public LinkedList addConnectionData = new LinkedList();
- public LinkedList removeConnectionData = new LinkedList();
+ public LinkedList<AddConnectionData> addConnectionData = new LinkedList<AddConnectionData>();
+ public LinkedList<RemoveConnectionData> removeConnectionData = new LinkedList<RemoveConnectionData>();
public class AddConnectionData {
public final ConnectionContext connectionContext;
@@ -124,7 +124,7 @@
return null;
}
- public Set getDurableDestinations() {
+ public Set<ActiveMQDestination> getDurableDestinations() {
return null;
}
@@ -190,7 +190,7 @@
public void gc() {
}
- public Map getDestinationMap() {
+ public Map<ActiveMQDestination, Destination> getDestinationMap() {
return null;
}
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/StubConnection.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/StubConnection.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/StubConnection.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/StubConnection.java Fri Aug 10 17:49:19 2007
@@ -34,14 +34,10 @@
public class StubConnection implements Service {
- private final BlockingQueue dispatchQueue = new LinkedBlockingQueue();
+ private final BlockingQueue<Object> dispatchQueue = new LinkedBlockingQueue<Object>();
private Connection connection;
private Transport transport;
- boolean shuttingDown;
-
- protected void dispatch(Object command) throws InterruptedException, IOException {
- dispatchQueue.put(command);
- }
+ private boolean shuttingDown;
public StubConnection(BrokerService broker) throws Exception {
this(TransportFactory.connect(broker.getVmConnectorURI()));
@@ -74,7 +70,11 @@
transport.start();
}
- public BlockingQueue getDispatchQueue() {
+ protected void dispatch(Object command) throws InterruptedException, IOException {
+ dispatchQueue.put(command);
+ }
+
+ public BlockingQueue<Object> getDispatchQueue() {
return dispatchQueue;
}
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/policy/DeadLetterTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/policy/DeadLetterTest.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/policy/DeadLetterTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/policy/DeadLetterTest.java Fri Aug 10 17:49:19 2007
@@ -23,12 +23,15 @@
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.RedeliveryPolicy;
import org.apache.activemq.command.ActiveMQQueue;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
/**
*
* @version $Revision$
*/
public class DeadLetterTest extends DeadLetterTestSupport {
+ private static final Log LOG = LogFactory.getLog(DeadLetterTest.class);
private int rollbackCount;
@@ -37,7 +40,7 @@
ActiveMQConnection amqConnection = (ActiveMQConnection) connection;
rollbackCount = amqConnection.getRedeliveryPolicy().getMaximumRedeliveries() + 1;
- log.info("Will redeliver messages: " + rollbackCount + " times");
+ LOG.info("Will redeliver messages: " + rollbackCount + " times");
makeConsumer();
makeDlqConsumer();
@@ -64,7 +67,7 @@
session.rollback();
}
- log.info("Rolled back: " + rollbackCount + " times");
+ LOG.info("Rolled back: " + rollbackCount + " times");
}
protected void setUp() throws Exception {