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/17 16:16:11 UTC

svn commit: r766021 - in /qpid/branches/0.5-release/qpid/java: ./ lib/ management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/ systests/src/main/java/org/apache/qpid/client/ systests/src/main/java/org/apache/qpid/server/persistent/...

Author: ritchiem
Date: Fri Apr 17 14:16:01 2009
New Revision: 766021

URL: http://svn.apache.org/viewvc?rev=766021&view=rev
Log:
QPID-1813 : Provide test that uses the DerbyMessageStore to check NoLocal functionality after a broker restart.
merged from trunk r765604

QPID-1817 : Update QTC to provide the configuration file to an external broker
merged from trunk r765605

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.
merged from trunk r765608 

QPID-1813 : Add missing DerbyDB library dependency.
merged from trunk r765628

QPID-1818 : Exclude NoLocalAfterRecoveryTest as 0-10 client code path does not restore a transacted session after failover.
merged from trunk r765656


Added:
    qpid/branches/0.5-release/qpid/java/lib/derby-10.3.2.1.jar
      - copied unchanged from r765628, qpid/trunk/qpid/java/lib/derby-10.3.2.1.jar
    qpid/branches/0.5-release/qpid/java/systests/src/main/java/org/apache/qpid/server/persistent/
      - copied from r765604, qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/persistent/
    qpid/branches/0.5-release/qpid/java/systests/src/main/java/org/apache/qpid/server/persistent/NoLocalAfterRecoveryTest.java
      - copied, changed from r765604, qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/persistent/NoLocalAfterRecoveryTest.java
Modified:
    qpid/branches/0.5-release/qpid/java/   (props changed)
    qpid/branches/0.5-release/qpid/java/010ExcludeList
    qpid/branches/0.5-release/qpid/java/build.deps
    qpid/branches/0.5-release/qpid/java/java.testprofile
    qpid/branches/0.5-release/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/AttributesTabControl.java   (props changed)
    qpid/branches/0.5-release/qpid/java/systests/src/main/java/org/apache/qpid/client/MultipleJCAProviderRegistrationTest.java
    qpid/branches/0.5-release/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/ConnectionTest.java
    qpid/branches/0.5-release/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidTestCase.java
    qpid/branches/0.5-release/qpid/java/test-provider.properties

Propchange: qpid/branches/0.5-release/qpid/java/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Apr 17 14:16:01 2009
@@ -1 +1 @@
-/qpid/trunk/qpid/java:764790,764838,765132,765134,765602
+/qpid/trunk/qpid/java:764790,764838,765132,765134,765602,765604-765605,765608,765628,765656

Modified: qpid/branches/0.5-release/qpid/java/010ExcludeList
URL: http://svn.apache.org/viewvc/qpid/branches/0.5-release/qpid/java/010ExcludeList?rev=766021&r1=766020&r2=766021&view=diff
==============================================================================
--- qpid/branches/0.5-release/qpid/java/010ExcludeList (original)
+++ qpid/branches/0.5-release/qpid/java/010ExcludeList Fri Apr 17 14:16:01 2009
@@ -67,3 +67,5 @@
 // This test may use QpidTestCase but it is not using the getConnection and is hardwired to InVM
 org.apache.qpid.test.unit.client.connection.CloseAfterConnectionFailureTest#*
 
+//QPID-1818 : 0-10 Client code path does not correctly restore a transacted session after failover.
+org.apache.qpid.server.persistent.NoLocalAfterRecoveryTest#*

Modified: qpid/branches/0.5-release/qpid/java/build.deps
URL: http://svn.apache.org/viewvc/qpid/branches/0.5-release/qpid/java/build.deps?rev=766021&r1=766020&r2=766021&view=diff
==============================================================================
--- qpid/branches/0.5-release/qpid/java/build.deps (original)
+++ qpid/branches/0.5-release/qpid/java/build.deps Fri Apr 17 14:16:01 2009
@@ -10,6 +10,8 @@
 commons-logging=lib/commons-logging-1.0.4.jar
 commons-pool=lib/commons-pool-1.4.jar
 
+derby-db=lib/derby-10.3.2.1.jar
+
 geronimo-jms=lib/geronimo-jms_1.1_spec-1.0.jar
 
 junit=lib/junit-3.8.1.jar
