summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--java/broker/etc/config-systests.xml2
-rw-r--r--java/broker/src/main/java/org/apache/qpid/server/configuration/ServerConfiguration.java22
-rw-r--r--java/broker/src/main/java/org/apache/qpid/server/logging/RootMessageLoggerImpl.java2
-rw-r--r--java/broker/src/test/java/org/apache/qpid/server/configuration/ServerConfigurationTest.java18
-rw-r--r--java/broker/src/test/java/org/apache/qpid/server/logging/StatusUpdateConfigurationTest.java73
-rw-r--r--java/systests/src/main/java/org/apache/qpid/server/configuration/ServerConfigurationFileTest.java7
6 files changed, 38 insertions, 86 deletions
diff --git a/java/broker/etc/config-systests.xml b/java/broker/etc/config-systests.xml
index 5193072746..7e3ef438ff 100644
--- a/java/broker/etc/config-systests.xml
+++ b/java/broker/etc/config-systests.xml
@@ -134,6 +134,8 @@
<auto_register>true</auto_register>
</queue>
+ <status-updates>ON</status-updates>
+
<virtualhosts>${conf}/virtualhosts-systests.xml</virtualhosts>
</broker>
diff --git a/java/broker/src/main/java/org/apache/qpid/server/configuration/ServerConfiguration.java b/java/broker/src/main/java/org/apache/qpid/server/configuration/ServerConfiguration.java
index 0bb4c050a3..e4ce042891 100644
--- a/java/broker/src/main/java/org/apache/qpid/server/configuration/ServerConfiguration.java
+++ b/java/broker/src/main/java/org/apache/qpid/server/configuration/ServerConfiguration.java
@@ -54,6 +54,7 @@ public class ServerConfiguration implements SignalHandler
public static final int DEFAULT_BUFFER_READ_LIMIT_SIZE = 262144;
public static final int DEFAULT_BUFFER_WRITE_LIMIT_SIZE = 262144;
public static final boolean DEFAULT_BROKER_CONNECTOR_PROTECTIO_ENABLED = false;
+ public static final String DEFAULT_STATUS_UPDATES = "on";
private static final int DEFAULT_FRAME_SIZE = 65536;
private static final int DEFAULT_PORT = 5672;
@@ -81,6 +82,7 @@ public class ServerConfiguration implements SignalHandler
public static final String CONNECTOR_PROTECTIO_ENABLED = "connector.protectio.enabled";
public static final String CONNECTOR_PROTECTIO_READ_BUFFER_LIMIT_SIZE = "connector.protectio.readBufferLimitSize";
public static final String CONNECTOR_PROTECTIO_WRITE_BUFFER_LIMIT_SIZE = "connector.protectio.writeBufferLimitSize";
+ public static final String STATUS_UPDATES = "status-updates";
{
envVarMap.put("QPID_PORT", "connector.port");
@@ -198,9 +200,16 @@ public class ServerConfiguration implements SignalHandler
return conf;
}
- public boolean getStatusEnabled()
+ /**
+ * Check the configuration file to see if status updates are enabled.
+ * @return true if status updates are enabled
+ */
+ public boolean getStatusUpdatesEnabled()
{
- return getConfig().getBoolean("status-updates", true);
+ // Retrieve the setting from configuration but default to on.
+ String value = getConfig().getString(STATUS_UPDATES, DEFAULT_STATUS_UPDATES);
+
+ return value.equalsIgnoreCase("on");
}
// Our configuration class needs to make the interpolate method
@@ -557,13 +566,4 @@ public class ServerConfiguration implements SignalHandler
getConfig().getLong("housekeeping.expiredMessageCheckPeriod",
DEFAULT_HOUSEKEEPING_PERIOD));
}
-
- public boolean getStatusUpdates()
- {
- // Retrieve the setting from configuration but default to on.
- String value = getConfig().getString("status-updates", "on");
-
- return value.equalsIgnoreCase("on");
- }
-
}
diff --git a/java/broker/src/main/java/org/apache/qpid/server/logging/RootMessageLoggerImpl.java b/java/broker/src/main/java/org/apache/qpid/server/logging/RootMessageLoggerImpl.java
index 9270c316b6..1c2b4e4046 100644
--- a/java/broker/src/main/java/org/apache/qpid/server/logging/RootMessageLoggerImpl.java
+++ b/java/broker/src/main/java/org/apache/qpid/server/logging/RootMessageLoggerImpl.java
@@ -31,7 +31,7 @@ public class RootMessageLoggerImpl implements RootMessageLogger
public RootMessageLoggerImpl(ServerConfiguration configuration, RawMessageLogger rawLogger)
{
- _enabled = configuration.getStatusUpdates();
+ _enabled = configuration.getStatusUpdatesEnabled();
_rawLogger = rawLogger;
}
diff --git a/java/broker/src/test/java/org/apache/qpid/server/configuration/ServerConfigurationTest.java b/java/broker/src/test/java/org/apache/qpid/server/configuration/ServerConfigurationTest.java
index a673a75fda..92f4926c83 100644
--- a/java/broker/src/test/java/org/apache/qpid/server/configuration/ServerConfigurationTest.java
+++ b/java/broker/src/test/java/org/apache/qpid/server/configuration/ServerConfigurationTest.java
@@ -223,6 +223,24 @@ public class ServerConfigurationTest extends TestCase
assertEquals(23, serverConfig.getBufferWriteLimit());
}
+
+ public void testGetStatusEnabled() throws ConfigurationException
+ {
+ // Check default
+ ServerConfiguration serverConfig = new ServerConfiguration(_config);
+ assertEquals(true, serverConfig.getStatusUpdatesEnabled());
+
+ // Check disabling we set
+ _config.setProperty(ServerConfiguration.STATUS_UPDATES, "off");
+ serverConfig = new ServerConfiguration(_config);
+ assertEquals(false, serverConfig.getStatusUpdatesEnabled());
+
+ // Check invalid values don't cause error but result in disabled
+ _config.setProperty(ServerConfiguration.STATUS_UPDATES, "Yes Please");
+ serverConfig = new ServerConfiguration(_config);
+ assertEquals(false, serverConfig.getStatusUpdatesEnabled());
+
+ }
public void testGetSynchedClocks() throws ConfigurationException
{
// Check default
diff --git a/java/broker/src/test/java/org/apache/qpid/server/logging/StatusUpdateConfigurationTest.java b/java/broker/src/test/java/org/apache/qpid/server/logging/StatusUpdateConfigurationTest.java
deleted file mode 100644
index 9a3c18bf99..0000000000
--- a/java/broker/src/test/java/org/apache/qpid/server/logging/StatusUpdateConfigurationTest.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * 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.
- *
- *
- */
-package org.apache.qpid.server.logging;
-
-import junit.framework.TestCase;
-import org.apache.qpid.server.configuration.ServerConfiguration;
-import org.apache.commons.configuration.Configuration;
-import org.apache.commons.configuration.ConfigurationException;
-import org.apache.commons.configuration.PropertiesConfiguration;
-
-/**
- * Set of test to validate the effects of the changes made to the
- * ServerConfiguration to enable the enabling/disabling of status update
- * messages.
- *
- * The default is to on.
- */
-public class StatusUpdateConfigurationTest extends TestCase
-{
-
- /**
- * Validate that with no configuration the status updates will default to
- * enabled.
- * @throws org.apache.commons.configuration.ConfigurationException
- * - if there was a problem in creating the configuratino
- */
- public void testEnabled() throws ConfigurationException
- {
-
- ServerConfiguration serverConfig = new ServerConfiguration(
- new PropertiesConfiguration());
-
- assertTrue("Status Updates not enabled as expected.",
- serverConfig.getStatusUpdates());
- }
-
-
- /**
- * Validate that through the config it is possible to disable status updates
- * @throws org.apache.commons.configuration.ConfigurationException
- * - if there was a problem in creating the configuratino
- */
- public void testUpdateControls() throws ConfigurationException
- {
-
- Configuration config = new PropertiesConfiguration();
- ServerConfiguration serverConfig = new ServerConfiguration(config);
-
- config.setProperty("status-updates", "off");
-
-
- assertFalse("Status Updates should not be enabled.",
- serverConfig.getStatusUpdates());
- }
-}
diff --git a/java/systests/src/main/java/org/apache/qpid/server/configuration/ServerConfigurationFileTest.java b/java/systests/src/main/java/org/apache/qpid/server/configuration/ServerConfigurationFileTest.java
index c25a53c4ea..d49206a650 100644
--- a/java/systests/src/main/java/org/apache/qpid/server/configuration/ServerConfigurationFileTest.java
+++ b/java/systests/src/main/java/org/apache/qpid/server/configuration/ServerConfigurationFileTest.java
@@ -29,7 +29,6 @@ import org.apache.qpid.test.utils.QpidTestCase;
*
* All configuration values should be set in the systest config file so that
* the ability to load them can be validated.
- *
*/
public class ServerConfigurationFileTest extends QpidTestCase
{
@@ -72,4 +71,10 @@ public class ServerConfigurationFileTest extends QpidTestCase
{
validatePropertyDefinedInFile(ServerConfiguration.CONNECTOR_PROTECTIO_WRITE_BUFFER_LIMIT_SIZE);
}
+
+ public void testStatusUpdates() throws ConfigurationException
+ {
+ validatePropertyDefinedInFile(ServerConfiguration.STATUS_UPDATES);
+ }
+
}