You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by vi...@apache.org on 2006/11/19 05:14:45 UTC
svn commit: r476701 [3/3] - in /incubator/qpid/trunk/qpid/java: ./ broker/
broker/src/test/java/org/apache/qpid/server/
broker/src/test/java/org/apache/qpid/server/configuration/
broker/src/test/java/org/apache/qpid/server/exchange/ broker/src/test/jav...
Modified: incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/jndi/referenceabletest/JNDIReferenceableTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/jndi/referenceabletest/JNDIReferenceableTest.java?view=diff&rev=476701&r1=476700&r2=476701
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/jndi/referenceabletest/JNDIReferenceableTest.java (original)
+++ incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/jndi/referenceabletest/JNDIReferenceableTest.java Sat Nov 18 20:14:42 2006
@@ -20,18 +20,14 @@
*/
package org.apache.qpid.test.unit.jndi.referenceabletest;
-import org.junit.Test;
-import org.junit.Assert;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Ignore;
import org.apache.qpid.client.transport.TransportConnection;
import org.apache.qpid.client.vmbroker.AMQVMBrokerCreationException;
-import junit.framework.JUnit4TestAdapter;
+import org.apache.qpid.test.VMBrokerSetup;
import javax.naming.NameAlreadyBoundException;
import javax.naming.NoInitialContextException;
+import junit.framework.TestCase;
/**
* Usage: To run these you need to have the sun JNDI SPI for the FileSystem.
@@ -43,31 +39,10 @@
* <p/>
* Also you need to create the directory /temp/qpid-jndi-test
*/
-public class JNDIReferenceableTest
+public class JNDIReferenceableTest extends TestCase
{
- @Before
- public void createVMBroker()
- {
- try
- {
- TransportConnection.createVMBroker(1);
- }
- catch (AMQVMBrokerCreationException e)
- {
- Assert.fail("Unable to create broker: " + e);
- }
- }
-
- @After
- public void stopVmBroker()
- {
- TransportConnection.killVMBroker(1);
- }
-
-
- @Ignore("FSContext has been removed from repository. This needs redone with the PropertiesFileInitialContextFactory. QPID-84")
- @Test
- public void referenceable()
+ // FIXME FSContext has been removed from repository. This needs redone with the PropertiesFileInitialContextFactory. QPID-84
+ public void testReferenceable()
{
Bind b = null;
try
@@ -86,18 +61,18 @@
}
catch (NameAlreadyBoundException ee)
{
- Assert.fail("Unable to clear bound objects for test.");
+ fail("Unable to clear bound objects for test.");
}
}
else
{
- Assert.fail("Unable to clear bound objects for test.");
+ fail("Unable to clear bound objects for test.");
}
}
}
catch (NoInitialContextException e)
{
- Assert.fail("You don't have the File System SPI on you class path.\n" +
+ fail("You don't have the File System SPI on you class path.\n" +
"This can be downloaded from sun here:\n" +
"http://java.sun.com/products/jndi/downloads/index.html\n" +
"Click : Download JNDI 1.2.1 & More button\n" +
@@ -105,25 +80,25 @@
"and add the two jars in the lib dir to your class path.");
}
- Assert.assertTrue(b.bound());
+ assertTrue(b.bound());
Lookup l = new Lookup(b.getProviderURL());
- Assert.assertTrue(l.connectionFactoryValue().equals(b.connectionFactoryValue()));
+ assertTrue(l.connectionFactoryValue().equals(b.connectionFactoryValue()));
- Assert.assertTrue(l.connectionValue().equals(b.connectionValue()));
+ assertTrue(l.connectionValue().equals(b.connectionValue()));
- Assert.assertTrue(l.topicValue().equals(b.topicValue()));
+ assertTrue(l.topicValue().equals(b.topicValue()));
Unbind u = new Unbind();
- Assert.assertTrue(u.unbound());
+ assertTrue(u.unbound());
}
public static junit.framework.Test suite()
{
- return new JUnit4TestAdapter(JNDIReferenceableTest.class);
+ return new VMBrokerSetup(new junit.framework.TestSuite(JNDIReferenceableTest.class));
}
}
Modified: incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/topic/DurableSubscriptionTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/topic/DurableSubscriptionTest.java?view=diff&rev=476701&r1=476700&r2=476701
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/topic/DurableSubscriptionTest.java (original)
+++ incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/topic/DurableSubscriptionTest.java Sat Nov 18 20:14:42 2006
@@ -20,11 +20,6 @@
*/
package org.apache.qpid.test.unit.topic;
-import junit.framework.JUnit4TestAdapter;
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.Before;
-import org.junit.After;
import org.apache.qpid.AMQException;
import org.apache.qpid.client.vmbroker.AMQVMBrokerCreationException;
import org.apache.qpid.url.URLSyntaxException;
@@ -32,6 +27,7 @@
import org.apache.qpid.client.AMQSession;
import org.apache.qpid.client.AMQTopic;
import org.apache.qpid.client.transport.TransportConnection;
+import org.apache.qpid.test.VMBrokerSetup;
import javax.jms.JMSException;
import javax.jms.Message;
@@ -41,30 +37,11 @@
import javax.jms.TextMessage;
import javax.jms.TopicSubscriber;
-public class DurableSubscriptionTest
-{
+import junit.framework.TestCase;
- @Before
- public void createVMBroker()
- {
- try
- {
- TransportConnection.createVMBroker(1);
- }
- catch (AMQVMBrokerCreationException e)
- {
- Assert.fail("Unable to create broker: " + e);
- }
- }
-
- @After
- public void stopVmBroker()
- {
- TransportConnection.killVMBroker(1);
- }
-
- @Test
- public void unsubscribe() throws AMQException, JMSException, URLSyntaxException
+public class DurableSubscriptionTest extends TestCase
+{
+ public void testUnsubscribe() throws AMQException, JMSException, URLSyntaxException
{
AMQTopic topic = new AMQTopic("MyTopic");
AMQConnection con = new AMQConnection("vm://:1", "guest", "guest", "test", "/test");
@@ -81,32 +58,31 @@
Message msg;
msg = consumer1.receive();
- Assert.assertEquals("A", ((TextMessage) msg).getText());
+ assertEquals("A", ((TextMessage) msg).getText());
msg = consumer1.receive(1000);
- Assert.assertEquals(null, msg);
+ assertEquals(null, msg);
msg = consumer2.receive();
- Assert.assertEquals("A", ((TextMessage) msg).getText());
+ assertEquals("A", ((TextMessage) msg).getText());
msg = consumer2.receive(1000);
- Assert.assertEquals(null, msg);
+ assertEquals(null, msg);
session2.unsubscribe("MySubscription");
producer.send(session1.createTextMessage("B"));
msg = consumer1.receive();
- Assert.assertEquals("B", ((TextMessage) msg).getText());
+ assertEquals("B", ((TextMessage) msg).getText());
msg = consumer1.receive(1000);
- Assert.assertEquals(null, msg);
+ assertEquals(null, msg);
msg = consumer2.receive(1000);
- Assert.assertEquals(null, msg);
+ assertEquals(null, msg);
con.close();
}
- @Test
- public void durability() throws AMQException, JMSException, URLSyntaxException
+ public void testDurability() throws AMQException, JMSException, URLSyntaxException
{
AMQTopic topic = new AMQTopic("MyTopic");
AMQConnection con = new AMQConnection("vm://:1", "guest", "guest", "test", "/test");
@@ -123,14 +99,14 @@
Message msg;
msg = consumer1.receive();
- Assert.assertEquals("A", ((TextMessage) msg).getText());
+ assertEquals("A", ((TextMessage) msg).getText());
msg = consumer1.receive(1000);
- Assert.assertEquals(null, msg);
+ assertEquals(null, msg);
msg = consumer2.receive();
- Assert.assertEquals("A", ((TextMessage) msg).getText());
+ assertEquals("A", ((TextMessage) msg).getText());
msg = consumer2.receive(1000);
- Assert.assertEquals(null, msg);
+ assertEquals(null, msg);
consumer2.close();
@@ -140,21 +116,20 @@
producer.send(session1.createTextMessage("B"));
msg = consumer1.receive();
- Assert.assertEquals("B", ((TextMessage) msg).getText());
+ assertEquals("B", ((TextMessage) msg).getText());
msg = consumer1.receive(1000);
- Assert.assertEquals(null, msg);
+ assertEquals(null, msg);
msg = consumer3.receive();
- Assert.assertEquals("B", ((TextMessage) msg).getText());
+ assertEquals("B", ((TextMessage) msg).getText());
msg = consumer3.receive(1000);
- Assert.assertEquals(null, msg);
+ assertEquals(null, msg);
con.close();
}
public static junit.framework.Test suite()
{
- return new JUnit4TestAdapter(DurableSubscriptionTest.class);
+ return new VMBrokerSetup(new junit.framework.TestSuite(DurableSubscriptionTest.class));
}
-
}
Modified: incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/transacted/TransactedTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/transacted/TransactedTest.java?view=diff&rev=476701&r1=476700&r2=476701
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/transacted/TransactedTest.java (original)
+++ incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/transacted/TransactedTest.java Sat Nov 18 20:14:42 2006
@@ -20,24 +20,18 @@
*/
package org.apache.qpid.test.unit.transacted;
-import junit.framework.JUnit4TestAdapter;
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.vmbroker.AMQVMBrokerCreationException;
-import org.junit.After;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.AfterClass;
+import org.apache.qpid.test.VMBrokerSetup;
import javax.jms.*;
-public class TransactedTest
+import junit.framework.TestCase;
+
+public class TransactedTest extends TestCase
{
private AMQQueue queue1;
private AMQQueue queue2;
@@ -56,28 +50,9 @@
private MessageConsumer testConsumer1;
private MessageConsumer testConsumer2;
-
- public void createVMBroker()
- {
- try
- {
- TransportConnection.createVMBroker(1);
- }
- catch (AMQVMBrokerCreationException e)
- {
- Assert.fail("Unable to create broker: " + e);
- }
- }
-
- public void stopVmBroker()
+ protected void setup() throws Exception
{
- TransportConnection.killVMBroker(1);
- }
-
- @Before
- public void setup() throws Exception
- {
- createVMBroker();
+ super.setUp();
queue1 = new AMQQueue("Q1", false);
queue2 = new AMQQueue("Q2", false);
@@ -108,17 +83,15 @@
testCon.start();
}
- @After
- public void shutdown() throws Exception
+ protected void tearDown() throws Exception
{
con.close();
testCon.close();
prepCon.close();
- stopVmBroker();
+ super.tearDown();
}
- @Test
- public void commit() throws Exception
+ public void testCommit() throws Exception
{
//send and receive some messages
producer2.send(session.createTextMessage("X"));
@@ -140,8 +113,7 @@
assertTrue(null == testConsumer2.receive(1000));
}
- @Test
- public void rollback() throws Exception
+ public void testRollback() throws Exception
{
producer2.send(session.createTextMessage("X"));
producer2.send(session.createTextMessage("Y"));
@@ -170,7 +142,6 @@
public static junit.framework.Test suite()
{
- return new JUnit4TestAdapter(TransactedTest.class);
+ return new VMBrokerSetup(new junit.framework.TestSuite(TransactedTest.class));
}
-
}
Modified: incubator/qpid/trunk/qpid/java/cluster/src/test/java/org/apache/qpid/server/cluster/ClusterCapabilityTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/cluster/src/test/java/org/apache/qpid/server/cluster/ClusterCapabilityTest.java?view=diff&rev=476701&r1=476700&r2=476701
==============================================================================
--- incubator/qpid/trunk/qpid/java/cluster/src/test/java/org/apache/qpid/server/cluster/ClusterCapabilityTest.java (original)
+++ incubator/qpid/trunk/qpid/java/cluster/src/test/java/org/apache/qpid/server/cluster/ClusterCapabilityTest.java Sat Nov 18 20:14:42 2006
@@ -20,13 +20,11 @@
*/
package org.apache.qpid.server.cluster;
-import static org.junit.Assert.assertTrue;
-import org.junit.Test;
+import junit.framework.TestCase;
-public class ClusterCapabilityTest
+public class ClusterCapabilityTest extends TestCase
{
- @Test
- public void startWithNull()
+ public void testStartWithNull()
{
MemberHandle peer = new SimpleMemberHandle("myhost:9999");
String c = ClusterCapability.add(null, peer);
@@ -34,8 +32,7 @@
assertTrue(peer.matches(ClusterCapability.getPeer(c)));
}
- @Test
- public void startWithText()
+ public void testStartWithText()
{
MemberHandle peer = new SimpleMemberHandle("myhost:9999");
String c = ClusterCapability.add("existing text", peer);
Modified: incubator/qpid/trunk/qpid/java/cluster/src/test/java/org/apache/qpid/server/cluster/SimpleClusterTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/cluster/src/test/java/org/apache/qpid/server/cluster/SimpleClusterTest.java?view=diff&rev=476701&r1=476700&r2=476701
==============================================================================
--- incubator/qpid/trunk/qpid/java/cluster/src/test/java/org/apache/qpid/server/cluster/SimpleClusterTest.java (original)
+++ incubator/qpid/trunk/qpid/java/cluster/src/test/java/org/apache/qpid/server/cluster/SimpleClusterTest.java Sat Nov 18 20:14:42 2006
@@ -20,7 +20,6 @@
*/
package org.apache.qpid.server.cluster;
-import org.junit.Test;
import org.apache.qpid.AMQException;
import org.apache.qpid.url.URLSyntaxException;
import org.apache.qpid.client.AMQConnection;
@@ -28,10 +27,11 @@
import javax.jms.JMSException;
-public class SimpleClusterTest
+import junit.framework.TestCase;
+
+public class SimpleClusterTest extends TestCase
{
- @Test
- public void declareExchange() throws AMQException, JMSException, URLSyntaxException
+ public void testDeclareExchange() throws AMQException, JMSException, URLSyntaxException
{
AMQConnection con = new AMQConnection("localhost:9000", "guest", "guest", "test", "/test");
AMQSession session = (AMQSession) con.createSession(false, AMQSession.NO_ACKNOWLEDGE);
Modified: incubator/qpid/trunk/qpid/java/cluster/src/test/java/org/apache/qpid/server/cluster/SimpleMemberHandleTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/cluster/src/test/java/org/apache/qpid/server/cluster/SimpleMemberHandleTest.java?view=diff&rev=476701&r1=476700&r2=476701
==============================================================================
--- incubator/qpid/trunk/qpid/java/cluster/src/test/java/org/apache/qpid/server/cluster/SimpleMemberHandleTest.java (original)
+++ incubator/qpid/trunk/qpid/java/cluster/src/test/java/org/apache/qpid/server/cluster/SimpleMemberHandleTest.java Sat Nov 18 20:14:42 2006
@@ -20,23 +20,18 @@
*/
package org.apache.qpid.server.cluster;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import org.junit.Test;
+import junit.framework.TestCase;
-public class SimpleMemberHandleTest
+public class SimpleMemberHandleTest extends TestCase
{
- @Test
- public void matches()
+ public void testMatches()
{
assertMatch(new SimpleMemberHandle("localhost", 8888), new SimpleMemberHandle("localhost", 8888));
assertNoMatch(new SimpleMemberHandle("localhost", 8889), new SimpleMemberHandle("localhost", 8888));
assertNoMatch(new SimpleMemberHandle("localhost", 8888), new SimpleMemberHandle("localhost2", 8888));
}
-
- @Test
- public void resolve()
+ public void testResolve()
{
assertEquivalent(new SimpleMemberHandle("WGLAIBD8XGR0J:9000"), new SimpleMemberHandle("localhost:9000"));
}
Modified: incubator/qpid/trunk/qpid/java/pom.xml
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/pom.xml?view=diff&rev=476701&r1=476700&r2=476701
==============================================================================
--- incubator/qpid/trunk/qpid/java/pom.xml (original)
+++ incubator/qpid/trunk/qpid/java/pom.xml Sat Nov 18 20:14:42 2006
@@ -411,7 +411,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
- <version>4.0</version>
+ <version>3.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
@@ -622,7 +622,7 @@
<mkdir dir="${full.eclipse.workspace}/.metadata/.plugins/org.eclipse.core.runtime/.settings"/>
<mkdir dir="${full.eclipse.workspace}/.metadata/.plugins/com.atlassw.tools.eclipse.checkstyle"/>
<mkdir dir="${full.eclipse.workspace}/.metadata/.plugins/net.sourceforge.pmd.eclipse"/>
- <copy file="${basedir}/${topDirectoryLocation}/checkstyle.xml" tofile="${full.eclipse.workspace}/cxf-checkstyle.xml"/>
+ <copy file="${basedir}/${topDirectoryLocation}/checkstyle.xml" tofile="${full.eclipse.workspace}/qpid-checkstyle.xml"/>
<copy file="${basedir}/${topDirectoryLocation}/etc/apache-header.txt" tofile="${full.eclipse.workspace}/apache-header.txt"/>
<!-- Add checkstyle config -->
@@ -630,7 +630,7 @@
tofile="${full.eclipse.workspace}/.metadata/.plugins/com.atlassw.tools.eclipse.checkstyle/checkstyle-config.xml"
overwrite="no">
<filterset>
- <filter token="CHECKSTYLE_CONFIG_FILE" value="${full.eclipse.workspace}/cxf-checkstyle.xml"/>
+ <filter token="CHECKSTYLE_CONFIG_FILE" value="${full.eclipse.workspace}/qpid-checkstyle.xml"/>
<filter token="APACHE_HEADER_FILE" value="${full.eclipse.workspace}/apache-header.txt"/>
</filterset>
</copy>
@@ -638,7 +638,7 @@
<xslt style="${basedir}/${topDirectoryLocation}/etc/eclipse/addcheckstyle.xsl"
in="${full.eclipse.workspace}/.metadata/.plugins/com.atlassw.tools.eclipse.checkstyle/checkstyle-config.xml"
out="${full.eclipse.workspace}/.metadata/.plugins/com.atlassw.tools.eclipse.checkstyle/checkstyle-config.xml.new">
- <param name="checkstyleconfig" expression="${full.eclipse.workspace}/cxf-checkstyle.xml"/>
+ <param name="checkstyleconfig" expression="${full.eclipse.workspace}/qpid-checkstyle.xml"/>
</xslt>
<copy
file="${full.eclipse.workspace}/.metadata/.plugins/com.atlassw.tools.eclipse.checkstyle/checkstyle-config.xml.new"
@@ -659,10 +659,10 @@
append="true" fixlastline="true">
<filelist dir="${basedir}/${topDirectoryLocation}/etc/eclipse" files="org.eclipse.jdt.core.prefs"/>
</concat>
- <loadfile property="eclipse.code.format" srcFile="${basedir}/${topDirectoryLocation}/etc/eclipse/CXFCodeFormatter.xml"/>
+ <loadfile property="eclipse.code.format" srcFile="${basedir}/${topDirectoryLocation}/etc/eclipse/QpidCodeFormatter.xml"/>
<loadfile property="eclipse.code.templates" srcFile="${basedir}/${topDirectoryLocation}/etc/eclipse/codetemplates.xml"/>
<propertyfile file="${full.eclipse.workspace}/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.ui.prefs">
- <entry key="formatter_profile" value="_CXF Java Conventions"/>
+ <entry key="formatter_profile" value="_Qpid Java Conventions"/>
<entry key="org.eclipse.jdt.ui.formatterprofiles" value="${eclipse.code.format}"/>
<entry key="org.eclipse.jdt.ui.text.custom_code_templates" value="${eclipse.code.templates}"/>
Modified: incubator/qpid/trunk/qpid/java/systests/pom.xml
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/systests/pom.xml?view=diff&rev=476701&r1=476700&r2=476701
==============================================================================
--- incubator/qpid/trunk/qpid/java/systests/pom.xml (original)
+++ incubator/qpid/trunk/qpid/java/systests/pom.xml Sat Nov 18 20:14:42 2006
@@ -68,6 +68,7 @@
<build>
<plugins>
+<!--
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
@@ -105,11 +106,27 @@
</execution>
</executions>
</plugin>
+-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
- <skip>true</skip>
+ <systemProperties>
+ <property>
+ <name>amqj.noAutoCreateVMBroker</name>
+ <value>true</value>
+ </property>
+ </systemProperties>
+ <includes>
+ <include>**/server/**/*Test.java</include>
+ <include>**/test/unit/ack/DisconnectAndRedeliver.java</include>
+ </includes>
+ <excludes>
+ <exclude>**/Abstract*Test*</exclude>
+ <exclude>**/*PerfTest*</exclude>
+ <exclude>**/*PerformanceTest*</exclude>
+ <exclude>**/server/util/ConcurrentTest.java</exclude>
+ </excludes>
</configuration>
</plugin>
</plugins>
Modified: incubator/qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/server/ack/TxAckTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/server/ack/TxAckTest.java?view=diff&rev=476701&r1=476700&r2=476701
==============================================================================
--- incubator/qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/server/ack/TxAckTest.java (original)
+++ incubator/qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/server/ack/TxAckTest.java Sat Nov 18 20:14:42 2006
@@ -20,12 +20,6 @@
*/
package org.apache.qpid.server.ack;
-import junit.framework.JUnit4TestAdapter;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.Ignore;
import org.apache.qpid.AMQException;
import org.apache.qpid.server.queue.AMQMessage;
import org.apache.qpid.server.store.TestableMemoryMessageStore;
@@ -35,15 +29,18 @@
import java.util.LinkedHashMap;
import java.util.List;
-public class TxAckTest
+import junit.framework.TestCase;
+
+public class TxAckTest extends TestCase
{
private Scenario individual;
private Scenario multiple;
private Scenario combined;
- @Before
- public void setup() throws Exception
- {
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
//ack only 5th msg
individual = new Scenario(10, Arrays.asList(5l), Arrays.asList(1l, 2l, 3l, 4l, 6l, 7l, 8l, 9l, 10l));
individual.update(5, false);
@@ -62,24 +59,21 @@
combined.update(10, false);
}
- @Test
- public void prepare() throws AMQException
+ public void testPrepare() throws AMQException
{
individual.prepare();
multiple.prepare();
combined.prepare();
}
- @Test
- public void undoPrepare() throws AMQException
+ public void testUndoPrepare() throws AMQException
{
individual.undoPrepare();
multiple.undoPrepare();
combined.undoPrepare();
}
- @Test
- public void commit() throws AMQException
+ public void testCommit() throws AMQException
{
individual.commit();
multiple.commit();
@@ -88,7 +82,7 @@
public static junit.framework.Test suite()
{
- return new JUnit4TestAdapter(TxAckTest.class);
+ return new junit.framework.TestSuite(TxAckTest.class);
}
private class Scenario
Modified: incubator/qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/server/exchange/AbstractHeadersExchangeTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/server/exchange/AbstractHeadersExchangeTest.java?view=diff&rev=476701&r1=476700&r2=476701
==============================================================================
--- incubator/qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/server/exchange/AbstractHeadersExchangeTest.java (original)
+++ incubator/qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/server/exchange/AbstractHeadersExchangeTest.java Sat Nov 18 20:14:42 2006
@@ -32,8 +32,6 @@
import org.apache.qpid.framing.FieldTable;
import org.apache.qpid.framing.BasicContentHeaderProperties;
import org.apache.qpid.AMQException;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertFalse;
import java.util.List;
import java.util.ArrayList;
@@ -41,7 +39,9 @@
import java.util.Set;
import java.util.HashSet;
-public class AbstractHeadersExchangeTest
+import junit.framework.TestCase;
+
+public class AbstractHeadersExchangeTest extends TestCase
{
private final HeadersExchange exchange = new HeadersExchange();
protected final Set<TestQueue> queues = new HashSet<TestQueue>();
Modified: incubator/qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/server/exchange/HeadersExchangeTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/server/exchange/HeadersExchangeTest.java?view=diff&rev=476701&r1=476700&r2=476701
==============================================================================
--- incubator/qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/server/exchange/HeadersExchangeTest.java (original)
+++ incubator/qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/server/exchange/HeadersExchangeTest.java Sat Nov 18 20:14:42 2006
@@ -20,23 +20,19 @@
*/
package org.apache.qpid.server.exchange;
-import org.junit.Test;
-import org.junit.Before;
import org.apache.qpid.AMQException;
import org.apache.qpid.server.registry.ApplicationRegistry;
import org.apache.qpid.server.util.TestApplicationRegistry;
-import junit.framework.JUnit4TestAdapter;
public class HeadersExchangeTest extends AbstractHeadersExchangeTest
{
- @Before
- public void init() throws Exception
+ protected void setUp() throws Exception
{
+ super.setUp();
ApplicationRegistry.initialise(new TestApplicationRegistry());
}
- @Test
- public void simple() throws AMQException
+ public void testSimple() throws AMQException
{
TestQueue q1 = bindDefault("F0000");
TestQueue q2 = bindDefault("F0000=Aardvark");
@@ -58,8 +54,7 @@
routeAndTest(new Message("Message6", "F0002"));
}
- @Test
- public void any() throws AMQException
+ public void testAny() throws AMQException
{
TestQueue q1 = bindDefault("F0000", "F0001", "X-match=any");
TestQueue q2 = bindDefault("F0000=Aardvark", "F0001=Bear", "X-match=any");
@@ -78,7 +73,6 @@
public static junit.framework.Test suite()
{
- return new JUnit4TestAdapter(HeadersExchangeTest.class);
+ return new junit.framework.TestSuite(HeadersExchangeTest.class);
}
-
}
Modified: incubator/qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/server/protocol/TestProtocolInitiation.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/server/protocol/TestProtocolInitiation.java?view=diff&rev=476701&r1=476700&r2=476701
==============================================================================
--- incubator/qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/server/protocol/TestProtocolInitiation.java (original)
+++ incubator/qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/server/protocol/TestProtocolInitiation.java Sat Nov 18 20:14:42 2006
@@ -20,8 +20,6 @@
*/
package org.apache.qpid.server.protocol;
-import junit.framework.Assert;
-import junit.framework.JUnit4TestAdapter;
import org.apache.qpid.codec.AMQDecoder;
import org.apache.qpid.codec.AMQEncoder;
import org.apache.qpid.framing.*;
@@ -30,13 +28,13 @@
import org.apache.mina.filter.codec.ProtocolDecoderOutput;
import org.apache.mina.filter.codec.ProtocolEncoderOutput;
import org.apache.mina.filter.codec.support.SimpleProtocolDecoderOutput;
-import org.junit.Before;
-import org.junit.Test;
+
+import junit.framework.TestCase;
/**
* This test suite tests the handling of protocol initiation frames and related issues.
*/
-public class TestProtocolInitiation implements ProtocolVersionList
+public class TestProtocolInitiation extends TestCase implements ProtocolVersionList
{
private AMQPFastProtocolHandler _protocolHandler;
@@ -83,9 +81,9 @@
}
}
- @Before
- public void createCommonObjects()
+ protected void setUp() throws Exception
{
+ super.setUp();
_mockIoSession = new MockIoSession();
_protocolHandler = new AMQPFastProtocolHandler(null, null);
}
@@ -95,67 +93,121 @@
* Tests that the AMQDecoder handles invalid protocol classes
* @throws Exception
*/
- @Test(expected = AMQProtocolClassException.class)
public void testDecoderValidateProtocolClass() throws Exception
{
- ProtocolInitiation pi = createValidProtocolInitiation();
- pi.protocolClass = 2;
- decodePI(pi);
+ try
+ {
+ ProtocolInitiation pi = createValidProtocolInitiation();
+ pi.protocolClass = 2;
+ decodePI(pi);
+ fail("expected exception did not occur");
+ }
+ catch (AMQProtocolClassException m)
+ {
+ // ok
+ }
+ catch (Exception e)
+ {
+ fail("expected AMQProtocolClassException, got " + e);
+ }
}
/**
* Tests that the AMQDecoder handles invalid protocol instance numbers
* @throws Exception
*/
- @Test(expected = AMQProtocolInstanceException.class)
public void testDecoderValidatesProtocolInstance() throws Exception
{
- ProtocolInitiation pi = createValidProtocolInitiation();
- pi.protocolInstance = 2;
- decodePI(pi);
+ try
+ {
+ ProtocolInitiation pi = createValidProtocolInitiation();
+ pi.protocolInstance = 2;
+ decodePI(pi);
+ fail("expected exception did not occur");
+ }
+ catch (AMQProtocolInstanceException m)
+ {
+ // ok
+ }
+ catch (Exception e)
+ {
+ fail("expected AMQProtocolInstanceException, got " + e);
+ }
}
/**
* Tests that the AMQDecoder handles invalid protocol major
* @throws Exception
*/
- @Test(expected = AMQProtocolVersionException.class)
public void testDecoderValidatesProtocolMajor() throws Exception
{
- ProtocolInitiation pi = createValidProtocolInitiation();
- pi.protocolMajor = 2;
- decodePI(pi);
+ try
+ {
+ ProtocolInitiation pi = createValidProtocolInitiation();
+ pi.protocolMajor = 2;
+ decodePI(pi);
+ fail("expected exception did not occur");
+ }
+ catch (AMQProtocolVersionException m)
+ {
+ // ok
+ }
+ catch (Exception e)
+ {
+ fail("expected AMQProtocolVersionException, got " + e);
+ }
}
/**
* Tests that the AMQDecoder handles invalid protocol minor
* @throws Exception
*/
- @Test(expected = AMQProtocolVersionException.class)
public void testDecoderValidatesProtocolMinor() throws Exception
{
- ProtocolInitiation pi = createValidProtocolInitiation();
- pi.protocolMinor = 99;
- decodePI(pi);
+ try
+ {
+ ProtocolInitiation pi = createValidProtocolInitiation();
+ pi.protocolMinor = 99;
+ decodePI(pi);
+ fail("expected exception did not occur");
+ }
+ catch (AMQProtocolVersionException m)
+ {
+ // ok
+ }
+ catch (Exception e)
+ {
+ fail("expected AMQProtocolVersionException, got " + e);
+ }
}
/**
* Tests that the AMQDecoder accepts a valid PI
* @throws Exception
*/
- @Test(expected = AMQProtocolHeaderException.class)
public void testDecoderValidatesHeader() throws Exception
{
- ProtocolInitiation pi = createValidProtocolInitiation();
- pi.header = new char[] {'P', 'Q', 'M', 'A' };
- decodePI(pi);
+ try
+ {
+ ProtocolInitiation pi = createValidProtocolInitiation();
+ pi.header = new char[] {'P', 'Q', 'M', 'A' };
+ decodePI(pi);
+ fail("expected exception did not occur");
+ }
+ catch (AMQProtocolHeaderException m)
+ {
+ // ok
+ }
+ catch (Exception e)
+ {
+ fail("expected AMQProtocolHeaderException, got " + e);
+ }
}
/**
* Test that a valid header is passed by the decoder.
* @throws Exception
*/
- @Test
public void testDecoderAcceptsValidHeader() throws Exception
{
ProtocolInitiation pi = createValidProtocolInitiation();
@@ -166,18 +218,17 @@
* This test checks that an invalid protocol header results in the
* connection being closed.
*/
- @Test
public void testInvalidProtocolHeaderClosesConnection() throws Exception
{
AMQProtocolHeaderException pe = new AMQProtocolHeaderException("Test");
_protocolHandler.exceptionCaught(_mockIoSession, pe);
- Assert.assertNotNull(_mockIoSession.getLastWrittenObject());
+ assertNotNull(_mockIoSession.getLastWrittenObject());
Object piResponse = _mockIoSession.getLastWrittenObject();
- Assert.assertEquals(piResponse.getClass(), ProtocolInitiation.class);
+ assertEquals(piResponse.getClass(), ProtocolInitiation.class);
ProtocolInitiation pi = (ProtocolInitiation) piResponse;
- Assert.assertEquals("Protocol Initiation sent out was not the broker's expected header", pi,
+ assertEquals("Protocol Initiation sent out was not the broker's expected header", pi,
createValidProtocolInitiation());
- Assert.assertTrue("Session has not been closed", _mockIoSession.isClosing());
+ assertTrue("Session has not been closed", _mockIoSession.isClosing());
}
private ProtocolInitiation createValidProtocolInitiation()
@@ -210,6 +261,6 @@
public static junit.framework.Test suite()
{
- return new JUnit4TestAdapter(TestProtocolInitiation.class);
+ return new junit.framework.TestSuite(TestProtocolInitiation.class);
}
}
Modified: incubator/qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/server/queue/AckTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/server/queue/AckTest.java?view=diff&rev=476701&r1=476700&r2=476701
==============================================================================
--- incubator/qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/server/queue/AckTest.java (original)
+++ incubator/qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/server/queue/AckTest.java Sat Nov 18 20:14:42 2006
@@ -20,7 +20,6 @@
*/
package org.apache.qpid.server.queue;
-import junit.framework.JUnit4TestAdapter;
import org.apache.log4j.Logger;
import org.apache.qpid.AMQException;
import org.apache.qpid.framing.BasicContentHeaderProperties;
@@ -31,17 +30,16 @@
import org.apache.qpid.server.registry.ApplicationRegistry;
import org.apache.qpid.server.store.TestableMemoryMessageStore;
import org.apache.qpid.server.util.TestApplicationRegistry;
-import static org.junit.Assert.assertTrue;
-import org.junit.Before;
-import org.junit.Test;
import java.util.Iterator;
import java.util.Map;
+import junit.framework.TestCase;
+
/**
* Tests that acknowledgements are handled correctly.
*/
-public class AckTest
+public class AckTest extends TestCase
{
private static final Logger _log = Logger.getLogger(AckTest.class);
@@ -62,9 +60,9 @@
ApplicationRegistry.initialise(new TestApplicationRegistry());
}
- @Before
- public void setup() throws Exception
+ protected void setUp() throws Exception
{
+ super.setUp();
_messageStore = new TestableMemoryMessageStore();
_channel = new AMQChannel(5, _messageStore, null/*dont need exchange registry*/);
_protocolSession = new MockProtocolSession(_messageStore);
@@ -107,8 +105,7 @@
* Tests that the acknowledgements are correctly associated with a channel and
* order is preserved when acks are enabled
*/
- @Test
- public void ackChannelAssociationTest() throws AMQException
+ public void testAckChannelAssociationTest() throws AMQException
{
_subscription = new SubscriptionImpl(5, _protocolSession, "conTag", true);
final int msgCount = 10;
@@ -134,7 +131,6 @@
/**
* Tests that in no-ack mode no messages are retained
*/
- @Test
public void testNoAckMode() throws AMQException
{
// false arg means no acks expected
@@ -151,8 +147,7 @@
* Tests that a single acknowledgement is handled correctly (i.e multiple flag not
* set case)
*/
- @Test
- public void singleAckReceivedTest() throws AMQException
+ public void testSingleAckReceivedTest() throws AMQException
{
_subscription = new SubscriptionImpl(5, _protocolSession, "conTag", true);
final int msgCount = 10;
@@ -182,8 +177,7 @@
* Tests that a single acknowledgement is handled correctly (i.e multiple flag not
* set case)
*/
- @Test
- public void multiAckReceivedTest() throws AMQException
+ public void testMultiAckReceivedTest() throws AMQException
{
_subscription = new SubscriptionImpl(5, _protocolSession, "conTag", true);
final int msgCount = 10;
@@ -208,8 +202,7 @@
/**
* Tests that a multiple acknowledgement is handled correctly. When ack'ing all pending msgs.
*/
- @Test
- public void multiAckAllReceivedTest() throws AMQException
+ public void testMultiAckAllReceivedTest() throws AMQException
{
_subscription = new SubscriptionImpl(5, _protocolSession, "conTag", true);
final int msgCount = 10;
@@ -231,8 +224,6 @@
}
}
-
- @Test
public void testPrefetchHighLow() throws AMQException
{
int lowMark = 5;
@@ -287,7 +278,6 @@
assertTrue(map.size() == 0);
}
- @Test
public void testPrefetch() throws AMQException
{
_subscription = new SubscriptionImpl(5, _protocolSession, "conTag", true);
@@ -316,9 +306,8 @@
assertTrue(map.size() == 0);
}
-
public static junit.framework.Test suite()
{
- return new JUnit4TestAdapter(AckTest.class);
+ return new junit.framework.TestSuite(AckTest.class);
}
}
Modified: incubator/qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/server/queue/ConcurrencyTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/server/queue/ConcurrencyTest.java?view=diff&rev=476701&r1=476700&r2=476701
==============================================================================
--- incubator/qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/server/queue/ConcurrencyTest.java (original)
+++ incubator/qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/server/queue/ConcurrencyTest.java Sat Nov 18 20:14:42 2006
@@ -20,11 +20,6 @@
*/
package org.apache.qpid.server.queue;
-import junit.framework.JUnit4TestAdapter;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import org.junit.Test;
-import org.junit.Assert;
import org.apache.qpid.AMQException;
import org.apache.qpid.server.handler.OnCurrentThreadExecutor;
@@ -61,23 +56,21 @@
new DefaultQueueRegistry()));
}
- @Test
- public void concurrent1() throws InterruptedException, AMQException
+ public void testConcurrent1() throws InterruptedException, AMQException
{
initSubscriptions(10);
initMessages(numMessages);
initThreads(1, 4, 4, 4);
- run();
+ doRun();
check();
}
- @Test
- public void concurrent2() throws InterruptedException, AMQException
+ public void testConcurrent2() throws InterruptedException, AMQException
{
initSubscriptions(10);
initMessages(numMessages);
initThreads(4, 2, 2, 2);
- run();
+ doRun();
check();
}
@@ -126,7 +119,7 @@
}
}
- void run() throws InterruptedException
+ void doRun() throws InterruptedException
{
for(Thread t : _threads)
{
@@ -147,7 +140,7 @@
{
_active.remove(s);
Subscription result = _subscriptionMgr.removeSubscriber(s);
- Assert.assertTrue("Removed subscription " + result + " but trying to remove subscription " + s,
+ assertTrue("Removed subscription " + result + " but trying to remove subscription " + s,
result != null && result.equals(s));
}
else
@@ -258,7 +251,7 @@
public static junit.framework.Test suite()
{
- return new JUnit4TestAdapter(ConcurrencyTest.class);
+ return new junit.framework.TestSuite(ConcurrencyTest.class);
}
}
Modified: incubator/qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/server/queue/ConcurrentDeliveryManagerTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/server/queue/ConcurrentDeliveryManagerTest.java?view=diff&rev=476701&r1=476700&r2=476701
==============================================================================
--- incubator/qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/server/queue/ConcurrentDeliveryManagerTest.java (original)
+++ incubator/qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/server/queue/ConcurrentDeliveryManagerTest.java Sat Nov 18 20:14:42 2006
@@ -20,12 +20,11 @@
*/
package org.apache.qpid.server.queue;
+import org.apache.qpid.AMQException;
import org.apache.qpid.server.queue.ConcurrentDeliveryManager;
import org.apache.qpid.server.queue.AMQQueue;
import org.apache.qpid.server.queue.DefaultQueueRegistry;
import org.apache.qpid.server.queue.DeliveryManagerTest;
-import org.apache.qpid.AMQException;
-import junit.framework.JUnit4TestAdapter;
public class ConcurrentDeliveryManagerTest extends DeliveryManagerTest
{
@@ -46,6 +45,6 @@
public static junit.framework.Test suite()
{
- return new JUnit4TestAdapter(ConcurrentDeliveryManagerTest.class);
+ return new junit.framework.TestSuite(ConcurrentDeliveryManagerTest.class);
}
}
Modified: incubator/qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/server/queue/DeliveryManagerTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/server/queue/DeliveryManagerTest.java?view=diff&rev=476701&r1=476700&r2=476701
==============================================================================
--- incubator/qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/server/queue/DeliveryManagerTest.java (original)
+++ incubator/qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/server/queue/DeliveryManagerTest.java Sat Nov 18 20:14:42 2006
@@ -20,19 +20,10 @@
*/
package org.apache.qpid.server.queue;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import org.junit.Test;
-import org.junit.runners.Suite;
-import org.junit.runner.RunWith;
import org.apache.qpid.server.handler.OnCurrentThreadExecutor;
import org.apache.qpid.AMQException;
-import junit.framework.JUnit4TestAdapter;
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
- ConcurrentDeliveryManagerTest.class,
- SynchronizedDeliveryManagerTest.class})
+import junit.framework.TestSuite;
abstract public class DeliveryManagerTest extends MessageTestHelper
{
@@ -43,9 +34,7 @@
{
}
-
- @Test
- public void startInQueueingMode() throws AMQException
+ public void testStartInQueueingMode() throws AMQException
{
AMQMessage[] messages = new AMQMessage[10];
for (int i = 0; i < messages.length; i++)
@@ -90,8 +79,7 @@
}
}
- @Test
- public void startInDirectMode() throws AMQException
+ public void testStartInDirectMode() throws AMQException
{
AMQMessage[] messages = new AMQMessage[10];
for (int i = 0; i < messages.length; i++)
@@ -136,27 +124,52 @@
}
- @Test(expected = NoConsumersException.class)
- public void noConsumers() throws AMQException
+ public void testNoConsumers() throws AMQException
{
- AMQMessage msg = message(true);
- _mgr.deliver("Me", msg);
- msg.checkDeliveredToConsumer();
+ try
+ {
+ AMQMessage msg = message(true);
+ _mgr.deliver("Me", msg);
+ msg.checkDeliveredToConsumer();
+ fail("expected exception did not occur");
+ }
+ catch (NoConsumersException m)
+ {
+ // ok
+ }
+ catch (Exception e)
+ {
+ fail("expected NoConsumersException, got " + e);
+ }
}
- @Test(expected = NoConsumersException.class)
- public void noActiveConsumers() throws AMQException
+ public void testNoActiveConsumers() throws AMQException
{
- TestSubscription s = new TestSubscription("A");
- _subscriptions.addSubscriber(s);
- s.setSuspended(true);
- AMQMessage msg = message(true);
- _mgr.deliver("Me", msg);
- msg.checkDeliveredToConsumer();
+ try
+ {
+ TestSubscription s = new TestSubscription("A");
+ _subscriptions.addSubscriber(s);
+ s.setSuspended(true);
+ AMQMessage msg = message(true);
+ _mgr.deliver("Me", msg);
+ msg.checkDeliveredToConsumer();
+ fail("expected exception did not occur");
+ }
+ catch (NoConsumersException m)
+ {
+ // ok
+ }
+ catch (Exception e)
+ {
+ fail("expected NoConsumersException, got " + e);
+ }
}
public static junit.framework.Test suite()
{
- return new JUnit4TestAdapter(DeliveryManagerTest.class);
+ TestSuite suite = new TestSuite();
+ suite.addTestSuite(ConcurrentDeliveryManagerTest.class);
+ suite.addTestSuite(SynchronizedDeliveryManagerTest.class);
+ return suite;
}
}
Modified: incubator/qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/server/queue/MessageTestHelper.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/server/queue/MessageTestHelper.java?view=diff&rev=476701&r1=476700&r2=476701
==============================================================================
--- incubator/qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/server/queue/MessageTestHelper.java (original)
+++ incubator/qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/server/queue/MessageTestHelper.java Sat Nov 18 20:14:42 2006
@@ -28,7 +28,9 @@
import org.apache.qpid.server.util.TestApplicationRegistry;
import org.apache.qpid.AMQException;
-class MessageTestHelper
+import junit.framework.TestCase;
+
+class MessageTestHelper extends TestCase
{
private final MessageStore _messageStore = new SkeletonMessageStore();
Modified: incubator/qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/server/queue/SubscriptionManagerTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/server/queue/SubscriptionManagerTest.java?view=diff&rev=476701&r1=476700&r2=476701
==============================================================================
--- incubator/qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/server/queue/SubscriptionManagerTest.java (original)
+++ incubator/qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/server/queue/SubscriptionManagerTest.java Sat Nov 18 20:14:42 2006
@@ -20,18 +20,13 @@
*/
package org.apache.qpid.server.queue;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import org.junit.Test;
-import junit.framework.JUnit4TestAdapter;
+import junit.framework.TestCase;
-public class SubscriptionManagerTest
+public class SubscriptionManagerTest extends TestCase
{
private final SubscriptionSet mgr = new SubscriptionSet();
- @Test
- public void basicSubscriptionManagement()
+ public void testBasicSubscriptionManagement()
{
assertTrue(mgr.isEmpty());
assertFalse(mgr.hasActiveSubscribers());
@@ -58,8 +53,7 @@
assertTrue(mgr.isEmpty());
}
- @Test
- public void roundRobin()
+ public void testRoundRobin()
{
TestSubscription a = new TestSubscription("A");
TestSubscription b = new TestSubscription("B");
@@ -103,6 +97,6 @@
public static junit.framework.Test suite()
{
- return new JUnit4TestAdapter(SubscriptionManagerTest.class);
+ return new junit.framework.TestSuite(SubscriptionManagerTest.class);
}
}
Modified: incubator/qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/server/queue/SubscriptionSetTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/server/queue/SubscriptionSetTest.java?view=diff&rev=476701&r1=476700&r2=476701
==============================================================================
--- incubator/qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/server/queue/SubscriptionSetTest.java (original)
+++ incubator/qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/server/queue/SubscriptionSetTest.java Sat Nov 18 20:14:42 2006
@@ -20,12 +20,9 @@
*/
package org.apache.qpid.server.queue;
-import junit.framework.JUnit4TestAdapter;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import org.junit.Test;
+import junit.framework.TestCase;
-public class SubscriptionSetTest
+public class SubscriptionSetTest extends TestCase
{
/**
* A SubscriptionSet that counts the number of items scanned.
@@ -58,8 +55,7 @@
final TestSubscription suspendedSub2 = new TestSubscription("sus2", true);
final TestSubscription suspendedSub3 = new TestSubscription("sus3", true);
- @Test
- public void nextMessage()
+ public void testNextMessage()
{
SubscriptionSet ss = new SubscriptionSet();
assertNull(ss.nextSubscriber(null));
@@ -81,8 +77,7 @@
assertEquals(3, ss.getCurrentSubscriber());
}
- @Test
- public void nextMessageWhenAllSuspended()
+ public void testNextMessageWhenAllSuspended()
{
SubscriptionSet ss = createAllSuspendedSubscriptionSet();
assertNull(ss.nextSubscriber(null));
@@ -101,8 +96,7 @@
return ss;
}
- @Test
- public void nextMessageAfterRemove()
+ public void testNextMessageAfterRemove()
{
SubscriptionSet ss = new SubscriptionSet();
ss.addSubscriber(suspendedSub1);
@@ -117,8 +111,7 @@
assertEquals(2, ss.getCurrentSubscriber());
}
- @Test
- public void nextMessageOverScanning()
+ public void testNextMessageOverScanning()
{
TestSubscriptionSet ss = new TestSubscriptionSet();
TestSubscription sub = new TestSubscription("test");
@@ -137,8 +130,7 @@
assertEquals(ss.size() + 1, ss.getScanned());
}
- @Test
- public void nextMessageOverscanWorstCase() {
+ public void testNextMessageOverscanWorstCase() {
TestSubscriptionSet ss = createAllSuspendedSubscriptionSet();
ss.nextSubscriber(null);
// Scans the subscriptions twice.
@@ -147,6 +139,6 @@
public static junit.framework.Test suite()
{
- return new JUnit4TestAdapter(SubscriptionSetTest.class);
+ return new junit.framework.TestSuite(SubscriptionSetTest.class);
}
}
Modified: incubator/qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/server/queue/SynchronizedDeliveryManagerTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/server/queue/SynchronizedDeliveryManagerTest.java?view=diff&rev=476701&r1=476700&r2=476701
==============================================================================
--- incubator/qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/server/queue/SynchronizedDeliveryManagerTest.java (original)
+++ incubator/qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/server/queue/SynchronizedDeliveryManagerTest.java Sat Nov 18 20:14:42 2006
@@ -26,7 +26,8 @@
import org.apache.qpid.server.queue.ConcurrentDeliveryManager;
import org.apache.qpid.server.queue.DeliveryManagerTest;
import org.apache.qpid.AMQException;
-import junit.framework.JUnit4TestAdapter;
+
+import junit.framework.TestSuite;
public class SynchronizedDeliveryManagerTest extends DeliveryManagerTest
{
@@ -47,6 +48,8 @@
public static junit.framework.Test suite()
{
- return new JUnit4TestAdapter(SynchronizedDeliveryManagerTest.class);
+ TestSuite suite = new TestSuite();
+ suite.addTestSuite(SynchronizedDeliveryManagerTest.class);
+ return suite;
}
}
Modified: incubator/qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/server/store/TestReferenceCounting.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/server/store/TestReferenceCounting.java?view=diff&rev=476701&r1=476700&r2=476701
==============================================================================
--- incubator/qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/server/store/TestReferenceCounting.java (original)
+++ incubator/qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/server/store/TestReferenceCounting.java Sat Nov 18 20:14:42 2006
@@ -20,52 +20,48 @@
*/
package org.apache.qpid.server.store;
-import junit.framework.JUnit4TestAdapter;
-import org.junit.Test;
-import org.junit.Assert;
-import org.junit.Before;
import org.apache.qpid.server.queue.AMQMessage;
import org.apache.qpid.AMQException;
+import junit.framework.TestCase;
+
/**
* Tests that reference counting works correctly with AMQMessage and the message store
*/
-public class TestReferenceCounting
+public class TestReferenceCounting extends TestCase
{
private TestableMemoryMessageStore _store;
- @Before
- public void createCommonObjects()
+ protected void setUp() throws Exception
{
+ super.setUp();
_store = new TestableMemoryMessageStore();
}
/**
* Check that when the reference count is decremented the message removes itself from the store
*/
- @Test
public void testMessageGetsRemoved() throws AMQException
{
AMQMessage message = new AMQMessage(_store, null);
_store.put(message);
- Assert.assertTrue(_store.getMessageMap().size() == 1);
+ assertTrue(_store.getMessageMap().size() == 1);
message.decrementReference();
- Assert.assertTrue(_store.getMessageMap().size() == 0);
+ assertTrue(_store.getMessageMap().size() == 0);
}
- @Test
public void testMessageRemains() throws AMQException
{
AMQMessage message = new AMQMessage(_store, null);
_store.put(message);
- Assert.assertTrue(_store.getMessageMap().size() == 1);
+ assertTrue(_store.getMessageMap().size() == 1);
message.incrementReference();
message.decrementReference();
- Assert.assertTrue(_store.getMessageMap().size() == 1);
+ assertTrue(_store.getMessageMap().size() == 1);
}
public static junit.framework.Test suite()
{
- return new JUnit4TestAdapter(TestReferenceCounting.class);
+ return new junit.framework.TestSuite(TestReferenceCounting.class);
}
}
Modified: incubator/qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/server/txn/TxnBufferTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/server/txn/TxnBufferTest.java?view=diff&rev=476701&r1=476700&r2=476701
==============================================================================
--- incubator/qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/server/txn/TxnBufferTest.java (original)
+++ incubator/qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/server/txn/TxnBufferTest.java Sat Nov 18 20:14:42 2006
@@ -20,29 +20,19 @@
*/
package org.apache.qpid.server.txn;
-import junit.framework.JUnit4TestAdapter;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.Ignore;
import org.apache.qpid.AMQException;
import org.apache.qpid.server.store.MessageStore;
import org.apache.qpid.server.store.TestableMemoryMessageStore;
import java.util.LinkedList;
-public class TxnBufferTest
+import junit.framework.TestCase;
+
+public class TxnBufferTest extends TestCase
{
private final LinkedList<MockOp> ops = new LinkedList<MockOp>();
- @Before
- public void setup() throws Exception
- {
- }
-
- @Test
- public void commit() throws AMQException
+ public void testCommit() throws AMQException
{
MockStore store = new MockStore();
@@ -60,8 +50,7 @@
store.validate();
}
- @Test
- public void rollback() throws AMQException
+ public void testRollback() throws AMQException
{
MockStore store = new MockStore();
@@ -76,8 +65,7 @@
store.validate();
}
- @Test
- public void commitWithFailureDuringPrepare() throws AMQException
+ public void testCommitWithFailureDuringPrepare() throws AMQException
{
MockStore store = new MockStore();
store.expectBegin().expectAbort();
@@ -95,8 +83,7 @@
store.validate();
}
- @Test
- public void commitWithPersistance() throws AMQException
+ public void testCommitWithPersistance() throws AMQException
{
MockStore store = new MockStore();
store.expectBegin().expectCommit();
@@ -115,7 +102,7 @@
private void validateOps()
{
- for(MockOp op : ops)
+ for (MockOp op : ops)
{
op.validate();
}
@@ -123,7 +110,7 @@
public static junit.framework.Test suite()
{
- return new JUnit4TestAdapter(TxnBufferTest.class);
+ return new junit.framework.TestSuite(TxnBufferTest.class);
}
class MockOp implements TxnOp
Added: incubator/qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/test/VMBrokerSetup.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/test/VMBrokerSetup.java?view=auto&rev=476701
==============================================================================
--- incubator/qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/test/VMBrokerSetup.java (added)
+++ incubator/qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/test/VMBrokerSetup.java Sat Nov 18 20:14:42 2006
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.qpid.test;
+
+import junit.extensions.TestSetup;
+import junit.framework.Test;
+
+import org.apache.qpid.client.transport.TransportConnection;
+
+public class VMBrokerSetup extends TestSetup
+{
+ public VMBrokerSetup(Test t)
+ {
+ super(t);
+ }
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ try
+ {
+ TransportConnection.createVMBroker(1);
+ }
+ catch (Exception e)
+ {
+ fail("Unable to create broker: " + e);
+ }
+ }
+
+ protected void tearDown() throws Exception
+ {
+ TransportConnection.killVMBroker(1);
+ super.tearDown();
+ }
+}
Propchange: incubator/qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/test/VMBrokerSetup.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/test/VMBrokerSetup.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/test/unit/ack/DisconnectAndRedeliverTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/test/unit/ack/DisconnectAndRedeliverTest.java?view=diff&rev=476701&r1=476700&r2=476701
==============================================================================
--- incubator/qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/test/unit/ack/DisconnectAndRedeliverTest.java (original)
+++ incubator/qpid/trunk/qpid/java/systests/src/test/java/org/apache/qpid/test/unit/ack/DisconnectAndRedeliverTest.java Sat Nov 18 20:14:42 2006
@@ -20,7 +20,6 @@
*/
package org.apache.qpid.test.unit.ack;
-import junit.framework.JUnit4TestAdapter;
import org.apache.log4j.Logger;
import org.apache.log4j.xml.DOMConfigurator;
import org.apache.qpid.client.AMQConnection;
@@ -31,18 +30,16 @@
import org.apache.qpid.server.registry.ApplicationRegistry;
import org.apache.qpid.server.store.TestableMemoryMessageStore;
import org.apache.qpid.server.util.TestApplicationRegistry;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+import org.apache.qpid.test.VMBrokerSetup;
import javax.jms.*;
-public class DisconnectAndRedeliverTest
+import junit.framework.TestCase;
+
+public class DisconnectAndRedeliverTest extends TestCase
{
private static final Logger _logger = Logger.getLogger(DisconnectAndRedeliverTest.class);
-
static
{
String workdir = System.getProperty("QPID_WORK");
@@ -52,34 +49,18 @@
System.out.println("QPID_WORK not set using tmp directory: " + tempdir);
System.setProperty("QPID_WORK", tempdir);
}
- //DOMConfigurator.configure("../etc/log4j.xml");
- DOMConfigurator.configure("broker/etc/log4j.xml");
+ DOMConfigurator.configure("../broker/etc/log4j.xml");
}
- @Before
- public void resetAppliactionRegistry() throws Exception
+ protected void setUp() throws Exception
{
- createVMBroker();
+ super.setUp();
ApplicationRegistry.initialise(new TestApplicationRegistry(), 1);
}
-
- public void createVMBroker()
- {
- try
- {
- TransportConnection.createVMBroker(1);
- }
- catch (AMQVMBrokerCreationException e)
- {
- Assert.fail("Unable to create broker: " + e);
- }
- }
-
- @After
- public void stopVmBroker()
+ protected void tearDown() throws Exception
{
- TransportConnection.killVMBroker(1);
+ super.tearDown();
}
/**
@@ -88,8 +69,7 @@
*
* @throws Exception
*/
- @Test
- public void disconnectRedeliversMessages() throws Exception
+ public void testDisconnectRedeliversMessages() throws Exception
{
Connection con = new AMQConnection("vm://:1", "guest", "guest", "consumer1", "/test");
@@ -134,15 +114,15 @@
con.start();
tm = (TextMessage) consumer.receive(3000);
- Assert.assertEquals("msg2", tm.getText());
+ assertEquals("msg2", tm.getText());
tm = (TextMessage) consumer.receive(3000);
- Assert.assertEquals("msg3", tm.getText());
+ assertEquals("msg3", tm.getText());
tm = (TextMessage) consumer.receive(3000);
- Assert.assertEquals("msg4", tm.getText());
+ assertEquals("msg4", tm.getText());
_logger.info("Received redelivery of three messages. Acknowledging last message");
tm.acknowledge();
@@ -155,7 +135,7 @@
_logger.info("Starting third consumer connection");
con.start();
tm = (TextMessage) consumer.receiveNoWait();
- Assert.assertNull(tm);
+ assertNull(tm);
_logger.info("No messages redelivered as is expected");
con.close();
@@ -165,12 +145,12 @@
_logger.info("Starting fourth consumer connection");
con.start();
tm = (TextMessage) consumer.receive(3000);
- Assert.assertNull(tm);
+ assertNull(tm);
_logger.info("No messages redelivered as is expected");
con.close();
_logger.info("Actually:" + store.getMessageMap().size());
- // Assert.assertTrue(store.getMessageMap().size() == 0);
+ // assertTrue(store.getMessageMap().size() == 0);
}
/**
@@ -179,8 +159,7 @@
*
* @throws Exception
*/
- @Test
- public void disconnectWithTransientQueueThrowsAwayMessages() throws Exception
+ public void testDisconnectWithTransientQueueThrowsAwayMessages() throws Exception
{
Connection con = new AMQConnection("vm://:1", "guest", "guest", "consumer1", "/test");
@@ -222,16 +201,16 @@
con.start();
tm = (TextMessage) consumer.receiveNoWait();
- Assert.assertNull(tm);
+ assertNull(tm);
_logger.info("No messages redelivered as is expected");
_logger.info("Actually:" + store.getMessageMap().size());
- Assert.assertTrue(store.getMessageMap().size() == 0);
+ assertTrue(store.getMessageMap().size() == 0);
con.close();
}
public static junit.framework.Test suite()
{
- return new JUnit4TestAdapter(DisconnectAndRedeliverTest.class);
+ return new VMBrokerSetup(new junit.framework.TestSuite(DisconnectAndRedeliverTest.class));
}
}