diff options
| author | Robert Godfrey <rgodfrey@apache.org> | 2014-04-10 10:41:27 +0000 |
|---|---|---|
| committer | Robert Godfrey <rgodfrey@apache.org> | 2014-04-10 10:41:27 +0000 |
| commit | b33dec1a97a28ceeda0e5877dbfef494cd5b21bf (patch) | |
| tree | 8ce42b3d9fb58fbb1ed5c78efb9af75ee80f2c6a /qpid/java/systests | |
| parent | c5d4bac39754028fd9eeef82494a7529071eb6f0 (diff) | |
| download | qpid-python-b33dec1a97a28ceeda0e5877dbfef494cd5b21bf.tar.gz | |
QPID-5679 : [Java Broker] Use interpolation for "inherited" attributes (such as queue alerting)
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1586268 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/systests')
8 files changed, 53 insertions, 86 deletions
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/AlertingTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/AlertingTest.java index ead6a36c13..c5049467c9 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/AlertingTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/AlertingTest.java @@ -32,7 +32,6 @@ import org.apache.qpid.client.AMQDestination; import org.apache.qpid.client.AMQSession; import org.apache.qpid.server.management.plugin.HttpManagement; import org.apache.qpid.server.model.AuthenticationProvider; -import org.apache.qpid.server.model.Broker; import org.apache.qpid.server.model.Plugin; import org.apache.qpid.server.model.Port; import org.apache.qpid.server.security.auth.manager.AnonymousAuthenticationManagerFactory; @@ -54,8 +53,8 @@ public class AlertingTest extends AbstractTestLogging { _numMessages = 50; TestBrokerConfiguration brokerConfiguration = getBrokerConfiguration(); - brokerConfiguration.setBrokerAttribute(Broker.VIRTUALHOST_HOUSEKEEPING_CHECK_PERIOD, String.valueOf(ALERT_LOG_WAIT_PERIOD)); - brokerConfiguration.setBrokerAttribute(Broker.QUEUE_ALERT_THRESHOLD_QUEUE_DEPTH_MESSAGES, _numMessages); + setTestSystemProperty("virtualhost.housekeepingCheckPeriod", String.valueOf(ALERT_LOG_WAIT_PERIOD)); + setTestSystemProperty("queue.alertThresholdQueueDepthMessages", String.valueOf(_numMessages)); // Then we do the normal setup stuff like starting the broker, getting a connection etc. super.setUp(); @@ -184,7 +183,7 @@ public class AlertingTest extends AbstractTestLogging // Change max message count to 5, start broker and make sure that that's triggered at the right time TestBrokerConfiguration brokerConfiguration = getBrokerConfiguration(); - brokerConfiguration.setBrokerAttribute(Broker.QUEUE_ALERT_THRESHOLD_QUEUE_DEPTH_MESSAGES, 5); + setTestSystemProperty("queue.alertThresholdQueueDepthMessages","5"); brokerConfiguration.setSaved(false); restTestHelper.submitRequest("/rest/queue/test/" + getTestQueueName(), "PUT", Collections.<String, Object>singletonMap(org.apache.qpid.server.model.Queue.ALERT_THRESHOLD_QUEUE_DEPTH_MESSAGES, 5)); 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 9750cbf612..d857bb4ce0 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 @@ -523,7 +523,7 @@ public class VirtualHostMessageStoreTest extends QpidTestCase private void setQueueExclusivity(boolean exclusive) throws MessageSource.ExistingConsumerPreventsExclusive { AMQQueue<?> queue = getVirtualHost().getQueue(durableExclusiveQueueName); - queue.setExclusivityPolicy(exclusive ? ExclusivityPolicy.CONTAINER : ExclusivityPolicy.NONE); + queue.setAttribute(Queue.EXCLUSIVE, queue.getExclusive(), exclusive ? ExclusivityPolicy.CONTAINER : ExclusivityPolicy.NONE); } private void validateQueueExclusivityProperty(boolean expected) diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BrokerRestTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BrokerRestTest.java index e0c18c0caf..1b0d340fcc 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BrokerRestTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BrokerRestTest.java @@ -134,22 +134,9 @@ public class BrokerRestTest extends QpidRestTestCase { Map<String, Object> invalidAttributes = new HashMap<String, Object>(); invalidAttributes.put(Broker.DEFAULT_VIRTUAL_HOST, "non-existing-host"); - invalidAttributes.put(Broker.QUEUE_ALERT_THRESHOLD_MESSAGE_AGE, -1000); - invalidAttributes.put(Broker.QUEUE_ALERT_THRESHOLD_QUEUE_DEPTH_MESSAGES, -2000); - invalidAttributes.put(Broker.QUEUE_ALERT_THRESHOLD_QUEUE_DEPTH_BYTES, -3000); - invalidAttributes.put(Broker.QUEUE_ALERT_THRESHOLD_MESSAGE_SIZE, -4000); - invalidAttributes.put(Broker.QUEUE_ALERT_REPEAT_GAP, -5000); - invalidAttributes.put(Broker.QUEUE_FLOW_CONTROL_SIZE_BYTES, -7000); - invalidAttributes.put(Broker.QUEUE_FLOW_CONTROL_RESUME_SIZE_BYTES, -16000); - invalidAttributes.put(Broker.QUEUE_MAXIMUM_DELIVERY_ATTEMPTS, -8); - invalidAttributes.put(Broker.VIRTUALHOST_HOUSEKEEPING_CHECK_PERIOD, -90000); invalidAttributes.put(Broker.CONNECTION_SESSION_COUNT_LIMIT, -10); invalidAttributes.put(Broker.CONNECTION_HEART_BEAT_DELAY, -11000); invalidAttributes.put(Broker.STATISTICS_REPORTING_PERIOD, -12000); - invalidAttributes.put(Broker.VIRTUALHOST_STORE_TRANSACTION_IDLE_TIMEOUT_CLOSE, -13000); - invalidAttributes.put(Broker.VIRTUALHOST_STORE_TRANSACTION_IDLE_TIMEOUT_WARN, -14000); - invalidAttributes.put(Broker.VIRTUALHOST_STORE_TRANSACTION_OPEN_TIMEOUT_CLOSE, -15000); - invalidAttributes.put(Broker.VIRTUALHOST_STORE_TRANSACTION_OPEN_TIMEOUT_WARN, -16000); for (Map.Entry<String, Object> entry : invalidAttributes.entrySet()) { @@ -159,12 +146,6 @@ public class BrokerRestTest extends QpidRestTestCase assertEquals("Unexpected update response for invalid attribute " + entry.getKey() + "=" + entry.getValue(), 409, response); } - // a special case when FLOW_CONTROL_RESUME_SIZE_BYTES > FLOW_CONTROL_SIZE_BYTES - Map<String, Object> brokerAttributes = getValidBrokerAttributes(); - brokerAttributes.put(Broker.QUEUE_FLOW_CONTROL_SIZE_BYTES, 1000); - brokerAttributes.put(Broker.QUEUE_FLOW_CONTROL_RESUME_SIZE_BYTES, 2000); - int response = getRestTestHelper().submitRequest("/rest/broker", "PUT", brokerAttributes); - assertEquals("Unexpected update response for flow resume size > flow size", 409, response); } public void testSetCloseOnNoRoute() throws Exception @@ -198,24 +179,10 @@ public class BrokerRestTest extends QpidRestTestCase { Map<String, Object> brokerAttributes = new HashMap<String, Object>(); brokerAttributes.put(Broker.DEFAULT_VIRTUAL_HOST, TEST3_VIRTUALHOST); - brokerAttributes.put(Broker.QUEUE_ALERT_THRESHOLD_MESSAGE_AGE, 1000); - brokerAttributes.put(Broker.QUEUE_ALERT_THRESHOLD_QUEUE_DEPTH_MESSAGES, 2000); - brokerAttributes.put(Broker.QUEUE_ALERT_THRESHOLD_QUEUE_DEPTH_BYTES, 3000); - brokerAttributes.put(Broker.QUEUE_ALERT_THRESHOLD_MESSAGE_SIZE, 4000); - brokerAttributes.put(Broker.QUEUE_ALERT_REPEAT_GAP, 5000); - brokerAttributes.put(Broker.QUEUE_FLOW_CONTROL_SIZE_BYTES, 7000); - brokerAttributes.put(Broker.QUEUE_FLOW_CONTROL_RESUME_SIZE_BYTES, 6000); - brokerAttributes.put(Broker.QUEUE_MAXIMUM_DELIVERY_ATTEMPTS, 8); - brokerAttributes.put(Broker.QUEUE_DEAD_LETTER_QUEUE_ENABLED, true); - brokerAttributes.put(Broker.VIRTUALHOST_HOUSEKEEPING_CHECK_PERIOD, 90000); brokerAttributes.put(Broker.CONNECTION_SESSION_COUNT_LIMIT, 10); brokerAttributes.put(Broker.CONNECTION_HEART_BEAT_DELAY, 11000); brokerAttributes.put(Broker.STATISTICS_REPORTING_PERIOD, 12000); brokerAttributes.put(Broker.STATISTICS_REPORTING_RESET_ENABLED, true); - brokerAttributes.put(Broker.VIRTUALHOST_STORE_TRANSACTION_IDLE_TIMEOUT_CLOSE, 13000); - brokerAttributes.put(Broker.VIRTUALHOST_STORE_TRANSACTION_IDLE_TIMEOUT_WARN, 14000); - brokerAttributes.put(Broker.VIRTUALHOST_STORE_TRANSACTION_OPEN_TIMEOUT_CLOSE, 15000); - brokerAttributes.put(Broker.VIRTUALHOST_STORE_TRANSACTION_OPEN_TIMEOUT_WARN, 16000); return brokerAttributes; } diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/BrokerACLTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/BrokerACLTest.java index c5f192e27c..37b705f2f3 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/BrokerACLTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/BrokerACLTest.java @@ -608,45 +608,45 @@ public class BrokerACLTest extends QpidRestTestCase { getRestTestHelper().setUsernameAndPassword(ALLOWED_USER, ALLOWED_USER); - int initialAlertRepeatGap = 30000; - int updatedAlertRepeatGap = 29999; + int initialSessionCountLimit = 256; + int updatedSessionCountLimit = 299; Map<String, Object> brokerAttributes = getRestTestHelper().getJsonAsSingletonList("/rest/broker"); - assertEquals("Unexpected alert repeat gap", initialAlertRepeatGap, - brokerAttributes.get(Broker.QUEUE_ALERT_REPEAT_GAP)); + assertEquals("Unexpected alert repeat gap", initialSessionCountLimit, + brokerAttributes.get(Broker.CONNECTION_SESSION_COUNT_LIMIT)); Map<String, Object> newAttributes = new HashMap<String, Object>(); - newAttributes.put(Broker.QUEUE_ALERT_REPEAT_GAP, updatedAlertRepeatGap); + newAttributes.put(Broker.CONNECTION_SESSION_COUNT_LIMIT, updatedSessionCountLimit); int responseCode = getRestTestHelper().submitRequest("/rest/broker", "PUT", newAttributes); assertEquals("Setting of port attribites should be allowed", 200, responseCode); brokerAttributes = getRestTestHelper().getJsonAsSingletonList("/rest/broker"); - assertEquals("Unexpected default alert repeat gap", updatedAlertRepeatGap, - brokerAttributes.get(Broker.QUEUE_ALERT_REPEAT_GAP)); + assertEquals("Unexpected default alert repeat gap", updatedSessionCountLimit, + brokerAttributes.get(Broker.CONNECTION_SESSION_COUNT_LIMIT)); } public void testSetBrokerAttributesDenied() throws Exception { getRestTestHelper().setUsernameAndPassword(ALLOWED_USER, ALLOWED_USER); - int initialAlertRepeatGap = 30000; - int updatedAlertRepeatGap = 29999; + int initialSessionCountLimit = 256; + int updatedSessionCountLimit = 299; Map<String, Object> brokerAttributes = getRestTestHelper().getJsonAsSingletonList("/rest/broker"); - assertEquals("Unexpected alert repeat gap", initialAlertRepeatGap, - brokerAttributes.get(Broker.QUEUE_ALERT_REPEAT_GAP)); + assertEquals("Unexpected alert repeat gap", initialSessionCountLimit, + brokerAttributes.get(Broker.CONNECTION_SESSION_COUNT_LIMIT)); getRestTestHelper().setUsernameAndPassword(DENIED_USER, DENIED_USER); Map<String, Object> newAttributes = new HashMap<String, Object>(); - newAttributes.put(Broker.QUEUE_ALERT_REPEAT_GAP, updatedAlertRepeatGap); + newAttributes.put(Broker.CONNECTION_SESSION_COUNT_LIMIT, updatedSessionCountLimit); int responseCode = getRestTestHelper().submitRequest("/rest/broker", "PUT", newAttributes); assertEquals("Setting of port attribites should be allowed", 403, responseCode); brokerAttributes = getRestTestHelper().getJsonAsSingletonList("/rest/broker"); - assertEquals("Unexpected default alert repeat gap", initialAlertRepeatGap, - brokerAttributes.get(Broker.QUEUE_ALERT_REPEAT_GAP)); + assertEquals("Unexpected default alert repeat gap", initialSessionCountLimit, + brokerAttributes.get(Broker.CONNECTION_SESSION_COUNT_LIMIT)); } /* === GroupProvider === */ diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/client/destination/AddressBasedDestinationTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/client/destination/AddressBasedDestinationTest.java index e6e7484b28..8802ccac58 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/test/client/destination/AddressBasedDestinationTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/test/client/destination/AddressBasedDestinationTest.java @@ -20,6 +20,7 @@ */ package org.apache.qpid.test.client.destination; +import java.util.Collections; import java.util.Enumeration; import java.util.HashMap; import java.util.Hashtable; @@ -70,7 +71,8 @@ public class AddressBasedDestinationTest extends QpidBrokerTestCase public void setUp() throws Exception { TestBrokerConfiguration config = getBrokerConfiguration(); - config.setObjectAttribute(VirtualHost.class, TestBrokerConfiguration.ENTRY_NAME_VIRTUAL_HOST, VirtualHost.QUEUE_MAXIMUM_DELIVERY_ATTEMPTS, 0); + config.setObjectAttribute(VirtualHost.class, TestBrokerConfiguration.ENTRY_NAME_VIRTUAL_HOST, VirtualHost.CONTEXT, + Collections.singletonMap("queue.maximumDeliveryAttempts","0")); super.setUp(); _connection = getConnection() ; diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/MaxDeliveryCountTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/MaxDeliveryCountTest.java index 6909a3cbbf..bf36fcbd2e 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/MaxDeliveryCountTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/MaxDeliveryCountTest.java @@ -20,17 +20,11 @@ */ package org.apache.qpid.test.unit.client; -import org.apache.log4j.Logger; -import org.apache.qpid.AMQException; -import org.apache.qpid.client.AMQDestination; -import org.apache.qpid.client.AMQQueue; -import org.apache.qpid.client.AMQSession; -import org.apache.qpid.client.RejectBehaviour; -import org.apache.qpid.configuration.ClientProperties; -import org.apache.qpid.server.model.Broker; -import org.apache.qpid.server.queue.AMQQueueFactory; -import org.apache.qpid.test.utils.QpidBrokerTestCase; -import org.apache.qpid.test.utils.TestBrokerConfiguration; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; import javax.jms.Connection; import javax.jms.Destination; @@ -43,11 +37,17 @@ import javax.jms.Session; import javax.jms.TextMessage; import javax.jms.Topic; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.TimeUnit; +import org.apache.log4j.Logger; + +import org.apache.qpid.AMQException; +import org.apache.qpid.client.AMQDestination; +import org.apache.qpid.client.AMQQueue; +import org.apache.qpid.client.AMQSession; +import org.apache.qpid.client.RejectBehaviour; +import org.apache.qpid.configuration.ClientProperties; +import org.apache.qpid.server.queue.AMQQueueFactory; +import org.apache.qpid.test.utils.QpidBrokerTestCase; +import org.apache.qpid.test.utils.TestBrokerConfiguration; /** * Test that the MaxRedelivery feature works as expected, allowing the client to reject @@ -79,8 +79,8 @@ public class MaxDeliveryCountTest extends QpidBrokerTestCase //enable DLQ/maximumDeliveryCount support for all queues at the vhost level TestBrokerConfiguration brokerConfiguration = getBrokerConfiguration(); - brokerConfiguration.setBrokerAttribute(Broker.QUEUE_DEAD_LETTER_QUEUE_ENABLED, true); - brokerConfiguration.setBrokerAttribute(Broker.QUEUE_MAXIMUM_DELIVERY_ATTEMPTS, MAX_DELIVERY_COUNT); + setTestSystemProperty("queue.deadLetterQueueEnabled","true"); + setTestSystemProperty("queue.maximumDeliveryAttempts", String.valueOf(MAX_DELIVERY_COUNT)); //Ensure management is on brokerConfiguration.addJmxManagementConfiguration(); diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutDisabledTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutDisabledTest.java index 2b914393f2..e37c6cf54b 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutDisabledTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutDisabledTest.java @@ -20,7 +20,6 @@ */ package org.apache.qpid.test.unit.transacted; -import org.apache.qpid.server.model.Broker; import org.apache.qpid.test.utils.TestBrokerConfiguration; /** @@ -33,7 +32,7 @@ public class TransactionTimeoutDisabledTest extends TransactionTimeoutTestCase { // Setup housekeeping every second TestBrokerConfiguration brokerConfiguration = getBrokerConfiguration(); - brokerConfiguration.setBrokerAttribute(Broker.VIRTUALHOST_HOUSEKEEPING_CHECK_PERIOD, 100); + setTestSystemProperty("virtualhost.housekeepingCheckPeriod", "100"); // No transaction timeout configuration. } diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutTest.java index 366cf11c4e..b84e03972d 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutTest.java @@ -47,28 +47,28 @@ public class TransactionTimeoutTest extends TransactionTimeoutTestCase // Setup housekeeping every 100ms TestBrokerConfiguration brokerConfiguration = getBrokerConfiguration(); - brokerConfiguration.setBrokerAttribute(Broker.VIRTUALHOST_HOUSEKEEPING_CHECK_PERIOD, 100); + setTestSystemProperty("virtualhost.housekeepingCheckPeriod","100"); if (getName().contains("ProducerIdle")) { - brokerConfiguration.setBrokerAttribute(Broker.VIRTUALHOST_STORE_TRANSACTION_OPEN_TIMEOUT_WARN, 0); - brokerConfiguration.setBrokerAttribute(Broker.VIRTUALHOST_STORE_TRANSACTION_OPEN_TIMEOUT_CLOSE, 0); - brokerConfiguration.setBrokerAttribute(Broker.VIRTUALHOST_STORE_TRANSACTION_IDLE_TIMEOUT_WARN, 500); - brokerConfiguration.setBrokerAttribute(Broker.VIRTUALHOST_STORE_TRANSACTION_IDLE_TIMEOUT_CLOSE, 1500); + setTestSystemProperty("virtualhost.storeTransactionOpenTimeoutWarn", "0"); + setTestSystemProperty("virtualhost.storeTransactionOpenTimeoutClose", "0"); + setTestSystemProperty("virtualhost.storeTransactionIdleTimeoutWarn", "500"); + setTestSystemProperty("virtualhost.storeTransactionIdleTimeoutClose", "1500"); } else if (getName().contains("ProducerOpen")) { - brokerConfiguration.setBrokerAttribute(Broker.VIRTUALHOST_STORE_TRANSACTION_OPEN_TIMEOUT_WARN, 1000); - brokerConfiguration.setBrokerAttribute(Broker.VIRTUALHOST_STORE_TRANSACTION_OPEN_TIMEOUT_CLOSE, 2000); - brokerConfiguration.setBrokerAttribute(Broker.VIRTUALHOST_STORE_TRANSACTION_IDLE_TIMEOUT_WARN, 0); - brokerConfiguration.setBrokerAttribute(Broker.VIRTUALHOST_STORE_TRANSACTION_IDLE_TIMEOUT_CLOSE, 0); + setTestSystemProperty("virtualhost.storeTransactionOpenTimeoutWarn", "1000"); + setTestSystemProperty("virtualhost.storeTransactionOpenTimeoutClose", "2000"); + setTestSystemProperty("virtualhost.storeTransactionIdleTimeoutWarn", "0"); + setTestSystemProperty("virtualhost.storeTransactionIdleTimeoutClose", "0"); } else { - brokerConfiguration.setBrokerAttribute(Broker.VIRTUALHOST_STORE_TRANSACTION_OPEN_TIMEOUT_WARN, 1000); - brokerConfiguration.setBrokerAttribute(Broker.VIRTUALHOST_STORE_TRANSACTION_OPEN_TIMEOUT_CLOSE, 2000); - brokerConfiguration.setBrokerAttribute(Broker.VIRTUALHOST_STORE_TRANSACTION_IDLE_TIMEOUT_WARN, 500); - brokerConfiguration.setBrokerAttribute(Broker.VIRTUALHOST_STORE_TRANSACTION_IDLE_TIMEOUT_CLOSE, 1500); + setTestSystemProperty("virtualhost.storeTransactionOpenTimeoutWarn", "1000"); + setTestSystemProperty("virtualhost.storeTransactionOpenTimeoutClose", "2000"); + setTestSystemProperty("virtualhost.storeTransactionIdleTimeoutWarn", "500"); + setTestSystemProperty("virtualhost.storeTransactionIdleTimeoutClose", "1500"); } } |
