summaryrefslogtreecommitdiff
path: root/qpid/java/broker/src/test
diff options
context:
space:
mode:
authorRobert Gemmell <robbie@apache.org>2013-05-05 12:26:26 +0000
committerRobert Gemmell <robbie@apache.org>2013-05-05 12:26:26 +0000
commit47ad28774043573bf3a5f74b559d382ef2bf2d77 (patch)
treeb742f77a5770307f2b18283e48d59a1066c4f576 /qpid/java/broker/src/test
parent7c0210c854e0dfaaafae9a4cc75ae7ae70e7ecdc (diff)
downloadqpid-python-47ad28774043573bf3a5f74b559d382ef2bf2d77.tar.gz
QPID-4815: make BrokerOptions the primary source of the location for the logging configuration file
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1479309 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/broker/src/test')
-rw-r--r--qpid/java/broker/src/test/java/org/apache/qpid/server/BrokerOptionsTest.java23
-rw-r--r--qpid/java/broker/src/test/java/org/apache/qpid/server/MainTest.java11
2 files changed, 26 insertions, 8 deletions
diff --git a/qpid/java/broker/src/test/java/org/apache/qpid/server/BrokerOptionsTest.java b/qpid/java/broker/src/test/java/org/apache/qpid/server/BrokerOptionsTest.java
index 47710ed485..7d956881f5 100644
--- a/qpid/java/broker/src/test/java/org/apache/qpid/server/BrokerOptionsTest.java
+++ b/qpid/java/broker/src/test/java/org/apache/qpid/server/BrokerOptionsTest.java
@@ -23,6 +23,7 @@ package org.apache.qpid.server;
import java.io.File;
import java.util.Map;
+import org.apache.qpid.server.configuration.BrokerProperties;
import org.apache.qpid.test.utils.QpidTestCase;
public class BrokerOptionsTest extends QpidTestCase
@@ -83,16 +84,30 @@ public class BrokerOptionsTest extends QpidTestCase
assertEquals(testConfigFile, _options.getConfigurationStoreLocation());
}
- public void testDefaultLogConfigFile()
+ public void testDefaultLogConfigFileWithQpidHome()
{
- assertNull(_options.getLogConfigFile());
+ String qpidHome = "/test/value";
+ setTestSystemProperty(BrokerProperties.PROPERTY_QPID_HOME, qpidHome);
+
+ String expectedPath = new File(qpidHome, BrokerOptions.DEFAULT_LOG_CONFIG_FILE).getAbsolutePath();
+
+ assertEquals(expectedPath, _options.getLogConfigFileLocation());
+ }
+
+ public void testDefaultLogConfigFileWithoutQpiddHome()
+ {
+ setTestSystemProperty(BrokerProperties.PROPERTY_QPID_HOME, null);
+
+ String expectedPath = new File(BrokerOptions.DEFAULT_LOG_CONFIG_FILE).getAbsolutePath();
+
+ assertEquals(expectedPath, _options.getLogConfigFileLocation());
}
public void testOverriddenLogConfigFile()
{
final String testLogConfigFile = "etc/mytestlog4j.xml";
- _options.setLogConfigFile(testLogConfigFile);
- assertEquals(testLogConfigFile, _options.getLogConfigFile());
+ _options.setLogConfigFileLocation(testLogConfigFile);
+ assertEquals(testLogConfigFile, _options.getLogConfigFileLocation());
}
public void testDefaultLogWatchFrequency()
diff --git a/qpid/java/broker/src/test/java/org/apache/qpid/server/MainTest.java b/qpid/java/broker/src/test/java/org/apache/qpid/server/MainTest.java
index 7e451fca86..27ad5a0313 100644
--- a/qpid/java/broker/src/test/java/org/apache/qpid/server/MainTest.java
+++ b/qpid/java/broker/src/test/java/org/apache/qpid/server/MainTest.java
@@ -38,16 +38,19 @@ public class MainTest extends QpidTestCase
public void testNoOptionsSpecified()
{
- BrokerOptions options = startDummyMain("");
-
String qpidWork = "/qpid/work";
setTestSystemProperty(BrokerProperties.PROPERTY_QPID_WORK, qpidWork);
+ String qpidHome = "/qpid/home";
+ setTestSystemProperty(BrokerProperties.PROPERTY_QPID_HOME, qpidHome);
String expectedStorePath = new File(qpidWork, BrokerOptions.DEFAULT_CONFIG_NAME_PREFIX + ".json").getAbsolutePath();
+ String expectedLogConfigPath = new File(qpidHome, BrokerOptions.DEFAULT_LOG_CONFIG_FILE).getAbsolutePath();
+
+ BrokerOptions options = startDummyMain("");
assertEquals("json", options.getConfigurationStoreType());
assertEquals(expectedStorePath, options.getConfigurationStoreLocation());
- assertEquals(null, options.getLogConfigFile());
+ assertEquals(expectedLogConfigPath, options.getLogConfigFileLocation());
assertEquals(0, options.getLogWatchFrequency());
assertEquals(BrokerOptions.DEFAULT_INITIAL_CONFIG_LOCATION, options.getInitialConfigurationLocation());
assertFalse(options.isOverwriteConfigurationStore());
@@ -88,7 +91,7 @@ public class MainTest extends QpidTestCase
{
BrokerOptions options = startDummyMain("-l wxyz/log4j.xml");
- assertEquals("wxyz/log4j.xml", options.getLogConfigFile());
+ assertEquals("wxyz/log4j.xml", options.getLogConfigFileLocation());
}
public void testLogWatch()