You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ru...@apache.org on 2007/06/11 18:44:10 UTC
svn commit: r546190 [4/6] - in /incubator/qpid/branches/M2/java: ./ broker/
client/ client/example/ client/src/main/java/org/apache/qpid/client/
client/src/main/java/org/apache/qpid/client/failover/
client/src/main/java/org/apache/qpid/client/handler/ ...
Modified: incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/basic/MapMessageTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/basic/MapMessageTest.java?view=diff&rev=546190&r1=546189&r2=546190
==============================================================================
--- incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/basic/MapMessageTest.java (original)
+++ incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/basic/MapMessageTest.java Mon Jun 11 09:43:57 2007
@@ -20,9 +20,17 @@
*/
package org.apache.qpid.test.unit.basic;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.qpid.client.AMQConnection;
+import org.apache.qpid.client.AMQQueue;
+import org.apache.qpid.client.AMQSession;
+import org.apache.qpid.client.message.JMSMapMessage;
+import org.apache.qpid.client.transport.TransportConnection;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import javax.jms.Destination;
import javax.jms.JMSException;
@@ -34,20 +42,13 @@
import javax.jms.MessageProducer;
import javax.jms.Session;
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
-import org.apache.log4j.Logger;
-import org.apache.qpid.client.AMQConnection;
-import org.apache.qpid.client.AMQQueue;
-import org.apache.qpid.client.AMQSession;
-import org.apache.qpid.client.message.JMSMapMessage;
-import org.apache.qpid.client.transport.TransportConnection;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
public class MapMessageTest extends TestCase implements MessageListener
{
-
- private static final Logger _logger = Logger.getLogger(MapMessageTest.class);
+ private static final Logger _logger = LoggerFactory.getLogger(MapMessageTest.class);
private AMQConnection _connection;
private Destination _destination;
@@ -57,7 +58,7 @@
private static final String MESSAGE = "Message ";
private int _count = 100;
public String _connectionString = "vm://:1";
- private byte[] _bytes = {99, 98, 97, 96, 95};
+ private byte[] _bytes = { 99, 98, 97, 96, 95 };
private static final float _smallfloat = 100.0f;
protected void setUp() throws Exception
@@ -83,7 +84,7 @@
private void init(AMQConnection connection) throws Exception
{
- Destination destination = new AMQQueue(connection,randomize("MapMessageTest"), true);
+ Destination destination = new AMQQueue(connection, randomize("MapMessageTest"), true);
init(connection, destination);
}
@@ -93,7 +94,7 @@
_destination = destination;
_session = (AMQSession) connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
- //set up a slow consumer
+ // set up a slow consumer
_session.createConsumer(destination).setMessageListener(this);
connection.start();
}
@@ -109,7 +110,7 @@
void send(int count) throws JMSException
{
- //create a publisher
+ // create a publisher
MessageProducer producer = _session.createProducer(_destination);
for (int i = 0; i < count; i++)
{
@@ -123,7 +124,7 @@
private void setMapValues(MapMessage message, int i) throws JMSException
{
- message.setBoolean("odd", i / 2 == 0);
+ message.setBoolean("odd", (i / 2) == 0);
message.setByte("byte", (byte) Byte.MAX_VALUE);
message.setBytes("bytes", _bytes);
message.setChar("char", (char) 'c');
@@ -136,7 +137,7 @@
message.setShort("short", (short) Short.MAX_VALUE);
message.setString("message", MESSAGE + i);
- //Test Setting Object Values
+ // Test Setting Object Values
message.setObject("object-bool", true);
message.setObject("object-byte", Byte.MAX_VALUE);
message.setObject("object-bytes", _bytes);
@@ -147,7 +148,7 @@
message.setObject("object-long", Long.MAX_VALUE);
message.setObject("object-short", Short.MAX_VALUE);
- //Set a null String value
+ // Set a null String value
message.setString("nullString", null);
// Highlight protocol problem
message.setString("emptyString", "");
@@ -159,10 +160,9 @@
long waitTime = 30000L;
long waitUntilTime = System.currentTimeMillis() + 30000L;
-
- synchronized(received)
+ synchronized (received)
{
- while(received.size() < count && waitTime>0)
+ while ((received.size() < count) && (waitTime > 0))
{
if (received.size() < count)
{
@@ -174,6 +174,7 @@
waitTime = waitUntilTime - System.currentTimeMillis();
}
}
+
if (received.size() < count)
{
throw new Exception("Timed-out. Waiting for " + count + " only got " + received.size());
@@ -236,7 +237,7 @@
}
catch (NumberFormatException nfe)
{
- //normal execution
+ // normal execution
}
try
@@ -246,10 +247,10 @@
}
catch (NumberFormatException nfe)
{
- //normal execution
+ // normal execution
}
- //Try bad reads
+ // Try bad reads
try
{
m.getChar("message");
@@ -257,7 +258,7 @@
}
catch (MessageFormatException npe)
{
- //normal execution
+ // normal execution
}
try
@@ -267,8 +268,9 @@
}
catch (NumberFormatException nfe)
{
- //normal execution
+ // normal execution
}
+
try
{
m.getLong("message");
@@ -276,10 +278,10 @@
}
catch (NumberFormatException nfe)
{
- //normal execution
+ // normal execution
}
- //Try bad reads
+ // Try bad reads
try
{
m.getFloat("message");
@@ -287,9 +289,9 @@
}
catch (NumberFormatException nfe)
{
- //normal execution
+ // normal execution
}
- //Try bad reads
+ // Try bad reads
try
{
m.getDouble("message");
@@ -297,9 +299,9 @@
}
catch (NumberFormatException nfe)
{
- //normal execution
+ // normal execution
}
- //Try bad reads
+ // Try bad reads
try
{
m.getBytes("message");
@@ -307,7 +309,7 @@
}
catch (MessageFormatException nfe)
{
- //normal execution
+ // normal execution
}
Assert.assertEquals(MESSAGE + m.getInt("messageNumber"), m.getString("message"));
@@ -316,7 +318,7 @@
private void testShort(JMSMapMessage m) throws JMSException
{
- //Try bad reads
+ // Try bad reads
try
{
m.getBoolean("short");
@@ -324,7 +326,7 @@
}
catch (MessageFormatException nfe)
{
- //normal execution
+ // normal execution
}
try
@@ -334,12 +336,12 @@
}
catch (MessageFormatException nfe)
{
- //normal execution
+ // normal execution
}
Assert.assertEquals(Short.MAX_VALUE, m.getShort("short"));
- //Try bad reads
+ // Try bad reads
try
{
m.getChar("short");
@@ -347,14 +349,14 @@
}
catch (MessageFormatException npe)
{
- //normal execution
+ // normal execution
}
Assert.assertEquals(Short.MAX_VALUE, m.getInt("short"));
Assert.assertEquals(Short.MAX_VALUE, m.getLong("short"));
- //Try bad reads
+ // Try bad reads
try
{
m.getFloat("short");
@@ -362,9 +364,9 @@
}
catch (MessageFormatException nfe)
{
- //normal execution
+ // normal execution
}
- //Try bad reads
+ // Try bad reads
try
{
m.getDouble("short");
@@ -372,9 +374,9 @@
}
catch (MessageFormatException nfe)
{
- //normal execution
+ // normal execution
}
- //Try bad reads
+ // Try bad reads
try
{
m.getBytes("short");
@@ -382,7 +384,7 @@
}
catch (MessageFormatException nfe)
{
- //normal execution
+ // normal execution
}
Assert.assertEquals("" + Short.MAX_VALUE, m.getString("short"));
@@ -391,7 +393,7 @@
private void testLong(JMSMapMessage m) throws JMSException
{
- //Try bad reads
+ // Try bad reads
try
{
m.getBoolean("long");
@@ -399,7 +401,7 @@
}
catch (MessageFormatException nfe)
{
- //normal execution
+ // normal execution
}
try
@@ -409,7 +411,7 @@
}
catch (MessageFormatException nfe)
{
- //normal execution
+ // normal execution
}
try
@@ -419,10 +421,10 @@
}
catch (MessageFormatException nfe)
{
- //normal execution
+ // normal execution
}
- //Try bad reads
+ // Try bad reads
try
{
m.getChar("long");
@@ -430,7 +432,7 @@
}
catch (MessageFormatException npe)
{
- //normal execution
+ // normal execution
}
try
@@ -440,12 +442,12 @@
}
catch (MessageFormatException nfe)
{
- //normal execution
+ // normal execution
}
Assert.assertEquals(Long.MAX_VALUE, m.getLong("long"));
- //Try bad reads
+ // Try bad reads
try
{
m.getFloat("long");
@@ -453,9 +455,9 @@
}
catch (MessageFormatException nfe)
{
- //normal execution
+ // normal execution
}
- //Try bad reads
+ // Try bad reads
try
{
m.getDouble("long");
@@ -463,9 +465,9 @@
}
catch (MessageFormatException nfe)
{
- //normal execution
+ // normal execution
}
- //Try bad reads
+ // Try bad reads
try
{
m.getBytes("long");
@@ -473,7 +475,7 @@
}
catch (MessageFormatException nfe)
{
- //normal execution
+ // normal execution
}
Assert.assertEquals("" + Long.MAX_VALUE, m.getString("long"));
@@ -482,7 +484,7 @@
private void testDouble(JMSMapMessage m) throws JMSException
{
- //Try bad reads
+ // Try bad reads
try
{
m.getBoolean("double");
@@ -490,7 +492,7 @@
}
catch (MessageFormatException nfe)
{
- //normal execution
+ // normal execution
}
try
@@ -500,7 +502,7 @@
}
catch (MessageFormatException nfe)
{
- //normal execution
+ // normal execution
}
try
@@ -510,10 +512,10 @@
}
catch (MessageFormatException nfe)
{
- //normal execution
+ // normal execution
}
- //Try bad reads
+ // Try bad reads
try
{
m.getChar("double");
@@ -521,7 +523,7 @@
}
catch (MessageFormatException npe)
{
- //normal execution
+ // normal execution
}
try
@@ -531,8 +533,9 @@
}
catch (MessageFormatException nfe)
{
- //normal execution
+ // normal execution
}
+
try
{
m.getLong("double");
@@ -540,10 +543,10 @@
}
catch (MessageFormatException nfe)
{
- //normal execution
+ // normal execution
}
- //Try bad reads
+ // Try bad reads
try
{
m.getFloat("double");
@@ -551,13 +554,12 @@
}
catch (MessageFormatException nfe)
{
- //normal execution
+ // normal execution
}
-
Assert.assertEquals(Double.MAX_VALUE, m.getDouble("double"));
- //Try bad reads
+ // Try bad reads
try
{
m.getBytes("double");
@@ -565,17 +567,16 @@
}
catch (MessageFormatException nfe)
{
- //normal execution
+ // normal execution
}
Assert.assertEquals("" + Double.MAX_VALUE, m.getString("double"));
}
-
private void testFloat(JMSMapMessage m) throws JMSException
{
- //Try bad reads
+ // Try bad reads
try
{
m.getBoolean("float");
@@ -583,7 +584,7 @@
}
catch (MessageFormatException nfe)
{
- //normal execution
+ // normal execution
}
try
@@ -593,7 +594,7 @@
}
catch (MessageFormatException nfe)
{
- //normal execution
+ // normal execution
}
try
@@ -603,10 +604,10 @@
}
catch (MessageFormatException nfe)
{
- //normal execution
+ // normal execution
}
- //Try bad reads
+ // Try bad reads
try
{
m.getChar("float");
@@ -614,7 +615,7 @@
}
catch (MessageFormatException npe)
{
- //normal execution
+ // normal execution
}
try
@@ -624,8 +625,9 @@
}
catch (MessageFormatException nfe)
{
- //normal execution
+ // normal execution
}
+
try
{
m.getLong("float");
@@ -633,15 +635,14 @@
}
catch (MessageFormatException nfe)
{
- //normal execution
+ // normal execution
}
-
Assert.assertEquals(Float.MAX_VALUE, m.getFloat("float"));
Assert.assertEquals(_smallfloat, (float) m.getDouble("smallfloat"));
- //Try bad reads
+ // Try bad reads
try
{
m.getBytes("float");
@@ -649,17 +650,16 @@
}
catch (MessageFormatException nfe)
{
- //normal execution
+ // normal execution
}
Assert.assertEquals("" + Float.MAX_VALUE, m.getString("float"));
}
-
private void testInt(JMSMapMessage m) throws JMSException
{
- //Try bad reads
+ // Try bad reads
try
{
m.getBoolean("int");
@@ -667,7 +667,7 @@
}
catch (MessageFormatException nfe)
{
- //normal execution
+ // normal execution
}
try
@@ -677,7 +677,7 @@
}
catch (MessageFormatException nfe)
{
- //normal execution
+ // normal execution
}
try
@@ -687,10 +687,10 @@
}
catch (MessageFormatException nfe)
{
- //normal execution
+ // normal execution
}
- //Try bad reads
+ // Try bad reads
try
{
m.getChar("int");
@@ -698,14 +698,14 @@
}
catch (MessageFormatException npe)
{
- //normal execution
+ // normal execution
}
Assert.assertEquals(Integer.MAX_VALUE, m.getInt("int"));
Assert.assertEquals(Integer.MAX_VALUE, (int) m.getLong("int"));
- //Try bad reads
+ // Try bad reads
try
{
m.getFloat("int");
@@ -713,9 +713,9 @@
}
catch (MessageFormatException nfe)
{
- //normal execution
+ // normal execution
}
- //Try bad reads
+ // Try bad reads
try
{
m.getDouble("int");
@@ -723,9 +723,9 @@
}
catch (MessageFormatException nfe)
{
- //normal execution
+ // normal execution
}
- //Try bad reads
+ // Try bad reads
try
{
m.getBytes("int");
@@ -733,17 +733,16 @@
}
catch (MessageFormatException nfe)
{
- //normal execution
+ // normal execution
}
Assert.assertEquals("" + Integer.MAX_VALUE, m.getString("int"));
}
-
private void testChar(JMSMapMessage m) throws JMSException
{
- //Try bad reads
+ // Try bad reads
try
{
m.getBoolean("char");
@@ -751,7 +750,7 @@
}
catch (MessageFormatException nfe)
{
- //normal execution
+ // normal execution
}
try
@@ -761,7 +760,7 @@
}
catch (MessageFormatException nfe)
{
- //normal execution
+ // normal execution
}
try
@@ -771,7 +770,7 @@
}
catch (MessageFormatException nfe)
{
- //normal execution
+ // normal execution
}
Assert.assertEquals('c', m.getChar("char"));
@@ -783,8 +782,9 @@
}
catch (MessageFormatException nfe)
{
- //normal execution
+ // normal execution
}
+
try
{
m.getLong("char");
@@ -792,10 +792,10 @@
}
catch (MessageFormatException nfe)
{
- //normal execution
+ // normal execution
}
- //Try bad reads
+ // Try bad reads
try
{
m.getFloat("char");
@@ -803,9 +803,9 @@
}
catch (MessageFormatException nfe)
{
- //normal execution
+ // normal execution
}
- //Try bad reads
+ // Try bad reads
try
{
m.getDouble("char");
@@ -813,9 +813,9 @@
}
catch (MessageFormatException nfe)
{
- //normal execution
+ // normal execution
}
- //Try bad reads
+ // Try bad reads
try
{
m.getBytes("char");
@@ -823,7 +823,7 @@
}
catch (MessageFormatException nfe)
{
- //normal execution
+ // normal execution
}
Assert.assertEquals("" + 'c', m.getString("char"));
@@ -831,7 +831,7 @@
private void testBytes(JMSMapMessage m) throws JMSException
{
- //Try bad reads
+ // Try bad reads
try
{
m.getBoolean("bytes");
@@ -839,7 +839,7 @@
}
catch (MessageFormatException nfe)
{
- //normal execution
+ // normal execution
}
try
@@ -849,7 +849,7 @@
}
catch (MessageFormatException nfe)
{
- //normal execution
+ // normal execution
}
try
@@ -859,10 +859,10 @@
}
catch (MessageFormatException nfe)
{
- //normal execution
+ // normal execution
}
- //Try bad reads
+ // Try bad reads
try
{
m.getChar("bytes");
@@ -870,7 +870,7 @@
}
catch (MessageFormatException npe)
{
- //normal execution
+ // normal execution
}
try
@@ -880,7 +880,7 @@
}
catch (MessageFormatException nfe)
{
- //normal execution
+ // normal execution
}
try
@@ -890,10 +890,10 @@
}
catch (MessageFormatException nfe)
{
- //normal execution
+ // normal execution
}
- //Try bad reads
+ // Try bad reads
try
{
m.getFloat("bytes");
@@ -901,9 +901,9 @@
}
catch (MessageFormatException nfe)
{
- //normal execution
+ // normal execution
}
- //Try bad reads
+ // Try bad reads
try
{
m.getDouble("bytes");
@@ -911,10 +911,9 @@
}
catch (MessageFormatException nfe)
{
- //normal execution
+ // normal execution
}
-
assertBytesEqual(_bytes, m.getBytes("bytes"));
try
@@ -924,15 +923,14 @@
}
catch (MessageFormatException nfe)
{
- //normal execution
+ // normal execution
}
-
}
private void testByte(JMSMapMessage m) throws JMSException
{
- //Try bad reads
+ // Try bad reads
try
{
m.getBoolean("byte");
@@ -940,14 +938,14 @@
}
catch (MessageFormatException nfe)
{
- //normal execution
+ // normal execution
}
Assert.assertEquals(Byte.MAX_VALUE, m.getByte("byte"));
Assert.assertEquals((short) Byte.MAX_VALUE, m.getShort("byte"));
- //Try bad reads
+ // Try bad reads
try
{
m.getChar("byte");
@@ -955,15 +953,15 @@
}
catch (MessageFormatException npe)
{
- //normal execution
+ // normal execution
}
- //Reading a byte as an int is ok
+ // Reading a byte as an int is ok
Assert.assertEquals((short) Byte.MAX_VALUE, m.getInt("byte"));
Assert.assertEquals((short) Byte.MAX_VALUE, m.getLong("byte"));
- //Try bad reads
+ // Try bad reads
try
{
m.getFloat("byte");
@@ -971,9 +969,9 @@
}
catch (MessageFormatException nfe)
{
- //normal execution
+ // normal execution
}
- //Try bad reads
+ // Try bad reads
try
{
m.getDouble("byte");
@@ -981,9 +979,9 @@
}
catch (MessageFormatException nfe)
{
- //normal execution
+ // normal execution
}
- //Try bad reads
+ // Try bad reads
try
{
m.getBytes("byte");
@@ -991,7 +989,7 @@
}
catch (MessageFormatException nfe)
{
- //normal execution
+ // normal execution
}
Assert.assertEquals("" + Byte.MAX_VALUE, m.getString("byte"));
@@ -1003,7 +1001,7 @@
Assert.assertEquals((m.getInt("messageNumber") / 2) == 0, m.getBoolean("odd"));
- //Try bad reads
+ // Try bad reads
try
{
m.getByte("odd");
@@ -1011,10 +1009,10 @@
}
catch (MessageFormatException nfe)
{
- //normal execution
+ // normal execution
}
- //Try bad reads
+ // Try bad reads
try
{
m.getShort("odd");
@@ -1022,9 +1020,9 @@
}
catch (MessageFormatException nfe)
{
- //normal execution
+ // normal execution
}
- //Try bad reads
+ // Try bad reads
try
{
m.getChar("odd");
@@ -1032,9 +1030,9 @@
}
catch (MessageFormatException npe)
{
- //normal execution
+ // normal execution
}
- //Try bad reads
+ // Try bad reads
try
{
m.getInt("odd");
@@ -1042,9 +1040,9 @@
}
catch (MessageFormatException nfe)
{
- //normal execution
+ // normal execution
}
- //Try bad reads
+ // Try bad reads
try
{
m.getLong("odd");
@@ -1052,9 +1050,9 @@
}
catch (MessageFormatException nfe)
{
- //normal execution
+ // normal execution
}
- //Try bad reads
+ // Try bad reads
try
{
m.getFloat("odd");
@@ -1062,9 +1060,9 @@
}
catch (MessageFormatException nfe)
{
- //normal execution
+ // normal execution
}
- //Try bad reads
+ // Try bad reads
try
{
m.getDouble("odd");
@@ -1072,9 +1070,9 @@
}
catch (MessageFormatException nfe)
{
- //normal execution
+ // normal execution
}
- //Try bad reads
+ // Try bad reads
try
{
m.getBytes("odd");
@@ -1082,16 +1080,15 @@
}
catch (MessageFormatException nfe)
{
- //normal execution
+ // normal execution
}
Assert.assertEquals("" + ((m.getInt("messageNumber") / 2) == 0), m.getString("odd"));
}
-
private void testPropertyWriteStatus(JMSMapMessage m) throws JMSException
{
- //Check property write status
+ // Check property write status
try
{
m.setStringProperty("test", "test");
@@ -1099,7 +1096,7 @@
}
catch (MessageNotWriteableException mnwe)
{
- //normal execution
+ // normal execution
}
m.clearProperties();
@@ -1123,7 +1120,7 @@
}
catch (MessageNotWriteableException mnwe)
{
- //normal execution
+ // normal execution
}
m.clearBody();
@@ -1138,54 +1135,51 @@
}
}
-
-
-
private void testMapValues(JMSMapMessage m, int count) throws JMSException
{
- //Test get<Primiative>
+ // Test get<Primiative>
- //Boolean
- assertEqual(count / 2 == 0, m.getBoolean("odd"));
- assertEqual("" + (count / 2 == 0), m.getString("odd"));
+ // Boolean
+ assertEqual((count / 2) == 0, m.getBoolean("odd"));
+ assertEqual("" + ((count / 2) == 0), m.getString("odd"));
- //Byte
+ // Byte
assertEqual(Byte.MAX_VALUE, m.getByte("byte"));
assertEqual("" + Byte.MAX_VALUE, m.getString("byte"));
- //Bytes
+ // Bytes
assertBytesEqual(_bytes, m.getBytes("bytes"));
- //Char
+ // Char
assertEqual('c', m.getChar("char"));
- //Double
+ // Double
assertEqual(Double.MAX_VALUE, m.getDouble("double"));
assertEqual("" + Double.MAX_VALUE, m.getString("double"));
- //Float
+ // Float
assertEqual(Float.MAX_VALUE, m.getFloat("float"));
assertEqual(_smallfloat, (float) m.getDouble("smallfloat"));
assertEqual("" + Float.MAX_VALUE, m.getString("float"));
- //Integer
+ // Integer
assertEqual(Integer.MAX_VALUE, m.getInt("int"));
assertEqual("" + Integer.MAX_VALUE, m.getString("int"));
assertEqual(count, m.getInt("messageNumber"));
- //long
+ // long
assertEqual(Long.MAX_VALUE, m.getLong("long"));
assertEqual("" + Long.MAX_VALUE, m.getString("long"));
- //Short
+ // Short
assertEqual(Short.MAX_VALUE, m.getShort("short"));
assertEqual("" + Short.MAX_VALUE, m.getString("short"));
assertEqual((int) Short.MAX_VALUE, m.getInt("short"));
- //String
+ // String
assertEqual(MESSAGE + count, m.getString("message"));
- //Test getObjects
+ // Test getObjects
assertEqual(true, m.getObject("object-bool"));
assertEqual(Byte.MAX_VALUE, m.getObject("object-byte"));
assertBytesEqual(_bytes, (byte[]) m.getObject("object-bytes"));
@@ -1196,7 +1190,7 @@
assertEqual(Long.MAX_VALUE, m.getObject("object-long"));
assertEqual(Short.MAX_VALUE, m.getObject("object-short"));
- //Check Special values
+ // Check Special values
assertTrue(m.getString("nullString") == null);
assertEqual("", m.getString("emptyString"));
}
@@ -1211,7 +1205,6 @@
}
}
-
private static void assertEqual(Iterator expected, Iterator actual)
{
List<String> errors = new ArrayList<String>();
@@ -1234,6 +1227,7 @@
{
errors.add("Found " + actual.next() + " but no more expected values.");
}
+
if (!errors.isEmpty())
{
throw new RuntimeException(errors.toString());
@@ -1250,7 +1244,7 @@
public void onMessage(Message message)
{
- synchronized(received)
+ synchronized (received)
{
_logger.info("****************** Recevied Messgage:" + (JMSMapMessage) message);
received.add((JMSMapMessage) message);
@@ -1266,12 +1260,13 @@
public static void main(String[] argv) throws Exception
{
MapMessageTest test = new MapMessageTest();
- test._connectionString = argv.length == 0 ? "vm://:1" : argv[0];
+ test._connectionString = (argv.length == 0) ? "vm://:1" : argv[0];
test.setUp();
if (argv.length > 1)
{
test._count = Integer.parseInt(argv[1]);
}
+
test.test();
}
Modified: incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/basic/MultipleConnectionTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/basic/MultipleConnectionTest.java?view=diff&rev=546190&r1=546189&r2=546190
==============================================================================
--- incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/basic/MultipleConnectionTest.java (original)
+++ incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/basic/MultipleConnectionTest.java Mon Jun 11 09:43:57 2007
@@ -19,12 +19,6 @@
*/
package org.apache.qpid.test.unit.basic;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageListener;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-
import junit.framework.TestCase;
import org.apache.qpid.client.AMQConnection;
@@ -33,11 +27,19 @@
import org.apache.qpid.client.AMQTopic;
import org.apache.qpid.client.transport.TransportConnection;
import org.apache.qpid.exchange.ExchangeDefaults;
-import org.apache.log4j.Logger;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
public class MultipleConnectionTest extends TestCase
{
- private static final Logger _logger = Logger.getLogger(MultipleConnectionTest.class);
+ private static final Logger _logger = LoggerFactory.getLogger(MultipleConnectionTest.class);
public static final String _defaultBroker = "vm://:1";
public String _connectionString = _defaultBroker;
@@ -64,6 +66,7 @@
_counters[i] = new MessageCounter(_sessions[i].toString());
_sessions[i].createConsumer(dest).setMessageListener(_counters[i]);
}
+
_connection.start();
}
@@ -128,8 +131,10 @@
{
break;
}
+
wait(timeLeft);
}
+
return expected <= _count;
}
@@ -144,7 +149,6 @@
}
}
-
protected void setUp() throws Exception
{
super.setUp();
@@ -183,7 +187,7 @@
public static void main(String[] argv) throws Exception
{
- String broker = argv.length > 0 ? argv[0] : _defaultBroker;
+ String broker = (argv.length > 0) ? argv[0] : _defaultBroker;
MultipleConnectionTest test = new MultipleConnectionTest();
test._connectionString = broker;
@@ -195,12 +199,9 @@
String broker = _connectionString;
int messages = 10;
- AMQTopic topic = new AMQTopic(ExchangeDefaults.TOPIC_EXCHANGE_NAME,"amq.topic");
+ AMQTopic topic = new AMQTopic(ExchangeDefaults.TOPIC_EXCHANGE_NAME, "amq.topic");
- Receiver[] receivers = new Receiver[]{
- new Receiver(broker, topic, 2),
- new Receiver(broker, topic, 14)
- };
+ Receiver[] receivers = new Receiver[] { new Receiver(broker, topic, 2), new Receiver(broker, topic, 14) };
Publisher publisher = new Publisher(broker, topic);
for (int i = 0; i < messages; i++)
Modified: incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/basic/ObjectMessageTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/basic/ObjectMessageTest.java?view=diff&rev=546190&r1=546189&r2=546190
==============================================================================
--- incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/basic/ObjectMessageTest.java (original)
+++ incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/basic/ObjectMessageTest.java Mon Jun 11 09:43:57 2007
@@ -19,17 +19,6 @@
*/
package org.apache.qpid.test.unit.basic;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageListener;
-import javax.jms.MessageNotWriteableException;
-import javax.jms.MessageProducer;
-
import junit.framework.Assert;
import junit.framework.TestCase;
@@ -39,11 +28,24 @@
import org.apache.qpid.client.AMQSession;
import org.apache.qpid.client.message.JMSObjectMessage;
import org.apache.qpid.client.transport.TransportConnection;
-import org.apache.log4j.Logger;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+import javax.jms.MessageNotWriteableException;
+import javax.jms.MessageProducer;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
public class ObjectMessageTest extends TestCase implements MessageListener
{
- private static final Logger _logger = Logger.getLogger(ObjectMessageTest.class);
+ private static final Logger _logger = LoggerFactory.getLogger(ObjectMessageTest.class);
private AMQConnection _connection;
private AMQDestination _destination;
@@ -75,7 +77,7 @@
private void init(AMQConnection connection) throws Exception
{
- init(connection, new AMQQueue(connection,randomize("ObjectMessageTest"), true));
+ init(connection, new AMQQueue(connection, randomize("ObjectMessageTest"), true));
}
private void init(AMQConnection connection, AMQDestination destination) throws Exception
@@ -84,7 +86,7 @@
_destination = destination;
_session = (AMQSession) connection.createSession(false, AMQSession.NO_ACKNOWLEDGE);
- //set up a slow consumer
+ // set up a slow consumer
_session.createConsumer(destination).setMessageListener(this);
connection.start();
}
@@ -101,7 +103,7 @@
void send(int count) throws JMSException
{
- //create a publisher
+ // create a publisher
MessageProducer producer = _session.createProducer(_destination);
for (int i = 0; i < count; i++)
{
@@ -113,7 +115,7 @@
void waitFor(int count) throws InterruptedException
{
- synchronized(received)
+ synchronized (received)
{
while (received.size() < count)
{
@@ -136,7 +138,7 @@
}
catch (MessageNotWriteableException mnwe)
{
- //normal execution
+ // normal execution
}
m.clearBody();
@@ -150,7 +152,7 @@
Assert.fail("Message should be writeable");
}
- //Check property write status
+ // Check property write status
try
{
m.setStringProperty("test", "test");
@@ -158,7 +160,7 @@
}
catch (MessageNotWriteableException mnwe)
{
- //normal execution
+ // normal execution
}
m.clearProperties();
@@ -200,6 +202,7 @@
{
errors.add("Found " + actual.next() + " but no more expected values.");
}
+
if (!errors.isEmpty())
{
throw new RuntimeException(errors.toString());
@@ -216,7 +219,7 @@
public void onMessage(Message message)
{
- synchronized(received)
+ synchronized (received)
{
received.add((JMSObjectMessage) message);
received.notify();
@@ -244,7 +247,7 @@
public boolean equals(Object o)
{
- return o instanceof Payload && ((Payload) o).data.equals(data);
+ return (o instanceof Payload) && ((Payload) o).data.equals(data);
}
public String toString()
@@ -256,12 +259,13 @@
public static void main(String[] argv) throws Exception
{
ObjectMessageTest test = new ObjectMessageTest();
- test._connectionString = argv.length == 0 ? "vm://:1" : argv[0];
+ test._connectionString = (argv.length == 0) ? "vm://:1" : argv[0];
test.setUp();
if (argv.length > 1)
{
test._count = Integer.parseInt(argv[1]);
}
+
test.test();
}
Modified: incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/basic/PropertyValueTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/basic/PropertyValueTest.java?view=diff&rev=546190&r1=546189&r2=546190
==============================================================================
--- incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/basic/PropertyValueTest.java (original)
+++ incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/basic/PropertyValueTest.java Mon Jun 11 09:43:57 2007
@@ -20,10 +20,19 @@
*/
package org.apache.qpid.test.unit.basic;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.math.BigDecimal;
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.qpid.client.AMQConnection;
+import org.apache.qpid.client.AMQQueue;
+import org.apache.qpid.client.AMQSession;
+import org.apache.qpid.client.message.AMQMessage;
+import org.apache.qpid.client.message.JMSTextMessage;
+import org.apache.qpid.client.transport.TransportConnection;
+import org.apache.qpid.framing.AMQShortString;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import javax.jms.Destination;
import javax.jms.JMSException;
@@ -33,22 +42,14 @@
import javax.jms.Queue;
import javax.jms.Session;
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
-import org.apache.log4j.Logger;
-import org.apache.qpid.client.AMQConnection;
-import org.apache.qpid.client.AMQQueue;
-import org.apache.qpid.client.AMQSession;
-import org.apache.qpid.client.transport.TransportConnection;
-import org.apache.qpid.client.message.JMSTextMessage;
-import org.apache.qpid.client.message.AMQMessage;
-import org.apache.qpid.framing.AMQShortString;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
public class PropertyValueTest extends TestCase implements MessageListener
{
-
- private static final Logger _logger = Logger.getLogger(PropertyValueTest.class);
+ private static final Logger _logger = LoggerFactory.getLogger(PropertyValueTest.class);
private int count = 0;
private AMQConnection _connection;
@@ -83,7 +84,7 @@
_destination = destination;
_session = (AMQSession) connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
- //set up a slow consumer
+ // set up a slow consumer
_session.createConsumer(destination).setMessageListener(this);
connection.start();
}
@@ -136,7 +137,7 @@
void send(int count) throws JMSException
{
- //create a publisher
+ // create a publisher
MessageProducer producer = _session.createProducer(_destination);
for (int i = 0; i < count; i++)
{
@@ -152,14 +153,14 @@
m.setIntProperty("Int", (int) Integer.MAX_VALUE);
m.setJMSCorrelationID("Correlation");
- //fixme the m.setJMSMessage has no effect
+ // fixme the m.setJMSMessage has no effect
producer.setPriority(8);
m.setJMSPriority(3);
- // Queue
+ // Queue
Queue q;
- if (i / 2 == 0)
+ if ((i / 2) == 0)
{
q = _session.createTemporaryQueue();
}
@@ -173,8 +174,8 @@
_logger.trace("Message:" + m);
- Assert.assertEquals("Check temp queue has been set correctly",
- m.getJMSReplyTo().toString(), m.getStringProperty("TempQueue"));
+ Assert.assertEquals("Check temp queue has been set correctly", m.getJMSReplyTo().toString(),
+ m.getStringProperty("TempQueue"));
m.setJMSType("Test");
m.setLongProperty("UnsignedInt", (long) 4294967295L);
@@ -183,18 +184,17 @@
m.setShortProperty("Short", (short) Short.MAX_VALUE);
m.setStringProperty("String", "Test");
- //AMQP Specific values
+ // AMQP Specific values
// Timestamp
long nano = System.nanoTime();
m.setStringProperty("time-str", String.valueOf(nano));
((AMQMessage) m).setTimestampProperty(new AMQShortString("time"), nano);
- //Decimal
+ // Decimal
BigDecimal bd = new BigDecimal(Integer.MAX_VALUE);
((AMQMessage) m).setDecimalProperty(new AMQShortString("decimal"), bd.setScale(Byte.MAX_VALUE));
-
bd = new BigDecimal((long) Integer.MAX_VALUE + 1L);
try
@@ -207,10 +207,10 @@
// normal path.
}
-
try
{
- ((AMQMessage) m).setDecimalProperty(new AMQShortString("decimal-bad-scale"), bd.setScale(Byte.MAX_VALUE + 1));
+ ((AMQMessage) m).setDecimalProperty(new AMQShortString("decimal-bad-scale"),
+ bd.setScale(Byte.MAX_VALUE + 1));
fail("UnsupportedOperationException should be thrown as scale can't be correctly transmitted");
}
catch (UnsupportedOperationException uoe)
@@ -218,7 +218,7 @@
// normal path.
}
- //Void
+ // Void
((AMQMessage) m).setVoidProperty(new AMQShortString("void"));
_logger.debug("Sending Msg:" + m);
@@ -244,58 +244,53 @@
{
actual.add(m.getText());
- //Check Properties
+ // Check Properties
- Assert.assertEquals("Check Boolean properties are correctly transported",
- true, m.getBooleanProperty("Bool"));
- Assert.assertEquals("Check Byte properties are correctly transported",
- (byte) Byte.MAX_VALUE, m.getByteProperty("Byte"));
- Assert.assertEquals("Check Double properties are correctly transported",
- (double) Double.MAX_VALUE, m.getDoubleProperty("Double"));
- Assert.assertEquals("Check Float properties are correctly transported",
- (float) Float.MAX_VALUE, m.getFloatProperty("Float"));
- Assert.assertEquals("Check Int properties are correctly transported",
- (int) Integer.MAX_VALUE, m.getIntProperty("Int"));
- Assert.assertEquals("Check CorrelationID properties are correctly transported",
- "Correlation", m.getJMSCorrelationID());
- Assert.assertEquals("Check Priority properties are correctly transported",
- 8, m.getJMSPriority());
+ Assert.assertEquals("Check Boolean properties are correctly transported", true, m.getBooleanProperty("Bool"));
+ Assert.assertEquals("Check Byte properties are correctly transported", (byte) Byte.MAX_VALUE,
+ m.getByteProperty("Byte"));
+ Assert.assertEquals("Check Double properties are correctly transported", (double) Double.MAX_VALUE,
+ m.getDoubleProperty("Double"));
+ Assert.assertEquals("Check Float properties are correctly transported", (float) Float.MAX_VALUE,
+ m.getFloatProperty("Float"));
+ Assert.assertEquals("Check Int properties are correctly transported", (int) Integer.MAX_VALUE,
+ m.getIntProperty("Int"));
+ Assert.assertEquals("Check CorrelationID properties are correctly transported", "Correlation",
+ m.getJMSCorrelationID());
+ Assert.assertEquals("Check Priority properties are correctly transported", 8, m.getJMSPriority());
// Queue
- Assert.assertEquals("Check ReplyTo properties are correctly transported",
- m.getStringProperty("TempQueue"), m.getJMSReplyTo().toString());
+ Assert.assertEquals("Check ReplyTo properties are correctly transported", m.getStringProperty("TempQueue"),
+ m.getJMSReplyTo().toString());
- Assert.assertEquals("Check Type properties are correctly transported",
- "Test", m.getJMSType());
+ Assert.assertEquals("Check Type properties are correctly transported", "Test", m.getJMSType());
- Assert.assertEquals("Check Short properties are correctly transported",
- (short) Short.MAX_VALUE, m.getShortProperty("Short"));
- Assert.assertEquals("Check UnsignedInt properties are correctly transported",
- (long) 4294967295L, m.getLongProperty("UnsignedInt"));
- Assert.assertEquals("Check Long properties are correctly transported",
- (long) Long.MAX_VALUE, m.getLongProperty("Long"));
- Assert.assertEquals("Check String properties are correctly transported",
- "Test", m.getStringProperty("String"));
+ Assert.assertEquals("Check Short properties are correctly transported", (short) Short.MAX_VALUE,
+ m.getShortProperty("Short"));
+ Assert.assertEquals("Check UnsignedInt properties are correctly transported", (long) 4294967295L,
+ m.getLongProperty("UnsignedInt"));
+ Assert.assertEquals("Check Long properties are correctly transported", (long) Long.MAX_VALUE,
+ m.getLongProperty("Long"));
+ Assert.assertEquals("Check String properties are correctly transported", "Test", m.getStringProperty("String"));
// AMQP Tests Specific values
- Assert.assertEquals("Check Timestamp properties are correctly transported",
- m.getStringProperty("time-str"),
- ((AMQMessage) m).getTimestampProperty(new AMQShortString("time")).toString());
+ Assert.assertEquals("Check Timestamp properties are correctly transported", m.getStringProperty("time-str"),
+ ((AMQMessage) m).getTimestampProperty(new AMQShortString("time")).toString());
- //Decimal
+ // Decimal
BigDecimal bd = new BigDecimal(Integer.MAX_VALUE);
- Assert.assertEquals("Check decimal properties are correctly transported",
- bd.setScale(Byte.MAX_VALUE),
- ((AMQMessage) m).getDecimalProperty(new AMQShortString("decimal")));
+ Assert.assertEquals("Check decimal properties are correctly transported", bd.setScale(Byte.MAX_VALUE),
+ ((AMQMessage) m).getDecimalProperty(new AMQShortString("decimal")));
- //Void
+ // Void
((AMQMessage) m).setVoidProperty(new AMQShortString("void"));
Assert.assertTrue("Check void properties are correctly transported",
- ((AMQMessage) m).getPropertyHeaders().containsKey("void"));
+ ((AMQMessage) m).getPropertyHeaders().containsKey("void"));
}
+
received.clear();
assertEqual(messages.iterator(), actual.iterator());
@@ -325,6 +320,7 @@
{
errors.add("Found " + actual.next() + " but no more expected values.");
}
+
if (!errors.isEmpty())
{
throw new RuntimeException(errors.toString());
@@ -356,12 +352,13 @@
public static void main(String[] argv) throws Exception
{
PropertyValueTest test = new PropertyValueTest();
- test._connectionString = argv.length == 0 ? "vm://:1" : argv[0];
+ test._connectionString = (argv.length == 0) ? "vm://:1" : argv[0];
test.setUp();
if (argv.length > 1)
{
test._count = Integer.parseInt(argv[1]);
}
+
test.testOnce();
}
Modified: incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/basic/SelectorTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/basic/SelectorTest.java?view=diff&rev=546190&r1=546189&r2=546190
==============================================================================
--- incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/basic/SelectorTest.java (original)
+++ incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/basic/SelectorTest.java Mon Jun 11 09:43:57 2007
@@ -20,14 +20,8 @@
*/
package org.apache.qpid.test.unit.basic;
-import javax.jms.DeliveryMode;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageListener;
-
import junit.framework.TestCase;
-import org.apache.log4j.Logger;
import org.apache.qpid.client.AMQConnection;
import org.apache.qpid.client.AMQDestination;
import org.apache.qpid.client.AMQQueue;
@@ -35,10 +29,17 @@
import org.apache.qpid.client.BasicMessageProducer;
import org.apache.qpid.client.transport.TransportConnection;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.jms.DeliveryMode;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+
public class SelectorTest extends TestCase implements MessageListener
{
-
- private final static Logger _logger = org.apache.log4j.Logger.getLogger(SelectorTest.class);
+ private static final Logger _logger = LoggerFactory.getLogger(SelectorTest.class);
private AMQConnection _connection;
private AMQDestination _destination;
@@ -70,13 +71,12 @@
_destination = destination;
connection.start();
-
String selector = null;
-// selector = "Cost = 2 AND JMSDeliveryMode=" + DeliveryMode.NON_PERSISTENT;
-// selector = "JMSType = Special AND Cost = 2 AND AMQMessageID > 0 AND JMSDeliveryMode=" + DeliveryMode.NON_PERSISTENT;
+ // selector = "Cost = 2 AND JMSDeliveryMode=" + DeliveryMode.NON_PERSISTENT;
+ // selector = "JMSType = Special AND Cost = 2 AND AMQMessageID > 0 AND JMSDeliveryMode=" + DeliveryMode.NON_PERSISTENT;
_session = (AMQSession) connection.createSession(false, AMQSession.NO_ACKNOWLEDGE);
- //_session.createConsumer(destination).setMessageListener(this);
+ // _session.createConsumer(destination).setMessageListener(this);
_session.createConsumer(destination, selector).setMessageListener(this);
}
@@ -103,7 +103,7 @@
if (count == 0)
{
fail("Did not get message!");
- //throw new RuntimeException("Did not get message!");
+ // throw new RuntimeException("Did not get message!");
}
}
finally
@@ -128,7 +128,7 @@
public static void main(String[] argv) throws Exception
{
SelectorTest test = new SelectorTest();
- test._connectionString = argv.length == 0 ? "localhost:5672" : argv[0];
+ test._connectionString = (argv.length == 0) ? "localhost:5672" : argv[0];
test.setUp();
test.test();
}
Modified: incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/basic/SessionStartTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/basic/SessionStartTest.java?view=diff&rev=546190&r1=546189&r2=546190
==============================================================================
--- incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/basic/SessionStartTest.java (original)
+++ incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/basic/SessionStartTest.java Mon Jun 11 09:43:57 2007
@@ -7,9 +7,9 @@
* 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
@@ -20,23 +20,25 @@
*/
package org.apache.qpid.test.unit.basic;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageListener;
-
import junit.framework.TestCase;
import org.apache.qpid.client.AMQConnection;
import org.apache.qpid.client.AMQDestination;
import org.apache.qpid.client.AMQQueue;
import org.apache.qpid.client.AMQSession;
-import org.apache.qpid.testutil.VMBrokerSetup;
import org.apache.qpid.framing.AMQShortString;
-import org.apache.log4j.Logger;
+import org.apache.qpid.testutil.VMBrokerSetup;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageListener;
public class SessionStartTest extends TestCase implements MessageListener
{
- private static final Logger _logger = Logger.getLogger(SessionStartTest.class);
+ private static final Logger _logger = LoggerFactory.getLogger(SessionStartTest.class);
private AMQConnection _connection;
private AMQDestination _destination;
@@ -57,7 +59,8 @@
private void init(AMQConnection connection) throws Exception
{
- init(connection, new AMQQueue(connection.getDefaultQueueExchangeName(), new AMQShortString(randomize("SessionStartTest")), true));
+ init(connection,
+ new AMQQueue(connection.getDefaultQueueExchangeName(), new AMQShortString(randomize("SessionStartTest")), true));
}
private void init(AMQConnection connection, AMQDestination destination) throws Exception
@@ -107,7 +110,7 @@
public static void main(String[] argv) throws Exception
{
SessionStartTest test = new SessionStartTest();
- test._connectionString = argv.length == 0 ? "localhost:5672" : argv[0];
+ test._connectionString = (argv.length == 0) ? "localhost:5672" : argv[0];
test.setUp();
test.test();
}
Modified: incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/basic/TextMessageTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/basic/TextMessageTest.java?view=diff&rev=546190&r1=546189&r2=546190
==============================================================================
--- incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/basic/TextMessageTest.java (original)
+++ incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/basic/TextMessageTest.java Mon Jun 11 09:43:57 2007
@@ -7,9 +7,9 @@
* 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
@@ -20,9 +20,18 @@
*/
package org.apache.qpid.test.unit.basic;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.qpid.client.AMQConnection;
+import org.apache.qpid.client.AMQQueue;
+import org.apache.qpid.client.AMQSession;
+import org.apache.qpid.client.message.JMSTextMessage;
+import org.apache.qpid.framing.AMQShortString;
+import org.apache.qpid.testutil.VMBrokerSetup;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import javax.jms.Destination;
import javax.jms.JMSException;
@@ -32,20 +41,13 @@
import javax.jms.MessageProducer;
import javax.jms.Session;
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
-import org.apache.log4j.Logger;
-import org.apache.qpid.client.AMQConnection;
-import org.apache.qpid.client.AMQQueue;
-import org.apache.qpid.client.AMQSession;
-import org.apache.qpid.client.message.JMSTextMessage;
-import org.apache.qpid.testutil.VMBrokerSetup;
-import org.apache.qpid.framing.AMQShortString;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
public class TextMessageTest extends TestCase implements MessageListener
{
- private static final Logger _logger = Logger.getLogger(TextMessageTest.class);
+ private static final Logger _logger = LoggerFactory.getLogger(TextMessageTest.class);
private AMQConnection _connection;
private Destination _destination;
@@ -75,7 +77,8 @@
private void init(AMQConnection connection) throws Exception
{
- Destination destination = new AMQQueue(connection.getDefaultQueueExchangeName(), new AMQShortString(randomize("TextMessageTest")), true);
+ Destination destination =
+ new AMQQueue(connection.getDefaultQueueExchangeName(), new AMQShortString(randomize("TextMessageTest")), true);
init(connection, destination);
}
@@ -85,7 +88,7 @@
_destination = destination;
_session = (AMQSession) connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
- //set up a slow consumer
+ // set up a slow consumer
_session.createConsumer(destination).setMessageListener(this);
connection.start();
}
@@ -102,7 +105,7 @@
void send(int count) throws JMSException
{
- //create a publisher
+ // create a publisher
MessageProducer producer = _session.createProducer(_destination);
for (int i = 0; i < count; i++)
{
@@ -118,7 +121,7 @@
void waitFor(int count) throws InterruptedException
{
- synchronized(received)
+ synchronized (received)
{
while (received.size() < count)
{
@@ -134,7 +137,7 @@
{
actual.add(m.getText());
- //Check body write status
+ // Check body write status
try
{
m.setText("Test text");
@@ -142,7 +145,7 @@
}
catch (MessageNotWriteableException mnwe)
{
- //normal execution
+ // normal execution
}
m.clearBody();
@@ -156,7 +159,7 @@
Assert.fail("Message should be writeable");
}
- //Check property write status
+ // Check property write status
try
{
m.setStringProperty("test", "test");
@@ -164,7 +167,7 @@
}
catch (MessageNotWriteableException mnwe)
{
- //normal execution
+ // normal execution
}
m.clearProperties();
@@ -205,6 +208,7 @@
{
errors.add("Found " + actual.next() + " but no more expected values.");
}
+
if (!errors.isEmpty())
{
throw new RuntimeException(errors.toString());
@@ -221,7 +225,7 @@
public void onMessage(Message message)
{
- synchronized(received)
+ synchronized (received)
{
received.add((JMSTextMessage) message);
received.notify();
@@ -236,12 +240,13 @@
public static void main(String[] argv) throws Exception
{
TextMessageTest test = new TextMessageTest();
- test._connectionString = argv.length == 0 ? "vm://:1" : argv[0];
+ test._connectionString = (argv.length == 0) ? "vm://:1" : argv[0];
test.setUp();
if (argv.length > 1)
{
test._count = Integer.parseInt(argv[1]);
}
+
test.test();
}
Modified: incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/basic/close/CloseTests.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/basic/close/CloseTests.java?view=diff&rev=546190&r1=546189&r2=546190
==============================================================================
--- incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/basic/close/CloseTests.java (original)
+++ incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/basic/close/CloseTests.java Mon Jun 11 09:43:57 2007
@@ -14,35 +14,35 @@
* "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.
+ * under the License.
+ *
*
- *
*/
package org.apache.qpid.test.unit.basic.close;
import junit.framework.TestCase;
-import org.apache.qpid.client.transport.TransportConnection;
+
+import org.apache.qpid.AMQException;
import org.apache.qpid.client.AMQConnection;
import org.apache.qpid.client.AMQQueue;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.url.URLSyntaxException;
+import org.apache.qpid.client.transport.TransportConnection;
import org.apache.qpid.url.AMQBindingURL;
-import org.apache.log4j.Logger;
+import org.apache.qpid.url.URLSyntaxException;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
-import javax.jms.Session;
import javax.jms.JMSException;
import javax.jms.MessageConsumer;
import javax.jms.MessageProducer;
+import javax.jms.Session;
public class CloseTests extends TestCase
{
-
- private static final Logger _logger = Logger.getLogger(CloseTests.class);
-
+ private static final Logger _logger = LoggerFactory.getLogger(CloseTests.class);
private static final String BROKER = "vm://:1";
-
protected void setUp() throws Exception
{
super.setUp();
@@ -57,12 +57,11 @@
TransportConnection.killVMBroker(1);
}
-
public void testCloseQueueReceiver() throws AMQException, URLSyntaxException, JMSException
{
AMQConnection connection = new AMQConnection(BROKER, "guest", "guest", this.getName(), "test");
- Session session = connection.createQueueSession(false,Session.AUTO_ACKNOWLEDGE);
+ Session session = connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
AMQQueue queue = new AMQQueue(new AMQBindingURL("test-queue"));
MessageConsumer consumer = session.createConsumer(queue);
@@ -76,6 +75,6 @@
consumer.close();
_logger.info("Closed Consumer");
-
+
}
}
Modified: incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/client/channelclose/ChannelCloseMethodHandlerNoCloseOk.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/client/channelclose/ChannelCloseMethodHandlerNoCloseOk.java?view=diff&rev=546190&r1=546189&r2=546190
==============================================================================
--- incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/client/channelclose/ChannelCloseMethodHandlerNoCloseOk.java (original)
+++ incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/client/channelclose/ChannelCloseMethodHandlerNoCloseOk.java Mon Jun 11 09:43:57 2007
@@ -14,30 +14,32 @@
* "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.
+ * under the License.
+ *
*
- *
*/
package org.apache.qpid.test.unit.client.channelclose;
-import org.apache.log4j.Logger;
-import org.apache.qpid.client.state.AMQStateManager;
-import org.apache.qpid.client.state.StateAwareMethodListener;
-import org.apache.qpid.client.protocol.AMQProtocolSession;
-import org.apache.qpid.client.AMQNoConsumersException;
-import org.apache.qpid.client.AMQNoRouteException;
-import org.apache.qpid.protocol.AMQMethodEvent;
-import org.apache.qpid.protocol.AMQConstant;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.AMQInvalidRoutingKeyException;
import org.apache.qpid.AMQChannelClosedException;
+import org.apache.qpid.AMQException;
import org.apache.qpid.AMQInvalidArgumentException;
-import org.apache.qpid.framing.ChannelCloseBody;
+import org.apache.qpid.AMQInvalidRoutingKeyException;
+import org.apache.qpid.client.AMQNoConsumersException;
+import org.apache.qpid.client.AMQNoRouteException;
+import org.apache.qpid.client.protocol.AMQProtocolSession;
+import org.apache.qpid.client.state.AMQStateManager;
+import org.apache.qpid.client.state.StateAwareMethodListener;
import org.apache.qpid.framing.AMQShortString;
+import org.apache.qpid.framing.ChannelCloseBody;
+import org.apache.qpid.protocol.AMQConstant;
+import org.apache.qpid.protocol.AMQMethodEvent;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class ChannelCloseMethodHandlerNoCloseOk implements StateAwareMethodListener
{
- private static final Logger _logger = Logger.getLogger(ChannelCloseMethodHandlerNoCloseOk.class);
+ private static final Logger _logger = LoggerFactory.getLogger(ChannelCloseMethodHandlerNoCloseOk.class);
private static ChannelCloseMethodHandlerNoCloseOk _handler = new ChannelCloseMethodHandlerNoCloseOk();
@@ -46,7 +48,8 @@
return _handler;
}
- public void methodReceived(AMQStateManager stateManager, AMQProtocolSession protocolSession, AMQMethodEvent evt) throws AMQException
+ public void methodReceived(AMQStateManager stateManager, AMQProtocolSession protocolSession, AMQMethodEvent evt)
+ throws AMQException
{
_logger.debug("ChannelClose method received");
ChannelCloseBody method = (ChannelCloseBody) evt.getMethod();
@@ -59,9 +62,9 @@
}
// For this test Method Handler .. don't send Close-OK
-// // TODO: Be aware of possible changes to parameter order as versions change.
-// AMQFrame frame = ChannelCloseOkBody.createAMQFrame(evt.getChannelId(), method.getMajor(), method.getMinor());
-// protocolSession.writeFrame(frame);
+ // // TODO: Be aware of possible changes to parameter order as versions change.
+ // AMQFrame frame = ChannelCloseOkBody.createAMQFrame(evt.getChannelId(), method.getMajor(), method.getMinor());
+ // protocolSession.writeFrame(frame);
if (errorCode != AMQConstant.REPLY_SUCCESS)
{
_logger.error("Channel close received with errorCode " + errorCode + ", and reason " + reason);
@@ -91,6 +94,7 @@
}
}
+
protocolSession.channelClosed(evt.getChannelId(), errorCode, String.valueOf(reason));
}
-}
\ No newline at end of file
+}
Modified: incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/client/channelclose/ChannelCloseOkTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/client/channelclose/ChannelCloseOkTest.java?view=diff&rev=546190&r1=546189&r2=546190
==============================================================================
--- incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/client/channelclose/ChannelCloseOkTest.java (original)
+++ incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/client/channelclose/ChannelCloseOkTest.java Mon Jun 11 09:43:57 2007
@@ -7,9 +7,9 @@
* 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
@@ -20,10 +20,17 @@
*/
package org.apache.qpid.test.unit.client.channelclose;
-import java.util.ArrayList;
-import java.util.List;
+import junit.framework.TestCase;
+
+import junit.textui.TestRunner;
+
+import org.apache.qpid.client.AMQConnection;
+import org.apache.qpid.client.AMQQueue;
+import org.apache.qpid.client.transport.TransportConnection;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
-import javax.jms.Connection;
import javax.jms.Destination;
import javax.jms.ExceptionListener;
import javax.jms.JMSException;
@@ -33,14 +40,8 @@
import javax.jms.Session;
import javax.jms.TextMessage;
-import junit.framework.TestCase;
-import junit.textui.TestRunner;
-
-import org.apache.log4j.Logger;
-import org.apache.qpid.client.AMQConnection;
-import org.apache.qpid.client.AMQQueue;
-import org.apache.qpid.client.transport.TransportConnection;
-
+import java.util.ArrayList;
+import java.util.List;
/**
* Due to bizarre exception handling all sessions are closed if you get
@@ -66,10 +67,9 @@
private final List<Message> _received1 = new ArrayList<Message>();
private final List<Message> _received2 = new ArrayList<Message>();
- private final static Logger _log = Logger.getLogger(ChannelCloseOkTest.class);
+ private static final Logger _log = LoggerFactory.getLogger(ChannelCloseOkTest.class);
public String _connectionString = "vm://:1";
-
protected void setUp() throws Exception
{
super.setUp();
@@ -77,34 +77,34 @@
TransportConnection.createVMBroker(1);
_connection = new AMQConnection(_connectionString, "guest", "guest", randomize("Client"), "test");
- _destination1 = new AMQQueue(_connection,"q1", true);
+ _destination1 = new AMQQueue(_connection, "q1", true);
_destination2 = new AMQQueue(_connection, "q2", true);
_session1 = _connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
_session1.createConsumer(_destination1).setMessageListener(new MessageListener()
- {
- public void onMessage(Message message)
{
- _log.debug("consumer 1 got message [" + getTextMessage(message) + "]");
- synchronized(_received1)
+ public void onMessage(Message message)
{
- _received1.add(message);
- _received1.notify();
+ _log.debug("consumer 1 got message [" + getTextMessage(message) + "]");
+ synchronized (_received1)
+ {
+ _received1.add(message);
+ _received1.notify();
+ }
}
- }
- });
+ });
_session2 = _connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
_session2.createConsumer(_destination2).setMessageListener(new MessageListener()
- {
- public void onMessage(Message message)
{
- _log.debug("consumer 2 got message [" + getTextMessage(message) + "]");
- synchronized(_received2)
+ public void onMessage(Message message)
{
- _received2.add(message);
- _received2.notify();
+ _log.debug("consumer 2 got message [" + getTextMessage(message) + "]");
+ synchronized (_received2)
+ {
+ _received2.add(message);
+ _received2.notify();
+ }
}
- }
- });
+ });
_connection.start();
}
@@ -145,12 +145,12 @@
public void testWithExceptionListener() throws Exception
{
_connection.setExceptionListener(new ExceptionListener()
- {
- public void onException(JMSException jmsException)
{
- _log.warn("onException - "+jmsException.getMessage());
- }
- });
+ public void onException(JMSException jmsException)
+ {
+ _log.warn("onException - " + jmsException.getMessage());
+ }
+ });
doTest();
}
@@ -175,6 +175,7 @@
send(_session1, _destination1, "" + i);
send(_session2, _destination2, "" + i);
}
+
waitFor(_received1, num + 1);
waitFor(_received2, num + 1);
@@ -184,7 +185,7 @@
}
private void sendAndWait(Session session, Destination destination, String message, List<Message> received, int count)
- throws JMSException, InterruptedException
+ throws JMSException, InterruptedException
{
send(session, destination, message);
waitFor(received, count);
@@ -199,7 +200,7 @@
private void waitFor(List<Message> received, int count) throws InterruptedException
{
- synchronized(received)
+ synchronized (received)
{
while (received.size() < count)
{
Modified: incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/client/channelclose/ChannelCloseTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/client/channelclose/ChannelCloseTest.java?view=diff&rev=546190&r1=546189&r2=546190
==============================================================================
--- incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/client/channelclose/ChannelCloseTest.java (original)
+++ incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/client/channelclose/ChannelCloseTest.java Mon Jun 11 09:43:57 2007
@@ -22,8 +22,6 @@
import junit.framework.TestCase;
-import org.apache.log4j.Logger;
-
import org.apache.qpid.AMQException;
import org.apache.qpid.AMQTimeoutException;
import org.apache.qpid.client.AMQConnection;
@@ -42,6 +40,9 @@
import org.apache.qpid.protocol.AMQConstant;
import org.apache.qpid.url.URLSyntaxException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import javax.jms.Connection;
import javax.jms.ExceptionListener;
import javax.jms.JMSException;
@@ -54,7 +55,7 @@
public class ChannelCloseTest extends TestCase implements ExceptionListener, ConnectionListener
{
- private static final Logger _logger = Logger.getLogger(ChannelCloseTest.class);
+ private static final Logger _logger = LoggerFactory.getLogger(ChannelCloseTest.class);
Connection _connection;
private String _brokerlist = "vm://:1";
Modified: incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/client/forwardall/Client.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/client/forwardall/Client.java?view=diff&rev=546190&r1=546189&r2=546190
==============================================================================
--- incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/client/forwardall/Client.java (original)
+++ incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/client/forwardall/Client.java Mon Jun 11 09:43:57 2007
@@ -7,9 +7,9 @@
* 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
@@ -20,14 +20,16 @@
*/
package org.apache.qpid.test.unit.client.forwardall;
-import javax.jms.Message;
-import javax.jms.MessageListener;
-
import org.apache.qpid.client.AMQConnection;
import org.apache.qpid.client.AMQQueue;
import org.apache.qpid.client.AMQSession;
import org.apache.qpid.framing.AMQShortString;
-import org.apache.log4j.Logger;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.jms.Message;
+import javax.jms.MessageListener;
/**
* Declare a private temporary response queue,
@@ -37,8 +39,7 @@
*/
public class Client implements MessageListener
{
-
- private static final Logger _logger = Logger.getLogger(Client.class);
+ private static final Logger _logger = LoggerFactory.getLogger(Client.class);
private final AMQConnection _connection;
private final AMQSession _session;
@@ -55,10 +56,11 @@
_connection = connection;
_expected = expected;
_session = (AMQSession) _connection.createSession(false, AMQSession.NO_ACKNOWLEDGE);
- AMQQueue response = new AMQQueue(_connection.getDefaultQueueExchangeName(), new AMQShortString("ResponseQueue"), true);
+ AMQQueue response =
+ new AMQQueue(_connection.getDefaultQueueExchangeName(), new AMQShortString("ResponseQueue"), true);
_session.createConsumer(response).setMessageListener(this);
_connection.start();
- AMQQueue service = new SpecialQueue(_connection,"ServiceQueue");
+ AMQQueue service = new SpecialQueue(_connection, "ServiceQueue");
Message request = _session.createTextMessage("Request!");
request.setJMSReplyTo(response);
_session.createProducer(service).send(request);
@@ -72,27 +74,27 @@
public synchronized void onMessage(Message response)
{
-
- _logger.info("Received " + (++_count) + " of " + _expected + " responses.");
- if(_count == _expected)
+
+ _logger.info("Received " + (++_count) + " of " + _expected + " responses.");
+ if (_count == _expected)
{
notifyAll();
}
-
}
synchronized void waitUntilComplete() throws Exception
{
- if(_count < _expected)
+ if (_count < _expected)
{
wait(10000L);
}
- if(_count < _expected)
+
+ if (_count < _expected)
{
- throw new Exception("Didn't receive all messages... got " + _count + " expected " + _expected);
+ throw new Exception("Didn't receive all messages... got " + _count + " expected " + _expected);
}
}
@@ -105,7 +107,8 @@
{
final String connectionString;
final int expected;
- if (argv.length == 0) {
+ if (argv.length == 0)
+ {
connectionString = "localhost:5672";
expected = 100;
}
Modified: incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/client/forwardall/CombinedTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/client/forwardall/CombinedTest.java?view=diff&rev=546190&r1=546189&r2=546190
==============================================================================
--- incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/client/forwardall/CombinedTest.java (original)
+++ incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/client/forwardall/CombinedTest.java Mon Jun 11 09:43:57 2007
@@ -7,9 +7,9 @@
* 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
@@ -23,7 +23,9 @@
import junit.framework.TestCase;
import org.apache.qpid.testutil.VMBrokerSetup;
-import org.apache.log4j.Logger;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Runs the Service's and Client parts of the test in the same process
@@ -31,7 +33,7 @@
*/
public class CombinedTest extends TestCase
{
- private static final Logger _logger = Logger.getLogger(CombinedTest.class);
+ private static final Logger _logger = LoggerFactory.getLogger(CombinedTest.class);
protected void setUp() throws Exception
{
Modified: incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/client/forwardall/ServiceCreator.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/client/forwardall/ServiceCreator.java?view=diff&rev=546190&r1=546189&r2=546190
==============================================================================
--- incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/client/forwardall/ServiceCreator.java (original)
+++ incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/client/forwardall/ServiceCreator.java Mon Jun 11 09:43:57 2007
@@ -7,9 +7,9 @@
* 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
@@ -20,14 +20,14 @@
*/
package org.apache.qpid.test.unit.client.forwardall;
-import org.apache.log4j.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import javax.jms.JMSException;
public class ServiceCreator implements Runnable
{
- private static final Logger _logger = Logger.getLogger(ServiceCreator.class);
-
+ private static final Logger _logger = LoggerFactory.getLogger(ServiceCreator.class);
private static Thread[] threads;
private static ServiceCreator[] _services;
@@ -67,7 +67,7 @@
}
catch (JMSException e)
{
- //ignore
+ // ignore
}
}
}
@@ -77,7 +77,7 @@
threads = new Thread[services];
_services = new ServiceCreator[services];
ServiceCreator runner = new ServiceCreator(broker);
- //start services
+ // start services
_logger.info("Starting " + services + " services...");
for (int i = 0; i < services; i++)
{
@@ -106,6 +106,7 @@
connectionString = argv[0];
services = Integer.parseInt(argv[1]);
}
+
start(connectionString, services);
}
}