Skip to content

Commit eaa8c11

Browse files
committed
QPID-4983 : [Java Broker] Move store implementations to broker plugins
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1501682 13f79535-47bb-0310-9956-ffa450edef68
1 parent 934d23d commit eaa8c11

File tree

28 files changed

+169
-41
lines changed

28 files changed

+169
-41
lines changed

qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreConfigurationTest.java

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,26 +20,40 @@
2020
*/
2121
package org.apache.qpid.server.store.berkeleydb;
2222

23+
import org.apache.qpid.server.store.AbstractDurableConfigurationStoreTestCase;
2324
import org.apache.qpid.server.store.DurableConfigurationStore;
24-
import org.apache.qpid.server.store.DurableConfigurationStoreTest;
25-
import org.apache.qpid.server.store.MessageStore;
2625

27-
public class BDBMessageStoreConfigurationTest extends DurableConfigurationStoreTest
26+
public class BDBMessageStoreConfigurationTest extends AbstractDurableConfigurationStoreTestCase
2827
{
2928

3029
private BDBMessageStore _bdbMessageStore;
3130

31+
@Override
32+
protected void onReopenStore()
33+
{
34+
_bdbMessageStore = null;
35+
}
36+
3237
@Override
3338
protected BDBMessageStore createMessageStore() throws Exception
3439
{
35-
_bdbMessageStore = new BDBMessageStore();
40+
createStoreIfNecessary();
3641
return _bdbMessageStore;
3742
}
3843

39-
// TODO - this only works so long as createConfigStore is called after createMessageStore
44+
private void createStoreIfNecessary()
45+
{
46+
if(_bdbMessageStore == null)
47+
{
48+
_bdbMessageStore = new BDBMessageStore();
49+
}
50+
}
51+
4052
@Override
4153
protected DurableConfigurationStore createConfigStore() throws Exception
4254
{
55+
createStoreIfNecessary();
56+
4357
return _bdbMessageStore;
4458
}
4559
}

qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/MessageStoreCreatorTest.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,14 @@
2020
*/
2121
package org.apache.qpid.server.store.berkeleydb;
2222

23-
import org.apache.qpid.server.store.MemoryMessageStore;
2423
import org.apache.qpid.server.store.MessageStore;
2524
import org.apache.qpid.server.store.MessageStoreCreator;
2625
import org.apache.qpid.server.store.berkeleydb.BDBMessageStore;
27-
import org.apache.qpid.server.store.derby.DerbyMessageStore;
2826
import org.apache.qpid.test.utils.QpidTestCase;
2927

3028
public class MessageStoreCreatorTest extends QpidTestCase
3129
{
32-
private static final String[] STORE_TYPES = {MemoryMessageStore.TYPE, DerbyMessageStore.TYPE, BDBMessageStore.TYPE};
30+
private static final String[] STORE_TYPES = {BDBMessageStore.TYPE};
3331

3432
public void testMessageStoreCreator()
3533
{
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<!--
2+
- Licensed to the Apache Software Foundation (ASF) under one
3+
- or more contributor license agreements. See the NOTICE file
4+
- distributed with this work for additional information
5+
- regarding copyright ownership. The ASF licenses this file
6+
- to you under the Apache License, Version 2.0 (the
7+
- "License"); you may not use this file except in compliance
8+
- with the License. You may obtain a copy of the License at
9+
-
10+
- http://www.apache.org/licenses/LICENSE-2.0
11+
-
12+
- Unless required by applicable law or agreed to in writing,
13+
- software distributed under the License is distributed on an
14+
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
- KIND, either express or implied. See the License for the
16+
- specific language governing permissions and limitations
17+
- under the License.
18+
-->
19+
<project name="Qpid Broker-Plugins Derby Store" default="build">
20+
<property name="module.depends" value="common broker" />
21+
<property name="module.test.depends" value="common/tests broker/tests" />
22+
23+
<property name="module.genpom" value="true"/>
24+
<property name="module.genpom.args" value="-Sqpid-common=provided -Sqpid-broker=provided"/>
25+
26+
<property name="broker.plugin" value="true"/>
27+
28+
<import file="../../module.xml" />
29+
30+
<target name="bundle" depends="bundle-tasks"/>
31+
32+
</project>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one
3+
# or more contributor license agreements. See the NOTICE file
4+
# distributed with this work for additional information
5+
# regarding copyright ownership. The ASF licenses this file
6+
# to you under the Apache License, Version 2.0 (the
7+
# "License"); you may not use this file except in compliance
8+
# with the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing,
13+
# software distributed under the License is distributed on an
14+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
# KIND, either express or implied. See the License for the
16+
# specific language governing permissions and limitations
17+
# under the License.
18+
#
19+
org.apache.qpid.server.store.derby.DerbyMessageStoreFactory

qpid/java/broker/src/test/java/org/apache/qpid/server/store/MessageStoreCreatorTest.java renamed to qpid/java/broker-plugins/derby-store/src/test/java/org/apache/qpid/server/store/derby/DerbyMessageStoreConfigurationTest.java

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,41 @@
1818
* under the License.
1919
*
2020
*/
21-
package org.apache.qpid.server.store;
21+
package org.apache.qpid.server.store.derby;
2222

23-
import org.apache.qpid.server.store.derby.DerbyMessageStore;
24-
import org.apache.qpid.test.utils.QpidTestCase;
23+
import org.apache.qpid.server.store.AbstractDurableConfigurationStoreTestCase;
2524

26-
public class MessageStoreCreatorTest extends QpidTestCase
25+
public class DerbyMessageStoreConfigurationTest extends AbstractDurableConfigurationStoreTestCase
2726
{
28-
private static final String[] STORE_TYPES = {MemoryMessageStore.TYPE, DerbyMessageStore.TYPE};
2927

30-
public void testMessageStoreCreator()
28+
private DerbyMessageStore _derbyMessageStore;
29+
30+
@Override
31+
protected void onReopenStore()
32+
{
33+
_derbyMessageStore = null;
34+
}
35+
36+
@Override
37+
protected DerbyMessageStore createMessageStore() throws Exception
3138
{
32-
MessageStoreCreator messageStoreCreator = new MessageStoreCreator();
33-
for (String type : STORE_TYPES)
39+
createStoreIfNecessary();
40+
return _derbyMessageStore;
41+
}
42+
43+
44+
private void createStoreIfNecessary()
45+
{
46+
if(_derbyMessageStore == null)
3447
{
35-
MessageStore store = messageStoreCreator.createMessageStore(type);
36-
assertNotNull("Store of type " + type + " is not created", store);
48+
_derbyMessageStore = new DerbyMessageStore();
3749
}
3850
}
51+
52+
@Override
53+
protected DerbyMessageStore createConfigStore() throws Exception
54+
{
55+
createStoreIfNecessary();
56+
return _derbyMessageStore;
57+
}
3958
}

0 commit comments

Comments
 (0)