summaryrefslogtreecommitdiff
path: root/java/broker/src/test/java/org/apache/qpid/server/logging/actors/AMQPChannelActorTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/broker/src/test/java/org/apache/qpid/server/logging/actors/AMQPChannelActorTest.java')
-rw-r--r--java/broker/src/test/java/org/apache/qpid/server/logging/actors/AMQPChannelActorTest.java150
1 files changed, 17 insertions, 133 deletions
diff --git a/java/broker/src/test/java/org/apache/qpid/server/logging/actors/AMQPChannelActorTest.java b/java/broker/src/test/java/org/apache/qpid/server/logging/actors/AMQPChannelActorTest.java
index f739d3fcb9..e2472dbf01 100644
--- a/java/broker/src/test/java/org/apache/qpid/server/logging/actors/AMQPChannelActorTest.java
+++ b/java/broker/src/test/java/org/apache/qpid/server/logging/actors/AMQPChannelActorTest.java
@@ -20,9 +20,8 @@
*/
package org.apache.qpid.server.logging.actors;
-import org.apache.commons.configuration.ConfigurationException;
-
-import org.apache.qpid.AMQException;
+import org.apache.qpid.server.AMQChannel;
+import org.apache.qpid.server.util.BrokerTestHelper;
import java.util.List;
@@ -38,24 +37,17 @@ import java.util.List;
public class AMQPChannelActorTest extends BaseConnectionActorTestCase
{
- @Override
- public void configure()
+ public void setUp()
{
- // Prevent defaulting Logging to ON
+ // do nothing
}
-
- @Override
- public void createBroker() throws Exception
+ private void setUpNow() throws Exception
{
- //prevent auto-broker startup
- }
+ super.setUp();
+ AMQChannel channel = BrokerTestHelper.createChannel(1, getSession());
- private void startBrokerNow() throws Exception
- {
- super.createBroker();
-
- _amqpActor = new AMQPChannelActor(getChannel(), _rootLogger);
+ setAmqpActor(new AMQPChannelActor(channel, getRootLogger()));
}
@@ -68,13 +60,11 @@ public class AMQPChannelActorTest extends BaseConnectionActorTestCase
*/
public void testChannel() throws Exception
{
- getConfigXml().setProperty("status-updates", "ON");
-
- startBrokerNow();
+ setUpNow();
- final String message = sendTestLogMessage(_amqpActor);
+ final String message = sendTestLogMessage(getAmqpActor());
- List<Object> logs = _rawLogger.getLogMessages();
+ List<Object> logs = getRawLogger().getLogMessages();
assertEquals("Message log size not as expected.", 1, logs.size());
@@ -95,128 +85,22 @@ public class AMQPChannelActorTest extends BaseConnectionActorTestCase
// Verify that the logged message contains the 'ch:1' marker
assertTrue("Message was not logged as part of channel 1" + logs.get(0),
logs.get(0).toString().contains("/ch:1"));
-
- }
-
- /**
- * Test that if logging is configured to be off in the configuration that
- * no logging is presented
- * @throws ConfigurationException
- * @throws AMQException
- */
- public void testChannelLoggingOFF() throws Exception, AMQException
- {
- getConfigXml().setProperty("status-updates", "OFF");
-
- // Start the broker now.
- startBrokerNow();
-
- sendTestLogMessage(_amqpActor);
-
- List<Object> logs = _rawLogger.getLogMessages();
-
- assertEquals("Message log size not as expected.", 0, logs.size());
-
- }
-
- /**
- * Test that if logging is configured to be off in the configuration that
- * no logging is presented
- * @throws ConfigurationException
- * @throws AMQException
- */
- public void testChannelLoggingOfF() throws Exception, AMQException
- {
- getConfigXml().setProperty("status-updates", "OfF");
-
- startBrokerNow();
-
- sendTestLogMessage(_amqpActor);
-
- List<Object> logs = _rawLogger.getLogMessages();
-
- assertEquals("Message log size not as expected.", 0, logs.size());
-
- }
-
- /**
- * Test that if logging is configured to be off in the configuration that
- * no logging is presented
- * @throws ConfigurationException
- * @throws AMQException
- */
- public void testChannelLoggingOff() throws Exception, AMQException
- {
- getConfigXml().setProperty("status-updates", "Off");
-
- startBrokerNow();
-
- sendTestLogMessage(_amqpActor);
-
- List<Object> logs = _rawLogger.getLogMessages();
-
- assertEquals("Message log size not as expected.", 0, logs.size());
-
}
/**
- * Test that if logging is configured to be off in the configuration that
+ * Test that if logging is configured to be off via system property that
* no logging is presented
- * @throws ConfigurationException
- * @throws AMQException
*/
- public void testChannelLoggingofF() throws Exception, AMQException
+ public void testChannelLoggingOFF() throws Exception
{
- getConfigXml().setProperty("status-updates", "ofF");
+ setStatusUpdatesEnabled(false);
- startBrokerNow();
+ setUpNow();
- sendTestLogMessage(_amqpActor);
+ sendTestLogMessage(getAmqpActor());
- List<Object> logs = _rawLogger.getLogMessages();
+ List<Object> logs = getRawLogger().getLogMessages();
assertEquals("Message log size not as expected.", 0, logs.size());
-
}
-
- /**
- * Test that if logging is configured to be off in the configuration that
- * no logging is presented
- * @throws ConfigurationException
- * @throws AMQException
- */
- public void testChannelLoggingoff() throws Exception, AMQException
- {
- getConfigXml().setProperty("status-updates", "off");
-
- startBrokerNow();
-
- sendTestLogMessage(_amqpActor);
-
- List<Object> logs = _rawLogger.getLogMessages();
-
- assertEquals("Message log size not as expected.", 0, logs.size());
-
- }
-
- /**
- * Test that if logging is configured to be off in the configuration that
- * no logging is presented
- * @throws ConfigurationException
- * @throws AMQException
- */
- public void testChannelLoggingoFf() throws Exception, AMQException
- {
- getConfigXml().setProperty("status-updates", "oFf");
-
- startBrokerNow();
-
- sendTestLogMessage(_amqpActor);
-
- List<Object> logs = _rawLogger.getLogMessages();
-
- assertEquals("Message log size not as expected.", 0, logs.size());
-
- }
-
}