You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ri...@apache.org on 2010/06/02 18:42:40 UTC
svn commit: r950640 - in /qpid/trunk/qpid/java/systests/src:
main/java/org/apache/qpid/server/failover/
main/java/org/apache/qpid/server/queue/
old_test/java/org/apache/qpid/server/queue/
old_test/java/org/apache/qpid/test/unit/ack/
Author: ritchiem
Date: Wed Jun 2 16:42:39 2010
New Revision: 950640
URL: http://svn.apache.org/viewvc?rev=950640&view=rev
Log:
QPID-2632 : A couple of tests in Systests are actually InVM only tests but are not marked as so.
They only work InVM but require a client. These should be either updated to be broker tests and not need the client
or updated to not relay on the InVM transport.
Also updated the code in old_test to be in line with these changes.
Modified:
qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/failover/FailoverMethodTest.java
qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/queue/QueueDepthWithSelectorTest.java
qpid/trunk/qpid/java/systests/src/old_test/java/org/apache/qpid/server/queue/SendPerfTest.java
qpid/trunk/qpid/java/systests/src/old_test/java/org/apache/qpid/test/unit/ack/DisconnectAndRedeliverTest.java
Modified: qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/failover/FailoverMethodTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/failover/FailoverMethodTest.java?rev=950640&r1=950639&r2=950640&view=diff
==============================================================================
--- qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/failover/FailoverMethodTest.java (original)
+++ qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/failover/FailoverMethodTest.java Wed Jun 2 16:42:39 2010
@@ -29,6 +29,7 @@ import org.apache.qpid.client.AMQConnect
import org.apache.qpid.client.transport.TransportConnection;
import org.apache.qpid.client.vmbroker.AMQVMBrokerCreationException;
import org.apache.qpid.server.registry.ApplicationRegistry;
+import org.apache.qpid.server.util.InternalBrokerBaseCase;
import org.apache.qpid.url.URLSyntaxException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -37,22 +38,23 @@ import javax.jms.ExceptionListener;
import javax.jms.JMSException;
import java.util.concurrent.CountDownLatch;
-public class FailoverMethodTest extends TestCase implements ExceptionListener
+public class FailoverMethodTest extends InternalBrokerBaseCase implements ExceptionListener
{
- private CountDownLatch _failoverComplete;
+ private CountDownLatch _failoverComplete = new CountDownLatch(1);
protected static final Logger _logger = LoggerFactory.getLogger(FailoverMethodTest.class);
- public void setUp() throws AMQVMBrokerCreationException
+ @Override
+ public void createBroker() throws Exception
{
- ApplicationRegistry.getInstance();
+ super.createBroker();
TransportConnection.createVMBroker(ApplicationRegistry.DEFAULT_INSTANCE);
- _failoverComplete = new CountDownLatch(1);
}
- public void tearDown()
+ @Override
+ public void stopBroker()
{
TransportConnection.killVMBroker(ApplicationRegistry.DEFAULT_INSTANCE);
- ApplicationRegistry.remove();
+ super.stopBroker();
}
/**
@@ -81,8 +83,7 @@ public class FailoverMethodTest extends
connection.setExceptionListener(this);
- TransportConnection.killVMBroker(ApplicationRegistry.DEFAULT_INSTANCE);
- ApplicationRegistry.remove();
+ stopBroker();
_failoverComplete.await();
@@ -125,8 +126,7 @@ public class FailoverMethodTest extends
connection.setExceptionListener(this);
- TransportConnection.killVMBroker(ApplicationRegistry.DEFAULT_INSTANCE);
- ApplicationRegistry.remove();
+ stopBroker();
_failoverComplete.await();
@@ -186,8 +186,7 @@ public class FailoverMethodTest extends
try
{
//Kill initial broker
- TransportConnection.killVMBroker(ApplicationRegistry.DEFAULT_INSTANCE);
- ApplicationRegistry.remove();
+ stopBroker();
//Create a thread to start the broker asynchronously
Thread brokerStart = new Thread(new Runnable()
@@ -199,8 +198,7 @@ public class FailoverMethodTest extends
//Wait before starting broker
// The wait should allow atleast 1 retries to fail before broker is ready
Thread.sleep(750);
- ApplicationRegistry.getInstance();
- TransportConnection.createVMBroker(ApplicationRegistry.DEFAULT_INSTANCE);
+ createBroker();
}
catch (Exception e)
{
@@ -234,8 +232,7 @@ public class FailoverMethodTest extends
start = System.currentTimeMillis();
//Kill connection
- TransportConnection.killVMBroker(ApplicationRegistry.DEFAULT_INSTANCE);
- ApplicationRegistry.remove();
+ stopBroker();
_failoverComplete.await();
Modified: qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/queue/QueueDepthWithSelectorTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/queue/QueueDepthWithSelectorTest.java?rev=950640&r1=950639&r2=950640&view=diff
==============================================================================
--- qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/queue/QueueDepthWithSelectorTest.java (original)
+++ qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/queue/QueueDepthWithSelectorTest.java Wed Jun 2 16:42:39 2010
@@ -31,6 +31,7 @@ import org.apache.qpid.client.AMQSession
import org.apache.qpid.client.transport.TransportConnection;
import org.apache.qpid.jndi.PropertiesFileInitialContextFactory;
import org.apache.qpid.server.registry.ApplicationRegistry;
+import org.apache.qpid.server.util.InternalBrokerBaseCase;
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
@@ -51,12 +52,14 @@ import java.util.Hashtable;
* - The message is returned.
* - The broker doesn't leak memory.
* - The broker's state is correct after test.
+ *
+ * Why is this hardcoded to InVM testing, should be converted to QTC.
*/
-public class QueueDepthWithSelectorTest extends TestCase
+public class QueueDepthWithSelectorTest extends InternalBrokerBaseCase
{
protected static final Logger _logger = Logger.getLogger(QueueDepthWithSelectorTest.class);
- protected final String BROKER = "vm://:1";
+ protected final String BROKER = "vm://:"+ApplicationRegistry.DEFAULT_INSTANCE;
protected final String VHOST = "test";
protected final String QUEUE = this.getClass().getName();
@@ -75,8 +78,11 @@ public class QueueDepthWithSelectorTest
protected Queue _queue;
- protected void setUp() throws Exception
+ @Override
+ public void setUp() throws Exception
{
+ super.setUp();
+ TransportConnection.createVMBroker(ApplicationRegistry.DEFAULT_INSTANCE);
System.err.println("amqj.logging.level:" + System.getProperty("amqj.logging.level"));
System.err.println("_logger.level:" + _logger.getLevel());
@@ -88,11 +94,6 @@ public class QueueDepthWithSelectorTest
System.err.println(Logger.getRootLogger().getLoggerRepository());
- if (BROKER.startsWith("vm://"))
- {
- ApplicationRegistry.getInstance(1);
- TransportConnection.createVMBroker(1);
- }
InitialContextFactory factory = new PropertiesFileInitialContextFactory();
Hashtable<String, String> env = new Hashtable<String, String>();
@@ -107,10 +108,9 @@ public class QueueDepthWithSelectorTest
init();
}
- protected void tearDown() throws Exception
+ @Override
+ public void tearDown() throws Exception
{
- super.tearDown();
-
if (_producerConnection != null)
{
_producerConnection.close();
@@ -121,11 +121,8 @@ public class QueueDepthWithSelectorTest
_clientConnection.close();
}
- if (BROKER.startsWith("vm://"))
- {
- TransportConnection.killVMBroker(1);
- ApplicationRegistry.remove(1);
- }
+ TransportConnection.killVMBroker(ApplicationRegistry.DEFAULT_INSTANCE);
+ super.tearDown();
}
public void test() throws Exception
Modified: qpid/trunk/qpid/java/systests/src/old_test/java/org/apache/qpid/server/queue/SendPerfTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/src/old_test/java/org/apache/qpid/server/queue/SendPerfTest.java?rev=950640&r1=950639&r2=950640&view=diff
==============================================================================
--- qpid/trunk/qpid/java/systests/src/old_test/java/org/apache/qpid/server/queue/SendPerfTest.java (original)
+++ qpid/trunk/qpid/java/systests/src/old_test/java/org/apache/qpid/server/queue/SendPerfTest.java Wed Jun 2 16:42:39 2010
@@ -20,6 +20,7 @@
*/
package org.apache.qpid.server.queue;
+import org.apache.commons.configuration.PropertiesConfiguration;
import org.apache.qpid.AMQException;
import org.apache.qpid.codec.AMQCodecFactory;
import org.apache.qpid.framing.BasicPublishBody;
@@ -28,6 +29,7 @@ import org.apache.qpid.framing.ContentHe
import org.apache.qpid.framing.FieldTable;
import org.apache.qpid.server.AMQChannel;
import org.apache.qpid.server.RequiredDeliveryException;
+import org.apache.qpid.server.configuration.ServerConfiguration;
import org.apache.qpid.server.txn.TransactionalContext;
import org.apache.qpid.server.txn.NonTransactionalContext;
import org.apache.qpid.server.exchange.AbstractExchange;
@@ -84,7 +86,7 @@ public class SendPerfTest extends TimedR
public static void main(String[] argv) throws Exception
{
- ApplicationRegistry.initialise(new TestApplicationRegistry());
+ ApplicationRegistry.initialise(new TestApplicationRegistry(new ServerConfiguration(new PropertiesConfiguration())));
int clients = Integer.parseInt(argv[0]);
int messages = Integer.parseInt(argv[1]);
int iterations = Integer.parseInt(argv[2]);
Modified: qpid/trunk/qpid/java/systests/src/old_test/java/org/apache/qpid/test/unit/ack/DisconnectAndRedeliverTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/src/old_test/java/org/apache/qpid/test/unit/ack/DisconnectAndRedeliverTest.java?rev=950640&r1=950639&r2=950640&view=diff
==============================================================================
--- qpid/trunk/qpid/java/systests/src/old_test/java/org/apache/qpid/test/unit/ack/DisconnectAndRedeliverTest.java (original)
+++ qpid/trunk/qpid/java/systests/src/old_test/java/org/apache/qpid/test/unit/ack/DisconnectAndRedeliverTest.java Wed Jun 2 16:42:39 2010
@@ -33,7 +33,7 @@ import org.apache.qpid.server.util.TestA
import javax.jms.*;
-public class DisconnectAndRedeliverTest extends TestCase
+public class DisconnectAndRedeliverTest extends InternalBrokerBaseCase
{
private static final Logger _logger = Logger.getLogger(DisconnectAndRedeliverTest.class);
@@ -49,17 +49,18 @@ public class DisconnectAndRedeliverTest
DOMConfigurator.configure("../broker/etc/log4j.xml");
}
- protected void setUp() throws Exception
+ @Override
+ public void createBroker() throws Exception
{
- super.setUp();
- TransportConnection.createVMBroker(1);
- ApplicationRegistry.initialise(new TestApplicationRegistry(), 1);
+ super.createBroker();
+ TransportConnection.createVMBroker(ApplicationRegistry.DEFAULT_INSTANCE);
}
- protected void tearDown() throws Exception
+ @Override
+ public void stopBroker()
{
- super.tearDown();
- TransportConnection.killAllVMBrokers();
+ TransportConnection.killVMBroker(ApplicationRegistry.DEFAULT_INSTANCE);
+ super.stopBroker();
}
/**
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org