@@ -78,7 +80,8 @@
 client.libs=${common.libs}  ${geronimo-jms}
 tools.libs=${client.libs}
 broker.libs=${common.libs} ${commons-cli} ${commons-logging} ${log4j} \
-    ${slf4j-log4j} ${xalan} ${felix.libs} ${build.lib}/${project.name}-common-${project.version}.jar
+    ${slf4j-log4j} ${xalan} ${felix.libs} ${derby-db} \
+    ${build.lib}/${project.name}-common-${project.version}.jar
 
 broker-plugins.libs=${common.libs} ${felix.libs} 
 management-client.libs=${jsp.libs} ${log4j} ${slf4j-log4j} ${slf4j-api} ${commons-pool} ${geronimo-servlet} ${muse.libs} ${javassist} ${xalan} ${mina-core} ${mina-filter-ssl}

Modified: qpid/branches/0.5-release/qpid/java/java.testprofile
URL: http://svn.apache.org/viewvc/qpid/branches/0.5-release/qpid/java/java.testprofile?rev=766021&r1=766020&r2=766021&view=diff
==============================================================================
--- qpid/branches/0.5-release/qpid/java/java.testprofile (original)
+++ qpid/branches/0.5-release/qpid/java/java.testprofile Fri Apr 17 14:16:01 2009
@@ -1,4 +1,5 @@
-broker=${project.root}/build/bin/qpid-server -p @PORT -m @MPORT
+broker.language=java
+broker=${project.root}/build/bin/qpid-server -p @PORT -m @MPORT -c @CONFIG_FILE
 broker.clean=${project.root}/clean-dir ${build.data}
 broker.ready=Qpid Broker Ready
 

Propchange: qpid/branches/0.5-release/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/AttributesTabControl.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Apr 17 14:16:01 2009
@@ -1 +1 @@
-/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/AttributesTabControl.java:762365,764790,764838,765132,765134,765602
+/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/AttributesTabControl.java:762365,764790,764838,765132,765134,765602,765604-765605,765608,765628,765656

Modified: qpid/branches/0.5-release/qpid/java/systests/src/main/java/org/apache/qpid/client/MultipleJCAProviderRegistrationTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.5-release/qpid/java/systests/src/main/java/org/apache/qpid/client/MultipleJCAProviderRegistrationTest.java?rev=766021&r1=766020&r2=766021&view=diff
==============================================================================
--- qpid/branches/0.5-release/qpid/java/systests/src/main/java/org/apache/qpid/client/MultipleJCAProviderRegistrationTest.java (original)
+++ qpid/branches/0.5-release/qpid/java/systests/src/main/java/org/apache/qpid/client/MultipleJCAProviderRegistrationTest.java Fri Apr 17 14:16:01 2009
@@ -40,26 +40,9 @@
 
     public void setUp() throws Exception
     {
-        super.setUp();
-
-        stopBroker();
-
         _broker = VM;
 
-        final String QpidHome = System.getProperty("QPID_HOME");
-
-        assertNotNull("QPID_HOME not set",QpidHome);
-
-        final File defaultaclConfigFile = new File(QpidHome, "etc/config.xml");
-
-        if (!defaultaclConfigFile.exists())
-        {
-            System.err.println("Configuration file not found:" + defaultaclConfigFile);
-            fail("Configuration file not found:" + defaultaclConfigFile);
-        }
-
-        ConfigurationFileApplicationRegistry config = new ConfigurationFileApplicationRegistry(defaultaclConfigFile);
-        startBroker();
+        super.setUp();
     }
 
     public void test() throws Exception

