qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From oru...@apache.org
Subject [2/3] qpid-broker-j git commit: QPID-7773: [Java Broker, REST API] Return json object for singleton object request
Date Thu, 14 Sep 2017 16:35:45 GMT
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/d128dea9/systests/src/test/java/org/apache/qpid/systest/rest/ConnectionRestTest.java
----------------------------------------------------------------------
diff --git a/systests/src/test/java/org/apache/qpid/systest/rest/ConnectionRestTest.java b/systests/src/test/java/org/apache/qpid/systest/rest/ConnectionRestTest.java
index 06d5481..0a001b3 100644
--- a/systests/src/test/java/org/apache/qpid/systest/rest/ConnectionRestTest.java
+++ b/systests/src/test/java/org/apache/qpid/systest/rest/ConnectionRestTest.java
@@ -155,7 +155,7 @@ public class ConnectionRestTest extends QpidRestTestCase
     {
         List<Map<String, Object>> sessions = getRestTestHelper().getJsonAsList("session");
         assertEquals("Unexpected number of sessions", 1, sessions.size());
-        assertSession(sessions.get(0), (AMQSession<?, ?>) _session);
+        assertSession(sessions.get(0));
     }
 
     public void testGetPortSessions() throws Exception
@@ -164,7 +164,7 @@ public class ConnectionRestTest extends QpidRestTestCase
 
         List<Map<String, Object>> sessions = getRestTestHelper().getJsonAsList("session/" + portName);
         assertEquals("Unexpected number of sessions", 1, sessions.size());
-        assertSession(sessions.get(0), (AMQSession<?, ?>) _session);
+        assertSession(sessions.get(0));
     }
 
     public void testGetConnectionSessions() throws Exception
@@ -175,7 +175,7 @@ public class ConnectionRestTest extends QpidRestTestCase
         List<Map<String, Object>> sessions = getRestTestHelper().getJsonAsList("session/" + portName + "/"
                 + getRestTestHelper().encodeAsUTF(connectionName));
         assertEquals("Unexpected number of sessions", 1, sessions.size());
-        assertSession(sessions.get(0), (AMQSession<?, ?>) _session);
+        assertSession(sessions.get(0));
     }
 
     public void testGetSessionByName() throws Exception
@@ -183,10 +183,9 @@ public class ConnectionRestTest extends QpidRestTestCase
         String connectionName = getConnectionName();
         String portName = TestBrokerConfiguration.ENTRY_NAME_AMQP_PORT;
 
-        List<Map<String, Object>> sessions = getRestTestHelper().getJsonAsList("session/" + portName + "/"
+        Map<String, Object> sessionDetails = getRestTestHelper().getJsonAsMap("session/" + portName + "/"
                 + getRestTestHelper().encodeAsUTF(connectionName) + "/" + ((AMQSession<?, ?>) _session).getChannelId());
-        assertEquals("Unexpected number of sessions", 1, sessions.size());
-        assertSession(sessions.get(0), (AMQSession<?, ?>) _session);
+        assertSession(sessionDetails);
     }
 
     public void testProducerSessionOpenHasTransactionStartAndUpdateTimes() throws Exception
@@ -199,12 +198,9 @@ public class ConnectionRestTest extends QpidRestTestCase
         String connectionName = getConnectionName();
         String portName = TestBrokerConfiguration.ENTRY_NAME_AMQP_PORT;
 
-        List<Map<String, Object>> sessions = getRestTestHelper().getJsonAsList("session/" + portName + "/"
+        Map<String, Object> sessionData = getRestTestHelper().getJsonAsMap("session/" + portName + "/"
                                                                                + getRestTestHelper().encodeAsUTF(connectionName)
                                                                                + "/" + ((AMQSession<?, ?>) _session).getChannelId());
-        assertEquals("Unexpected number of sessions", 1, sessions.size());
-
-        final Map<String, Object> sessionData = sessions.get(0);
 
         @SuppressWarnings("unchecked")
         Map<String, Object> statistics = (Map<String, Object>) sessionData.get(Asserts.STATISTICS_ATTRIBUTE);
@@ -238,10 +234,10 @@ public class ConnectionRestTest extends QpidRestTestCase
         List<Map<String, Object>> sessions = getRestTestHelper().getJsonAsList("session/amqp/" + encodedName);
         assertNotNull("Sessions cannot be found", sessions);
         assertEquals("Unexpected number of sessions", 1, sessions.size());
-        assertSession(sessions.get(0), (AMQSession<?, ?>) _session);
+        assertSession(sessions.get(0));
     }
 
