You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by rg...@apache.org on 2012/05/08 20:05:41 UTC

svn commit: r1335667 - in /qpid/trunk/qpid/java: broker/src/main/java/org/apache/qpid/server/store/derby/ systests/etc/ test-profiles/

Author: rgodfrey
Date: Tue May  8 18:05:40 2012
New Revision: 1335667

URL: http://svn.apache.org/viewvc?rev=1335667&view=rev
Log:
QPID-3989 : [Java Broker] Add ability to run "in-memory" Derby store

Added:
    qpid/trunk/qpid/java/systests/etc/config-systests-derby-mem-settings.xml
    qpid/trunk/qpid/java/systests/etc/config-systests-derby-mem.xml
    qpid/trunk/qpid/java/systests/etc/virtualhosts-systests-derby-mem-settings.xml
    qpid/trunk/qpid/java/systests/etc/virtualhosts-systests-derby-mem.xml
    qpid/trunk/qpid/java/test-profiles/java-dby-mem.0-10.testprofile
    qpid/trunk/qpid/java/test-profiles/java-dby-mem.0-8.testprofile
    qpid/trunk/qpid/java/test-profiles/java-dby-mem.0-9-1.testprofile
    qpid/trunk/qpid/java/test-profiles/java-dby-mem.0-9.testprofile
Modified:
    qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStore.java

Modified: qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStore.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStore.java?rev=1335667&r1=1335666&r2=1335667&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStore.java (original)
+++ qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStore.java Tue May  8 18:05:40 2012
@@ -112,6 +112,7 @@ public class DerbyMessageStore implement
 
 
     private static Class<Driver> DRIVER_CLASS;
+    public static final String MEMORY_STORE_LOCATION = ":memory:";
 
     private final AtomicLong _messageId = new AtomicLong(0);
     private AtomicBoolean _closed = new AtomicBoolean(false);
@@ -302,13 +303,16 @@ public class DerbyMessageStore implement
         final String databasePath = storeConfiguration.getString(MessageStoreConstants.ENVIRONMENT_PATH_PROPERTY, System.getProperty("QPID_WORK")
                 + File.separator + "derbyDB");
 
-        File environmentPath = new File(databasePath);
-        if (!environmentPath.exists())
+        if(!MEMORY_STORE_LOCATION.equals(databasePath))
         {
-            if (!environmentPath.mkdirs())
+            File environmentPath = new File(databasePath);
+            if (!environmentPath.exists())
             {
-                throw new IllegalArgumentException("Environment path " + environmentPath + " could not be read or created. "
-                    + "Ensure the path is correct and that the permissions are correct.");
+                if (!environmentPath.mkdirs())
+                {
+                    throw new IllegalArgumentException("Environment path " + environmentPath + " could not be read or created. "
+                        + "Ensure the path is correct and that the permissions are correct.");
+                }
             }
         }
 
