From 8f3a8dcf26af5a39411522faa995918714d1c062 Mon Sep 17 00:00:00 2001 From: Robert Godfrey Date: Tue, 8 May 2012 18:05:40 +0000 Subject: QPID-3989 : [Java Broker] Add ability to run "in-memory" Derby store git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1335667 13f79535-47bb-0310-9956-ffa450edef68 --- .../qpid/server/store/derby/DerbyMessageStore.java | 16 ++++--- .../etc/config-systests-derby-mem-settings.xml | 26 +++++++++++ java/systests/etc/config-systests-derby-mem.xml | 30 ++++++++++++ .../virtualhosts-systests-derby-mem-settings.xml | 54 ++++++++++++++++++++++ .../etc/virtualhosts-systests-derby-mem.xml | 29 ++++++++++++ java/test-profiles/java-dby-mem.0-10.testprofile | 30 ++++++++++++ java/test-profiles/java-dby-mem.0-8.testprofile | 36 +++++++++++++++ java/test-profiles/java-dby-mem.0-9-1.testprofile | 36 +++++++++++++++ java/test-profiles/java-dby-mem.0-9.testprofile | 36 +++++++++++++++ 9 files changed, 287 insertions(+), 6 deletions(-) create mode 100644 java/systests/etc/config-systests-derby-mem-settings.xml create mode 100644 java/systests/etc/config-systests-derby-mem.xml create mode 100644 java/systests/etc/virtualhosts-systests-derby-mem-settings.xml create mode 100644 java/systests/etc/virtualhosts-systests-derby-mem.xml create mode 100644 java/test-profiles/java-dby-mem.0-10.testprofile create mode 100644 java/test-profiles/java-dby-mem.0-8.testprofile create mode 100644 java/test-profiles/java-dby-mem.0-9-1.testprofile create mode 100644 java/test-profiles/java-dby-mem.0-9.testprofile (limited to 'java') diff --git a/java/broker/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStore.java b/java/broker/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStore.java index 480da2246c..de1ce1a9db 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStore.java +++ b/java/broker/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStore.java @@ -112,6 +112,7 @@ public class DerbyMessageStore implements MessageStore private static Class 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 implements MessageStore 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 implements MessageStore 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(); diff --git a/java/systests/etc/config-systests-derby-mem-settings.xml b/java/systests/etc/config-systests-derby-mem-settings.xml new file mode 100644 index 0000000000..69369d9ac9 --- /dev/null +++ b/java/systests/etc/config-systests-derby-mem-settings.xml @@ -0,0 +1,26 @@ + + + + ${QPID_HOME}/etc/virtualhosts-systests-derby-mem.xml + + + diff --git a/java/systests/etc/config-systests-derby-mem.xml b/java/systests/etc/config-systests-derby-mem.xml new file mode 100644 index 0000000000..1e4b19e48f --- /dev/null +++ b/java/systests/etc/config-systests-derby-mem.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + diff --git a/java/systests/etc/virtualhosts-systests-derby-mem-settings.xml b/java/systests/etc/virtualhosts-systests-derby-mem-settings.xml new file mode 100644 index 0000000000..74189ad5e9 --- /dev/null +++ b/java/systests/etc/virtualhosts-systests-derby-mem-settings.xml @@ -0,0 +1,54 @@ + + + + ${QPID_HOME}/virtualhosts + test + + + + + org.apache.qpid.server.store.derby.DerbyMessageStoreFactory + :memory: + + + + + + + + org.apache.qpid.server.store.derby.DerbyMessageStoreFactory + :memory: + + + + + + + + org.apache.qpid.server.store.derby.DerbyMessageStoreFactory + :memory: + + + + + + diff --git a/java/systests/etc/virtualhosts-systests-derby-mem.xml b/java/systests/etc/virtualhosts-systests-derby-mem.xml new file mode 100644 index 0000000000..845b8dfafa --- /dev/null +++ b/java/systests/etc/virtualhosts-systests-derby-mem.xml @@ -0,0 +1,29 @@ + + + + + + + + + + diff --git a/java/test-profiles/java-dby-mem.0-10.testprofile b/java/test-profiles/java-dby-mem.0-10.testprofile new file mode 100644 index 0000000000..05ba6d8829 --- /dev/null +++ b/java/test-profiles/java-dby-mem.0-10.testprofile @@ -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 diff --git a/java/test-profiles/java-dby-mem.0-8.testprofile b/java/test-profiles/java-dby-mem.0-8.testprofile new file mode 100644 index 0000000000..fbfd41bfc9 --- /dev/null +++ b/java/test-profiles/java-dby-mem.0-8.testprofile @@ -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 + diff --git a/java/test-profiles/java-dby-mem.0-9-1.testprofile b/java/test-profiles/java-dby-mem.0-9-1.testprofile new file mode 100644 index 0000000000..6152b4c929 --- /dev/null +++ b/java/test-profiles/java-dby-mem.0-9-1.testprofile @@ -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 + diff --git a/java/test-profiles/java-dby-mem.0-9.testprofile b/java/test-profiles/java-dby-mem.0-9.testprofile new file mode 100644 index 0000000000..e0e77b2804 --- /dev/null +++ b/java/test-profiles/java-dby-mem.0-9.testprofile @@ -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 + -- cgit v1.2.1