From 73e49b5fc7ebcb9235265f648dbb7f3cc522752a Mon Sep 17 00:00:00 2001 From: Alex Rudyy Date: Thu, 26 Jun 2014 08:25:56 +0000 Subject: QPID-5851: [Java Broker] Introduce new test profiles for JSON configuration store and persistent message store git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1605697 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/java/pom.xml | 100 ++++++++++++++++----- .../org/apache/qpid/test/utils/QpidTestCase.java | 19 ++-- qpid/java/systests/etc/config-systests.json | 4 +- .../apache/qpid/server/store/SplitStoreTest.java | 4 +- .../server/store/VirtualHostMessageStoreTest.java | 15 +++- .../qpid/systest/rest/VirtualHostRestTest.java | 4 +- .../apache/qpid/test/utils/QpidBrokerTestCase.java | 7 +- qpid/java/test-profiles/CPPExcludes | 1 + qpid/java/test-profiles/JavaJsonExcludes | 24 +++++ 9 files changed, 137 insertions(+), 41 deletions(-) create mode 100644 qpid/java/test-profiles/JavaJsonExcludes diff --git a/qpid/java/pom.xml b/qpid/java/pom.xml index 4cbff8b55b..71984fe9ed 100644 --- a/qpid/java/pom.xml +++ b/qpid/java/pom.xml @@ -47,7 +47,7 @@ - (java-mms.0-9|java-mms.0-9-1|java-mms.0-10|java-bdb.0-9|java-bdb.0-9-1|java-bdb.0-10|java-dby.0-9|java-dby.0-9-1|java-dby.0-10|java-dby-mem.0-9|java-dby-mem.0-9-1|java-dby-mem.0-10|cpp) + (java-mms.0-9|java-mms.0-9-1|java-mms.0-10|java-bdb.0-9|java-bdb.0-9-1|java-bdb.0-10|java-dby.0-9|java-dby.0-9-1|java-dby.0-10|java-dby-mem.0-9|java-dby-mem.0-9-1|java-dby-mem.0-10|cpp|java-json.0-9-1|java-json.0-10) ${basedir} @@ -60,15 +60,17 @@ internal Exception BRK-1004 - ${qpid.home}${file.separator}bin${file.separator}qpid-server -sp @STORE_PATH -st @STORE_TYPE -l @LOG_CONFIG_FILE - ${qpid.home}${file.separator}bin${file.separator}qpid-server.bat -sp @STORE_PATH -st @STORE_TYPE -l @LOG_CONFIG_FILE + ${qpid.home}${file.separator}bin${file.separator}qpid-server -sp ${at.sign}STORE_PATH -st ${at.sign}STORE_TYPE -l ${at.sign}LOG_CONFIG_FILE + ${qpid.home}${file.separator}bin${file.separator}qpid-server.bat -sp ${at.sign}STORE_PATH -st ${at.sign}STORE_TYPE -l ${at.sign}LOG_CONFIG_FILE Excludes JavaExcludes ${profile}.excludes ${profile.specific.excludes} JavaTransientExcludes Java010Excludes v0_10 AMQP_1_0 false - Memory + Memory true + $ + @ @@ -172,7 +174,8 @@ [profile.broker.version] ${profile.broker.version} [profile.qpid.broker_default_amqp_protocol_excludes] ${profile.qpid.broker_default_amqp_protocol_excludes} [profile.broker.persistent] ${profile.broker.persistent} - [profile.messagestore.type] ${profile.messagestore.type} + [profile.virtualhostnode.type] ${profile.virtualhostnode.type} + [profile.virtualhostnode.context.blueprint] ${profile.virtualhostnode.context.blueprint} @@ -238,7 +241,8 @@ ${profile.broker.version} ${profile.qpid.broker_default_amqp_protocol_excludes} ${profile.broker.persistent} - ${profile.messagestore.type} + ${profile.virtualhostnode.type} + ${profile.virtualhostnode.context.blueprint} ${profile.broker.clean.between.tests} @@ -396,7 +400,8 @@ v0_10 AMQP_1_0 false - Memory + Memory + {"type":"ProvidedStore"} @@ -414,7 +419,8 @@ v0_9_1 AMQP_1_0,AMQP_0_10 false - Memory + Memory + {"type":"ProvidedStore"} @@ -432,7 +438,8 @@ v0_9 AMQP_1_0,AMQP_0_10,AMQP_0_9_1 false - Memory + Memory + {"type":"ProvidedStore"} @@ -450,7 +457,8 @@ v0_10 AMQP_1_0 true - BDB + BDB + {"type":"ProvidedStore"} @@ -468,7 +476,8 @@ v0_9_1 AMQP_1_0,AMQP_0_10 true - BDB + BDB + {"type":"ProvidedStore"} @@ -486,7 +495,8 @@ v0_9 AMQP_1_0,AMQP_0_10,AMQP_0_9_1 true - BDB + BDB + {"type":"ProvidedStore"} @@ -504,7 +514,8 @@ v0_10 AMQP_1_0 true - DERBY + DERBY + {"type":"ProvidedStore"} @@ -522,7 +533,8 @@ v0_9_1 AMQP_1_0,AMQP_0_10 true - DERBY + DERBY + {"type":"ProvidedStore"} @@ -540,7 +552,8 @@ v0_9 AMQP_1_0,AMQP_0_10,AMQP_0_9_1 true - DERBY + DERBY + {"type":"ProvidedStore"} @@ -557,9 +570,9 @@ JavaPersistentExcludes JavaDerbyExcludes Java010Excludes v0_10 AMQP_1_0 - ${QPID_HOME}${file.separator}etc${file.separator}virtualhosts-systests-derby.xml true - DERBY + DERBY + {"type":"ProvidedStore"} @@ -576,9 +589,9 @@ JavaPersistentExcludes JavaDerbyExcludes XAExcludes JavaPre010Excludes v0_9_1 AMQP_1_0,AMQP_0_10 - ${QPID_HOME}${file.separator}etc${file.separator}virtualhosts-systests-derby.xml true - DERBY + DERBY + {"type":"ProvidedStore"} @@ -595,13 +608,56 @@ JavaPersistentExcludes JavaDerbyExcludes XAExcludes JavaPre010Excludes v0_9 AMQP_1_0,AMQP_0_10,AMQP_0_9_1 - ${QPID_HOME}${file.separator}etc${file.separator}virtualhosts-systests-derby.xml true - DERBY + DERBY + {"type":"ProvidedStore"} + + java-json.0-9-1 + + + profile + java-json.0-9-1 + + + + java-json.0-9-1 + JavaPersistentExcludes JavaJsonExcludes XAExcludes JavaPre010Excludes + v0_9_1 + AMQP_1_0,AMQP_0_10 + true + JSON + {"type":"DERBY","messageStoreSettings":{"storePath":"${dollar.sign}{QPID_WORK}/${dollar.sign}{this:name}/derby"}} + + + + + java-json.0-10 + + + profile + java-json.0-10 + + + + java-json.0-10 + JavaPersistentExcludes JavaJsonExcludes XAExcludes Java010Excludes + v0_10 + AMQP_1_0 + true + JSON + {"type":"DERBY","messageStoreSettings":{"storePath":"${dollar.sign}{QPID_WORK}/${dollar.sign}{this:name}/derby"}} + + + + cpp @@ -615,7 +671,7 @@ spawned Exception constructed Listening on TCP - ${cpp-broker-dir}/qpidd -p @PORT --data-dir ${qpid.work}/@PORT -t --auth no --no-module-dir + ${cpp-broker-dir}/qpidd -p ${at.sign}PORT --data-dir ${qpid.work}/${at.sign}PORT -t --auth no --no-module-dir Excludes CPPExcludes ${profile}.excludes ${profile.specific.excludes} cpp.excludes CPPPrefetchExcludes CPPTransientExcludes diff --git a/qpid/java/qpid-test-utils/src/main/java/org/apache/qpid/test/utils/QpidTestCase.java b/qpid/java/qpid-test-utils/src/main/java/org/apache/qpid/test/utils/QpidTestCase.java index ca80ad09c2..5a3c0182fd 100644 --- a/qpid/java/qpid-test-utils/src/main/java/org/apache/qpid/test/utils/QpidTestCase.java +++ b/qpid/java/qpid-test-utils/src/main/java/org/apache/qpid/test/utils/QpidTestCase.java @@ -35,12 +35,13 @@ import junit.framework.TestResult; import org.apache.log4j.Level; import org.apache.log4j.Logger; - public class QpidTestCase extends TestCase { private static final String TEST_EXCLUDES = "test.excludes"; private static final String TEST_EXCLUDELIST = "test.excludelist"; private static final String TEST_EXCLUDEFILES = "test.excludefiles"; + private static final String VIRTUAL_HOST_NODE_TYPE = "virtualhostnode.type"; + private static final String VIRTUAL_HOST_NODE_CONTEXT_BLUEPRINT = "virtualhostnode.context.blueprint"; public static final String QPID_HOME = System.getProperty("QPID_HOME"); public static final String TEST_RESOURCES_DIR = QPID_HOME + "/../test-profiles/test_resources/"; public static final String TEST_PROFILES_DIR = QPID_HOME + "/../test-profiles/"; @@ -124,8 +125,6 @@ public class QpidTestCase extends TestCase } } - protected static final String MESSAGE_STORE_TYPE = "messagestore.type"; - private static List _exclusionList; public QpidTestCase() @@ -148,17 +147,21 @@ public class QpidTestCase extends TestCase } } - public String getTestProfileMessageStoreType() + public String getTestProfileVirtualHostNodeType() { - final String storeType = System.getProperty(MESSAGE_STORE_TYPE); - _logger.debug(MESSAGE_STORE_TYPE + "=" + storeType); + final String storeType = System.getProperty(VIRTUAL_HOST_NODE_TYPE); + + if (_logger.isDebugEnabled()) + { + _logger.debug(VIRTUAL_HOST_NODE_TYPE + "=" + storeType); + } return storeType != null ? storeType : "TestMemory"; } - public String getTestProfileVirtualHostNodeType() + public String getTestProfileVirtualHostNodeBlueprint() { - return getTestProfileMessageStoreType(); + return System.getProperty(VIRTUAL_HOST_NODE_CONTEXT_BLUEPRINT); } public static final int MIN_PORT_NUMBER = 1; diff --git a/qpid/java/systests/etc/config-systests.json b/qpid/java/systests/etc/config-systests.json index ac5c46ad6a..27124de1fb 100644 --- a/qpid/java/systests/etc/config-systests.json +++ b/qpid/java/systests/etc/config-systests.json @@ -59,10 +59,10 @@ }], "virtualhostnodes" : [ { "name" : "test", - "type" : "${messagestore.type}", + "type" : "${virtualhostnode.type}", "storePath" : "${QPID_WORK}/${test.port}/test/config", "context" : { - "virtualhostBlueprint" : "{ \"type\" : \"ProvidedStore\" }" + "virtualhostBlueprint" : "${virtualhostnode.context.blueprint}" } } ] } diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/server/store/SplitStoreTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/server/store/SplitStoreTest.java index 0f67121212..7605c8a024 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/server/store/SplitStoreTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/server/store/SplitStoreTest.java @@ -76,12 +76,12 @@ public class SplitStoreTest extends QpidBrokerTestCase public void testJsonConfigurationStoreWithPersistentMessageStore() throws Exception { - doTest(JsonFileConfigStore.TYPE, getTestProfileMessageStoreType()); + doTest(JsonFileConfigStore.TYPE, getTestProfileVirtualHostNodeType()); } public void testSeparateConfigurationAndMessageStoresOfTheSameType() throws Exception { - doTest(getTestProfileVirtualHostNodeType(), getTestProfileMessageStoreType()); + doTest(getTestProfileVirtualHostNodeType(), getTestProfileVirtualHostNodeType()); } private void configureAndStartBroker(String virtualHostNodeType, String virtualHostType) throws Exception diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/server/store/VirtualHostMessageStoreTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/server/store/VirtualHostMessageStoreTest.java index 430fadc2f1..278de6cf41 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/server/store/VirtualHostMessageStoreTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/server/store/VirtualHostMessageStoreTest.java @@ -24,6 +24,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import java.io.File; +import java.io.IOException; import java.security.PrivilegedAction; import java.util.ArrayList; import java.util.Collection; @@ -71,10 +72,13 @@ import org.apache.qpid.server.queue.StandardQueueImpl; import org.apache.qpid.server.txn.AutoCommitTransaction; import org.apache.qpid.server.txn.ServerTransaction; import org.apache.qpid.server.util.BrokerTestHelper; +import org.apache.qpid.server.virtualhost.TestMemoryVirtualHost; import org.apache.qpid.server.virtualhost.VirtualHostImpl; +import org.apache.qpid.server.virtualhostnode.AbstractStandardVirtualHostNode; import org.apache.qpid.server.virtualhostnode.FileBasedVirtualHostNode; import org.apache.qpid.test.utils.QpidTestCase; import org.apache.qpid.util.FileUtils; +import org.codehaus.jackson.map.ObjectMapper; /** * @@ -136,12 +140,21 @@ public class VirtualHostMessageStoreTest extends QpidTestCase nodeAttributes.put(ConfiguredObject.TYPE, getTestProfileVirtualHostNodeType()); nodeAttributes.put(FileBasedVirtualHostNode.STORE_PATH, _storePath); nodeAttributes.put(VirtualHostNode.NAME, nodeName); + _node = factory.create(VirtualHostNode.class, nodeAttributes, broker); _node.start(); final Map virtualHostAttributes = new HashMap<>(); virtualHostAttributes.put(VirtualHost.NAME, hostName); - + virtualHostAttributes.put(VirtualHost.NAME, hostName); + String bluePrint = getTestProfileVirtualHostNodeBlueprint(); + if (bluePrint == null) + { + bluePrint = "{type=\"" + TestMemoryVirtualHost.VIRTUAL_HOST_TYPE + "\"}"; + } + ObjectMapper objectMapper = new ObjectMapper(); + Map attrs = objectMapper.readValue(bluePrint, Map.class); + virtualHostAttributes.putAll(attrs); _node.createChild(VirtualHost.class, virtualHostAttributes, _node); _virtualHost = (VirtualHostImpl)_node.getVirtualHost(); diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/VirtualHostRestTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/VirtualHostRestTest.java index 54dca95e9b..e287c9d5c1 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/VirtualHostRestTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/VirtualHostRestTest.java @@ -30,6 +30,7 @@ import java.util.Map; import javax.jms.Session; import javax.servlet.http.HttpServletResponse; +import org.apache.qpid.server.virtualhost.TestMemoryVirtualHost; import org.codehaus.jackson.JsonGenerationException; import org.codehaus.jackson.map.JsonMappingException; @@ -42,7 +43,6 @@ import org.apache.qpid.server.queue.LastValueQueue; import org.apache.qpid.server.queue.PriorityQueue; import org.apache.qpid.server.queue.SortedQueue; import org.apache.qpid.server.virtualhost.AbstractVirtualHost; -import org.apache.qpid.server.virtualhost.ProvidedStoreVirtualHost; import org.apache.qpid.server.virtualhostnode.FileBasedVirtualHostNode; import org.apache.qpid.util.FileUtils; @@ -540,7 +540,7 @@ public class VirtualHostRestTest extends QpidRestTestCase Map virtualhostData = new HashMap<>(); virtualhostData.put(VirtualHost.NAME, virtualHostName); - virtualhostData.put(VirtualHost.TYPE, ProvidedStoreVirtualHost.VIRTUAL_HOST_TYPE); + virtualhostData.put(VirtualHost.TYPE, TestMemoryVirtualHost.VIRTUAL_HOST_TYPE); getRestTestHelper().submitRequest("virtualhost/" + virtualHostName + "/" + virtualHostName, "PUT", diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidBrokerTestCase.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidBrokerTestCase.java index 9b6abb1447..92d163f05a 100755 --- a/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidBrokerTestCase.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidBrokerTestCase.java @@ -70,7 +70,6 @@ import org.apache.qpid.server.model.Protocol; import org.apache.qpid.server.model.VirtualHostNode; import org.apache.qpid.server.store.DurableConfigurationStore; import org.apache.qpid.server.store.MemoryConfigurationStore; -import org.apache.qpid.server.virtualhost.ProvidedStoreVirtualHost; import org.apache.qpid.server.virtualhostnode.AbstractStandardVirtualHostNode; import org.apache.qpid.server.virtualhostnode.FileBasedVirtualHostNode; import org.apache.qpid.url.URLSyntaxException; @@ -561,8 +560,8 @@ public class QpidBrokerTestCase extends QpidTestCase setSystemProperty("test.port.ssl"); setSystemProperty("test.port.alt"); setSystemProperty("test.port.alt.ssl"); - setSystemProperty("messagestore.type"); - + setSystemProperty("virtualhostnode.type"); + setSystemProperty("virtualhostnode.context.blueprint"); // Add all the specified system properties to QPID_OPTS if (!_propertiesSetForBroker.isEmpty()) @@ -872,7 +871,7 @@ public class QpidBrokerTestCase extends QpidTestCase { attributes.put(FileBasedVirtualHostNode.STORE_PATH, storeDir); } - final String blueprint = String.format("{ \"type\" : \"%s\" } }", ProvidedStoreVirtualHost.VIRTUAL_HOST_TYPE); + final String blueprint = getTestProfileVirtualHostNodeBlueprint(); attributes.put(ConfiguredObject.CONTEXT, Collections.singletonMap(AbstractStandardVirtualHostNode.VIRTUALHOST_BLUEPRINT_CONTEXT_VAR, blueprint)); diff --git a/qpid/java/test-profiles/CPPExcludes b/qpid/java/test-profiles/CPPExcludes index 8e48e77e07..9e9708bf3c 100755 --- a/qpid/java/test-profiles/CPPExcludes +++ b/qpid/java/test-profiles/CPPExcludes @@ -93,6 +93,7 @@ org.apache.qpid.server.store.VirtualHostMessageStoreTest#testQueuePersistence org.apache.qpid.server.store.VirtualHostMessageStoreTest#testDurableQueueRemoval org.apache.qpid.server.store.VirtualHostMessageStoreTest#testExchangePersistence org.apache.qpid.server.store.VirtualHostMessageStoreTest#testDurableExchangeRemoval +org.apache.qpid.server.store.VirtualHostMessageStoreTest#testQueueExchangeAndBindingCreation org.apache.qpid.server.store.DurableConfigurationStoreTest#* // CPP Broker does not follow the same Logging convention as the Java broker diff --git a/qpid/java/test-profiles/JavaJsonExcludes b/qpid/java/test-profiles/JavaJsonExcludes new file mode 100644 index 0000000000..9a5d87ca8a --- /dev/null +++ b/qpid/java/test-profiles/JavaJsonExcludes @@ -0,0 +1,24 @@ +// +// 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. +// + +org.apache.qpid.server.store.berkeleydb.* +org.apache.qpid.server.store.berkeleydb.replication.* +org.apache.qpid.server.store.SplitStoreTest#* +org.apache.qpid.systest.rest.VirtualHostNodeRestTest#testCreateAndDeleteVirtualHostNode +org.apache.qpid.server.BrokerStartupTest#testStartupWithNoConfig -- cgit v1.2.1