diff options
| author | Keith Wall <kwall@apache.org> | 2012-09-17 21:55:27 +0000 |
|---|---|---|
| committer | Keith Wall <kwall@apache.org> | 2012-09-17 21:55:27 +0000 |
| commit | 12ac9fa3db673c774f122c19cce31d875edcf2ed (patch) | |
| tree | f3088ea6e1d488c9af8951d149beca7aa7b807c3 /java/systests | |
| parent | 58c39c6eb49e20790639588a8179fb9e5c6c9e9b (diff) | |
| download | qpid-python-12ac9fa3db673c774f122c19cce31d875edcf2ed.tar.gz | |
QPID-4284: Remove system test dependencies on development and localhost virtual hosts
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1386864 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/systests')
10 files changed, 67 insertions, 307 deletions
diff --git a/java/systests/etc/virtualhosts-systests-bdb-settings.xml b/java/systests/etc/virtualhosts-systests-bdb-settings.xml index ce16523f13..350f05c178 100644 --- a/java/systests/etc/virtualhosts-systests-bdb-settings.xml +++ b/java/systests/etc/virtualhosts-systests-bdb-settings.xml @@ -20,37 +20,13 @@ - --> <virtualhosts> - <work>${QPID_WORK}</work> - - <virtualhost> - <name>localhost</name> - <localhost> - <store> - <class>org.apache.qpid.server.store.berkeleydb.BDBMessageStore</class> - <environment-path>${work}/bdbstore/localhost-store</environment-path> - </store> - </localhost> - </virtualhost> - - <virtualhost> - <name>development</name> - <development> - <store> - <class>org.apache.qpid.server.store.berkeleydb.BDBMessageStore</class> - <environment-path>${work}/bdbstore/development-store</environment-path> - </store> - </development> - </virtualhost> - <virtualhost> <name>test</name> <test> <store> <class>org.apache.qpid.server.store.berkeleydb.BDBMessageStore</class> - <environment-path>${work}/bdbstore/test-store</environment-path> + <environment-path>${QPID_WORK}/test-store</environment-path> </store> </test> </virtualhost> </virtualhosts> - - diff --git a/java/systests/etc/virtualhosts-systests-derby-mem-settings.xml b/java/systests/etc/virtualhosts-systests-derby-mem-settings.xml index 74189ad5e9..4e28f6d330 100644 --- a/java/systests/etc/virtualhosts-systests-derby-mem-settings.xml +++ b/java/systests/etc/virtualhosts-systests-derby-mem-settings.xml @@ -20,35 +20,12 @@ - --> <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> + <class>org.apache.qpid.server.store.derby.DerbyMessageStore</class> <environment-path>:memory:</environment-path> </store> </test> </virtualhost> </virtualhosts> - - diff --git a/java/systests/etc/virtualhosts-systests-derby-settings.xml b/java/systests/etc/virtualhosts-systests-derby-settings.xml index 08a40ca812..f9cc3d2336 100644 --- a/java/systests/etc/virtualhosts-systests-derby-settings.xml +++ b/java/systests/etc/virtualhosts-systests-derby-settings.xml @@ -20,35 +20,12 @@ - --> <virtualhosts> - <directory>${QPID_HOME}/virtualhosts</directory> - <default>test</default> - - <virtualhost> - <localhost> - <store> - <class>org.apache.qpid.server.store.derby.DerbyMessageStore</class> - <environment-path>${QPID_WORK}/derbyDB/localhost-store</environment-path> - </store> - </localhost> - </virtualhost> - - <virtualhost> - <development> - <store> - <class>org.apache.qpid.server.store.derby.DerbyMessageStore</class> - <environment-path>${QPID_WORK}/derbyDB/development-store</environment-path> - </store> - </development> - </virtualhost> - <virtualhost> <test> <store> <class>org.apache.qpid.server.store.derby.DerbyMessageStore</class> - <environment-path>${QPID_WORK}/derbyDB/test-store</environment-path> + <environment-path>${QPID_WORK}/test-store</environment-path> </store> </test> </virtualhost> </virtualhosts> - - diff --git a/java/systests/etc/virtualhosts-systests-settings.xml b/java/systests/etc/virtualhosts-systests-settings.xml index 0ec16b31ef..5d4ec28b71 100644 --- a/java/systests/etc/virtualhosts-systests-settings.xml +++ b/java/systests/etc/virtualhosts-systests-settings.xml @@ -22,136 +22,11 @@ <virtualhosts> <default>test</default> <virtualhost> - <name>localhost</name> - <localhost> - <store> - <class>org.apache.qpid.server.store.MemoryMessageStore</class> - </store> - - <housekeeping> - <threadCount>2</threadCount> - <checkPeriod>20000</checkPeriod> - </housekeeping> - - <exchanges> - <exchange> - <type>direct</type> - <name>test.direct</name> - <durable>true</durable> - </exchange> - <exchange> - <type>topic</type> - <name>test.topic</name> - </exchange> - </exchanges> - <queues> - <exchange>amq.direct</exchange> - <maximumQueueDepth>4235264</maximumQueueDepth> - <!-- 4Mb --> - <maximumMessageSize>2117632</maximumMessageSize> - <!-- 2Mb --> - <maximumMessageAge>600000</maximumMessageAge> - <!-- 10 mins --> - <maximumMessageCount>50</maximumMessageCount> - <!-- 50 messages --> - - <queue> - <name>queue</name> - </queue> - <queue> - <name>ping</name> - </queue> - <queue> - <name>test-queue</name> - <test-queue> - <exchange>test.direct</exchange> - <durable>true</durable> - </test-queue> - </queue> - <queue> - <name>test-ping</name> - <test-ping> - <exchange>test.direct</exchange> - </test-ping> - </queue> - - </queues> - </localhost> - </virtualhost> - - - <virtualhost> - <name>development</name> - <development> - <store> - <class>org.apache.qpid.server.store.MemoryMessageStore</class> - </store> - - <queues> - <minimumAlertRepeatGap>30000</minimumAlertRepeatGap> - <maximumMessageCount>50</maximumMessageCount> - <queue> - <name>queue</name> - <queue> - <exchange>amq.direct</exchange> - <maximumQueueDepth>4235264</maximumQueueDepth> - <!-- 4Mb --> - <maximumMessageSize>2117632</maximumMessageSize> - <!-- 2Mb --> - <maximumMessageAge>600000</maximumMessageAge> - <!-- 10 mins --> - </queue> - </queue> - <queue> - <name>ping</name> - <ping> - <exchange>amq.direct</exchange> - <maximumQueueDepth>4235264</maximumQueueDepth> - <!-- 4Mb --> - <maximumMessageSize>2117632</maximumMessageSize> - <!-- 2Mb --> - <maximumMessageAge>600000</maximumMessageAge> - <!-- 10 mins --> - </ping> - </queue> - </queues> - </development> - </virtualhost> - <virtualhost> <name>test</name> <test> <store> <class>org.apache.qpid.server.store.MemoryMessageStore</class> </store> - - <queues> - <minimumAlertRepeatGap>30000</minimumAlertRepeatGap> - <maximumMessageCount>50</maximumMessageCount> - <queue> - <name>queue</name> - <queue> - <exchange>amq.direct</exchange> - <maximumQueueDepth>4235264</maximumQueueDepth> - <!-- 4Mb --> - <maximumMessageSize>2117632</maximumMessageSize> - <!-- 2Mb --> - <maximumMessageAge>600000</maximumMessageAge> - <!-- 10 mins --> - </queue> - </queue> - <queue> - <name>ping</name> - <ping> - <exchange>amq.direct</exchange> - <maximumQueueDepth>4235264</maximumQueueDepth> - <!-- 4Mb --> - <maximumMessageSize>2117632</maximumMessageSize> - <!-- 2Mb --> - <maximumMessageAge>600000</maximumMessageAge> - <!-- 10 mins --> - </ping> - </queue> - </queues> </test> </virtualhost> </virtualhosts> diff --git a/java/systests/src/main/java/org/apache/qpid/server/logging/AlertingTest.java b/java/systests/src/main/java/org/apache/qpid/server/logging/AlertingTest.java index 02c41e14c0..7c676ad01d 100644 --- a/java/systests/src/main/java/org/apache/qpid/server/logging/AlertingTest.java +++ b/java/systests/src/main/java/org/apache/qpid/server/logging/AlertingTest.java @@ -22,10 +22,6 @@ package org.apache.qpid.server.logging; import org.apache.qpid.client.AMQDestination; import org.apache.qpid.client.AMQSession; -import org.apache.qpid.framing.AMQShortString; -import org.apache.qpid.server.configuration.ServerConfiguration; -import org.apache.qpid.server.registry.ApplicationRegistry; -import org.apache.qpid.util.FileUtils; import javax.jms.Connection; import javax.jms.Queue; @@ -44,29 +40,19 @@ public class AlertingTest extends AbstractTestLogging public void setUp() throws Exception { - // Update the configuration to make our virtualhost Persistent. - makeVirtualHostPersistent(VIRTUALHOST); - setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".housekeeping.checkPeriod", "5000"); - _numMessages = 50; + setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".housekeeping.checkPeriod", String.valueOf(ALERT_LOG_WAIT_PERIOD)); + setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".queues.maximumMessageCount", String.valueOf(_numMessages)); + // Then we do the normal setup stuff like starting the broker, getting a connection etc. super.setUp(); setupConnection(); } - @Override - public void tearDown() throws Exception - { - // Ensure queue is clean for next run. - drainQueue(_destination); - super.tearDown(); - } - - /** - * Create a new connection and ensure taht our destination queue is created + * Create a new connection and ensure that our destination queue is created * and bound. * * Note that the tests here that restart the broker rely on persistence. @@ -102,20 +88,6 @@ public class AlertingTest extends AbstractTestLogging if (!waitForMessage(MESSAGE_COUNT_ALERT, ALERT_LOG_WAIT_PERIOD)) { StringBuffer message = new StringBuffer("Could not find 'MESSAGE_COUNT_ALERT' in log file: " + _monitor.getMonitoredFile().getAbsolutePath()); - message.append("\n"); - - // Add the current contents of the log file to test output - message.append(_monitor.readFile()); - - // Write the test config file to test output - message.append("Server configuration overrides in use:\n"); - message.append(FileUtils.readFileAsString(getTestConfigFile())); - - message.append("\nVirtualhost maxMessageCount:\n"); - ServerConfiguration config = new ServerConfiguration(_configFile); - config.initialise(); - message.append(config.getVirtualHostConfig(VIRTUALHOST).getMaximumMessageCount()); - fail(message.toString()); } } @@ -148,9 +120,6 @@ public class AlertingTest extends AbstractTestLogging * Test sends two messages to the broker then restarts the broker with new * configuration. * - * If the test is running inVM the test validates that the new configuration - * has been applied. - * * Validates that we only have two messages on the queue and then sends * enough messages to trigger the alert. * @@ -176,27 +145,20 @@ public class AlertingTest extends AbstractTestLogging startBroker(); - if (isInternalBroker()) - { - assertEquals("Alert Max Msg Count is not correct", 5, ApplicationRegistry.getInstance().getVirtualHostRegistry(). - getVirtualHost(VIRTUALHOST).getQueueRegistry().getQueue(new AMQShortString(_destination.getQueueName())). - getMaximumMessageCount()); - } - setupConnection(); // Validate the queue depth is as expected long messageCount = ((AMQSession<?, ?>) _session).getQueueDepth((AMQDestination) _destination); assertEquals("Broker has invalid message count for test", 2, messageCount); - // Ensure the alert has not occured yet + // Ensure the alert has not occurred yet assertLoggingNotYetOccured(MESSAGE_COUNT_ALERT); // Trigger the new value sendMessage(_session, _destination, 3); _session.commit(); - // Validate that the alert occured. + // Validate that the alert occurred. wasAlertFired(); } } diff --git a/java/systests/src/main/java/org/apache/qpid/server/logging/SubscriptionLoggingTest.java b/java/systests/src/main/java/org/apache/qpid/server/logging/SubscriptionLoggingTest.java index 236202f323..9f532ec5f7 100644 --- a/java/systests/src/main/java/org/apache/qpid/server/logging/SubscriptionLoggingTest.java +++ b/java/systests/src/main/java/org/apache/qpid/server/logging/SubscriptionLoggingTest.java @@ -66,8 +66,8 @@ public class SubscriptionLoggingTest extends AbstractTestLogging _session = _connection.createSession(false, Session.AUTO_ACKNOWLEDGE); - _queue = (Queue) getInitialContext().lookup(QUEUE); - _topic = (Topic) getInitialContext().lookup(TOPIC); + _queue = _session.createQueue(getTestQueueName() + "Queue"); + _topic = _session.createTopic(getTestQueueName() + "Topic"); } /** @@ -434,10 +434,6 @@ public class SubscriptionLoggingTest extends AbstractTestLogging throw afe; } _connection.close(); - - //Ensure the queue is drained before the test ends - drainQueue(_queue); - } /** diff --git a/java/systests/src/main/java/org/apache/qpid/server/security/acl/ExternalACLJMXTest.java b/java/systests/src/main/java/org/apache/qpid/server/security/acl/ExternalACLJMXTest.java index a5aa3d39df..52229316be 100644 --- a/java/systests/src/main/java/org/apache/qpid/server/security/acl/ExternalACLJMXTest.java +++ b/java/systests/src/main/java/org/apache/qpid/server/security/acl/ExternalACLJMXTest.java @@ -33,14 +33,19 @@ import java.lang.management.RuntimeMXBean; */ public class ExternalACLJMXTest extends AbstractACLTestCase { + private JMXTestUtils _jmx; private static final String TEST_QUEUE_OWNER = "admin"; private static final String TEST_VHOST = "test"; + private static final String TEST2_VHOST = "test2"; @Override public void setUp() throws Exception { + createTestVirtualHost(TEST_VHOST); + createTestVirtualHost(TEST2_VHOST); + _jmx = new JMXTestUtils(this); _jmx.setUp(); super.setUp(); @@ -128,7 +133,7 @@ public class ExternalACLJMXTest extends AbstractACLTestCase //try a vhost-level method on a different vhost try { - _jmx.createQueue("development", getTestQueueName(), TEST_QUEUE_OWNER, true); + _jmx.createQueue(TEST2_VHOST, getTestQueueName(), TEST_QUEUE_OWNER, true); fail("Exception not thrown"); } catch (SecurityException e) diff --git a/java/systests/src/main/java/org/apache/qpid/server/stats/StatisticsReportingTest.java b/java/systests/src/main/java/org/apache/qpid/server/stats/StatisticsReportingTest.java index c38fcd9199..1e61ff9382 100644 --- a/java/systests/src/main/java/org/apache/qpid/server/stats/StatisticsReportingTest.java +++ b/java/systests/src/main/java/org/apache/qpid/server/stats/StatisticsReportingTest.java @@ -45,10 +45,14 @@ import javax.jms.TextMessage; */ public class StatisticsReportingTest extends QpidBrokerTestCase { + private static final String VHOST_NAME1 = "vhost1"; + private static final String VHOST_NAME2 = "vhost2"; + private static final String VHOST_NAME3 = "vhost3"; + protected LogMonitor _monitor; protected static final String USER = "admin"; - protected Connection _test, _dev, _local; + protected Connection _conToVhost1, _conToVhost2, _conToVhost3; protected String _queueName = "statistics"; protected Destination _queue; protected String _brokerUrl; @@ -56,6 +60,10 @@ public class StatisticsReportingTest extends QpidBrokerTestCase @Override public void setUp() throws Exception { + createTestVirtualHost(VHOST_NAME1); + createTestVirtualHost(VHOST_NAME2); + createTestVirtualHost(VHOST_NAME3); + setConfigurationProperty("statistics.generation.broker", "true"); setConfigurationProperty("statistics.generation.virtualhosts", "true"); @@ -69,22 +77,21 @@ public class StatisticsReportingTest extends QpidBrokerTestCase super.setUp(); _brokerUrl = getBroker().toString(); - _test = new AMQConnection(_brokerUrl, USER, USER, "clientid", "test"); - _dev = new AMQConnection(_brokerUrl, USER, USER, "clientid", "development"); - _local = new AMQConnection(_brokerUrl, USER, USER, "clientid", "localhost"); - - _test.start(); - _dev.start(); - _local.start(); + _conToVhost1 = new AMQConnection(_brokerUrl, USER, USER, "clientid", VHOST_NAME1); + _conToVhost2 = new AMQConnection(_brokerUrl, USER, USER, "clientid", VHOST_NAME2); + _conToVhost3 = new AMQConnection(_brokerUrl, USER, USER, "clientid", VHOST_NAME3); + _conToVhost1.start(); + _conToVhost2.start(); + _conToVhost3.start(); } @Override public void tearDown() throws Exception { - _test.close(); - _dev.close(); - _local.close(); + _conToVhost1.close(); + _conToVhost2.close(); + _conToVhost3.close(); super.tearDown(); } @@ -94,9 +101,9 @@ public class StatisticsReportingTest extends QpidBrokerTestCase */ public void testEnabledStatisticsReporting() throws Exception { - sendUsing(_test, 10, 100); - sendUsing(_dev, 20, 100); - sendUsing(_local, 15, 100); + sendUsing(_conToVhost1, 10, 100); + sendUsing(_conToVhost2, 20, 100); + sendUsing(_conToVhost3, 15, 100); Thread.sleep(10 * 1000); // 15s @@ -116,9 +123,9 @@ public class StatisticsReportingTest extends QpidBrokerTestCase */ public void testNotEnabledStatisticsReporting() throws Exception { - sendUsing(_test, 10, 100); - sendUsing(_dev, 20, 100); - sendUsing(_local, 15, 100); + sendUsing(_conToVhost1, 10, 100); + sendUsing(_conToVhost2, 20, 100); + sendUsing(_conToVhost3, 15, 100); Thread.sleep(10 * 1000); // 15s diff --git a/java/systests/src/main/java/org/apache/qpid/test/client/RollbackOrderTest.java b/java/systests/src/main/java/org/apache/qpid/test/client/RollbackOrderTest.java index a53c3d3ee0..2ed3f356d3 100644 --- a/java/systests/src/main/java/org/apache/qpid/test/client/RollbackOrderTest.java +++ b/java/systests/src/main/java/org/apache/qpid/test/client/RollbackOrderTest.java @@ -40,19 +40,19 @@ import java.util.concurrent.atomic.AtomicBoolean; * Description: * * The problem that this test is exposing is that the dispatcher used to be capable - * of holding on to a message when stopped. This ment that when the rollback was + * of holding on to a message when stopped. This meant that when the rollback was * called and the dispatcher stopped it may have hold of a message. So after all * the local queues(preDeliveryQueue, SynchronousQueue, PostDeliveryTagQueue) * have been cleared the client still had a single message, the one the * dispatcher was holding on to. * * As a result the TxRollback operation would run and then release the dispatcher. - * Whilst the dispatcher would then proceed to reject the message it was holiding + * Whilst the dispatcher would then proceed to reject the message it was holding * the Broker would already have resent that message so the rejection would silently * fail. * - * And the client would receieve that single message 'early', depending on the - * number of messages already recevied when rollback was called. + * And the client would receive that single message 'early', depending on the + * number of messages already received when rollback was called. * * * Aims: @@ -78,7 +78,7 @@ import java.util.concurrent.atomic.AtomicBoolean; * as expected. * * We are testing a race condition here but we can check through the log file if - * the race condition occured. However, performing that check will only validate + * the race condition occurred. However, performing that check will only validate * the problem exists and will not be suitable as part of a system test. * */ @@ -183,18 +183,8 @@ public class RollbackOrderTest extends QpidBrokerTestCase } } -// _consumer.close(); _connection.close(); assertFalse("Exceptions thrown during test run, Check Std.err.", failed.get()); } - - @Override public void tearDown() throws Exception - { - - drainQueue(_queue); - - super.tearDown(); - } - } diff --git a/java/systests/src/main/java/org/apache/qpid/test/utils/QpidBrokerTestCase.java b/java/systests/src/main/java/org/apache/qpid/test/utils/QpidBrokerTestCase.java index aa909a6674..ec2607a621 100644 --- a/java/systests/src/main/java/org/apache/qpid/test/utils/QpidBrokerTestCase.java +++ b/java/systests/src/main/java/org/apache/qpid/test/utils/QpidBrokerTestCase.java @@ -19,10 +19,8 @@ package org.apache.qpid.test.utils; import java.io.File; import java.io.FileOutputStream; -import java.io.IOException; import java.io.PrintStream; import java.net.MalformedURLException; -import java.net.URL; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; @@ -818,34 +816,33 @@ public class QpidBrokerTestCase extends QpidTestCase } /** - * Attempt to set the Java Broker to use the BDBMessageStore for persistence - * Falling back to the DerbyMessageStore if + * Creates a new virtual host within the test virtualhost file. * - * @param virtualhost - The virtualhost to modify - * - * @throws ConfigurationException - when reading/writing existing configuration - * @throws IOException - When creating a temporary file. + * @param virtualHostName virtual host name + * @throws ConfigurationException */ - protected void makeVirtualHostPersistent(String virtualhost) - throws ConfigurationException, IOException + protected void createTestVirtualHost(String virtualHostName) throws ConfigurationException { - Class<?> storeClass = null; - try + String storeClassName = getTestProfileMessageStoreClassName(); + + _testVirtualhosts.setProperty("virtualhost.name(-1)", virtualHostName); + _testVirtualhosts.setProperty("virtualhost." + virtualHostName + ".store.class", storeClassName); + + String storeDir = null; + + if (System.getProperty("profile", "").startsWith("java-dby-mem")) { - // Try and lookup the BDB class - storeClass = Class.forName("org.apache.qpid.server.store.berkeleydb.BDBMessageStore"); + storeDir = DerbyMessageStore.MEMORY_STORE_LOCATION; } - catch (ClassNotFoundException e) + else if (!MEMORY_STORE_CLASS_NAME.equals(storeClassName)) { - // No BDB store, we'll use Derby instead. - storeClass = DerbyMessageStore.class; + storeDir = "${QPID_WORK}" + File.separator + virtualHostName + "-store"; } - - setConfigurationProperty("virtualhosts.virtualhost." + virtualhost + ".store.class", - storeClass.getName()); - setConfigurationProperty("virtualhosts.virtualhost." + virtualhost + ".store." + MessageStoreConstants.ENVIRONMENT_PATH_PROPERTY, - "${QPID_WORK}/" + virtualhost); + if (storeDir != null) + { + _testVirtualhosts.setProperty("virtualhost." + virtualHostName + ".store." + MessageStoreConstants.ENVIRONMENT_PATH_PROPERTY, storeDir); + } } /** @@ -884,10 +881,8 @@ public class QpidBrokerTestCase extends QpidTestCase * @param value the new value * * @throws ConfigurationException when loading the current config file - * @throws IOException when writing the new config file */ - public void setConfigurationProperty(String property, String value) - throws ConfigurationException, IOException + public void setConfigurationProperty(String property, String value) throws ConfigurationException { // Choose which file to write the property to based on prefix. if (property.startsWith("virtualhosts")) @@ -1092,7 +1087,7 @@ public class QpidBrokerTestCase extends QpidTestCase * * @return A connection factory * - * @throws Exception if there is an error getting the tactory + * @throws Exception if there is an error getting the factory */ public AMQConnectionFactory getConnectionFactory(String factoryName) throws NamingException { |