@@ -345,7 +349,7 @@ public class DerbyMessageStore implement
     private void createOrOpenDatabase(String name, final String environmentPath) throws SQLException
     {
         //FIXME this the _vhost name should not be added here, but derby wont use an empty directory as was possibly just created.
-        _connectionURL = "jdbc:derby:" + environmentPath + "/" + name + ";create=true";
+        _connectionURL = "jdbc:derby" + (environmentPath.equals(MEMORY_STORE_LOCATION) ? environmentPath : ":" + environmentPath + "/") + name + ";create=true";
 
         Connection conn = newAutoCommitConnection();
 

Added: qpid/trunk/qpid/java/systests/etc/config-systests-derby-mem-settings.xml
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/etc/config-systests-derby-mem-settings.xml?rev=1335667&view=auto
==============================================================================
--- qpid/trunk/qpid/java/systests/etc/config-systests-derby-mem-settings.xml (added)
+++ qpid/trunk/qpid/java/systests/etc/config-systests-derby-mem-settings.xml Tue May  8 18:05:40 2012
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ -
+ - 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.
+ -
+ -->
+<broker>
+    <virtualhosts>${QPID_HOME}/etc/virtualhosts-systests-derby-mem.xml</virtualhosts>
+</broker>
+
+

Added: qpid/trunk/qpid/java/systests/etc/config-systests-derby-mem.xml
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/etc/config-systests-derby-mem.xml?rev=1335667&view=auto
==============================================================================
--- qpid/trunk/qpid/java/systests/etc/config-systests-derby-mem.xml (added)
+++ qpid/trunk/qpid/java/systests/etc/config-systests-derby-mem.xml Tue May  8 18:05:40 2012
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ -
+ - 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.
+ -
+ -->
+<configuration>
+    <system/>
+    <override>
+        <xml fileName="${QPID_HOME}/${test.config}" optional="true"/>
+        <xml fileName="${QPID_HOME}/etc/config-systests-derby-mem-settings.xml"/>
+        <xml fileName="${QPID_HOME}/etc/config-systests-settings.xml"/>
+        <xml fileName="${QPID_HOME}/etc/config.xml"/>
+    </override>
+</configuration>

Added: qpid/trunk/qpid/java/systests/etc/virtualhosts-systests-derby-mem-settings.xml
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/etc/virtualhosts-systests-derby-mem-settings.xml?rev=1335667&view=auto
==============================================================================
--- qpid/trunk/qpid/java/systests/etc/virtualhosts-systests-derby-mem-settings.xml (added)
+++ qpid/trunk/qpid/java/systests/etc/virtualhosts-systests-derby-mem-settings.xml Tue May  8 18:05:40 2012
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ -
+ - 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.
+ -
+ -->
+<virtualhosts>
+    <directory>${QPID_HOME}/virtualhosts</directory>
+    <default>test</default>
+    
+    <virtualhost>
+        <localhost>
+            <store>
+                <factoryclass>org.apache.qpid.server.store.derby.DerbyMessageStoreFactory</factoryclass>
+                <environment-path>:memory:</environment-path>
+            </store>
+        </localhost>
+    </virtualhost>
+
+    <virtualhost>
+        <development>
+            <store>
+                <factoryclass>org.apache.qpid.server.store.derby.DerbyMessageStoreFactory</factoryclass>
+                <environment-path>:memory:</environment-path>
+            </store>
+        </development>
+    </virtualhost>
+
+    <virtualhost>
+        <test>
+            <store>
+                <factoryclass>org.apache.qpid.server.store.derby.DerbyMessageStoreFactory</factoryclass>
+                <environment-path>:memory:</environment-path>
+            </store>
+        </test>
+    </virtualhost>
+</virtualhosts>
+
+

Added: qpid/trunk/qpid/java/systests/etc/virtualhosts-systests-derby-mem.xml
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/etc/virtualhosts-systests-derby-mem.xml?rev=1335667&view=auto
==============================================================================
--- qpid/trunk/qpid/java/systests/etc/virtualhosts-systests-derby-mem.xml (added)
+++ qpid/trunk/qpid/java/systests/etc/virtualhosts-systests-derby-mem.xml Tue May  8 18:05:40 2012
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ -
+ - 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.
+ -
+ -->
+<configuration>
+    <system/>
+    <override>
+        <xml fileName="${QPID_HOME}/${test.virtualhosts}" optional="true"/>
+        <xml fileName="${QPID_HOME}/etc/virtualhosts-systests-derby-mem-settings.xml"/>
+        <xml fileName="${QPID_HOME}/etc/virtualhosts.xml"/>
+    </override>
+</configuration>

Added: qpid/trunk/qpid/java/test-profiles/java-dby-mem.0-10.testprofile
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/test-profiles/java-dby-mem.0-10.testprofile?rev=1335667&view=auto
==============================================================================
--- qpid/trunk/qpid/java/test-profiles/java-dby-mem.0-10.testprofile (added)
+++ qpid/trunk/qpid/java/test-profiles/java-dby-mem.0-10.testprofile Tue May  8 18:05:40 2012
@@ -0,0 +1,30 @@
+#
+# 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.
+#
+broker.language=java
+broker.version=v0_10
+broker.type=internal
+#broker.command only used for the second broker during failover tests in this profile
+broker.command=build/bin/qpid-server -p @PORT -m @MPORT -c @CONFIG_FILE -l test-profiles/log4j-test.xml
+broker.ready=BRK-1004
+broker.stopped=Exception
+broker.config=build/etc/config-systests-derby-mem.xml
+messagestorefactory.class.name=org.apache.qpid.server.store.derby.DerbyMessageStoreFactory
+profile.excludes=JavaPersistentExcludes JavaDerbyExcludes Java010Excludes
+broker.clean.between.tests=true
+broker.persistent=true

Added: qpid/trunk/qpid/java/test-profiles/java-dby-mem.0-8.testprofile
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/test-profiles/java-dby-mem.0-8.testprofile?rev=1335667&view=auto
==============================================================================
--- qpid/trunk/qpid/java/test-profiles/java-dby-mem.0-8.testprofile (added)
+++ qpid/trunk/qpid/java/test-profiles/java-dby-mem.0-8.testprofile Tue May  8 18:05:40 2012
@@ -0,0 +1,36 @@
+#
+# 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.
+#
+broker.version=v0_8
+broker.language=java
+broker.type=internal
+#broker.command only used for the second broker during failover tests in this profile
+broker.command=build/bin/qpid-server -p @PORT -m @MPORT @EXCLUDES -c @CONFIG_FILE -l test-profiles/log4j-test.xml
+broker.ready=BRK-1004
+broker.stopped=Exception
+broker.config=build/etc/config-systests-derby-mem.xml
+broker.protocol.excludes=--exclude-0-10 @PORT --exclude-0-10 @SSL_PORT --exclude-1-0 @PORT --exclude-1-0 @SSL_PORT --exclude-0-9-1 @PORT --exclude-0-9-1 @SSL_PORT --exclude-0-9 @PORT --exclude-0-9 @SSL_PORT
+messagestorefactory.class.name=org.apache.qpid.server.store.derby.DerbyMessageStoreFactory
+profile.excludes=JavaPersistentExcludes JavaDerbyExcludes XAExcludes JavaPre010Excludes
+broker.clean.between.tests=true
+broker.persistent=true
+#
+# Do not enable. Allow client to attempt 0-10 and negotiate downwards
+#
+#qpid.amqp.version=0-8
+

Added: qpid/trunk/qpid/java/test-profiles/java-dby-mem.0-9-1.testprofile
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/test-profiles/java-dby-mem.0-9-1.testprofile?rev=1335667&view=auto
==============================================================================
--- qpid/trunk/qpid/java/test-profiles/java-dby-mem.0-9-1.testprofile (added)
+++ qpid/trunk/qpid/java/test-profiles/java-dby-mem.0-9-1.testprofile Tue May  8 18:05:40 2012
@@ -0,0 +1,36 @@
+#
+# 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.
+#
+broker.version=v0_9_1
+broker.language=java
+broker.type=internal
+#broker.command only used for the second broker during failover tests in this profile
+broker.command=build/bin/qpid-server -p @PORT -m @MPORT @EXCLUDES -c @CONFIG_FILE -l test-profiles/log4j-test.xml
+broker.ready=BRK-1004
+broker.stopped=Exception
+broker.config=build/etc/config-systests-derby-mem.xml
+broker.protocol.excludes=--exclude-0-10 @PORT --exclude-0-10 @SSL_PORT --exclude-1-0 @PORT --exclude-1-0 @SSL_PORT
+messagestorefactory.class.name=org.apache.qpid.server.store.derby.DerbyMessageStoreFactory
+profile.excludes=JavaPersistentExcludes JavaDerbyExcludes XAExcludes JavaPre010Excludes
+broker.clean.between.tests=true
+broker.persistent=true
+#
+# Do not enable. Allow client to attempt 0-10 and negotiate downwards
+#
+#qpid.amqp.version=0-91
+

Added: qpid/trunk/qpid/java/test-profiles/java-dby-mem.0-9.testprofile
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/test-profiles/java-dby-mem.0-9.testprofile?rev=1335667&view=auto
==============================================================================
--- qpid/trunk/qpid/java/test-profiles/java-dby-mem.0-9.testprofile (added)
+++ qpid/trunk/qpid/java/test-profiles/java-dby-mem.0-9.testprofile Tue May  8 18:05:40 2012
@@ -0,0 +1,36 @@
+#
+# 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.
+#
+broker.version=v0_9
+broker.language=java
+broker.type=internal
+#broker.command only used for the second broker during failover tests in this profile
+broker.command=build/bin/qpid-server -p @PORT -m @MPORT @EXCLUDES -c @CONFIG_FILE -l test-profiles/log4j-test.xml
+broker.ready=BRK-1004
+broker.stopped=Exception
+broker.config=build/etc/config-systests-derby-mem.xml
+broker.protocol.excludes=--exclude-0-10 @PORT --exclude-0-10 @SSL_PORT --exclude-1-0 @PORT --exclude-1-0 @SSL_PORT --exclude-0-9-1 @PORT --exclude-0-9-1 @SSL_PORT
+messagestorefactory.class.name=org.apache.qpid.server.store.derby.DerbyMessageStoreFactory
+profile.excludes=JavaPersistentExcludes JavaDerbyExcludes XAExcludes JavaPre010Excludes
+broker.clean.between.tests=true
+broker.persistent=true
+#
+# Do not enable. Allow client to attempt 0-10 and negotiate downwards
+#
+#qpid.amqp.version=0-9
+



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org