-    private void assertSession(Map<String, Object> sessionData, AMQSession<?, ?> session)
+    private void assertSession(Map<String, Object> sessionData)
     {
         assertNotNull("Session map cannot be null", sessionData);
         Asserts.assertAttributesPresent(sessionData, BrokerModel.getInstance().getTypeRegistry().getAttributeNames(
@@ -257,12 +253,10 @@ public class ConnectionRestTest extends QpidRestTestCase
                                         Session.STATE,
                                         Session.DURABLE,
                                         Session.LIFETIME_POLICY);
-        assertEquals("Unexpected value of attribute " + Session.NAME, session.getChannelId() + "",
-                sessionData.get(Session.NAME));
         assertEquals("Unexpected value of attribute " + Session.PRODUCER_FLOW_BLOCKED, Boolean.FALSE,
                 sessionData.get(Session.PRODUCER_FLOW_BLOCKED));
-        assertEquals("Unexpected value of attribute " + Session.CHANNEL_ID, session.getChannelId(),
-                sessionData.get(Session.CHANNEL_ID));
+        assertNotNull("Unexpected value of attribute " + Session.NAME, sessionData.get(Session.NAME));
+        assertNotNull("Unexpected value of attribute " + Session.CHANNEL_ID , sessionData.get(Session.CHANNEL_ID));
 
         @SuppressWarnings("unchecked")
         Map<String, Object> statistics = (Map<String, Object>) sessionData.get(Asserts.STATISTICS_ATTRIBUTE);

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/d128dea9/systests/src/test/java/org/apache/qpid/systest/rest/ExchangeRestTest.java
----------------------------------------------------------------------
diff --git a/systests/src/test/java/org/apache/qpid/systest/rest/ExchangeRestTest.java b/systests/src/test/java/org/apache/qpid/systest/rest/ExchangeRestTest.java
index 8b39eda..25502e8 100644
--- a/systests/src/test/java/org/apache/qpid/systest/rest/ExchangeRestTest.java
+++ b/systests/src/test/java/org/apache/qpid/systest/rest/ExchangeRestTest.java
@@ -65,8 +65,9 @@ public class ExchangeRestTest extends QpidRestTestCase
     {
         for (String exchangeName : EXPECTED_EXCHANGES)
         {
-            Map<String, Object> exchange = getRestTestHelper().getJsonAsSingletonList("exchange/test/test/"
-                    + getRestTestHelper().encodeAsUTF(exchangeName));
+            Map<String, Object> exchange = getRestTestHelper().getJsonAsMap("exchange/test/test/"
+                                                                            + getRestTestHelper().encodeAsUTF(
+                    exchangeName));
             assertExchange(exchangeName, exchange);
         }
     }
@@ -81,7 +82,7 @@ public class ExchangeRestTest extends QpidRestTestCase
         attributes.put(Exchange.TYPE, "direct");
         getRestTestHelper().submitRequest(exchangeUrl, "PUT", attributes, 201);
 
-        Map<String, Object> exchange = getRestTestHelper().getJsonAsSingletonList(exchangeUrl);
+        Map<String, Object> exchange = getRestTestHelper().getJsonAsMap(exchangeUrl);
         assertNotNull("Exchange not found", exchange);
 
         attributes = new HashMap<>();
@@ -90,7 +91,7 @@ public class ExchangeRestTest extends QpidRestTestCase
                        Collections.singletonMap(AlternateBinding.DESTINATION, "amq.direct"));
 
         getRestTestHelper().submitRequest(exchangeUrl, "PUT", attributes, 200);
-        exchange = getRestTestHelper().getJsonAsSingletonList(exchangeUrl);
+        exchange = getRestTestHelper().getJsonAsMap(exchangeUrl);
         assertNotNull("Exchange not found", exchange);
         assertEquals(new HashMap<>(Collections.singletonMap(AlternateBinding.DESTINATION, "amq.direct")),
                      new HashMap<>(((Map<String, Object>) exchange.get(Exchange.ALTERNATE_BINDING))));

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/d128dea9/systests/src/test/java/org/apache/qpid/systest/rest/GroupProviderRestTest.java
----------------------------------------------------------------------
diff --git a/systests/src/test/java/org/apache/qpid/systest/rest/GroupProviderRestTest.java b/systests/src/test/java/org/apache/qpid/systest/rest/GroupProviderRestTest.java
index 7a909fa..9bb9c6d 100644
--- a/systests/src/test/java/org/apache/qpid/systest/rest/GroupProviderRestTest.java
+++ b/systests/src/test/java/org/apache/qpid/systest/rest/GroupProviderRestTest.java
@@ -82,8 +82,8 @@ public class GroupProviderRestTest extends QpidRestTestCase
         for (Map<String, Object> provider : providerDetails)
         {
             assertProvider(FILE_GROUP_MANAGER, FileBasedGroupProviderImpl.GROUP_FILE_PROVIDER_TYPE, provider);
-            Map<String, Object> data = getRestTestHelper().getJsonAsSingletonList("groupprovider/"
-                    + provider.get(GroupProvider.NAME));
+            Map<String, Object> data = getRestTestHelper().getJsonAsMap("groupprovider/"
+                                                                        + provider.get(GroupProvider.NAME));
             assertNotNull("Cannot load data for " + provider.get(GroupProvider.NAME), data);
             assertProvider(FILE_GROUP_MANAGER, FileBasedGroupProviderImpl.GROUP_FILE_PROVIDER_TYPE, data);
         }
@@ -94,14 +94,13 @@ public class GroupProviderRestTest extends QpidRestTestCase
         String groupName = "newGroup";
 
         Map<String, Object> data =
-                getRestTestHelper().getJsonAsSingletonList("groupprovider/" + FILE_GROUP_MANAGER + "?depth=1");
+                getRestTestHelper().getJsonAsMap("groupprovider/" + FILE_GROUP_MANAGER + "?depth=1");
         assertNotNull("Cannot load data for provider", data);
 
         getRestTestHelper().assertNumberOfGroups(data, 1);
 
         getRestTestHelper().createGroup(groupName, FILE_GROUP_MANAGER);
-
-        data = getRestTestHelper().getJsonAsSingletonList("groupprovider/" + FILE_GROUP_MANAGER + "?depth=1");
+        data = getRestTestHelper().getJsonAsMap("groupprovider/" + FILE_GROUP_MANAGER + "?depth=1");
         assertNotNull("Cannot load data for provider", data);
 
         getRestTestHelper().assertNumberOfGroups(data, 2);
@@ -112,14 +111,14 @@ public class GroupProviderRestTest extends QpidRestTestCase
         String groupName = "myGroup";
 
         Map<String, Object> data =
-                getRestTestHelper().getJsonAsSingletonList("groupprovider/" + FILE_GROUP_MANAGER + "?depth=1");
+                getRestTestHelper().getJsonAsMap("groupprovider/" + FILE_GROUP_MANAGER + "?depth=1");
         assertNotNull("Cannot load data for provider", data);
 
         getRestTestHelper().assertNumberOfGroups(data, 1);
 
         getRestTestHelper().removeGroup(groupName, FILE_GROUP_MANAGER);
 
-        data = getRestTestHelper().getJsonAsSingletonList("groupprovider/" + FILE_GROUP_MANAGER + "?depth=1");
+        data = getRestTestHelper().getJsonAsMap("groupprovider/" + FILE_GROUP_MANAGER + "?depth=1");
         assertNotNull("Cannot load data for provider", data);
 
         getRestTestHelper().assertNumberOfGroups(data, 0);
@@ -140,7 +139,7 @@ public class GroupProviderRestTest extends QpidRestTestCase
             int responseCode = getRestTestHelper().submitRequest("groupprovider/" + providerName, "PUT", attributes);
             assertEquals("Group provider was not created", 201, responseCode);
 
-            Map<String, Object> data = getRestTestHelper().getJsonAsSingletonList("groupprovider/" + providerName + "?depth=2");
+            Map<String, Object> data = getRestTestHelper().getJsonAsMap("groupprovider/" + providerName + "?depth=2");
             assertProvider(providerName, FileBasedGroupProviderImpl.GROUP_FILE_PROVIDER_TYPE, data);
             assertEquals("Unexpected name", providerName, data.get(GroupProvider.NAME));
             assertEquals("Unexpected path", groupFile.getAbsolutePath(), data.get(FileBasedGroupProvider.PATH));
@@ -202,7 +201,7 @@ public class GroupProviderRestTest extends QpidRestTestCase
             int responseCode = getRestTestHelper().submitRequest("groupprovider/" + providerName, "PUT", attributes);
             assertEquals("Group provider was not created", 201, responseCode);
 
-            Map<String, Object> data = getRestTestHelper().getJsonAsSingletonList("groupprovider/" + providerName);
+            Map<String, Object> data = getRestTestHelper().getJsonAsMap("groupprovider/" + providerName);
             assertEquals("Unexpected name", providerName, data.get(GroupProvider.NAME));
             assertEquals("Unexpected path", groupFile.getAbsolutePath(), data.get(FileBasedGroupProvider.PATH));
 
@@ -320,7 +319,8 @@ public class GroupProviderRestTest extends QpidRestTestCase
 
         getRestTestHelper().setUsernameAndPassword(SystemConfig.MANAGEMENT_MODE_USER_NAME, MANAGEMENT_MODE_PASSWORD);
 
-        Map<String, Object> groupProvider = getRestTestHelper().getJsonAsSingletonList("groupprovider/" + TestBrokerConfiguration.ENTRY_NAME_GROUP_FILE);
+        Map<String, Object> groupProvider =
+                getRestTestHelper().getJsonAsMap("groupprovider/" + TestBrokerConfiguration.ENTRY_NAME_GROUP_FILE);
         assertEquals("Unexpected id", id.toString(), groupProvider.get(GroupProvider.ID));
         assertEquals("Unexpected path", file.getAbsolutePath() , groupProvider.get(FileBasedGroupProvider.PATH));
         assertEquals("Unexpected state", State.ERRORED.name() , groupProvider.get(GroupProvider.STATE));

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/d128dea9/systests/src/test/java/org/apache/qpid/systest/rest/GroupRestTest.java
----------------------------------------------------------------------
diff --git a/systests/src/test/java/org/apache/qpid/systest/rest/GroupRestTest.java b/systests/src/test/java/org/apache/qpid/systest/rest/GroupRestTest.java
index 887feb4..5e54e2d 100644
--- a/systests/src/test/java/org/apache/qpid/systest/rest/GroupRestTest.java
+++ b/systests/src/test/java/org/apache/qpid/systest/rest/GroupRestTest.java
@@ -67,7 +67,8 @@ public class GroupRestTest extends QpidRestTestCase
 
     public void testGet() throws Exception
     {
-        Map<String, Object> group = getRestTestHelper().getJsonAsSingletonList("group/" + FILE_GROUP_MANAGER + "/myGroup?depth=1");
+        Map<String, Object> group =
+                getRestTestHelper().getJsonAsMap("group/" + FILE_GROUP_MANAGER + "/myGroup?depth=1");
         List<Map<String, Object>> groupmembers = (List<Map<String, Object>>) group.get("groupmembers");
         assertEquals(1, groupmembers.size());
 
@@ -77,26 +78,28 @@ public class GroupRestTest extends QpidRestTestCase
 
     public void testCreateNewMemberByPutUsingMemberURI() throws Exception
     {
-        Map<String, Object> group = getRestTestHelper().getJsonAsSingletonList("group/" + FILE_GROUP_MANAGER + "/myGroup?depth=1");
+        Map<String, Object> group =
+                getRestTestHelper().getJsonAsMap("group/" + FILE_GROUP_MANAGER + "/myGroup?depth=1");
         getRestTestHelper().assertNumberOfGroupMembers(group, 1);
 
         String url = "groupmember/" + FILE_GROUP_MANAGER + "/"+ GROUP_NAME + "/" +  NEW_MEMBER;
         getRestTestHelper().submitRequest(url, "PUT", Collections.<String, Object>emptyMap(), HttpServletResponse.SC_CREATED);
 
-        Map<String, Object> member = getRestTestHelper().getJsonAsSingletonList(url);
+        Map<String, Object> member = getRestTestHelper().getJsonAsMap(url);
         assertEquals("Unexpected group name", NEW_MEMBER, member.get(GroupMember.NAME));
     }
 
     public void testCreateNewMemberByPostUsingParentURI() throws Exception
     {
-        Map<String, Object> group = getRestTestHelper().getJsonAsSingletonList("group/" + FILE_GROUP_MANAGER + "/myGroup?depth=1");
+        Map<String, Object> group =
+                getRestTestHelper().getJsonAsMap("group/" + FILE_GROUP_MANAGER + "/myGroup?depth=1");
         getRestTestHelper().assertNumberOfGroupMembers(group, 1);
 
         String url = "groupmember/" + FILE_GROUP_MANAGER + "/"+ GROUP_NAME;
         Map<String, Object> data = Collections.<String, Object>singletonMap("name", NEW_MEMBER);
         getRestTestHelper().submitRequest(url, "POST", data, HttpServletResponse.SC_CREATED);
 
-        Map<String, Object> member = getRestTestHelper().getJsonAsSingletonList(url + "/" +  NEW_MEMBER);
+        Map<String, Object> member = getRestTestHelper().getJsonAsMap(url + "/" + NEW_MEMBER);
         assertEquals("Unexpected group name", NEW_MEMBER, member.get(GroupMember.NAME));
 
         // verify that second creation request fails
@@ -105,14 +108,15 @@ public class GroupRestTest extends QpidRestTestCase
 
     public void testCreateNewMemberByPutUsingParentURI() throws Exception
     {
-        Map<String, Object> group = getRestTestHelper().getJsonAsSingletonList("group/" + FILE_GROUP_MANAGER + "/myGroup?depth=1");
+        Map<String, Object> group =
+                getRestTestHelper().getJsonAsMap("group/" + FILE_GROUP_MANAGER + "/myGroup?depth=1");
         getRestTestHelper().assertNumberOfGroupMembers(group, 1);
 
         String url = "groupmember/" + FILE_GROUP_MANAGER + "/"+ GROUP_NAME;
         Map<String, Object> data = Collections.<String, Object>singletonMap("name", NEW_MEMBER);
         getRestTestHelper().submitRequest(url, "PUT", data, HttpServletResponse.SC_CREATED);
 
-        Map<String, Object> member = getRestTestHelper().getJsonAsSingletonList(url + "/" +  NEW_MEMBER);
+        Map<String, Object> member = getRestTestHelper().getJsonAsMap(url + "/" + NEW_MEMBER);
         assertEquals("Unexpected group name", NEW_MEMBER, member.get(GroupMember.NAME));
 
         // verify that second creation request fails
@@ -121,12 +125,13 @@ public class GroupRestTest extends QpidRestTestCase
 
     public void testRemoveMemberFromGroup() throws Exception
     {
-        Map<String, Object> group = getRestTestHelper().getJsonAsSingletonList("group/" + FILE_GROUP_MANAGER + "/myGroup?depth=1");
+        Map<String, Object> group =
+                getRestTestHelper().getJsonAsMap("group/" + FILE_GROUP_MANAGER + "/myGroup?depth=1");
         getRestTestHelper().assertNumberOfGroupMembers(group, 1);
 
         getRestTestHelper().removeMemberFromGroup(FILE_GROUP_MANAGER, GROUP_NAME, EXISTING_MEMBER);
 
-        group = getRestTestHelper().getJsonAsSingletonList("group/" + FILE_GROUP_MANAGER + "/myGroup");
+        group = getRestTestHelper().getJsonAsMap("group/" + FILE_GROUP_MANAGER + "/myGroup");
         getRestTestHelper().assertNumberOfGroupMembers(group, 0);
     }
 

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/d128dea9/systests/src/test/java/org/apache/qpid/systest/rest/HttpManagementRestTest.java
----------------------------------------------------------------------
diff --git a/systests/src/test/java/org/apache/qpid/systest/rest/HttpManagementRestTest.java b/systests/src/test/java/org/apache/qpid/systest/rest/HttpManagementRestTest.java
index d85b1e3..298d594 100644
--- a/systests/src/test/java/org/apache/qpid/systest/rest/HttpManagementRestTest.java
+++ b/systests/src/test/java/org/apache/qpid/systest/rest/HttpManagementRestTest.java
@@ -32,8 +32,8 @@ public class HttpManagementRestTest extends QpidRestTestCase
 
     public void testGetHttpManagement() throws Exception
     {
-        Map<String, Object> details = getRestTestHelper().getJsonAsSingletonList(
-                "plugin/" + TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT);
+        Map<String, Object> details =
+                getRestTestHelper().getJsonAsMap("plugin/" + TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT);
 
         assertEquals("Unexpected session timeout", HttpManagement.DEFAULT_TIMEOUT_IN_SECONDS,
                 details.get(HttpManagement.TIME_OUT));
@@ -58,8 +58,8 @@ public class HttpManagementRestTest extends QpidRestTestCase
 
         getRestTestHelper().submitRequest("plugin/" + TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT, "PUT", attributes);
 
-        Map<String, Object> details = getRestTestHelper().getJsonAsSingletonList(
-                "plugin/" + TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT);
+        Map<String, Object> details =
+                getRestTestHelper().getJsonAsMap("plugin/" + TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT);
 
         assertEquals("Unexpected session timeout", 10000, details.get(HttpManagement.TIME_OUT));
         assertEquals("Unexpected http basic auth enabled", true, details.get(HttpManagement.HTTP_BASIC_AUTHENTICATION_ENABLED));

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/d128dea9/systests/src/test/java/org/apache/qpid/systest/rest/KeyStoreRestTest.java
----------------------------------------------------------------------
diff --git a/systests/src/test/java/org/apache/qpid/systest/rest/KeyStoreRestTest.java b/systests/src/test/java/org/apache/qpid/systest/rest/KeyStoreRestTest.java
index c42c9d5..1b34545 100644
--- a/systests/src/test/java/org/apache/qpid/systest/rest/KeyStoreRestTest.java
+++ b/systests/src/test/java/org/apache/qpid/systest/rest/KeyStoreRestTest.java
@@ -62,10 +62,8 @@ public class KeyStoreRestTest extends QpidRestTestCase
         createKeyStore(name, certAlias, TestSSLConstants.KEYSTORE, TestSSLConstants.KEYSTORE_PASSWORD);
         assertNumberOfKeyStores(2);
 
-        List<Map<String, Object>> keyStores = getRestTestHelper().getJsonAsList("keystore/" + name + "?actuals=true");
-        assertNotNull("details cannot be null", keyStores);
+        Map<String, Object> keystore = getRestTestHelper().getJsonAsMap("keystore/" + name + "?actuals=true");
 
-        Map<String, Object> keystore = keyStores.get(0);
         assertEquals("Unexpected name", name, keystore.get(KeyStore.NAME));
         assertEquals("unexpected path to key store", TestSSLConstants.KEYSTORE, keystore.get(FileKeyStore.STORE_URL));
         assertEquals("unexpected password", AbstractConfiguredObject.SECURED_STRING_VALUE, keystore.get(FileKeyStore.PASSWORD));
@@ -82,10 +80,8 @@ public class KeyStoreRestTest extends QpidRestTestCase
         createKeyStore(name, null, dataUrlForKeyStore, TestSSLConstants.KEYSTORE_PASSWORD);
         assertNumberOfKeyStores(2);
 
-        List<Map<String, Object>> keyStores = getRestTestHelper().getJsonAsList("keystore/" + name + "?actuals=true");
-        assertNotNull("details cannot be null", keyStores);
+        Map<String, Object> keystore = getRestTestHelper().getJsonAsMap("keystore/" + name + "?actuals=true");
 
-        Map<String, Object> keystore = keyStores.get(0);
         assertEquals("Unexpected name", name, keystore.get(KeyStore.NAME));
         assertEquals("unexpected data", AbstractConfiguredObject.SECURED_STRING_VALUE, keystore.get(FileKeyStore.STORE_URL));
         assertEquals("unexpected password", AbstractConfiguredObject.SECURED_STRING_VALUE, keystore.get(FileKeyStore.PASSWORD));
@@ -127,10 +123,8 @@ public class KeyStoreRestTest extends QpidRestTestCase
 
         getRestTestHelper().submitRequest("keystore/" + name, "PUT", attributes, HttpServletResponse.SC_OK);
 
-        List<Map<String, Object>> keyStores = getRestTestHelper().getJsonAsList("keystore/" + name + "?actuals=true");
-        assertNotNull("details should not be null", keyStores);
+        Map<String, Object> keystore = getRestTestHelper().getJsonAsMap("keystore/" + name + "?actuals=true");
 
-        Map<String, Object> keystore = keyStores.get(0);
         assertEquals("Unexpected name", name, keystore.get(KeyStore.NAME));
         assertEquals("unexpected data", TestSSLConstants.UNTRUSTED_KEYSTORE, keystore.get(FileKeyStore.STORE_URL));
         assertEquals("unexpected password", AbstractConfiguredObject.SECURED_STRING_VALUE, keystore.get(FileKeyStore.PASSWORD));

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/d128dea9/systests/src/test/java/org/apache/qpid/systest/rest/PortRestTest.java
----------------------------------------------------------------------
diff --git a/systests/src/test/java/org/apache/qpid/systest/rest/PortRestTest.java b/systests/src/test/java/org/apache/qpid/systest/rest/PortRestTest.java
index ca7c1d2..6b99bd4 100644
--- a/systests/src/test/java/org/apache/qpid/systest/rest/PortRestTest.java
+++ b/systests/src/test/java/org/apache/qpid/systest/rest/PortRestTest.java
@@ -20,6 +20,8 @@
  */
 package org.apache.qpid.systest.rest;
 
+import static javax.servlet.http.HttpServletResponse.SC_CREATED;
+import static javax.servlet.http.HttpServletResponse.SC_OK;
 import static org.apache.qpid.server.management.plugin.servlet.rest.AbstractServlet.SC_UNPROCESSABLE_ENTITY;
 
 import java.net.InetSocketAddress;
@@ -48,7 +50,7 @@ public class PortRestTest extends QpidRestTestCase
 
     public void testGet() throws Exception
     {
-        List<Map<String, Object>> ports = getRestTestHelper().getJsonAsList("port/");
+        List<Map<String, Object>> ports = getRestTestHelper().getJsonAsList("port");
         assertNotNull("Port data cannot be null", ports);
         assertEquals("Unexpected number of ports", 2, ports.size());
 
@@ -65,14 +67,14 @@ public class PortRestTest extends QpidRestTestCase
 
     public void testGetPort() throws Exception
     {
-        List<Map<String, Object>> ports = getRestTestHelper().getJsonAsList("port/");
+        List<Map<String, Object>> ports = getRestTestHelper().getJsonAsList("port");
         assertNotNull("Ports data cannot be null", ports);
         assertEquals("Unexpected number of ports", 2, ports.size());
         for (Map<String, Object> portMap : ports)
         {
             String portName = (String) portMap.get(Port.NAME);
             assertNotNull("Port name attribute is not found", portName);
-            Map<String, Object> portData = getRestTestHelper().getJsonAsSingletonList("port/" + getRestTestHelper().encodeAsUTF(portName));
+            Map<String, Object> portData = getRestTestHelper().getJsonAsMap("port/" + getRestTestHelper().encodeAsUTF(portName));
             assertNotNull("Port " + portName + " is not found", portData);
             Asserts.assertPortAttributes(portData);
         }
@@ -86,21 +88,17 @@ public class PortRestTest extends QpidRestTestCase
         attributes.put(Port.PORT, 0);
         attributes.put(Port.AUTHENTICATION_PROVIDER, TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER);
 
-        int responseCode = getRestTestHelper().submitRequest("port/" + portName, "PUT", attributes);
-        assertEquals("Unexpected response code", 201, responseCode);
+        getRestTestHelper().submitRequest("port/" + portName, "PUT", attributes, SC_CREATED);
+
+        Map<String, Object> port = getRestTestHelper().getJsonAsMap("port/" + portName);
 
-        List<Map<String, Object>> portDetails = getRestTestHelper().getJsonAsList("port/" + portName);
-        assertNotNull("Port details cannot be null", portDetails);
-        assertEquals("Unexpected number of ports with name " + portName, 1, portDetails.size());
-        Map<String, Object> port = portDetails.get(0);
         Asserts.assertPortAttributes(port);
 
         // make sure that port is there after broker restart
         restartDefaultBroker();
 
-        portDetails = getRestTestHelper().getJsonAsList("port/" + portName);
-        assertNotNull("Port details cannot be null", portDetails);
-        assertEquals("Unexpected number of ports with name " + portName, 1, portDetails.size());
+        port = getRestTestHelper().getJsonAsMap("port/" + portName);
+        Asserts.assertPortAttributes(port);
     }
 
     public void testPutCreateAndUpdateAmqpPort() throws Exception
@@ -111,28 +109,29 @@ public class PortRestTest extends QpidRestTestCase
         attributes.put(Port.PORT, 0);
         attributes.put(Port.AUTHENTICATION_PROVIDER, TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER);
 
-        int responseCode = getRestTestHelper().submitRequest("port/" + portName, "PUT", attributes);
-        assertEquals("Unexpected response code for port creation", 201, responseCode);
+        getRestTestHelper().submitRequest("port/" + portName, "PUT", attributes, SC_CREATED);
 
-        List<Map<String, Object>> portDetails = getRestTestHelper().getJsonAsList("port/" + portName);
-        assertNotNull("Port details cannot be null", portDetails);
-        assertEquals("Unexpected number of ports with name " + portName, 1, portDetails.size());
-        Map<String, Object> port = portDetails.get(0);
+        Map<String, Object> port = getRestTestHelper().getJsonAsMap("port/" + portName);
         Asserts.assertPortAttributes(port);
 
         Map<String, Object> authProviderAttributes = new HashMap<String, Object>();
         authProviderAttributes.put(AuthenticationProvider.TYPE, AnonymousAuthenticationManager.PROVIDER_TYPE);
         authProviderAttributes.put(AuthenticationProvider.NAME, TestBrokerConfiguration.ENTRY_NAME_ANONYMOUS_PROVIDER);
 
-        responseCode = getRestTestHelper().submitRequest("authenticationprovider/" + TestBrokerConfiguration.ENTRY_NAME_ANONYMOUS_PROVIDER, "PUT", authProviderAttributes);
-        assertEquals("Unexpected response code for authentication provider creation", 201, responseCode);
+        getRestTestHelper().submitRequest("authenticationprovider/" + TestBrokerConfiguration.ENTRY_NAME_ANONYMOUS_PROVIDER, "PUT", authProviderAttributes, SC_CREATED);
 
         attributes = new HashMap<>(port);
         attributes.put(Port.AUTHENTICATION_PROVIDER, TestBrokerConfiguration.ENTRY_NAME_ANONYMOUS_PROVIDER);
         attributes.put(Port.PROTOCOLS, Collections.singleton(Protocol.AMQP_0_9_1));
 
-        responseCode = getRestTestHelper().submitRequest("port/" + portName, "PUT", attributes);
-        assertEquals("Unexpected response code for port update", 200, responseCode);
+        getRestTestHelper().submitRequest("port/" + portName, "PUT", attributes, SC_OK);
+        port = getRestTestHelper().getJsonAsMap("port/" + portName);
+        assertEquals("Unexpected authentication provider",
+                     TestBrokerConfiguration.ENTRY_NAME_ANONYMOUS_PROVIDER,
+                     port.get(Port.AUTHENTICATION_PROVIDER));
+        assertEquals("Unexpected authentication protocols",
+                     new HashSet<>(Collections.singleton(Protocol.AMQP_0_9_1.name())),
+                     new HashSet<>((Collection<String>) port.get(Port.PROTOCOLS)));
     }
 
     public void testUpdatePortTransportFromTCPToSSLWhenKeystoreIsConfigured() throws Exception
@@ -146,7 +145,7 @@ public class PortRestTest extends QpidRestTestCase
         int responseCode = getRestTestHelper().submitRequest("port/" + portName, "PUT", attributes);
         assertEquals("Transport has not been changed to SSL " , 200, responseCode);
 
-        Map<String, Object> port = getRestTestHelper().getJsonAsSingletonList("port/" + portName);
+        Map<String, Object> port = getRestTestHelper().getJsonAsMap("port/" + portName);
 
         @SuppressWarnings("unchecked")
         Collection<String> transports = (Collection<String>) port.get(Port.TRANSPORTS);
@@ -188,7 +187,7 @@ public class PortRestTest extends QpidRestTestCase
         responseCode = getRestTestHelper().submitRequest("port/" + portName, "PUT", attributes);
         assertEquals("Attributes for need/want client auth are not set", 200, responseCode);
 
-        Map<String, Object> port = getRestTestHelper().getJsonAsSingletonList("port/" + portName);
+        Map<String, Object> port = getRestTestHelper().getJsonAsMap("port/" + portName);
         assertEquals("Unexpected " + Port.NEED_CLIENT_AUTH, true, port.get(Port.NEED_CLIENT_AUTH));
         assertEquals("Unexpected " + Port.WANT_CLIENT_AUTH, true, port.get(Port.WANT_CLIENT_AUTH));
         assertEquals("Unexpected " + Port.KEY_STORE, TestBrokerConfiguration.ENTRY_NAME_SSL_KEYSTORE, port.get(Port.KEY_STORE));
@@ -214,7 +213,7 @@ public class PortRestTest extends QpidRestTestCase
         responseCode = getRestTestHelper().submitRequest("port/" + portName, "PUT", attributes);
         assertEquals("Should be able to change transport to TCP ", 200, responseCode);
 
-        port = getRestTestHelper().getJsonAsSingletonList("port/" + portName);
+        port = getRestTestHelper().getJsonAsMap("port/" + portName);
         assertEquals("Unexpected " + Port.NEED_CLIENT_AUTH, false, port.get(Port.NEED_CLIENT_AUTH));
         assertEquals("Unexpected " + Port.WANT_CLIENT_AUTH, false, port.get(Port.WANT_CLIENT_AUTH));
 
@@ -254,8 +253,7 @@ public class PortRestTest extends QpidRestTestCase
         attributes.put(Port.AUTHENTICATION_PROVIDER, TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER);
         responseCode = getRestTestHelper().submitRequest("port/" + portName, "PUT", attributes);
         assertEquals("Unexpected response when trying to change auth provider to existing one", 200, responseCode);
-
-        Map<String, Object> port = getRestTestHelper().getJsonAsSingletonList("port/" + portName);
+        Map<String, Object> port = getRestTestHelper().getJsonAsMap("port/" + portName);
         assertEquals("Unexpected auth provider", TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER, port.get(Port.AUTHENTICATION_PROVIDER));
     }
 
@@ -267,14 +265,16 @@ public class PortRestTest extends QpidRestTestCase
         getRestTestHelper().setUsernameAndPassword(SystemConfig.MANAGEMENT_MODE_USER_NAME, MANAGEMENT_MODE_PASSWORD);
 
         String ampqPortName = TestBrokerConfiguration.ENTRY_NAME_AMQP_PORT;
-        Map<String, Object> portData = getRestTestHelper().getJsonAsSingletonList("port/" + getRestTestHelper().encodeAsUTF(ampqPortName));
+        Map<String, Object> portData =
+                getRestTestHelper().getJsonAsMap("port/" + getRestTestHelper().encodeAsUTF(ampqPortName));
         Asserts.assertPortAttributes(portData, State.QUIESCED);
     }
 
     public void testDeletePort() throws Exception
     {
         String ampqPortName = TestBrokerConfiguration.ENTRY_NAME_AMQP_PORT;
-        Map<String, Object> portData = getRestTestHelper().getJsonAsSingletonList("port/" + getRestTestHelper().encodeAsUTF(ampqPortName));
+        Map<String, Object> portData =
+                getRestTestHelper().getJsonAsMap("port/" + getRestTestHelper().encodeAsUTF(ampqPortName));
         assertFalse("Port data are not found", portData.isEmpty());
 
         int deleteResponseCode = getRestTestHelper().submitRequest("port/" + ampqPortName, "DELETE");

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/d128dea9/systests/src/test/java/org/apache/qpid/systest/rest/QueueRestTest.java
----------------------------------------------------------------------
diff --git a/systests/src/test/java/org/apache/qpid/systest/rest/QueueRestTest.java b/systests/src/test/java/org/apache/qpid/systest/rest/QueueRestTest.java
index dff4fcf..73189ef 100644
--- a/systests/src/test/java/org/apache/qpid/systest/rest/QueueRestTest.java
+++ b/systests/src/test/java/org/apache/qpid/systest/rest/QueueRestTest.java
@@ -20,6 +20,8 @@
  */
 package org.apache.qpid.systest.rest;
 
+import static javax.servlet.http.HttpServletResponse.SC_NOT_FOUND;
+
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -30,6 +32,8 @@ import javax.jms.Message;
 import javax.jms.MessageConsumer;
 import javax.jms.MessageProducer;
 import javax.jms.Session;
+import javax.jms.TemporaryQueue;
+import javax.servlet.http.HttpServletResponse;
 
 import org.apache.qpid.server.model.BrokerModel;
 import org.apache.qpid.server.model.ConfiguredObject;
@@ -39,7 +43,6 @@ import org.apache.qpid.server.model.Queue;
 
 public class QueueRestTest extends QpidRestTestCase
 {
-    private static final String QUEUE_ATTRIBUTE_CONSUMERS = "consumers";
 
     /**
      * Message number to publish into queue
@@ -53,56 +56,98 @@ public class QueueRestTest extends QpidRestTestCase
     private static final int DEQUEUED_MESSAGES = 1;
 
     private Connection _connection;
+    private Session _session;
 
     @Override
     public void setUp() throws Exception
     {
         super.setUp();
         _connection = getConnection();
-        Session session = _connection.createSession(true, Session.SESSION_TRANSACTED);
-        Destination queue = createTestQueue(session);
-        session.commit();
-        MessageConsumer consumer = session.createConsumer(queue);
-        MessageProducer producer = session.createProducer(queue);
+        _session = _connection.createSession(true, Session.SESSION_TRANSACTED);
+        Destination queue = createTestQueue(_session);
+        _session.commit();
+        MessageConsumer consumer = _session.createConsumer(queue);
+        MessageProducer producer = _session.createProducer(queue);
 
         for (int i = 0; i < MESSAGE_NUMBER; i++)
         {
-            producer.send(session.createTextMessage("Test-" + i));
+            producer.send(_session.createTextMessage("Test-" + i));
         }
-        session.commit();
+        _session.commit();
         _connection.start();
-        Message m = consumer.receive(1000l);
+        Message m = consumer.receive(getReceiveTimeout());
         assertNotNull("Message is not received", m);
-        session.commit();
+        _session.commit();
     }
 
-    public void testGetVirtualHostQueues() throws Exception
+    public void testGetByName() throws Exception
     {
         String queueName = getTestQueueName();
-        List<Map<String, Object>> queues = getRestTestHelper().getJsonAsList("queue/test");
-        assertEquals("Unexpected number of queues", 1, queues.size());
-        String[] expectedQueues = new String[]{queueName};
 
-        for (String name : expectedQueues)
-        {
-            Map<String, Object> queueDetails = getRestTestHelper().find(Queue.NAME, name, queues);
-            Asserts.assertQueue(name, "standard", queueDetails);
-        }
+        Map<String, Object> queueDetails =
+                getRestTestHelper().getJsonAsMap(String.format("queue/test/test/%s", queueName));
+        Asserts.assertQueue(queueName, "standard", queueDetails);
     }
 
-    public void testGetByName() throws Exception
+    public void testGetByNameAsList() throws Exception
     {
         String queueName = getTestQueueName();
+
         Map<String, Object> queueDetails =
-                getRestTestHelper().getJsonAsSingletonList("queue/test/test/" + queueName + "?depth=1");
+                getRestTestHelper().getJsonAsSingletonList(String.format("queue/test/test/%s?singletonModelObjectResponseAsList=true", queueName));
         Asserts.assertQueue(queueName, "standard", queueDetails);
-        assertStatistics(queueDetails);
+    }
 
-        @SuppressWarnings("unchecked")
-        List<Map<String, Object>> consumers = (List<Map<String, Object>>) queueDetails.get(QUEUE_ATTRIBUTE_CONSUMERS);
-        assertNotNull("Queue consumers are not found", consumers);
-        assertEquals("Unexpected number of consumers", 1, consumers.size());
-        assertConsumer(consumers.get(0));
+    public void testGetById() throws Exception
+    {
+        String queueName = getTestQueueName();
+        Map<String, Object> queueDetails =
+                getRestTestHelper().getJsonAsMap(String.format("queue/test/test/%s", queueName));
+        String queueId = (String) queueDetails.get(Queue.ID);
+
+        List<Map<String, Object>> filteredResults = getRestTestHelper().getJsonAsList("queue/test/test?id=" + queueId);
+        assertEquals("Unexpected number of queues when querying by id filter", 1, filteredResults.size());
+    }
+
+    public void testGetByName_NotFound() throws Exception
+    {
+        String queueName = "notfound";
+        getRestTestHelper().submitRequest(String.format("queue/test/test/%s", queueName), "GET", SC_NOT_FOUND);
+    }
+
+    public void testGetAllQueues() throws Exception
+    {
+        List<Map<String, Object>> brokerQueues = getRestTestHelper().getJsonAsList("queue");
+        assertEquals("Unexpected number of queues queried broker-wide", 1, brokerQueues.size());
+
+        List<Map<String, Object>> vhnQueues = getRestTestHelper().getJsonAsList("queue/test");
+        assertEquals("Unexpected number of queues queried virtualhostnode scoped", 1, vhnQueues.size());
+
+        List<Map<String, Object>> vhQueues = getRestTestHelper().getJsonAsList("queue/test/test");
+        assertEquals("Unexpected number of queues queried virtualhost scoped", 1, vhQueues.size());
+
+        TemporaryQueue queue = _session.createTemporaryQueue();
+        queue.getQueueName();
+
+        vhQueues = getRestTestHelper().getJsonAsList("queue/test/test");
+        assertEquals("Unexpected number of queues", 2, vhQueues.size());
+    }
+
+    public void testGetAllQueuesWildcards() throws Exception
+    {
+        List<Map<String, Object>> vhnQueues = getRestTestHelper().getJsonAsList("queue/*");
+        assertEquals("Unexpected number of queues queried virtualhostnode scoped", 1, vhnQueues.size());
+
+        getRestTestHelper().submitRequest("queue/*/test", "GET", HttpServletResponse.SC_NOT_FOUND);
+    }
+
+    public void testGetAll_NotFound() throws Exception
+    {
+        List<Map<String, Object>> vhn2Queues = getRestTestHelper().getJsonAsList(String.format("queue/%s", TEST2_VIRTUALHOST));
+        assertEquals("Unexpected number of queues on vhn : " + TEST2_VIRTUALHOST  , 0, vhn2Queues.size());
+
+        List<Map<String, Object>> vh2Queues = getRestTestHelper().getJsonAsList(String.format("queue/%s/%s", TEST2_VIRTUALHOST, TEST2_VIRTUALHOST));
+        assertEquals("Unexpected number of queues on vhn " + TEST2_VIRTUALHOST, 0, vh2Queues.size());
     }
 
     public void testUpdateQueue() throws Exception
@@ -113,13 +158,12 @@ public class QueueRestTest extends QpidRestTestCase
         attributes.put(Queue.NAME, queueName);
 
         String queueUrl = "queue/test/test/" + queueName;
-        int responseCode =  getRestTestHelper().submitRequest(queueUrl, "PUT", attributes);
-        assertEquals("Queue was not created", 201, responseCode);
+        getRestTestHelper().submitRequest(queueUrl, "PUT", attributes, HttpServletResponse.SC_CREATED);
 
-        Map<String, Object> queueDetails = getRestTestHelper().getJsonAsSingletonList(queueUrl);
+        Map<String, Object> queueDetails = getRestTestHelper().getJsonAsMap(queueUrl);
         Asserts.assertQueue(queueName, "standard", queueDetails);
 
-        attributes = new HashMap<String, Object>();
+        attributes = new HashMap<>();
         attributes.put(Queue.NAME, queueName);
         attributes.put(Queue.MAXIMUM_QUEUE_DEPTH_MESSAGES, 100000);
         attributes.put(Queue.ALERT_REPEAT_GAP, 10000);
@@ -129,10 +173,9 @@ public class QueueRestTest extends QpidRestTestCase
         attributes.put(Queue.ALERT_THRESHOLD_QUEUE_DEPTH_MESSAGES, 50000);
         attributes.put(Queue.MAXIMUM_DELIVERY_ATTEMPTS, 10);
 
-        responseCode = getRestTestHelper().submitRequest(queueUrl, "PUT", attributes);
-        assertEquals("Setting of queue attributes should be allowed", 200, responseCode);
+        getRestTestHelper().submitRequest(queueUrl, "PUT", attributes, HttpServletResponse.SC_OK);
 
-        Map<String, Object> queueData = getRestTestHelper().getJsonAsSingletonList(queueUrl);
+        Map<String, Object> queueData = getRestTestHelper().getJson(queueUrl, Map.class);
         assertEquals("Unexpected " + Queue.MAXIMUM_QUEUE_DEPTH_MESSAGES, 100000, queueData.get(Queue.MAXIMUM_QUEUE_DEPTH_MESSAGES));
         assertEquals("Unexpected " + Queue.ALERT_REPEAT_GAP, 10000, queueData.get(Queue.ALERT_REPEAT_GAP) );
         assertEquals("Unexpected " + Queue.ALERT_THRESHOLD_MESSAGE_AGE, 20000, queueData.get(Queue.ALERT_THRESHOLD_MESSAGE_AGE) );

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/d128dea9/systests/src/test/java/org/apache/qpid/systest/rest/TrustStoreRestTest.java
----------------------------------------------------------------------
diff --git a/systests/src/test/java/org/apache/qpid/systest/rest/TrustStoreRestTest.java b/systests/src/test/java/org/apache/qpid/systest/rest/TrustStoreRestTest.java
index 25427c5..70759f9 100644
--- a/systests/src/test/java/org/apache/qpid/systest/rest/TrustStoreRestTest.java
+++ b/systests/src/test/java/org/apache/qpid/systest/rest/TrustStoreRestTest.java
@@ -62,10 +62,8 @@ public class TrustStoreRestTest extends QpidRestTestCase
         createTrustStore(name, true, TestSSLConstants.TRUSTSTORE, TestSSLConstants.TRUSTSTORE_PASSWORD);
         assertNumberOfTrustStores(2);
 
-        List<Map<String, Object>> trustStores = getRestTestHelper().getJsonAsList("truststore/" + name);
-        assertNotNull("details cannot be null", trustStores);
+        Map<String, Object> truststore = getRestTestHelper().getJsonAsMap("truststore/" + name);
 
-        Map<String, Object> truststore = trustStores.get(0);
         assertEquals("unexpected trust store name", name, truststore.get(TrustStore.NAME));
         assertEquals("unexpected store URL", TestSSLConstants.TRUSTSTORE, truststore.get(FileTrustStore.STORE_URL));
         assertEquals("unexpected password value", AbstractConfiguredObject.SECURED_STRING_VALUE, truststore.get(FileTrustStore.PASSWORD));
@@ -85,10 +83,8 @@ public class TrustStoreRestTest extends QpidRestTestCase
 
         assertNumberOfTrustStores(2);
 
-        List<Map<String, Object>> trustStores = getRestTestHelper().getJsonAsList("truststore/" + name);
-        assertNotNull("details cannot be null", trustStores);
+        Map<String, Object> truststore = getRestTestHelper().getJsonAsMap("truststore/" + name);
 
-        Map<String, Object> truststore = trustStores.get(0);
         assertEquals("nexpected trust store name", name, truststore.get(TrustStore.NAME));
         assertEquals("unexpected store URL value",  ConfiguredObject.OVER_SIZED_ATTRIBUTE_ALTERNATIVE_TEXT, truststore.get(FileTrustStore.STORE_URL));
         assertEquals("unexpected password value", AbstractConfiguredObject.SECURED_STRING_VALUE, truststore.get(FileTrustStore.PASSWORD));
@@ -132,15 +128,13 @@ public class TrustStoreRestTest extends QpidRestTestCase
 
         getRestTestHelper().submitRequest("truststore/" + name , "PUT", attributes, HttpServletResponse.SC_OK);
 
-        List<Map<String, Object>> trustStore = getRestTestHelper().getJsonAsList("truststore/" + name);
-        assertNotNull("details should not be null", trustStore);
+        Map<String, Object> trustStore = getRestTestHelper().getJsonAsMap("truststore/" + name);
 
-        Map<String, Object> truststore = trustStore.get(0);
-        assertEquals("unexpected name", name, truststore.get(TrustStore.NAME));
-        assertEquals("unexpected path to trust store",  TestSSLConstants.TRUSTSTORE, truststore.get(FileTrustStore.STORE_URL));
-        assertEquals("unexpected password", AbstractConfiguredObject.SECURED_STRING_VALUE, truststore.get(FileTrustStore.PASSWORD));
-        assertEquals("unexpected type", java.security.KeyStore.getDefaultType(), truststore.get(FileTrustStore.TRUST_STORE_TYPE));
-        assertEquals("unexpected peersOnly value", false, truststore.get(FileTrustStore.PEERS_ONLY));
+        assertEquals("unexpected name", name, trustStore.get(TrustStore.NAME));
+        assertEquals("unexpected path to trust store",  TestSSLConstants.TRUSTSTORE, trustStore.get(FileTrustStore.STORE_URL));
+        assertEquals("unexpected password", AbstractConfiguredObject.SECURED_STRING_VALUE, trustStore.get(FileTrustStore.PASSWORD));
+        assertEquals("unexpected type", java.security.KeyStore.getDefaultType(), trustStore.get(FileTrustStore.TRUST_STORE_TYPE));
+        assertEquals("unexpected peersOnly value", false, trustStore.get(FileTrustStore.PEERS_ONLY));
     }
 
     private List<Map<String, Object>> assertNumberOfTrustStores(int numberOfTrustStores) throws Exception

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/d128dea9/systests/src/test/java/org/apache/qpid/systest/rest/UserRestTest.java
----------------------------------------------------------------------
diff --git a/systests/src/test/java/org/apache/qpid/systest/rest/UserRestTest.java b/systests/src/test/java/org/apache/qpid/systest/rest/UserRestTest.java
index 1c96947..cfaffec 100644
--- a/systests/src/test/java/org/apache/qpid/systest/rest/UserRestTest.java
+++ b/systests/src/test/java/org/apache/qpid/systest/rest/UserRestTest.java
@@ -67,8 +67,10 @@ public class UserRestTest extends QpidRestTestCase
             assertNotNull("Attribute " + User.ID, user.get(User.ID));
             String userName = (String) user.get(User.NAME);
             assertNotNull("Attribute " + User.NAME, userName);
-            Map<String, Object> userDetails = getRestTestHelper().getJsonAsSingletonList("user/"
-                    + TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER + "/" + userName);
+            Map<String, Object> userDetails = getRestTestHelper().getJsonAsMap("user/"
+                                                                               + TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER
+                                                                               + "/"
+                                                                               + userName);
             assertUser(userDetails);
             assertEquals("Unexpected user name", userName, userDetails.get(User.NAME));
         }
@@ -79,8 +81,10 @@ public class UserRestTest extends QpidRestTestCase
         String userName = getTestName();
         getRestTestHelper().createOrUpdateUser(userName, "newPassword");
 
-        Map<String, Object> userDetails = getRestTestHelper().getJsonAsSingletonList("user/"
-                + TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER + "/" + userName);
+        Map<String, Object> userDetails = getRestTestHelper().getJsonAsMap("user/"
+                                                                           + TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER
+                                                                           + "/"
+                                                                           + userName);
         assertUser(userDetails);
         assertEquals("Unexpected user name", userName, userDetails.get(User.NAME));
     }
@@ -96,7 +100,7 @@ public class UserRestTest extends QpidRestTestCase
         String url = "user/" + TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER;
         getRestTestHelper().submitRequest(url, "POST", userAttributes, HttpServletResponse.SC_CREATED);
 
-        Map<String, Object> userDetails = getRestTestHelper().getJsonAsSingletonList(url+ "/" + userName);
+        Map<String, Object> userDetails = getRestTestHelper().getJsonAsMap(url + "/" + userName);
         assertUser(userDetails);
         assertEquals("Unexpected user name", userName, userDetails.get(User.NAME));
 
@@ -115,7 +119,7 @@ public class UserRestTest extends QpidRestTestCase
         String url = "user/" + TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER;
         getRestTestHelper().submitRequest(url, "PUT", userAttributes, HttpServletResponse.SC_CREATED);
 
-        Map<String, Object> userDetails = getRestTestHelper().getJsonAsSingletonList(url+ "/" + userName);
+        Map<String, Object> userDetails = getRestTestHelper().getJsonAsMap(url + "/" + userName);
         assertUser(userDetails);
         assertEquals("Unexpected user name", userName, userDetails.get(User.NAME));
 
@@ -141,8 +145,10 @@ public class UserRestTest extends QpidRestTestCase
         String userName = getTestName();
         getRestTestHelper().createOrUpdateUser(userName, "newPassword");
 
-        Map<String, Object> userDetails = getRestTestHelper().getJsonAsSingletonList("user/"
-                + TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER + "/" + userName);
+        Map<String, Object> userDetails = getRestTestHelper().getJsonAsMap("user/"
+                                                                           + TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER
+                                                                           + "/"
+                                                                           + userName);
         String id = (String) userDetails.get(User.ID);
 
         getRestTestHelper().removeUserById(id);

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/d128dea9/systests/src/test/java/org/apache/qpid/systest/rest/VirtualHostLoggerRestTest.java
----------------------------------------------------------------------
diff --git a/systests/src/test/java/org/apache/qpid/systest/rest/VirtualHostLoggerRestTest.java b/systests/src/test/java/org/apache/qpid/systest/rest/VirtualHostLoggerRestTest.java
index 2a03a5f..0748c3c 100644
--- a/systests/src/test/java/org/apache/qpid/systest/rest/VirtualHostLoggerRestTest.java
+++ b/systests/src/test/java/org/apache/qpid/systest/rest/VirtualHostLoggerRestTest.java
@@ -49,7 +49,7 @@ public class VirtualHostLoggerRestTest extends QpidRestTestCase
         virtualHostLoggerAttributes.put(ConfiguredObject.TYPE, VirtualHostFileLogger.TYPE);
 
         getRestTestHelper().submitRequest(loggerRestUrlBase, "PUT", virtualHostLoggerAttributes, HttpServletResponse.SC_CREATED);
-        Map<String, Object> loggerData = getRestTestHelper().getJsonAsSingletonList(loggerRestUrl);
+        Map<String, Object> loggerData = getRestTestHelper().getJsonAsMap(loggerRestUrl);
 
         String loggerRuleName = "testRule";
         Map<String, Object> virtualHostRuleAttributes = new HashMap<>();

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/d128dea9/systests/src/test/java/org/apache/qpid/systest/rest/VirtualHostNodeRestTest.java
----------------------------------------------------------------------
diff --git a/systests/src/test/java/org/apache/qpid/systest/rest/VirtualHostNodeRestTest.java b/systests/src/test/java/org/apache/qpid/systest/rest/VirtualHostNodeRestTest.java
index b1e1438..b216e86 100644
--- a/systests/src/test/java/org/apache/qpid/systest/rest/VirtualHostNodeRestTest.java
+++ b/systests/src/test/java/org/apache/qpid/systest/rest/VirtualHostNodeRestTest.java
@@ -79,10 +79,10 @@ public class VirtualHostNodeRestTest  extends QpidRestTestCase
                                           HttpServletResponse.SC_CREATED);
 
 
