summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Godfrey <rgodfrey@apache.org>2012-05-08 18:05:40 +0000
committerRobert Godfrey <rgodfrey@apache.org>2012-05-08 18:05:40 +0000
commit23eb568f969127c848dc0f3671251944c457a850 (patch)
treeaa1f39e37ed6890ab25daa27ebb4a1ccabac5130
parent0dfb2eeb048361461538c2223cb26bf036c513c3 (diff)
downloadqpid-python-23eb568f969127c848dc0f3671251944c457a850.tar.gz
QPID-3989 : [Java Broker] Add ability to run "in-memory" Derby store
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1335667 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStore.java16
-rw-r--r--qpid/java/systests/etc/config-systests-derby-mem-settings.xml26
-rw-r--r--qpid/java/systests/etc/config-systests-derby-mem.xml30
-rw-r--r--qpid/java/systests/etc/virtualhosts-systests-derby-mem-settings.xml54
-rw-r--r--qpid/java/systests/etc/virtualhosts-systests-derby-mem.xml29
-rw-r--r--qpid/java/test-profiles/java-dby-mem.0-10.testprofile30
-rw-r--r--qpid/java/test-profiles/java-dby-mem.0-8.testprofile36
-rw-r--r--qpid/java/test-profiles/java-dby-mem.0-9-1.testprofile36
-rw-r--r--qpid/java/test-profiles/java-dby-mem.0-9.testprofile36
9 files changed, 287 insertions, 6 deletions
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStore.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStore.java
index 480da2246c..de1ce1a9db 100644
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStore.java
+++ b/qpid/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> 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/qpid/java/systests/etc/config-systests-derby-mem-settings.xml b/qpid/java/systests/etc/config-systests-derby-mem-settings.xml
new file mode 100644
index 0000000000..69369d9ac9
--- /dev/null
+++ b/qpid/java/systests/etc/config-systests-derby-mem-settings.xml
@@ -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>
+
+
diff --git a/qpid/java/systests/etc/config-systests-derby-mem.xml b/qpid/java/systests/etc/config-systests-derby-mem.xml
new file mode 100644
index 0000000000..1e4b19e48f
--- /dev/null
+++ b/qpid/java/systests/etc/config-systests-derby-mem.xml
@@ -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>
diff --git a/qpid/java/systests/etc/virtualhosts-systests-derby-mem-settings.xml b/qpid/java/systests/etc/virtualhosts-systests-derby-mem-settings.xml
new file mode 100644
index 0000000000..74189ad5e9
--- /dev/null
+++ b/qpid/java/systests/etc/virtualhosts-systests-derby-mem-settings.xml
@@ -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>
+
+
diff --git a/qpid/java/systests/etc/virtualhosts-systests-derby-mem.xml b/qpid/java/systests/etc/virtualhosts-systests-derby-mem.xml
new file mode 100644
index 0000000000..845b8dfafa
--- /dev/null
+++ b/qpid/java/systests/etc/virtualhosts-systests-derby-mem.xml
@@ -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>
diff --git a/qpid/java/test-profiles/java-dby-mem.0-10.testprofile b/qpid/java/test-profiles/java-dby-mem.0-10.testprofile
new file mode 100644
index 0000000000..05ba6d8829
--- /dev/null
+++ b/qpid/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/qpid/java/test-profiles/java-dby-mem.0-8.testprofile b/qpid/java/test-profiles/java-dby-mem.0-8.testprofile
new file mode 100644
index 0000000000..fbfd41bfc9
--- /dev/null
+++ b/qpid/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/qpid/java/test-profiles/java-dby-mem.0-9-1.testprofile b/qpid/java/test-profiles/java-dby-mem.0-9-1.testprofile
new file mode 100644
index 0000000000..6152b4c929
--- /dev/null
+++ b/qpid/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/qpid/java/test-profiles/java-dby-mem.0-9.testprofile b/qpid/java/test-profiles/java-dby-mem.0-9.testprofile
new file mode 100644
index 0000000000..e0e77b2804
--- /dev/null
+++ b/qpid/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
+