[rhmessaging-commits] rhmessaging commits: r3282 - in store/branches/java/0.5-release: etc/scripts and 4 other directories.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Mon Apr 13 12:09:04 EDT 2009


Author: ritchiem
Date: 2009-04-13 12:09:04 -0400 (Mon, 13 Apr 2009)
New Revision: 3282

Modified:
   store/branches/java/0.5-release/build.xml
   store/branches/java/0.5-release/etc/scripts/bdbtest.sh
   store/branches/java/0.5-release/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStore.java
   store/branches/java/0.5-release/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBStoreTest.java
   store/branches/java/0.5-release/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBUpgradeTest.java
   store/branches/java/0.5-release/src/test/java/org/apache/qpid/server/store/berkeleydb/utils/BDBVMTestCase.java
   store/branches/java/0.5-release/src/tools/java/org/apache/qpid/server/store/berkeleydb/BDBStoreUpgrade.java
   store/branches/java/0.5-release/test-provider.properties
Log:
Merged a number of changes for r3125 and r3250 to restore compatiblity with new Apache 0.5

Modified: store/branches/java/0.5-release/build.xml
===================================================================
--- store/branches/java/0.5-release/build.xml	2009-04-13 10:07:57 UTC (rev 3281)
+++ store/branches/java/0.5-release/build.xml	2009-04-13 16:09:04 UTC (rev 3282)
@@ -4,7 +4,7 @@
 <project name="BDBStore" default="build">
  
     <property name="project.name" value="qpid-BDB-MessageStore"/>
-    <property name="project.version" value="M3"/>
+    <property name="project.version" value="0.5"/>
     <property name="src.tools.dir" location="src/tools/java"/>
     <property name="src.main.dir" location="src/main/java"/>
     <property name="src.test.dir" location="src/test/java"/>
@@ -17,6 +17,8 @@
     <property name="java.target" value="1.5"/>
     <property name="java.source" value="1.5"/>
 
+    <dirname property="project.root" file="${ant.file.common}"/>
+
     <property name="build.classes" location="build/classes"/>
     <property name="build.test.classes" location="build/test/classes"/>
     <property name="build.tools.classes" location="build/tools/classes"/>
@@ -28,14 +30,13 @@
     <property name="release.tar"       location="${release.dir}/${project.namever}.tar"/>
     <property name="release.tgz"       location="${release.dir}/${project.namever}.tgz"/>
     <property name="release.bz2"       location="${release.dir}/${project.namever}.bz2"/>
+    <property name="qpid.work.dir"     location="${project.root}/build/test-work"/>
 
 
     <property name="java.naming.factory.initial" value="org.apache.qpid.jndi.PropertiesFileInitialContextFactory"/>    
 
     <available property="src.test.dir.exists" file="${src.test.dir}"/>
 
-    <dirname property="project.root" file="${ant.file.common}"/>
-
     <property file="${project.root}/default.testprofile"/>
 
     <path id="class.path">
@@ -102,7 +103,7 @@
 	<jar destfile="${bdbtools.jar}" basedir="${build.tools.classes}"/>
     </target>
 
-  <target name="test" depends="build-tests" if="src.test.dir.exists"
+  <target name="test" depends="build-tests,prepare-tests" if="src.test.dir.exists"
          unless="${dontruntest}" description="execute unit tests">
 
     <delete file="${module.failed}"/>
@@ -110,7 +111,6 @@
     <junit fork="${test.fork}" maxmemory="${test.mem}" reloading="no"
            haltonfailure="${haltonfailure}" haltonerror="${haltonerror}"
            failureproperty="test.failures" printsummary="on" timeout="600000" >
-
       <sysproperty key="amqj.logging.level" value="${amqj.logging.level}"/>
       <sysproperty key="root.logging.level" value="${root.logging.level}"/>
       <sysproperty key="log4j.configuration" value="${log4j.configuration}"/>
@@ -125,8 +125,8 @@
       <sysproperty key="max_prefetch" value ="${max_prefetch}"/>
       <sysproperty key="example.plugin.target" value="${project.root}/build/lib/plugins"/>
       <sysproperty key="QPID_HOME" value="${project.root}"/>
-      <sysproperty key="QPID_WORK" value="${project.root}/build/test-work"/>
-      <sysproperty key="BDB_WORK" value="${project.root}/build/test-work/bdbstore"/>
+      <sysproperty key="QPID_WORK" value="${qpid.work.dir}"/>
+      <sysproperty key="BDB_WORK" value="${qpid.work.dir}/bdbstore"/>
       <sysproperty key="BDB_HOME" value="${project.root}"/>
       <sysproperty key="test.excludes" value="false"/>
 