-        Map<String, Object> virtualhostNode = getRestTestHelper().getJsonAsSingletonList("virtualhostnode/" + nodeName);
+        Map<String, Object> virtualhostNode = getRestTestHelper().getJsonAsMap("virtualhostnode/" + nodeName);
         Asserts.assertVirtualHostNode(nodeName, virtualhostNode);
 
-        Map<String, Object> virtualhost = getRestTestHelper().getJsonAsSingletonList("virtualhost/" + nodeName + "/" + nodeName);
+        Map<String, Object> virtualhost = getRestTestHelper().getJsonAsMap("virtualhost/" + nodeName + "/" + nodeName);
         Asserts.assertVirtualHost(nodeName, virtualhost);
     }
 
@@ -94,7 +94,7 @@ public class VirtualHostNodeRestTest  extends QpidRestTestCase
         createVirtualHostNode(nodeName, virtualhostNodeType);
 
         String restUrl = "virtualhostnode/" + nodeName;
-        Map<String, Object> virtualhostNode = getRestTestHelper().getJsonAsSingletonList(restUrl);
+        Map<String, Object> virtualhostNode = getRestTestHelper().getJsonAsMap(restUrl);
         Asserts.assertVirtualHostNode(nodeName, virtualhostNode);
         assertNull("Virtualhostnode should not automatically get a virtualhost child",
                 virtualhostNode.get("virtualhosts"));
