summaryrefslogtreecommitdiff
path: root/java/systests/src/main/java/org/apache/qpid/server/logging/AlertingTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/systests/src/main/java/org/apache/qpid/server/logging/AlertingTest.java')
-rw-r--r--java/systests/src/main/java/org/apache/qpid/server/logging/AlertingTest.java52
1 files changed, 7 insertions, 45 deletions
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..68ec101245 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;
+ setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".housekeeping.checkPeriod", String.valueOf(ALERT_LOG_WAIT_PERIOD));
+ setVirtualHostConfigurationProperty("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.
*
@@ -172,31 +141,24 @@ public class AlertingTest extends AbstractTestLogging
_monitor.markDiscardPoint();
// Change max message count to 5, start broker and make sure that that's triggered at the right time
- setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".queues.maximumMessageCount", "5");
+ setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".queues.maximumMessageCount", "5");
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();
}
}