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 2009/04/16 14:29:54 UTC
svn commit: r765608 - in /qpid/trunk/qpid/java: ./
broker/src/main/java/org/apache/qpid/server/store/
systests/src/main/java/org/apache/qpid/server/persistent/
systests/src/main/java/org/apache/qpid/test/unit/client/connection/
systests/src/main/java/o...
Author: ritchiem
Date: Thu Apr 16 12:29:53 2009
New Revision: 765608
URL: http://svn.apache.org/viewvc?rev=765608&view=rev
Log:
QPID-1813/QPID-1817 : Removed the new properties from the test-provider as this will affect all tests. The NoLocalAfterRecoveryTest now updates a ConnectionURL based on the JNDI data and uses that to start a connection. NLART also provides a default location for the derbyDB store as the DMS class does not correctly attempt to put the store in QPID_WORK. This will be re-addressed when ServerConfiguration is again available from a VHC object. ConnectionTest was updated to remove the literal values for the BrokerDetail options.
Modified:
qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/store/DerbyMessageStore.java
qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/persistent/NoLocalAfterRecoveryTest.java
qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/ConnectionTest.java
qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidTestCase.java
qpid/trunk/qpid/java/test-provider.properties
Modified: qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/store/DerbyMessageStore.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/store/DerbyMessageStore.java?rev=765608&r1=765607&r2=765608&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/store/DerbyMessageStore.java (original)
+++ qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/store/DerbyMessageStore.java Thu Apr 16 12:29:53 2009
@@ -67,7 +67,7 @@
private static final Logger _logger = Logger.getLogger(DerbyMessageStore.class);
- private static final String ENVIRONMENT_PATH_PROPERTY = "environment-path";
+ public static final String ENVIRONMENT_PATH_PROPERTY = "environment-path";
private static final String SQL_DRIVER_NAME = "org.apache.derby.jdbc.EmbeddedDriver";
@@ -155,7 +155,7 @@
QueueRegistry queueRegistry = virtualHost.getQueueRegistry();
//Update to pick up QPID_WORK and use that as the default location not just derbyDB
- final String databasePath = config.getStoreConfiguration().getString(base + "." + ENVIRONMENT_PATH_PROPERTY, "derbyDB");
+ final String databasePath = config.getStoreConfiguration().getString(ENVIRONMENT_PATH_PROPERTY, "derbyDB");
File environmentPath = new File(databasePath);
if (!environmentPath.exists())
Modified: qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/persistent/NoLocalAfterRecoveryTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/persistent/NoLocalAfterRecoveryTest.java?rev=765608&r1=765607&r2=765608&view=diff
==============================================================================
--- qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/persistent/NoLocalAfterRecoveryTest.java (original)
+++ qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/persistent/NoLocalAfterRecoveryTest.java Thu Apr 16 12:29:53 2009
@@ -24,8 +24,11 @@
import org.apache.qpid.client.AMQConnection;
import org.apache.qpid.client.AMQSession;
import org.apache.qpid.jms.ConnectionListener;
+import org.apache.qpid.jms.BrokerDetails;
+import org.apache.qpid.jms.ConnectionURL;
import org.apache.qpid.server.registry.ApplicationRegistry;
import org.apache.qpid.server.registry.ConfigurationFileApplicationRegistry;
+import org.apache.qpid.server.store.DerbyMessageStore;
import org.apache.commons.configuration.XMLConfiguration;
import javax.jms.Connection;
@@ -55,25 +58,49 @@
protected static final int SEND_COUNT = 10;
private CountDownLatch _failoverComplete = new CountDownLatch(1);
+ protected ConnectionURL _connectionURL;
+
@Override
protected void setUp() throws Exception
{
+
XMLConfiguration configuration = new XMLConfiguration(_configFile);
configuration.setProperty("virtualhosts.virtualhost.test.store.class", "org.apache.qpid.server.store.DerbyMessageStore");
+ configuration.setProperty("virtualhosts.virtualhost.test.store."+ DerbyMessageStore.ENVIRONMENT_PATH_PROPERTY,
+ System.getProperty("QPID_WORK", System.getProperty("java.io.tmpdir")) + File.separator + "derbyDB-NoLocalAfterRecoveryTest");
File tmpFile = File.createTempFile("configFile", "test");
tmpFile.deleteOnExit();
configuration.save(tmpFile);
_configFile = tmpFile;
+ _connectionURL = getConnectionURL();
+
+ BrokerDetails details = _connectionURL.getBrokerDetails(0);
+
+ // Due to the problem with SingleServer delaying on all connection
+ // attempts. So using a high retry value.
+ if (_broker.equals(VM))
+ {
+ // Local testing suggests InVM restart takes under a second
+ details.setProperty(BrokerDetails.OPTIONS_RETRY, "5");
+ details.setProperty(BrokerDetails.OPTIONS_CONNECT_DELAY, "200");
+ }
+ else
+ {
+ // This will attempt to failover for 3 seconds.
+ // Local testing suggests failover takes 2 seconds
+ details.setProperty(BrokerDetails.OPTIONS_RETRY, "10");
+ details.setProperty(BrokerDetails.OPTIONS_CONNECT_DELAY, "500");
+ }
+
super.setUp();
}
public void test() throws Exception
{
-
- Connection connection = getConnection();
+ Connection connection = getConnection(_connectionURL);
Session session = connection.createSession(true, Session.SESSION_TRANSACTED);
Topic topic = (Topic) getInitialContext().lookup("topic");
Modified: qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/ConnectionTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/ConnectionTest.java?rev=765608&r1=765607&r2=765608&view=diff
==============================================================================
--- qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/ConnectionTest.java (original)
+++ qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/ConnectionTest.java Thu Apr 16 12:29:53 2009
@@ -48,28 +48,6 @@
String _broker_NotRunning = "vm://:2";
String _broker_BadDNS = "tcp://hg3sgaaw4lgihjs";
- public BrokerDetails getBroker()
- {
- try
- {
- if (getConnectionFactory().getConnectionURL().getBrokerCount() > 0)
- {
- return getConnectionFactory().getConnectionURL().getBrokerDetails(0);
- }
- else
- {
- fail("No broker details are available.");
- }
- }
- catch (NamingException e)
- {
- fail(e.getMessage());
- }
-
- //keep compiler happy
- return null;
- }
-
public void testSimpleConnection() throws Exception
{
AMQConnection conn = null;
@@ -93,7 +71,7 @@
try
{
BrokerDetails broker = getBroker();
- broker.setProperty("retries","1");
+ broker.setProperty(BrokerDetails.OPTIONS_RETRY, "1");
ConnectionURL url = new AMQConnectionURL("amqp://guest:guest@clientid/test?brokerlist='"
+ broker
+ "'&defaultQueueExchange='test.direct'"
@@ -160,7 +138,7 @@
try
{
BrokerDetails broker = getBroker();
- broker.setProperty("retries", "0");
+ broker.setProperty(BrokerDetails.OPTIONS_RETRY, "0");
conn = new AMQConnection("amqp://guest:rubbishpassword@clientid/test?brokerlist='" + broker + "'");
fail("Connection should not be established password is wrong.");
}
@@ -234,7 +212,7 @@
try
{
BrokerDetails broker = getBroker();
- broker.setProperty("retries", "0");
+ broker.setProperty(BrokerDetails.OPTIONS_RETRY, "0");
conn = new AMQConnection("amqp://guest:guest@clientid/rubbishhost?brokerlist='" + broker + "'");
fail("Connection should not be established");
}
Modified: qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidTestCase.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidTestCase.java?rev=765608&r1=765607&r2=765608&view=diff
==============================================================================
--- qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidTestCase.java (original)
+++ qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidTestCase.java Thu Apr 16 12:29:53 2009
@@ -25,6 +25,7 @@
import javax.jms.Session;
import javax.jms.MessageProducer;
import javax.jms.Message;
+import javax.jms.JMSException;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import java.io.*;
@@ -42,6 +43,8 @@
import org.apache.qpid.client.AMQConnectionFactory;
import org.apache.qpid.server.registry.ApplicationRegistry;
import org.apache.qpid.server.registry.ConfigurationFileApplicationRegistry;
+import org.apache.qpid.jms.BrokerDetails;
+import org.apache.qpid.jms.ConnectionURL;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -584,6 +587,15 @@
return getConnection("guest", "guest");
}
+ public Connection getConnection(ConnectionURL url) throws JMSException
+ {
+ Connection connection = new AMQConnectionFactory(url).createConnection("guest", "guest");
+
+ _connections.add(connection);
+
+ return connection;
+ }
+
/**
* Get a connection (remote or in-VM)
*
@@ -649,4 +661,32 @@
return messages;
}
+ public ConnectionURL getConnectionURL() throws NamingException
+ {
+ return getConnectionFactory().getConnectionURL();
+ }
+
+
+ public BrokerDetails getBroker()
+ {
+ try
+ {
+ if (getConnectionFactory().getConnectionURL().getBrokerCount() > 0)
+ {
+ return getConnectionFactory().getConnectionURL().getBrokerDetails(0);
+ }
+ else
+ {
+ fail("No broker details are available.");
+ }
+ }
+ catch (NamingException e)
+ {
+ fail(e.getMessage());
+ }
+
+ //keep compiler happy
+ return null;
+ }
+
}
Modified: qpid/trunk/qpid/java/test-provider.properties
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/test-provider.properties?rev=765608&r1=765607&r2=765608&view=diff
==============================================================================
--- qpid/trunk/qpid/java/test-provider.properties (original)
+++ qpid/trunk/qpid/java/test-provider.properties Thu Apr 16 12:29:53 2009
@@ -19,10 +19,8 @@
#
#
-# Allow the client to reconnect to the broker if the connection is lost, for up to 1second.
-# This will allow for persistent tests to bounce the broker.
-connectionfactory.default = amqp://username:password@clientid/test?brokerlist='tcp://localhost:5672?retries='5'&connectdelay='200''
-connectionfactory.default.vm = amqp://username:password@clientid/test?brokerlist='vm://:1?retries='5'&connectdelay='200''
+connectionfactory.default = amqp://username:password@clientid/test?brokerlist='tcp://localhost:5672'
+connectionfactory.default.vm = amqp://username:password@clientid/test?brokerlist='vm://:1'
connectionfactory.ssl = amqp://username:password@clientid/test?brokerlist='tcp://localhost:5671?ssl='true''
connectionfactory.failover = amqp://username:password@clientid/test?brokerlist='tcp://localhost:5673;tcp://localhost:5672'&sync_ack='true'&sync_publish='all'&failover='roundrobin?cyclecount='20''
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org