@@ -134,7 +134,7 @@ public class VirtualHostNodeRestTest  extends QpidRestTestCase
     {
         String restUrl = "virtualhostnode/" + TEST3_VIRTUALHOST;
 
-        Map<String, Object> virtualhostNode = getRestTestHelper().getJsonAsSingletonList(restUrl);
+        Map<String, Object> virtualhostNode = getRestTestHelper().getJsonAsMap(restUrl);
         assertNull(virtualhostNode.get(VirtualHostNode.DESCRIPTION));
 
         String newDescription = "My virtualhost node";
@@ -143,7 +143,7 @@ public class VirtualHostNodeRestTest  extends QpidRestTestCase
 
         getRestTestHelper().submitRequest(restUrl, "PUT", newAttributes, HttpServletResponse.SC_OK);
 
-        virtualhostNode = getRestTestHelper().getJsonAsSingletonList(restUrl);
+        virtualhostNode = getRestTestHelper().getJsonAsMap(restUrl);
         assertEquals(newDescription, virtualhostNode.get(VirtualHostNode.DESCRIPTION));
     }
 
@@ -167,7 +167,7 @@ public class VirtualHostNodeRestTest  extends QpidRestTestCase
         String url = "virtualhostnode";
         getRestTestHelper().submitRequest(url, method, nodeData, HttpServletResponse.SC_CREATED);
 