@@ -160,6 +160,10 @@
      <mkdir dir="${release.dir}"/>
   </target>
 
+  <target name="prepare-tests">
+     <mkdir dir="${qpid.work.dir}"/>
+  </target>
+
   <target name="zip" depends="build,prepare" description="build release archive">
     <zip destfile="${release.zip}">
       <zipfileset dir="${bin.dir}" prefix="${project.namever}/bin" filemode="755">

Modified: store/branches/java/0.5-release/etc/scripts/bdbtest.sh
===================================================================
--- store/branches/java/0.5-release/etc/scripts/bdbtest.sh	2009-04-13 10:07:57 UTC (rev 3281)
+++ store/branches/java/0.5-release/etc/scripts/bdbtest.sh	2009-04-13 16:09:04 UTC (rev 3282)
@@ -1,5 +1,28 @@
 #!/bin/bash
+#
+# 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.
+#
 
+if [ -z "$QPID_HOME" ]; then
+    export QPID_HOME=$(dirname $(dirname $(readlink -f $0)))
+    export PATH=${PATH}:${QPID_HOME}/bin
+fi
+
 # Parse arguements taking all - prefixed args as JAVA_OPTS
 for arg in "$@"; do
     if [[ $arg == -java:* ]]; then
@@ -9,4 +32,12 @@
     fi
 done
 
-java -Xms256m -Dlog4j.configuration=perftests.log4j -Xmx256m -Dbadger.level=warn -Damqj.test.logging.level=warn -Damqj.logging.level=warn ${JAVA_OPTS} -cp qpid-bdbstore-1.0-incubating-M2-SNAPSHOT-all-test-deps.jar org.apache.qpid.ping.PingDurableClient -o $QPID_WORK/results ${ARGS} 
+VERSION=0.5
+
+# Set classpath to include Qpid jar with all required jars in manifest
+QPID_LIBS=$QPID_HOME/lib/qpid-all.jar:$QPID_HOME/lib/qpid-junit-toolkit-$VERSION.jar:$QPID_HOME/lib/junit-3.8.1.jar:$QPID_HOME/lib/log4j-1.2.12.jar:$QPID_HOME/lib/qpid-perftests-$VERSION.jar:$QPID_HOME/lib/slf4j-log4j12-1.4.0.jar
+
+# Set other variables used by the qpid-run script before calling
+export JAVA=java        JAVA_MEM=-Xmx256m        QPID_CLASSPATH=$QPID_LIBS
+
+. qpid-run -Dlog4j.configuration=perftests.log4j -Dbadger.level=warn -Damqj.test.logging.level=warn -Damqj.logging.level=warn ${JAVA_OPTS} org.apache.qpid.ping.PingDurableClient -o $QPID_WORK/results ${ARGS}

Modified: store/branches/java/0.5-release/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStore.java
===================================================================
--- store/branches/java/0.5-release/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStore.java	2009-04-13 10:07:57 UTC (rev 3281)
+++ store/branches/java/0.5-release/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStore.java	2009-04-13 16:09:04 UTC (rev 3282)
@@ -49,6 +49,7 @@
 import org.apache.qpid.server.txn.NonTransactionalContext;
 import org.apache.qpid.server.txn.TransactionalContext;
 import org.apache.qpid.server.virtualhost.VirtualHost;
+import org.apache.qpid.server.configuration.VirtualHostConfiguration;
 
 import java.io.File;
 import java.util.ArrayList;
@@ -176,16 +177,15 @@
      * whatever parameters it wants.
      *
      * @param virtualHost The virtual host using by this store
-     * @param base        The base element identifier from which all configuration items are relative. For example, if
-     *                    the base element is "store", the all elements used by concrete classes will be "store.foo"
-     *                    etc.
-     * @param config      The apache commons configuration object.
+     * @param base        Not used
+     * @param vHostConfig The configuration for this virtualhost
      *
      * @throws Exception If any error occurs that means the store is unable to configure itself.
      */