Copied: qpid/branches/0.5-release/qpid/java/systests/src/main/java/org/apache/qpid/server/persistent/NoLocalAfterRecoveryTest.java (from r765604, qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/persistent/NoLocalAfterRecoveryTest.java)
URL: http://svn.apache.org/viewvc/qpid/branches/0.5-release/qpid/java/systests/src/main/java/org/apache/qpid/server/persistent/NoLocalAfterRecoveryTest.java?p2=qpid/branches/0.5-release/qpid/java/systests/src/main/java/org/apache/qpid/server/persistent/NoLocalAfterRecoveryTest.java&p1=qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/persistent/NoLocalAfterRecoveryTest.java&r1=765604&r2=766021&rev=766021&view=diff
==============================================================================
--- qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/persistent/NoLocalAfterRecoveryTest.java (original)
+++ qpid/branches/0.5-release/qpid/java/systests/src/main/java/org/apache/qpid/server/persistent/NoLocalAfterRecoveryTest.java Fri Apr 17 14:16:01 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/branches/0.5-release/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/ConnectionTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.5-release/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/ConnectionTest.java?rev=766021&r1=766020&r2=766021&view=diff
==============================================================================
--- qpid/branches/0.5-release/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/ConnectionTest.java (original)
+++ qpid/branches/0.5-release/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/ConnectionTest.java Fri Apr 17 14:16:01 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/branches/0.5-release/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidTestCase.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.5-release/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidTestCase.java?rev=766021&r1=766020&r2=766021&view=diff
==============================================================================
--- qpid/branches/0.5-release/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidTestCase.java (original)
+++ qpid/branches/0.5-release/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidTestCase.java Fri Apr 17 14:16:01 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.*;
@@ -35,12 +36,15 @@
 import java.util.HashMap;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
+import java.net.MalformedURLException;
 
 import org.apache.qpid.client.transport.TransportConnection;
 import org.apache.qpid.client.AMQConnection;
 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;
@@ -127,6 +131,7 @@
     private static List<String> _exclusionList;
 
     // system properties
+    private static final String BROKER_LANGUAGE = "broker.language";
     private static final String BROKER = "broker";
     private static final String BROKER_CLEAN = "broker.clean";
     private static final String BROKER_VERSION = "broker.version";
@@ -134,6 +139,8 @@
     private static final String TEST_OUTPUT = "test.output";
 
     // values
+    protected static final String JAVA = "java";
+    protected static final String CPP = "cpp";
     protected static final String VM = "vm";
     protected static final String EXTERNAL = "external";
     private static final String VERSION_08 = "0-8";
@@ -144,6 +151,7 @@
     protected int DEFAULT_VM_PORT = 1;
     protected int DEFAULT_PORT = 5672;
 
+    protected String _brokerLanguage = System.getProperty(BROKER_LANGUAGE, JAVA);
     protected String _broker = System.getProperty(BROKER, VM);
     private String _brokerClean = System.getProperty(BROKER_CLEAN, null);
     private String _brokerVersion = System.getProperty(BROKER_VERSION, VERSION_08);
@@ -331,11 +339,21 @@
         }
     }
 
-    private String getBrokerCommand(int port)
+    private String getBrokerCommand(int port) throws MalformedURLException
     {
-        return _broker
-            .replace("@PORT", "" + port)
-            .replace("@MPORT", "" + (port + (8999 - DEFAULT_PORT)));
+        if (_brokerLanguage.equals(JAVA))
+        {
+            return _broker
+                .replace("@PORT", "" + port)
+                .replace("@MPORT", "" + (port + (8999 - DEFAULT_PORT)))
+                .replace("@CONFIG_FILE", _configFile.toString());
+        }
+        else
+        {
+            return _broker
+                .replace("@PORT", "" + port)
+                .replace("@MPORT", "" + (port + (8999 - DEFAULT_PORT)));
+        }
     }
 
     public void startBroker(int port) throws Exception
@@ -569,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)
      *
@@ -634,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/branches/0.5-release/qpid/java/test-provider.properties
URL: http://svn.apache.org/viewvc/qpid/branches/0.5-release/qpid/java/test-provider.properties?rev=766021&r1=766020&r2=766021&view=diff
==============================================================================
--- qpid/branches/0.5-release/qpid/java/test-provider.properties (original)
+++ qpid/branches/0.5-release/qpid/java/test-provider.properties Fri Apr 17 14:16:01 2009
@@ -35,5 +35,6 @@
 queue.queue = example.queue
 queue.xaQueue =  xaQueue
 
+topic.topic = topic
 topic.xaTopic = xaTopic
 topic.durableSubscriberTopic = durableSubscriberTopic



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org