-        Map<String, Object> virtualhostNode = getRestTestHelper().getJsonAsSingletonList(url + "/" + nodeName);
+        Map<String, Object> virtualhostNode = getRestTestHelper().getJsonAsMap(url + "/" + nodeName);
         Asserts.assertVirtualHostNode(nodeName, virtualhostNode);
     }
 
@@ -181,7 +181,7 @@ public class VirtualHostNodeRestTest  extends QpidRestTestCase
         assertTrue("Store should exist after creation of node", storePathAsFile.exists());
 
         String restUrl = "virtualhostnode/" + nodeName;
-        Map<String, Object> virtualhostNode = getRestTestHelper().getJsonAsSingletonList(restUrl);
+        Map<String, Object> virtualhostNode = getRestTestHelper().getJsonAsMap(restUrl);
         Asserts.assertVirtualHostNode(nodeName, virtualhostNode);
         assertNull("Virtualhostnode should not automatically get a virtualhost child",
                 virtualhostNode.get("virtualhosts"));
@@ -194,7 +194,7 @@ public class VirtualHostNodeRestTest  extends QpidRestTestCase
                                              final String expectedDesiredState,
                                              final String expectedActualState) throws IOException
     {
-        Map<String, Object> virtualhostNode = getRestTestHelper().getJsonAsSingletonList(restUrl);
+        Map<String, Object> virtualhostNode = getRestTestHelper().getJsonAsMap(restUrl);
         Asserts.assertActualAndDesiredState(expectedDesiredState, expectedActualState, virtualhostNode);
     }
 

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/d128dea9/systests/src/test/java/org/apache/qpid/systest/rest/VirtualHostRestTest.java
----------------------------------------------------------------------
diff --git a/systests/src/test/java/org/apache/qpid/systest/rest/VirtualHostRestTest.java b/systests/src/test/java/org/apache/qpid/systest/rest/VirtualHostRestTest.java
index 1628f8d..e4b9559 100644
--- a/systests/src/test/java/org/apache/qpid/systest/rest/VirtualHostRestTest.java
+++ b/systests/src/test/java/org/apache/qpid/systest/rest/VirtualHostRestTest.java
@@ -20,6 +20,8 @@
  */
 package org.apache.qpid.systest.rest;
 
