You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by or...@apache.org on 2016/07/29 16:29:19 UTC
svn commit: r1754550 - in /qpid/java/trunk:
broker-core/src/main/java/org/apache/qpid/server/model/
broker-core/src/main/java/org/apache/qpid/server/model/adapter/
broker-plugins/management-http/src/main/java/resources/
broker-plugins/management-http/s...
Author: orudyy
Date: Fri Jul 29 16:29:18 2016
New Revision: 1754550
URL: http://svn.apache.org/viewvc?rev=1754550&view=rev
Log:
QPID-7328: Rename context and attribute for helpURL into documentationUrl and improve tests
Modified:
qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/Broker.java
qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/adapter/BrokerImpl.java
qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/index.html
qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/common/ConsoleHelper.js
qpid/java/trunk/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/ConfiguredObjectToMapConverterTest.java
qpid/java/trunk/systests/src/test/java/org/apache/qpid/systest/rest/BrokerRestTest.java
Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/Broker.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/Broker.java?rev=1754550&r1=1754549&r2=1754550&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/Broker.java (original)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/Broker.java Fri Jul 29 16:29:18 2016
@@ -64,7 +64,7 @@ public interface Broker<X extends Broker
String STORE_FILESYSTEM_MAX_USAGE_PERCENT = "store.filesystem.maxUsagePercent";
String QPID_AMQP_PORT = "qpid.amqp_port";
String QPID_HTTP_PORT = "qpid.http_port";
- String QPID_HELP_URL = "qpid.helpURL";
+ String QPID_DOCUMENTATION_URL = "qpid.documentationUrl";
String NETWORK_BUFFER_SIZE = "qpid.broker.networkBufferSize";
// network buffer should at least hold a SSL/TLS frame which in jdk1.8 is 33305 bytes
@@ -107,8 +107,8 @@ public interface Broker<X extends Broker
@ManagedContextDefault(name = CommonProperties.QPID_SECURITY_TLS_CIPHER_SUITE_BLACK_LIST)
String DEFAULT_SECURITY_TLS_CIPHER_SUITE_BLACK_LIST = "[]";
- @ManagedContextDefault(name = QPID_HELP_URL)
- String DEFAULT_HELP_URL = "http://qpid.apache.org/releases/qpid-java-${qpid.version}/java-broker/book/index.html";
+ @ManagedContextDefault(name = QPID_DOCUMENTATION_URL)
+ String DEFAULT_DOCUMENTATION_URL = "http://qpid.apache.org/releases/qpid-java-${qpid.version}/java-broker/book/";
@DerivedAttribute
String getBuildVersion();
@@ -200,8 +200,8 @@ public interface Broker<X extends Broker
@DerivedAttribute(description = "JVM arguments specified on startup")
List<String> getJvmArguments();
- @DerivedAttribute(description = "URL to broker help")
- String getHelpURL();
+ @DerivedAttribute(description = "URL to broker documentation")
+ String getDocumentationUrl();
@ManagedStatistic(statisticType = StatisticType.POINT_IN_TIME,
units = StatisticUnit.COUNT,
Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/adapter/BrokerImpl.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/adapter/BrokerImpl.java?rev=1754550&r1=1754549&r2=1754550&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/adapter/BrokerImpl.java (original)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/adapter/BrokerImpl.java Fri Jul 29 16:29:18 2016
@@ -201,7 +201,7 @@ public class BrokerImpl extends Abstract
private ConfigurationChangeListener _accessControlProviderListener = new AccessControlProviderListener();
private final AccessControl _accessControl;
private TaskExecutor _preferenceTaskExecutor;
- private String _helpURL;
+ private String _documentationUrl;
@ManagedObjectFactoryConstructor
public BrokerImpl(Map<String, Object> attributes,
@@ -487,7 +487,7 @@ public class BrokerImpl extends Abstract
getEventLogger().message(BrokerMessages.FAILED_CHILDREN(failedChildren.toString()));
}
- _helpURL = getContextValue(String.class, QPID_HELP_URL);
+ _documentationUrl = getContextValue(String.class, QPID_DOCUMENTATION_URL);
final boolean brokerShutdownOnErroredChild = getContextValue(Boolean.class,
BROKER_FAIL_STARTUP_WITH_ERRORED_CHILD);
if (!_parent.isManagementMode() && brokerShutdownOnErroredChild && hasBrokerAnyErroredChildren)
@@ -1269,10 +1269,9 @@ public class BrokerImpl extends Abstract
return _jvmArguments;
}
- @Override
- public String getHelpURL()
+ public String getDocumentationUrl()
{
- return _helpURL;
+ return _documentationUrl;
}
@Override
Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/index.html
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/index.html?rev=1754550&r1=1754549&r2=1754550&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/index.html (original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/index.html Fri Jul 29 16:29:18 2016
@@ -133,7 +133,7 @@
<div data-dojo-type="dijit/Menu">
<div data-dojo-type="dijit/MenuItem" data-dojo-props="onClick: function(){qpidManagementHelper.showAPI();}">REST API</div>
<div data-dojo-type="dijit/MenuItem"
- data-dojo-props="iconClass: 'helpIcon', onClick: function(){qpidManagementHelper.showHelp();}">Help</div>
+ data-dojo-props="iconClass: 'helpIcon', onClick: function(){qpidManagementHelper.showDocumentation();}">Documentation</div>
</div>
</div>
<span data-dojo-type="dijit/ToolbarSeparator"></span>
Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/common/ConsoleHelper.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/common/ConsoleHelper.js?rev=1754550&r1=1754549&r2=1754550&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/common/ConsoleHelper.js (original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/common/ConsoleHelper.js Fri Jul 29 16:29:18 2016
@@ -29,67 +29,52 @@ define(["dojo/query",
"dojo/domReady!"], function (query, registry, entities, Structure, updater, Management, util, Dialog)
{
- var helpURL = null;
+ var documentationUrl = null;
var queryCreateDialog = null;
var queryCreateDialogForm = null;
+ var openWindow = function (url, title)
+ {
+ var newWindow = window.open(
+ url,
+ title,
+ 'height=600,width=600,scrollbars=1,location=1,resizable=1,status=0,toolbar=0,titlebar=1,menubar=0',
+ true);
+ newWindow.focus();
+ };
+
return {
showPreferencesDialog: function ()
{
this.management.userPreferences.showEditor();
},
- getHelpUrl: function (callback)
- {
- this.management.load({type: "broker"}, {depth: 0, excludeInheritedContext: true})
- .then(function (data)
- {
- var broker = data[0];
- if (broker.helpURL)
- {
- helpURL = broker.helpURL;
- }
- else
- {
- helpURL = "http://qpid.apache.org/components/java-broker/index.html";
- }
- if (callback)
- {
- callback(helpURL);
- }
- });
- },
- showHelp: function ()
+ showDocumentation: function ()
{
- var openWindow = function (url)
+ if (documentationUrl)
{
- var newWindow = window.open(url,
- 'QpidHelp',
- 'height=600,width=600,scrollbars=1,location=1,resizable=1,status=0,toolbar=0,titlebar=1,menubar=0',
- true);
- newWindow.focus();
- };
-
- if (helpURL)
- {
- openWindow(helpURL)
+ openWindow(documentationUrl, "Qpid Documentation");
}
else
{
- this.getHelpUrl(openWindow);
+ this.management.load({type: "broker"}, {depth: 0, excludeInheritedContext: true})
+ .then(function (data)
+ {
+ var broker = data[0];
+ if (broker.documentationUrl)
+ {
+ documentationUrl = broker.documentationUrl;
+ }
+ else
+ {
+ documentationUrl = "http://qpid.apache.org/components/java-broker/";
+ }
+ openWindow(documentationUrl, "Qpid Documentation")
+ });
}
},
showAPI: function ()
{
- var openWindow = function (url)
- {
- var newWindow = window.open(url,
- 'Qpid REST API',
- 'height=800,width=800,scrollbars=1,location=1,resizable=1,status=0,toolbar=1,titlebar=1,menubar=1',
- true);
- newWindow.focus();
- };
-
- openWindow("/apidocs");
+ openWindow("/apidocs", 'Qpid REST API');
},
showQueryCreateDialog: function (e)
{
Modified: qpid/java/trunk/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/ConfiguredObjectToMapConverterTest.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/ConfiguredObjectToMapConverterTest.java?rev=1754550&r1=1754549&r2=1754550&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/ConfiguredObjectToMapConverterTest.java (original)
+++ qpid/java/trunk/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/ConfiguredObjectToMapConverterTest.java Fri Jul 29 16:29:18 2016
@@ -48,6 +48,23 @@ import org.apache.qpid.test.utils.QpidTe
public class ConfiguredObjectToMapConverterTest extends QpidTestCase
{
+ private static final String TEST_SYSTEM_PROPERTY1_NAME = "qpid.test.name";
+ private static final String TEST_SYSTEM_PROPERTY1_ACTUAL_VALUE = "context-test";
+ private static final String TEST_SYSTEM_PROPERTY2_NAME = "qpid.test.name2";
+ private static final String TEST_SYSTEM_PROPERTY2_ACTUAL_VALUE = "${" + TEST_SYSTEM_PROPERTY1_NAME + "}-value2";
+ private static final String TEST_SYSTEM_PROPERTY2_EFFECTIVE_VALUE = TEST_SYSTEM_PROPERTY1_ACTUAL_VALUE + "-value2";
+ private static final String PARENT_CONTEXT_PROPERTY1_NAME = "parentTest";
+ private static final String PARENT_CONTEXT_PROPERTY1_ACTUAL_VALUE = "carTestValue";
+ private static final String PARENT_CONTEXT_PROPERTY2_NAME = "parentTestExpression";
+ private static final String PARENT_CONTEXT_PROPERTY2_ACTUAL_VALUE =
+ "${" + PARENT_CONTEXT_PROPERTY1_NAME + "}-${" + TEST_SYSTEM_PROPERTY2_NAME + "}";
+ private static final String PARENT_CONTEXT_PROPERTY2_EFFECTIVE_VALUE =
+ PARENT_CONTEXT_PROPERTY1_ACTUAL_VALUE + "-" + TEST_SYSTEM_PROPERTY2_EFFECTIVE_VALUE;
+ private static final String CHILD_CONTEXT_PROPERTY_NAME = "test";
+ private static final String CHILD_CONTEXT_PROPERTY_ACTUAL_VALUE =
+ "test-${" + PARENT_CONTEXT_PROPERTY2_NAME + "}";
+ private static final String CHILD_CONTEXT_PROPERTY_EFFECTIVE_VALUE =
+ "test-" + PARENT_CONTEXT_PROPERTY2_EFFECTIVE_VALUE;
private ConfiguredObjectToMapConverter _converter = new ConfiguredObjectToMapConverter();
private ConfiguredObject _configuredObject = mock(ConfiguredObject.class);
@@ -381,26 +398,9 @@ public class ConfiguredObjectToMapConver
assertEquals("*****", ((Map) attrs).get("secureAttribute"));
}
- public void testExcludeInheritedContext()
+ public void testIncludeInheritedContextAndEffective()
{
- setTestSystemProperty("qpid.test.name", getTestName());
- setTestSystemProperty("qpid.test.name2", "${qpid.test.name}2");
- Model model = org.apache.qpid.server.model.testmodels.hierarchy.TestModel.getInstance();
- final Map<String, Object> carAttributes = new HashMap<>();
- carAttributes.put(ConfiguredObject.NAME, "myCar");
- Map<String, String> carContext = new HashMap<>();
- carContext.put("parentTest", "carTestValue");
- carContext.put("parentTestExpression", "${parentTest}-${qpid.test.name2}");
- carAttributes.put(ConfiguredObject.CONTEXT, carContext);
- TestCar car = model.getObjectFactory().create(TestCar.class, carAttributes);
- final Map<String, Object> engineAttributes = new HashMap<>();
- engineAttributes.put(ConfiguredObject.NAME, "myEngine");
- engineAttributes.put(ConfiguredObject.TYPE, TestElecEngineImpl.TEST_ELEC_ENGINE_TYPE);
- Map<String, String> engineContext = new HashMap<>();
- engineContext.put("test", "testValue-${parentTestExpression}");
- engineAttributes.put(ConfiguredObject.CONTEXT, engineContext);
- TestEngine engine = (TestEngine) car.createChild(TestEngine.class, engineAttributes);
-
+ TestEngine engine = createEngineWithContext();
ConfiguredObjectToMapConverter.ConverterOptions options = new ConfiguredObjectToMapConverter.ConverterOptions(
1,
false,
@@ -409,36 +409,117 @@ public class ConfiguredObjectToMapConver
false,
false);
Map<String, Object> resultMap = _converter.convertObjectToMap(engine, TestEngine.class, options);
- Object contextValue = resultMap.get("context");
- assertTrue("Unexpected type of context", contextValue instanceof Map);
- Map<String,String> context = (Map<String, String>)contextValue;
+ Map<String, String> context = getContext(resultMap);
+
assertTrue("Unexpected size of context", context.size() >= 5);
assertEquals("Unexpected engine context content",
- "testValue-carTestValue-" + getTestName() + "2",
- ((Map) contextValue).get("test"));
- assertEquals("Unexpected car context content", "carTestValue", context.get("parentTest"));
+ CHILD_CONTEXT_PROPERTY_EFFECTIVE_VALUE,
+ context.get(CHILD_CONTEXT_PROPERTY_NAME));
+ assertEquals("Unexpected car context content",
+ PARENT_CONTEXT_PROPERTY1_ACTUAL_VALUE, context.get(PARENT_CONTEXT_PROPERTY1_NAME));
assertEquals("Unexpected car context content",
- "carTestValue-" + getTestName() + "2",
- context.get("parentTestExpression"));
+ PARENT_CONTEXT_PROPERTY2_EFFECTIVE_VALUE,
+ context.get(PARENT_CONTEXT_PROPERTY2_NAME));
+ assertEquals("Unexpected system context content",
+ TEST_SYSTEM_PROPERTY1_ACTUAL_VALUE,
+ context.get(TEST_SYSTEM_PROPERTY1_NAME));
+ assertEquals("Unexpected system context content",
+ TEST_SYSTEM_PROPERTY2_EFFECTIVE_VALUE,
+ context.get(TEST_SYSTEM_PROPERTY2_NAME));
+ }
- assertEquals("Unexpected system context content", getTestName(), context.get("qpid.test.name"));
+ public void testIncludeInheritedContextAndActual()
+ {
+ TestEngine engine = createEngineWithContext();
+ ConfiguredObjectToMapConverter.ConverterOptions options = new ConfiguredObjectToMapConverter.ConverterOptions(
+ 1,
+ true,
+ false,
+ 0,
+ false,
+ false);
+ Map<String, Object> resultMap = _converter.convertObjectToMap(engine, TestEngine.class, options);
+ Map<String, String> context = getContext(resultMap);
+ assertTrue("Unexpected size of context", context.size() >= 5);
+ assertEquals("Unexpected engine context content",
+ CHILD_CONTEXT_PROPERTY_ACTUAL_VALUE,
+ context.get(CHILD_CONTEXT_PROPERTY_NAME));
+ assertEquals("Unexpected car context content",
+ PARENT_CONTEXT_PROPERTY1_ACTUAL_VALUE, context.get(PARENT_CONTEXT_PROPERTY1_NAME));
+ assertEquals("Unexpected car context content",
+ PARENT_CONTEXT_PROPERTY2_ACTUAL_VALUE,
+ context.get(PARENT_CONTEXT_PROPERTY2_NAME));
+ assertEquals("Unexpected system context content",
+ TEST_SYSTEM_PROPERTY1_ACTUAL_VALUE,
+ context.get(TEST_SYSTEM_PROPERTY1_NAME));
assertEquals("Unexpected system context content",
- getTestName() + "2",
- context.get("qpid.test.name2"));
+ TEST_SYSTEM_PROPERTY2_ACTUAL_VALUE,
+ context.get(TEST_SYSTEM_PROPERTY2_NAME));
+ }
- options = new ConfiguredObjectToMapConverter.ConverterOptions(
+ public void testExcludeInheritedContextAndEffective()
+ {
+ TestEngine engine = createEngineWithContext();
+ ConfiguredObjectToMapConverter.ConverterOptions options = new ConfiguredObjectToMapConverter.ConverterOptions(
1,
false,
false,
0,
false,
true);
- resultMap = _converter.convertObjectToMap(engine, TestEngine.class, options);
- contextValue = resultMap.get("context");
- assertTrue("Unexpected type of context", contextValue instanceof Map);
- context = (Map<String, String>)contextValue;
+ Map<String, Object> resultMap = _converter.convertObjectToMap(engine, TestEngine.class, options);
+ Map<String, String> context = getContext(resultMap);
+ assertEquals("Unexpected size of context", 1, context.size());
+ assertEquals("Unexpected context content",
+ CHILD_CONTEXT_PROPERTY_EFFECTIVE_VALUE,
+ context.get(CHILD_CONTEXT_PROPERTY_NAME));
+ }
+
+ public void testExcludeInheritedContextAndActual()
+ {
+ TestEngine engine = createEngineWithContext();
+ ConfiguredObjectToMapConverter.ConverterOptions options = new ConfiguredObjectToMapConverter.ConverterOptions(
+ 1,
+ true,
+ false,
+ 0,
+ false,
+ true);
+ Map<String, Object> resultMap = _converter.convertObjectToMap(engine, TestEngine.class, options);
+ Map<String, String> context = getContext(resultMap);
assertEquals("Unexpected size of context", 1, context.size());
- assertEquals("Unexpected context content", "testValue-carTestValue-" + getTestName() + "2", context.get("test"));
+ assertEquals("Unexpected context content",
+ CHILD_CONTEXT_PROPERTY_ACTUAL_VALUE,
+ context.get(CHILD_CONTEXT_PROPERTY_NAME));
+ }
+
+ private Map<String, String> getContext(final Map<String, Object> resultMap)
+ {
+ Object contextValue = resultMap.get(ConfiguredObject.CONTEXT);
+ assertTrue("Unexpected type of context", contextValue instanceof Map);
+ Map<String, String> context = (Map<String, String>) contextValue;
+ return context;
+ }
+
+ private TestEngine createEngineWithContext()
+ {
+ setTestSystemProperty(TEST_SYSTEM_PROPERTY1_NAME, TEST_SYSTEM_PROPERTY1_ACTUAL_VALUE);
+ setTestSystemProperty(TEST_SYSTEM_PROPERTY2_NAME, TEST_SYSTEM_PROPERTY2_ACTUAL_VALUE);
+ Model model = org.apache.qpid.server.model.testmodels.hierarchy.TestModel.getInstance();
+ final Map<String, Object> carAttributes = new HashMap<>();
+ carAttributes.put(ConfiguredObject.NAME, "myCar");
+ Map<String, String> carContext = new HashMap<>();
+ carContext.put(PARENT_CONTEXT_PROPERTY1_NAME, PARENT_CONTEXT_PROPERTY1_ACTUAL_VALUE);
+ carContext.put(PARENT_CONTEXT_PROPERTY2_NAME, PARENT_CONTEXT_PROPERTY2_ACTUAL_VALUE);
+ carAttributes.put(ConfiguredObject.CONTEXT, carContext);
+ TestCar car = model.getObjectFactory().create(TestCar.class, carAttributes);
+ final Map<String, Object> engineAttributes = new HashMap<>();
+ engineAttributes.put(ConfiguredObject.NAME, "myEngine");
+ engineAttributes.put(ConfiguredObject.TYPE, TestElecEngineImpl.TEST_ELEC_ENGINE_TYPE);
+ Map<String, String> engineContext = new HashMap<>();
+ engineContext.put(CHILD_CONTEXT_PROPERTY_NAME, CHILD_CONTEXT_PROPERTY_ACTUAL_VALUE);
+ engineAttributes.put(ConfiguredObject.CONTEXT, engineContext);
+ return (TestEngine) car.createChild(TestEngine.class, engineAttributes);
}
private Model createTestModel()
Modified: qpid/java/trunk/systests/src/test/java/org/apache/qpid/systest/rest/BrokerRestTest.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/systests/src/test/java/org/apache/qpid/systest/rest/BrokerRestTest.java?rev=1754550&r1=1754549&r2=1754550&view=diff
==============================================================================
--- qpid/java/trunk/systests/src/test/java/org/apache/qpid/systest/rest/BrokerRestTest.java (original)
+++ qpid/java/trunk/systests/src/test/java/org/apache/qpid/systest/rest/BrokerRestTest.java Fri Jul 29 16:29:18 2016
@@ -48,15 +48,20 @@ public class BrokerRestTest extends Qpid
private static final String BROKER_VIRTUALHOST_NODES_ATTRIBUTE = "virtualhostnodes";
private static final String BROKER_STATISTICS_ATTRIBUTE = "statistics";
private static final String SYSTEM_PROPERTY_NAME = "qpid.rest.test.name";
+ private static final String SYSTEM_PROPERTY_ACTUAL_VALUE = "qpid.rest.test.name.value";
private static final String SYSTEM_PROPERTY2_NAME = "qpid.rest.test.var";
- private static final String SYSTEM_PROPERTY2_VALUE = "Test name is ${qpid.rest.test.name}";
+ private static final String SYSTEM_PROPERTY2_ACTUAL_VALUE = "qpid.rest.test.name=${" + SYSTEM_PROPERTY_NAME + "}";
+ private static final String SYSTEM_PROPERTY2_EFFECTIVE_VALUE = "qpid.rest.test.name=" + SYSTEM_PROPERTY_ACTUAL_VALUE;
+ private static final String SYSTEM_PROPERTY3_NAME = "qpid.rest.test.var2";
+ private static final String SYSTEM_PROPERTY3_ACTUAL_VALUE = "${" + SYSTEM_PROPERTY2_NAME + "}2";
+ private static final String SYSTEM_PROPERTY3_EFFECTIVE_VALUE = SYSTEM_PROPERTY2_EFFECTIVE_VALUE + "2";
@Override
public void setUp() throws Exception
{
HashMap<String, String> _testSystemContext = new HashMap<>();
- _testSystemContext.put(SYSTEM_PROPERTY_NAME, getTestName());
- _testSystemContext.put(SYSTEM_PROPERTY2_NAME, SYSTEM_PROPERTY2_VALUE);
+ _testSystemContext.put(SYSTEM_PROPERTY_NAME, SYSTEM_PROPERTY_ACTUAL_VALUE);
+ _testSystemContext.put(SYSTEM_PROPERTY2_NAME, SYSTEM_PROPERTY2_ACTUAL_VALUE);
for (Map.Entry<String,String> testContextEntry: _testSystemContext.entrySet())
{
setSystemProperty(testContextEntry.getKey(), testContextEntry.getValue());
@@ -166,10 +171,12 @@ public class BrokerRestTest extends Qpid
{
Map<String, Object> brokerDetails =
getRestTestHelper().getJsonAsSingletonList("broker?inheritedActuals=true&actuals=true");
- Map<String, String> brokerContext = (Map<String, String>) brokerDetails.get("context");
- assertEquals("Unexpected test context variable value", getTestName(), brokerContext.get(SYSTEM_PROPERTY_NAME));
+ Map<String, String> brokerContext = (Map<String, String>) brokerDetails.get(ConfiguredObject.CONTEXT);
+ assertEquals("Unexpected test context variable value",
+ SYSTEM_PROPERTY_ACTUAL_VALUE,
+ brokerContext.get(SYSTEM_PROPERTY_NAME));
assertEquals("Unexpected test context expression value",
- SYSTEM_PROPERTY2_VALUE,
+ SYSTEM_PROPERTY2_ACTUAL_VALUE,
brokerContext.get(SYSTEM_PROPERTY2_NAME));
}
@@ -177,11 +184,13 @@ public class BrokerRestTest extends Qpid
{
Map<String, Object> brokerDetails =
getRestTestHelper().getJsonAsSingletonList("broker?inheritedActuals=false&actuals=false");
- Map<String, String> brokerContext = (Map<String, String>) brokerDetails.get("context");
- assertEquals("Unexpected test context variable value", getTestName(), brokerContext.get("qpid.rest.test.name"));
+ Map<String, String> brokerContext = (Map<String, String>) brokerDetails.get(ConfiguredObject.CONTEXT);
+ assertEquals("Unexpected test context variable value",
+ SYSTEM_PROPERTY_ACTUAL_VALUE,
+ brokerContext.get(SYSTEM_PROPERTY_NAME));
assertEquals("Unexpected test context expression value",
- "Test name is " + getTestName(),
- brokerContext.get("qpid.rest.test.var"));
+ SYSTEM_PROPERTY2_EFFECTIVE_VALUE,
+ brokerContext.get(SYSTEM_PROPERTY2_NAME));
}
public void testActualNotInheritedContext() throws IOException
@@ -189,18 +198,19 @@ public class BrokerRestTest extends Qpid
Map<String, Object> brokerDetails =
getRestTestHelper().getJsonAsSingletonList("broker?excludeInheritedContext=true&actuals=true");
- assertFalse("Unexpected context", brokerDetails.containsKey("context"));
+ assertFalse("Unexpected context", brokerDetails.containsKey(ConfiguredObject.CONTEXT));
Map<String, Object> attributes = Collections.<String, Object>singletonMap(
- "context",
- Collections.singletonMap("qpid.rest.test.var2", "${qpid.rest.test.var}2"));
+ ConfiguredObject.CONTEXT,
+ Collections.singletonMap(SYSTEM_PROPERTY3_NAME, SYSTEM_PROPERTY3_ACTUAL_VALUE));
getRestTestHelper().submitRequest("broker", "POST", attributes);
brokerDetails =
getRestTestHelper().getJsonAsSingletonList("broker?excludeInheritedContext=true&actuals=true");
- Map<String, Object> brokerContext = new HashMap<>((Map<String, Object>) brokerDetails.get("context"));
+ Map<String, Object> brokerContext =
+ new HashMap<>((Map<String, Object>) brokerDetails.get(ConfiguredObject.CONTEXT));
Map<String, String> expectedContext = new HashMap<>();
- expectedContext.put("qpid.rest.test.var2", "${qpid.rest.test.var}2");
+ expectedContext.put(SYSTEM_PROPERTY3_NAME, SYSTEM_PROPERTY3_ACTUAL_VALUE);
assertEquals("Unexpected context", expectedContext, brokerContext);
}
@@ -210,20 +220,21 @@ public class BrokerRestTest extends Qpid
Map<String, Object> brokerDetails =
getRestTestHelper().getJsonAsSingletonList("broker?excludeInheritedContext=true&actuals=false");
- assertFalse("Unexpected context", brokerDetails.containsKey("context"));
+ assertFalse("Unexpected context", brokerDetails.containsKey(ConfiguredObject.CONTEXT));
Map<String, Object> attributes = Collections.<String, Object>singletonMap(
- "context",
- Collections.singletonMap("qpid.rest.test.var2", "${qpid.rest.test.var}2"));
+ ConfiguredObject.CONTEXT,
+ Collections.singletonMap(SYSTEM_PROPERTY3_NAME, SYSTEM_PROPERTY3_ACTUAL_VALUE));
getRestTestHelper().submitRequest("broker", "POST", attributes);
brokerDetails =
getRestTestHelper().getJsonAsSingletonList("broker?excludeInheritedContext=true&actuals=false");
Map<String, String> expectedContext = new HashMap<>();
- Map<String, Object> brokerContext = new HashMap<>((Map<String, Object>) brokerDetails.get("context"));
+ Map<String, Object> brokerContext =
+ new HashMap<>((Map<String, Object>) brokerDetails.get(ConfiguredObject.CONTEXT));
- expectedContext.put("qpid.rest.test.var2", "Test name is " + getTestName() + "2");
+ expectedContext.put(SYSTEM_PROPERTY3_NAME, SYSTEM_PROPERTY3_EFFECTIVE_VALUE);
assertEquals("Unexpected context", expectedContext, brokerContext);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org