-    public void configure(VirtualHost virtualHost, String base, Configuration config) throws Exception
+    public void configure(VirtualHost virtualHost, String base, VirtualHostConfiguration vHostConfig) throws Exception
     {
-        File environmentPath = new File(config.getString(base + "." + ENVIRONMENT_PATH_PROPERTY, "bdbEnv"));
+        Configuration config = vHostConfig.getStoreConfiguration();
+        File environmentPath = new File(config.getString(ENVIRONMENT_PATH_PROPERTY, "bdbEnv"));        
         if (!environmentPath.exists())
         {
             if (!environmentPath.mkdirs())
@@ -195,7 +195,7 @@
             }
         }
 
-        _version = config.getInt(base + "." + DATABASE_FORMAT_VERSION_PROPERTY, DATABASE_FORMAT_VERSION);
+        _version = config.getInt(DATABASE_FORMAT_VERSION_PROPERTY, DATABASE_FORMAT_VERSION);
 
         configure(virtualHost, environmentPath, false);
     }
@@ -231,7 +231,7 @@
             if (!newEnvironment && virtualHost != null)
             {
                 // this recovers durable queues and persistent messages
-                recover();
+                recover(virtualHost);
             }
         }
 
@@ -598,7 +598,8 @@
 
     /**
      * Removes the specified persistent exchange.
-     *
+     * Internal method that is package scoped to allow testing.
+     *  
      * @param exchange The exchange to remove.
      *
      * @throws org.apache.qpid.AMQException If the operation fails for any reason.
@@ -1214,7 +1215,7 @@
         }
     }
 
-    public void recover() throws AMQException
+    public void recover(VirtualHost virtualHost) throws AMQException
     {
         stateTransition(State.CONFIGURED, State.RECOVERING);
 
@@ -1225,6 +1226,11 @@
             beginTran(context);
             Map<AMQShortString, AMQQueue> queues = loadQueues();
 
+            for (AMQQueue q : queues.values())
+            {
+                q.configure(virtualHost.getConfiguration().getQueueConfiguration(q.getName().asString()));
+            }
+
             recoverExchanges();
 
             deliverMessages(context, queues);

Modified: store/branches/java/0.5-release/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBStoreTest.java
===================================================================
--- store/branches/java/0.5-release/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBStoreTest.java	2009-04-13 10:07:57 UTC (rev 3281)
+++ store/branches/java/0.5-release/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBStoreTest.java	2009-04-13 16:09:04 UTC (rev 3282)
@@ -29,6 +29,8 @@
 import org.apache.qpid.framing.abstraction.MessagePublishInfo;
 import org.apache.qpid.framing.abstraction.ContentChunk;
 import org.apache.qpid.server.RequiredDeliveryException;
+import org.apache.qpid.server.configuration.VirtualHostConfiguration;
+import org.apache.qpid.server.configuration.ServerConfiguration;
 import org.apache.qpid.server.exchange.Exchange;
 import org.apache.qpid.server.exchange.DefaultExchangeFactory;
 import org.apache.qpid.server.exchange.DirectExchange;
@@ -87,7 +89,16 @@
         _store = new BDBMessageStore();
         _store.configure(BDB_DIR);
 
-        _virtualHost = new VirtualHost("test", _store);
+        PropertiesConfiguration config = new PropertiesConfiguration();
+
+        // This is used to test that recovery will correctly reapply configuration to the queues
+        // in testRecovery
+        config.setProperty("queues.maximumMessageAge", "23");
+
+        VirtualHostConfiguration vhostConfig = new VirtualHostConfiguration("test", config);
+
+        _virtualHost = new VirtualHost(vhostConfig, _store);
+
         _store.setVirtualHost(_virtualHost);
 
         _txnContext = new NonTransactionalContext(_store, _storeContext, null, new LinkedList<RequiredDeliveryException>());
@@ -102,8 +113,12 @@
         env.addProperty("store.environment-path", STORE_LOCATION);
         env.addProperty("store.class", "org.apache.qpid.server.store.berkeleydb.BDBMessageStore");
 
-        _virtualHost = new VirtualHost("test", env);
+        _virtualHost = new VirtualHost(new VirtualHostConfiguration("test", env), null);
+
         _store = (BDBMessageStore) _virtualHost.getMessageStore();
+        env.addProperty("store.class", "org.apache.qpid.server.store.berkeleydb.InspectableBDBMessageStore");
+        env.setProperty("queues.maximumMessageAge", 23);
+        _virtualHost = new VirtualHost(new VirtualHostConfiguration("test", env));
     }
 
     public void tearDown() throws Exception
@@ -467,6 +482,9 @@
             Assert.assertEquals("Queue1 has incorrect message count", 3, q1.getMessageCount());
             Assert.assertNotNull("Queue2 is was not recovered", q2);
             Assert.assertEquals("Queue2 has incorrect message count", 1, q2.getMessageCount());
+            
+            // Message age is set in setUp
+            assertEquals("q1 has an incorrect maximum message age", 23, q1.getMaximumMessageAge());
         }
         catch (Exception e)
         {

Modified: store/branches/java/0.5-release/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBUpgradeTest.java
===================================================================
--- store/branches/java/0.5-release/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBUpgradeTest.java	2009-04-13 10:07:57 UTC (rev 3281)
+++ store/branches/java/0.5-release/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBUpgradeTest.java	2009-04-13 16:09:04 UTC (rev 3282)
@@ -24,9 +24,12 @@
 import org.apache.qpid.server.registry.ApplicationRegistry;
 import org.apache.qpid.server.store.berkeleydb.utils.Publisher;
 import org.apache.qpid.server.store.berkeleydb.utils.DurableSubscriber;
+import org.apache.qpid.server.virtualhost.VirtualHost;
+import org.apache.qpid.server.configuration.VirtualHostConfiguration;
 import org.apache.qpid.client.transport.TransportConnection;
 import org.apache.qpid.util.FileUtils;
 import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.PropertiesConfiguration;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -107,6 +110,7 @@
         }
         catch (Exception e)
         {
+            System.err.println("Showing stack trace. expecting Unable to load BDBStore error");
             e.printStackTrace();
             assertTrue("Incorrect Exception Thrown:" + e.getMessage(),
                        e.getMessage().contains("Unable to load BDBStore as version 1. Store on disk contains version 2 data"));
@@ -145,6 +149,7 @@
 
         startBroker(2, VERSION_2);
 
+        ///* This test is currently broken due to QPID-1275
         //Ensure that the selector was preseved on restart and caused all msgs to be removed.
         sendAndCheckDurableSubscriber(broker, false, false, 0, null);
         stopBroker(2);
@@ -184,14 +189,19 @@
         ConfigurationFileApplicationRegistry config = new ConfigurationFileApplicationRegistry(_configFile);
 
         //Disable management on broker.
-        config.getConfiguration().setProperty("management.enabled", "false");
+        config.getConfiguration().setManagementEnabled(false);
 
-        Configuration testVirtualhost = config.getConfiguration().subset("virtualhosts.virtualhost." + VIRTUALHOST);
+        ApplicationRegistry.initialise(config, port);
+
+        Configuration testVirtualhost = new PropertiesConfiguration();
         testVirtualhost.setProperty("store.class", "org.apache.qpid.server.store.berkeleydb.BDBMessageStore");
-        testVirtualhost.setProperty("store." + BDBMessageStore.ENVIRONMENT_PATH_PROPERTY, "${work}/version" + port + "Store");
+        testVirtualhost.setProperty("store." + BDBMessageStore.ENVIRONMENT_PATH_PROPERTY,
+                                    System.getProperty("QPID_WORK")+ "/version" + version + "Store");
         testVirtualhost.setProperty("store.version", version);
 
-        ApplicationRegistry.initialise(config, port);
+        ApplicationRegistry.getInstance(port).getVirtualHostRegistry().
+                registerVirtualHost(new VirtualHost(new VirtualHostConfiguration("bdbtest",testVirtualhost)));
+
         TransportConnection.createVMBroker(port);
 
     }

Modified: store/branches/java/0.5-release/src/test/java/org/apache/qpid/server/store/berkeleydb/utils/BDBVMTestCase.java
===================================================================
--- store/branches/java/0.5-release/src/test/java/org/apache/qpid/server/store/berkeleydb/utils/BDBVMTestCase.java	2009-04-13 10:07:57 UTC (rev 3281)
+++ store/branches/java/0.5-release/src/test/java/org/apache/qpid/server/store/berkeleydb/utils/BDBVMTestCase.java	2009-04-13 16:09:04 UTC (rev 3282)
@@ -75,10 +75,24 @@
         }
 
         //Reset BDB_WORK
-        System.setProperty(BDB_WORK, BDB_WORK_PRE_TEST == null ? "" : BDB_WORK_PRE_TEST);
+        if (BDB_WORK_PRE_TEST == null)
+        {
+            System.clearProperty(BDB_WORK);
+        }
+        else
+        {
+            System.setProperty(BDB_WORK, BDB_WORK_PRE_TEST);
+        }
 
         //Reset QPID_WORK
-        System.setProperty(QPID_WORK, QPID_WORK_PRE_TEST == null ? "" : QPID_WORK_PRE_TEST);
+        if (QPID_WORK_PRE_TEST == null)
+        {
+            System.clearProperty(QPID_WORK);
+        }
+        else
+        {
+            System.setProperty(QPID_WORK, QPID_WORK_PRE_TEST);
+        }
     }
 
     public void setupWorkDirectory()

Modified: store/branches/java/0.5-release/src/tools/java/org/apache/qpid/server/store/berkeleydb/BDBStoreUpgrade.java
===================================================================
--- store/branches/java/0.5-release/src/tools/java/org/apache/qpid/server/store/berkeleydb/BDBStoreUpgrade.java	2009-04-13 10:07:57 UTC (rev 3281)
+++ store/branches/java/0.5-release/src/tools/java/org/apache/qpid/server/store/berkeleydb/BDBStoreUpgrade.java	2009-04-13 16:09:04 UTC (rev 3282)
@@ -26,6 +26,7 @@
 import org.apache.qpid.server.queue.AMQQueue;
 import org.apache.qpid.server.virtualhost.VirtualHost;
 import org.apache.qpid.server.registry.ApplicationRegistry;
+import org.apache.qpid.server.configuration.VirtualHostConfiguration;
 import org.apache.qpid.AMQException;
 import org.apache.qpid.util.FileUtils;
 import org.apache.commons.cli.PosixParser;
@@ -34,6 +35,7 @@
 import org.apache.commons.cli.ParseException;
 import org.apache.commons.cli.Option;
 import org.apache.commons.cli.OptionBuilder;
+import org.apache.commons.configuration.PropertiesConfiguration;
 
 import java.io.File;
 import java.io.BufferedReader;
@@ -327,8 +329,8 @@
         }
 
         // Note the name of the Vhosts is not important, the store doesnot record the name of the vhost.
-        _newVirtualHost = new VirtualHost("Upgraded", new MemoryMessageStore());
-        _oldVirtualHost = new VirtualHost("Old", new MemoryMessageStore());
+        _newVirtualHost = new VirtualHost(new VirtualHostConfiguration("Upgraded", new PropertiesConfiguration()), new MemoryMessageStore());
+        _oldVirtualHost = new VirtualHost(new VirtualHostConfiguration("Old", new PropertiesConfiguration()), new MemoryMessageStore());
 
         //Create a new messageStore
         _newMessageStore = new BDBMessageStore();

Modified: store/branches/java/0.5-release/test-provider.properties
===================================================================
--- store/branches/java/0.5-release/test-provider.properties	2009-04-13 10:07:57 UTC (rev 3281)
+++ store/branches/java/0.5-release/test-provider.properties	2009-04-13 16:09:04 UTC (rev 3282)
@@ -19,16 +19,21 @@
 # 
 #
 
-connectionfactory.vm = amqp://username:password@clientid/test?brokerlist='vm://:1'
+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.vmfailover = amqp://username:password@clientid/test?brokerlist='vm://:2;vm://:1'
-connectionfactory.connection1 = amqp://username:password@clientid/test?brokerlist='vm://:1'
-connectionfactory.connection2 = amqp://username:password@clientid/test?brokerlist='vm://:2'
+connectionfactory.failover = amqp://username:password@clientid/test?brokerlist='tcp://localhost:5673;tcp://localhost:5672'&sync_ack='true'&sync_publish='all'&failover='roundrobin?cyclecount='20''
+connectionfactory.failover.vm = amqp://username:password@clientid/test?brokerlist='vm://:2;vm://:1'
+connectionfactory.connection1 = amqp://username:password@clientid/test?brokerlist='tcp://localhost:5672'
+connectionfactory.connection2 = amqp://username:password@clientid/test?brokerlist='tcp://localhost:5673'
+connectionfactory.connection1.vm = amqp://username:password@clientid/test?brokerlist='vm://:1'
+connectionfactory.connection2.vm = amqp://username:password@clientid/test?brokerlist='vm://:2'
 
 
-#queue.MyQueue = example.MyQueue
+queue.MyQueue = example.MyQueue
 queue.queue = example.queue
-#queue.xaQueue =  xaQueue
+queue.xaQueue =  xaQueue
 
-#topic.xaTopic = xaTopic
-#topic.durableSubscriberTopic = durableSubscriberTopic
+topic.xaTopic = xaTopic
+topic.durableSubscriberTopic = durableSubscriberTopic




More information about the rhmessaging-commits mailing list