+import static javax.servlet.http.HttpServletResponse.SC_NOT_FOUND;
+import static javax.servlet.http.HttpServletResponse.SC_OK;
 import static org.apache.qpid.server.management.plugin.servlet.rest.AbstractServlet.SC_UNPROCESSABLE_ENTITY;
 
 import java.io.IOException;
@@ -83,7 +85,7 @@ public class VirtualHostRestTest extends QpidRestTestCase
         Session session = _connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
         createTestQueue(session);
 
-        Map<String, Object> hostDetails = getRestTestHelper().getJsonAsSingletonList("virtualhost/test");
+        Map<String, Object> hostDetails = getRestTestHelper().getJsonAsMap("virtualhost/test/test");
         Asserts.assertVirtualHost("test", hostDetails);
 
         @SuppressWarnings("unchecked")
@@ -122,11 +124,11 @@ public class VirtualHostRestTest extends QpidRestTestCase
         Map<String, Object> requestData = submitVirtualHost(true, "PUT", HttpServletResponse.SC_CREATED);
         String hostName = (String)requestData.get(VirtualHost.NAME);
 
-        Map<String, Object> hostDetails = getRestTestHelper().getJsonAsSingletonList("virtualhost/"
-                                                                                     + EMPTY_VIRTUALHOSTNODE_NAME
-                                                                                     + "/"
-                                                                                     + hostName
-                                                                                     + "?depth=1");
+        Map<String, Object> hostDetails = getRestTestHelper().getJsonAsMap("virtualhost/"
+                                                                           + EMPTY_VIRTUALHOSTNODE_NAME
+                                                                           + "/"
+                                                                           + hostName
+                                                                           + "?depth=1");
         Asserts.assertVirtualHost(hostName, hostDetails);
 
         assertNewVirtualHost(hostDetails);
@@ -138,7 +140,7 @@ public class VirtualHostRestTest extends QpidRestTestCase
         String hostName = (String)data.get(VirtualHost.NAME);
 
         String url = "virtualhost/" + EMPTY_VIRTUALHOSTNODE_NAME + "/" + hostName + "?depth=1";
-        Map<String, Object> hostDetails = getRestTestHelper().getJsonAsSingletonList(url);
+        Map<String, Object> hostDetails = getRestTestHelper().getJsonAsMap(url);
         Asserts.assertVirtualHost(hostName, hostDetails);
         assertNewVirtualHost(hostDetails);
     }
@@ -148,11 +150,11 @@ public class VirtualHostRestTest extends QpidRestTestCase
         Map<String, Object> data = submitVirtualHost(true, "POST", HttpServletResponse.SC_CREATED);
         String hostName = (String)data.get(VirtualHost.NAME);
 
-        Map<String, Object> hostDetails = getRestTestHelper().getJsonAsSingletonList("virtualhost/"
-                                                                                     + EMPTY_VIRTUALHOSTNODE_NAME
-                                                                                     + "/"
-                                                                                     + hostName
-                                                                                     + "?depth=1");
+        Map<String, Object> hostDetails = getRestTestHelper().getJsonAsMap("virtualhost/"
+                                                                           + EMPTY_VIRTUALHOSTNODE_NAME
+                                                                           + "/"
+                                                                           + hostName
+                                                                           + "?depth=1");
         Asserts.assertVirtualHost(hostName, hostDetails);
         assertNewVirtualHost(hostDetails);
     }
@@ -161,11 +163,11 @@ public class VirtualHostRestTest extends QpidRestTestCase
     {
         Map<String, Object> data = submitVirtualHost(false, "PUT", HttpServletResponse.SC_CREATED);
         String hostName = (String)data.get(VirtualHost.NAME);
-        Map<String, Object> hostDetails = getRestTestHelper().getJsonAsSingletonList("virtualhost/"
-                                                                                     + EMPTY_VIRTUALHOSTNODE_NAME
-                                                                                     + "/"
-                                                                                     + hostName
-                                                                                     + "?depth=1");
+        Map<String, Object> hostDetails = getRestTestHelper().getJsonAsMap("virtualhost/"
+                                                                           + EMPTY_VIRTUALHOSTNODE_NAME
+                                                                           + "/"
+                                                                           + hostName
+                                                                           + "?depth=1");
         Asserts.assertVirtualHost(hostName, hostDetails);
 
         assertNewVirtualHost(hostDetails);
@@ -174,18 +176,18 @@ public class VirtualHostRestTest extends QpidRestTestCase
 
     public void testCreateVirtualHostByPostUsingVirtualHostURI() throws Exception
     {
-        Map<String, Object> data = submitVirtualHost(false, "POST", HttpServletResponse.SC_NOT_FOUND);
+        Map<String, Object> data = submitVirtualHost(false, "POST", SC_NOT_FOUND);
 
         String hostName = (String)data.get(VirtualHost.NAME);
         getRestTestHelper().submitRequest("virtualhost/" + EMPTY_VIRTUALHOSTNODE_NAME + "/" + hostName,
-                "GET", HttpServletResponse.SC_NOT_FOUND);
+                "GET", SC_NOT_FOUND);
     }
 
     public void testDeleteHost() throws Exception
     {
         getRestTestHelper().submitRequest("virtualhost/" + TEST3_VIRTUALHOST + "/" + TEST3_VIRTUALHOST,
                                           "DELETE",
-                                          HttpServletResponse.SC_OK);
+                                          SC_OK);
 
         List<Map<String, Object>> hosts = getRestTestHelper().getJsonAsList("virtualhost/" + TEST3_VIRTUALHOST);
         assertEquals("Host should be deleted", 0, hosts.size());
@@ -206,13 +208,13 @@ public class VirtualHostRestTest extends QpidRestTestCase
         String hostToUpdate = TEST3_VIRTUALHOST;
         String restHostUrl = "virtualhost/" + hostToUpdate + "/" + hostToUpdate;
 
-        Map<String, Object> hostDetails = getRestTestHelper().getJsonAsSingletonList(restHostUrl);
+        Map<String, Object> hostDetails = getRestTestHelper().getJsonAsMap(restHostUrl);
         Asserts.assertVirtualHost(hostToUpdate, hostDetails);
 
         Map<String, Object> newAttributes = Collections.<String, Object>singletonMap(VirtualHost.DESCRIPTION, "This is a virtual host");
-        getRestTestHelper().submitRequest(restHostUrl, method, newAttributes, HttpServletResponse.SC_OK);
+        getRestTestHelper().submitRequest(restHostUrl, method, newAttributes, SC_OK);
 
-        Map<String, Object> rereadHostDetails = getRestTestHelper().getJsonAsSingletonList(restHostUrl);
+        Map<String, Object> rereadHostDetails = getRestTestHelper().getJsonAsMap(restHostUrl);
         Asserts.assertVirtualHost(hostToUpdate, rereadHostDetails);
         assertEquals("This is a virtual host", rereadHostDetails.get(VirtualHost.DESCRIPTION));
     }
@@ -222,7 +224,7 @@ public class VirtualHostRestTest extends QpidRestTestCase
         String hostToUpdate = TEST3_VIRTUALHOST;
         String restHostUrl = "virtualhost/" + hostToUpdate + "/" + hostToUpdate;
 
-        Map<String, Object> hostDetails = getRestTestHelper().getJsonAsSingletonList(restHostUrl);
+        Map<String, Object> hostDetails = getRestTestHelper().getJsonAsMap(restHostUrl);
         Asserts.assertVirtualHost(hostToUpdate, hostDetails);
 
         NodeAutoCreationPolicy[] policies = new NodeAutoCreationPolicy[] {
@@ -293,8 +295,8 @@ public class VirtualHostRestTest extends QpidRestTestCase
         };
         Map<String, Object> newAttributes = Collections.<String, Object>singletonMap(QueueManagingVirtualHost.NODE_AUTO_CREATION_POLICIES,
                                                                                      Arrays.asList(policies));
-        getRestTestHelper().submitRequest(restHostUrl, "POST", newAttributes, HttpServletResponse.SC_OK);
-        Map<String, Object> rereadHostDetails = getRestTestHelper().getJsonAsSingletonList(restHostUrl);
+        getRestTestHelper().submitRequest(restHostUrl, "POST", newAttributes, SC_OK);
+        Map<String, Object> rereadHostDetails = getRestTestHelper().getJsonAsMap(restHostUrl);
 
         Object retrievedPolicies = rereadHostDetails.get(QueueManagingVirtualHost.NODE_AUTO_CREATION_POLICIES);
         assertNotNull("Retrieved node policies are null", retrievedPolicies);
@@ -320,7 +322,7 @@ public class VirtualHostRestTest extends QpidRestTestCase
         String hostToUpdate = TEST3_VIRTUALHOST;
         String restHostUrl = "virtualhost/" + hostToUpdate + "/" + hostToUpdate;
 
-        Map<String, Object> hostDetails = getRestTestHelper().getJsonAsSingletonList(restHostUrl);
+        Map<String, Object> hostDetails = getRestTestHelper().getJsonAsMap(restHostUrl);
         Asserts.assertVirtualHost(hostToUpdate, hostDetails);
 
         NodeAutoCreationPolicy[] policies = new NodeAutoCreationPolicy[] {
@@ -361,7 +363,7 @@ public class VirtualHostRestTest extends QpidRestTestCase
                                                                                      Arrays.asList(policies));
         getRestTestHelper().submitRequest(restHostUrl, "POST", newAttributes, 422);
 
-        Map<String, Object> rereadHostDetails = getRestTestHelper().getJsonAsSingletonList(restHostUrl);
+        Map<String, Object> rereadHostDetails = getRestTestHelper().getJsonAsMap(restHostUrl);
 
         Object retrievedPolicies = rereadHostDetails.get(QueueManagingVirtualHost.NODE_AUTO_CREATION_POLICIES);
         assertNotNull("Retrieved node policies are null", retrievedPolicies);
@@ -377,13 +379,13 @@ public class VirtualHostRestTest extends QpidRestTestCase
         assertActualAndDesireStates(restHostUrl, "ACTIVE", "ACTIVE");
 
         Map<String, Object> newAttributes = Collections.<String, Object>singletonMap(VirtualHost.DESIRED_STATE, "STOPPED");
-        getRestTestHelper().submitRequest(restHostUrl, "PUT", newAttributes, HttpServletResponse.SC_OK);
+        getRestTestHelper().submitRequest(restHostUrl, "PUT", newAttributes, SC_OK);
 
         _restTestHelper.waitForAttributeChanged(restHostUrl, VirtualHost.STATE, "STOPPED");
         assertActualAndDesireStates(restHostUrl, "STOPPED", "STOPPED");
 
         newAttributes = Collections.<String, Object>singletonMap(VirtualHost.DESIRED_STATE, "ACTIVE");
-        getRestTestHelper().submitRequest(restHostUrl, "PUT", newAttributes, HttpServletResponse.SC_OK);
+        getRestTestHelper().submitRequest(restHostUrl, "PUT", newAttributes, SC_OK);
 
         _restTestHelper.waitForAttributeChanged(restHostUrl, VirtualHost.STATE, "ACTIVE");
 
@@ -409,13 +411,13 @@ public class VirtualHostRestTest extends QpidRestTestCase
         assertQueueDepth(restQueueUrl, "Unexpected number of messages before stopped", 1);
 
         Map<String, Object> newAttributes = Collections.<String, Object>singletonMap(VirtualHost.DESIRED_STATE, "STOPPED");
-        getRestTestHelper().submitRequest(restHostUrl, "PUT", newAttributes, HttpServletResponse.SC_OK);
+        getRestTestHelper().submitRequest(restHostUrl, "PUT", newAttributes, SC_OK);
 
         _restTestHelper.waitForAttributeChanged(restHostUrl, VirtualHost.STATE, "STOPPED");
         assertActualAndDesireStates(restHostUrl, "STOPPED", "STOPPED");
 
         newAttributes = Collections.<String, Object>singletonMap(VirtualHost.DESIRED_STATE, "ACTIVE");
-        getRestTestHelper().submitRequest(restHostUrl, "PUT", newAttributes, HttpServletResponse.SC_OK);
+        getRestTestHelper().submitRequest(restHostUrl, "PUT", newAttributes, SC_OK);
 
         _restTestHelper.waitForAttributeChanged(restHostUrl, VirtualHost.STATE, "ACTIVE");
 
@@ -435,13 +437,13 @@ public class VirtualHostRestTest extends QpidRestTestCase
         newAttributes.put(VirtualHost.DESIRED_STATE, "STOPPED");
         newAttributes.put(VirtualHost.DESCRIPTION, "My description");
 
-        getRestTestHelper().submitRequest(restUrl, "PUT", newAttributes, HttpServletResponse.SC_OK);
+        getRestTestHelper().submitRequest(restUrl, "PUT", newAttributes, SC_OK);
 
         assertActualAndDesireStates(restUrl, "STOPPED", "STOPPED");
 
         restartDefaultBroker();
 
-        Map<String, Object> rereadVirtualhost = getRestTestHelper().getJsonAsSingletonList(restUrl);
+        Map<String, Object> rereadVirtualhost = getRestTestHelper().getJsonAsMap(restUrl);
         Asserts.assertActualAndDesiredState("STOPPED", "STOPPED", rereadVirtualhost);
 
         assertEquals("Unexpected description after restart", "My description", rereadVirtualhost.get(VirtualHost.DESCRIPTION));
@@ -465,7 +467,7 @@ public class VirtualHostRestTest extends QpidRestTestCase
         lvqQueueAttributes.put(LastValueQueue.LVQ_KEY, "LVQ");
         createQueue(queueName + "-lvq", "lvq", lvqQueueAttributes);
 
-        Map<String, Object> hostDetails = getRestTestHelper().getJsonAsSingletonList("virtualhost/test?depth=1");
+        Map<String, Object> hostDetails = getRestTestHelper().getJsonAsMap("virtualhost/test/test?depth=1");
 
         @SuppressWarnings("unchecked")
         List<Map<String, Object>> queues = (List<Map<String, Object>>) hostDetails.get(VirtualHostRestTest.VIRTUALHOST_QUEUES_ATTRIBUTE);
@@ -498,7 +500,7 @@ public class VirtualHostRestTest extends QpidRestTestCase
         createExchange(exchangeName + "-headers", "headers");
         createExchange(exchangeName + "-fanout", "fanout");
 
-        Map<String, Object> hostDetails = getRestTestHelper().getJsonAsSingletonList("virtualhost/test?depth=1");
+        Map<String, Object> hostDetails = getRestTestHelper().getJsonAsMap("virtualhost/test/test?depth=1");
 
         @SuppressWarnings("unchecked")
         List<Map<String, Object>> exchanges = (List<Map<String, Object>>) hostDetails.get(VirtualHostRestTest.VIRTUALHOST_EXCHANGES_ATTRIBUTE);
@@ -523,7 +525,7 @@ public class VirtualHostRestTest extends QpidRestTestCase
         String queueName = getTestQueueName()+ "-lvq";
         createQueue(queueName, "lvq", null);
 
-        Map<String, Object> hostDetails = getRestTestHelper().getJsonAsSingletonList("virtualhost/test?depth=1");
+        Map<String, Object> hostDetails = getRestTestHelper().getJsonAsMap("virtualhost/test/test?depth=1");
 
         @SuppressWarnings("unchecked")
         List<Map<String, Object>> queues = (List<Map<String, Object>>) hostDetails.get(VirtualHostRestTest.VIRTUALHOST_QUEUES_ATTRIBUTE);
@@ -540,7 +542,7 @@ public class VirtualHostRestTest extends QpidRestTestCase
         int responseCode = tryCreateQueue(queueName, "sorted", null);
         assertEquals("Unexpected response code", SC_UNPROCESSABLE_ENTITY, responseCode);
 
-        Map<String, Object> hostDetails = getRestTestHelper().getJsonAsSingletonList("virtualhost/test?depth=1");
+        Map<String, Object> hostDetails = getRestTestHelper().getJsonAsMap("virtualhost/test/test?depth=1");
 
         @SuppressWarnings("unchecked")
         List<Map<String, Object>> queues = (List<Map<String, Object>>) hostDetails.get(VirtualHostRestTest.VIRTUALHOST_QUEUES_ATTRIBUTE);
@@ -554,7 +556,7 @@ public class VirtualHostRestTest extends QpidRestTestCase
         String queueName = getTestQueueName()+ "-priority";
         createQueue(queueName, "priority", null);
 
-        Map<String, Object> hostDetails = getRestTestHelper().getJsonAsSingletonList("virtualhost/test?depth=1");
+        Map<String, Object> hostDetails = getRestTestHelper().getJsonAsMap("virtualhost/test/test?depth=1");
 
         @SuppressWarnings("unchecked")
         List<Map<String, Object>> queues = (List<Map<String, Object>>) hostDetails.get(VirtualHostRestTest.VIRTUALHOST_QUEUES_ATTRIBUTE);
@@ -570,7 +572,7 @@ public class VirtualHostRestTest extends QpidRestTestCase
         String queueName = getTestQueueName();
         createQueue(queueName, null, null);
 
-        Map<String, Object> hostDetails = getRestTestHelper().getJsonAsSingletonList("virtualhost/test?depth=1");
+        Map<String, Object> hostDetails = getRestTestHelper().getJsonAsMap("virtualhost/test/test?depth=1");
 
         @SuppressWarnings("unchecked")
         List<Map<String, Object>> queues = (List<Map<String, Object>>) hostDetails.get(VirtualHostRestTest.VIRTUALHOST_QUEUES_ATTRIBUTE);
@@ -585,7 +587,7 @@ public class VirtualHostRestTest extends QpidRestTestCase
         int responseCode = tryCreateQueue(queueName, "unsupported", null);
         assertEquals("Unexpected response code", SC_UNPROCESSABLE_ENTITY, responseCode);
 
-        Map<String, Object> hostDetails = getRestTestHelper().getJsonAsSingletonList("virtualhost/test?depth=1");
+        Map<String, Object> hostDetails = getRestTestHelper().getJsonAsMap("virtualhost/test/test?depth=1");
 
         @SuppressWarnings("unchecked")
         List<Map<String, Object>> queues = (List<Map<String, Object>>) hostDetails.get(VirtualHostRestTest.VIRTUALHOST_QUEUES_ATTRIBUTE);
@@ -600,23 +602,21 @@ public class VirtualHostRestTest extends QpidRestTestCase
         createQueue(queueName, null, null);
 
         String queueUrl = "queue/test/test/" + queueName;
-        List<Map<String, Object>> queues = getRestTestHelper().getJsonAsList(queueUrl);
-        assertEquals("Queue should exist", 1, queues.size());
+        Map<String, Object> queueData = getRestTestHelper().getJsonAsMap(queueUrl);
+        assertEquals("Unexpected name", queueName, queueData.get(Queue.NAME));
 
-        int statusCode = getRestTestHelper().submitRequest(queueUrl, "DELETE");
-        assertEquals("Unexpected response code", 200, statusCode);
+        getRestTestHelper().submitRequest(queueUrl, "DELETE", SC_OK);
 
-        getRestTestHelper().submitRequest(queueUrl, "GET", HttpServletResponse.SC_NOT_FOUND);
+        getRestTestHelper().submitRequest(queueUrl, "GET", SC_NOT_FOUND);
     }
 
     public void testDeleteQueueById() throws Exception
     {
         String queueName = getTestQueueName();
         createQueue(queueName, null, null);
-        Map<String, Object> queueDetails = getRestTestHelper().getJsonAsSingletonList("queue/test/test/" + queueName);
-        int statusCode = getRestTestHelper().submitRequest("queue/test/test?id=" + queueDetails.get(Queue.ID), "DELETE");
-        assertEquals("Unexpected response code", 200, statusCode);
-        getRestTestHelper().submitRequest("queue/test/test/" + queueName, "GET", HttpServletResponse.SC_NOT_FOUND);
+        Map<String, Object> queueDetails = getRestTestHelper().getJsonAsMap("queue/test/test/" + queueName);
+        getRestTestHelper().submitRequest("queue/test/test?id=" + queueDetails.get(Queue.ID), "DELETE", SC_OK);
+        getRestTestHelper().submitRequest("queue/test/test/" + queueName, "GET", SC_NOT_FOUND);
     }
 
     public void testDeleteExchange() throws Exception
@@ -627,19 +627,19 @@ public class VirtualHostRestTest extends QpidRestTestCase
         int statusCode = getRestTestHelper().submitRequest("exchange/test/test/" + exchangeName, "DELETE");
 
         assertEquals("Unexpected response code", 200, statusCode);
-        getRestTestHelper().submitRequest("exchange/test/test/" + exchangeName, "GET", HttpServletResponse.SC_NOT_FOUND);
+        getRestTestHelper().submitRequest("exchange/test/test/" + exchangeName, "GET", SC_NOT_FOUND);
     }
 
     public void testDeleteExchangeById() throws Exception
     {
         String exchangeName = getTestName();
         createExchange(exchangeName, "direct");
-        Map<String, Object> echangeDetails = getRestTestHelper().getJsonAsSingletonList("exchange/test/test/" + exchangeName);
+        Map<String, Object> echangeDetails = getRestTestHelper().getJsonAsMap("exchange/test/test/" + exchangeName);
 
         int statusCode = getRestTestHelper().submitRequest("exchange/test/test?id=" + echangeDetails.get(Exchange.ID), "DELETE");
 
         assertEquals("Unexpected response code", 200, statusCode);
-        getRestTestHelper().submitRequest("exchange/test/test/" + exchangeName, "GET", HttpServletResponse.SC_NOT_FOUND);
+        getRestTestHelper().submitRequest("exchange/test/test/" + exchangeName, "GET", SC_NOT_FOUND);
     }
 
     public void testPutCreateQueueWithAttributes() throws Exception
@@ -671,7 +671,7 @@ public class VirtualHostRestTest extends QpidRestTestCase
         lvqQueueAttributes.put(LastValueQueue.LVQ_KEY, "LVQ");
         createQueue(queueName + "-lvq", "lvq", lvqQueueAttributes);
 
-        Map<String, Object> hostDetails = getRestTestHelper().getJsonAsSingletonList("virtualhost/test?depth=1");
+        Map<String, Object> hostDetails = getRestTestHelper().getJsonAsMap("virtualhost/test/test?depth=1");
 
         @SuppressWarnings("unchecked")
         List<Map<String, Object>> queues = (List<Map<String, Object>>) hostDetails.get(VirtualHostRestTest.VIRTUALHOST_QUEUES_ATTRIBUTE);
@@ -700,7 +700,7 @@ public class VirtualHostRestTest extends QpidRestTestCase
 
         // Test creation
         createQueue(queueNameDoubleEncoded, "standard", null);
-        Map<String, Object> hostDetails = getRestTestHelper().getJsonAsSingletonList("virtualhost/test?depth=1");
+        Map<String, Object> hostDetails = getRestTestHelper().getJsonAsMap("virtualhost/test/test?depth=1");
         List<Map<String, Object>> queues = (List<Map<String, Object>>) hostDetails.get(VirtualHostRestTest.VIRTUALHOST_QUEUES_ATTRIBUTE);
         Map<String, Object> queue = getRestTestHelper().find(Queue.NAME, queueName , queues);
         Asserts.assertQueue(queueName, "standard", queue);
@@ -708,7 +708,7 @@ public class VirtualHostRestTest extends QpidRestTestCase
         // Test deletion
         int statusCode = getRestTestHelper().submitRequest(queueUrl, "DELETE");
         assertEquals("Unexpected response code", 200, statusCode);
-        getRestTestHelper().submitRequest(queueUrl, "GET", HttpServletResponse.SC_NOT_FOUND);
+        getRestTestHelper().submitRequest(queueUrl, "GET", SC_NOT_FOUND);
     }
 
     private void createExchange(String exchangeName, String exchangeType) throws IOException
@@ -805,13 +805,13 @@ public class VirtualHostRestTest extends QpidRestTestCase
                                              final String expectedDesiredState,
                                              final String expectedActualState) throws IOException
     {
-        Map<String, Object> virtualhost = getRestTestHelper().getJsonAsSingletonList(restUrl);
+        Map<String, Object> virtualhost = getRestTestHelper().getJsonAsMap(restUrl);
         Asserts.assertActualAndDesiredState(expectedDesiredState, expectedActualState, virtualhost);
     }
 
     private void assertQueueDepth(String restQueueUrl, String message, int expectedDepth) throws IOException
     {
-        Map<String, Object> queueDetails = getRestTestHelper().getJsonAsSingletonList(restQueueUrl);
+        Map<String, Object> queueDetails = getRestTestHelper().getJsonAsMap(restQueueUrl);
         assertNotNull(queueDetails);
         Map<String, Object> statistics = (Map<String, Object>) queueDetails.get(Asserts.STATISTICS_ATTRIBUTE);
         assertNotNull(statistics);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message