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 2014/05/02 17:29:26 UTC
svn commit: r1591948 [3/3] - in /qpid/trunk/qpid/java:
bdbstore/systests/src/main/java/org/apache/qpid/server/store/berkeleydb/
broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/
systests/src/main/java/org/apache/qpi...
Modified: qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/VirtualHostRestTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/VirtualHostRestTest.java?rev=1591948&r1=1591947&r2=1591948&view=diff
==============================================================================
--- qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/VirtualHostRestTest.java (original)
+++ qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/VirtualHostRestTest.java Fri May 2 15:29:25 2014
@@ -22,7 +22,6 @@ package org.apache.qpid.systest.rest;
import java.io.File;
import java.io.IOException;
-import java.net.HttpURLConnection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -55,7 +54,7 @@ public class VirtualHostRestTest extends
public void testGet() throws Exception
{
- List<Map<String, Object>> hosts = getRestTestHelper().getJsonAsList("/rest/virtualhost");
+ List<Map<String, Object>> hosts = getRestTestHelper().getJsonAsList("virtualhost");
assertNotNull("Hosts data cannot be null", hosts);
assertEquals("Unexpected number of hosts", EXPECTED_VIRTUALHOSTS.length, hosts.size());
for (String hostName : EXPECTED_VIRTUALHOSTS)
@@ -72,7 +71,7 @@ public class VirtualHostRestTest extends
Session session = _connection.createSession(true, Session.SESSION_TRANSACTED);
session.createConsumer(getTestQueue());
- Map<String, Object> hostDetails = getRestTestHelper().getJsonAsSingletonList("/rest/virtualhost/test");
+ Map<String, Object> hostDetails = getRestTestHelper().getJsonAsSingletonList("virtualhost/test");
Asserts.assertVirtualHost("test", hostDetails);
@SuppressWarnings("unchecked")
@@ -114,7 +113,7 @@ public class VirtualHostRestTest extends
{
// make sure that the host is saved in the broker store
restartBroker();
- Map<String, Object> hostDetails = getRestTestHelper().getJsonAsSingletonList("/rest/virtualhost/" + hostName);
+ Map<String, Object> hostDetails = getRestTestHelper().getJsonAsSingletonList("virtualhost/" + hostName);
Asserts.assertVirtualHost(hostName, hostDetails);
assertNewVirtualHost(hostDetails);
@@ -130,31 +129,28 @@ public class VirtualHostRestTest extends
public void testDeleteHost() throws Exception
{
- String hostToDelete = TEST3_VIRTUALHOST;
- HttpURLConnection connection = getRestTestHelper().openManagementConnection("/rest/virtualhost/" + hostToDelete + "/" + hostToDelete, "DELETE");
- connection.connect();
- assertEquals("Unexpected response code", 200, connection.getResponseCode());
+ int responseCode = getRestTestHelper().submitRequest("virtualhost/" + TEST3_VIRTUALHOST + "/" + TEST3_VIRTUALHOST, "DELETE");
+ assertEquals("Unexpected response code", 200, responseCode);
- List<Map<String, Object>> hosts = getRestTestHelper().getJsonAsList("/rest/virtualhost/" + hostToDelete);
+ List<Map<String, Object>> hosts = getRestTestHelper().getJsonAsList("virtualhost/" + TEST3_VIRTUALHOST);
assertEquals("Host should be deleted", 0, hosts.size());
}
public void testDeleteDefaultHostFails() throws Exception
{
- String hostToDelete = TEST1_VIRTUALHOST;
- int response = getRestTestHelper().submitRequest("/rest/virtualhost/" + hostToDelete, "DELETE", null);
- assertEquals("Unexpected response code", 409, response);
+ int responseCode = getRestTestHelper().submitRequest("virtualhost/" + TEST1_VIRTUALHOST, "DELETE");
+ assertEquals("Unexpected response code", 409, responseCode);
restartBroker();
- List<Map<String, Object>> hosts = getRestTestHelper().getJsonAsList("/rest/virtualhost/" + hostToDelete);
+ List<Map<String, Object>> hosts = getRestTestHelper().getJsonAsList("virtualhost/" + TEST1_VIRTUALHOST);
assertEquals("Host should be deleted", 1, hosts.size());
}
public void testUpdateActiveHostFails() throws Exception
{
String hostToUpdate = TEST3_VIRTUALHOST;
- String restHostUrl = "/rest/virtualhost/" + hostToUpdate + "/" + hostToUpdate;
+ String restHostUrl = "virtualhost/" + hostToUpdate + "/" + hostToUpdate;
Map<String, Object> hostDetails = getRestTestHelper().getJsonAsSingletonList(restHostUrl);
Asserts.assertVirtualHost(hostToUpdate, hostDetails);
@@ -190,7 +186,7 @@ public class VirtualHostRestTest extends
lvqQueueAttributes.put(LastValueQueue.LVQ_KEY, "LVQ");
createQueue(queueName + "-lvq", "lvq", lvqQueueAttributes);
- Map<String, Object> hostDetails = getRestTestHelper().getJsonAsSingletonList("/rest/virtualhost/test");
+ Map<String, Object> hostDetails = getRestTestHelper().getJsonAsSingletonList("virtualhost/test");
@SuppressWarnings("unchecked")
List<Map<String, Object>> queues = (List<Map<String, Object>>) hostDetails.get(VirtualHostRestTest.VIRTUALHOST_QUEUES_ATTRIBUTE);
@@ -223,7 +219,7 @@ public class VirtualHostRestTest extends
createExchange(exchangeName + "-headers", "headers");
createExchange(exchangeName + "-fanout", "fanout");
- Map<String, Object> hostDetails = getRestTestHelper().getJsonAsSingletonList("/rest/virtualhost/test");
+ Map<String, Object> hostDetails = getRestTestHelper().getJsonAsSingletonList("virtualhost/test");
@SuppressWarnings("unchecked")
List<Map<String, Object>> exchanges = (List<Map<String, Object>>) hostDetails.get(VirtualHostRestTest.VIRTUALHOST_EXCHANGES_ATTRIBUTE);
@@ -249,7 +245,7 @@ public class VirtualHostRestTest extends
String queueName = getTestQueueName()+ "-lvq";
createQueue(queueName, "lvq", null);
- Map<String, Object> hostDetails = getRestTestHelper().getJsonAsSingletonList("/rest/virtualhost/test");
+ Map<String, Object> hostDetails = getRestTestHelper().getJsonAsSingletonList("virtualhost/test");
@SuppressWarnings("unchecked")
List<Map<String, Object>> queues = (List<Map<String, Object>>) hostDetails.get(VirtualHostRestTest.VIRTUALHOST_QUEUES_ATTRIBUTE);
@@ -266,7 +262,7 @@ public class VirtualHostRestTest extends
int responseCode = tryCreateQueue(queueName, "sorted", null);
assertEquals("Unexpected response code", HttpServletResponse.SC_CONFLICT, responseCode);
- Map<String, Object> hostDetails = getRestTestHelper().getJsonAsSingletonList("/rest/virtualhost/test");
+ Map<String, Object> hostDetails = getRestTestHelper().getJsonAsSingletonList("virtualhost/test");
@SuppressWarnings("unchecked")
List<Map<String, Object>> queues = (List<Map<String, Object>>) hostDetails.get(VirtualHostRestTest.VIRTUALHOST_QUEUES_ATTRIBUTE);
@@ -280,7 +276,7 @@ public class VirtualHostRestTest extends
String queueName = getTestQueueName()+ "-priority";
createQueue(queueName, "priority", null);
- Map<String, Object> hostDetails = getRestTestHelper().getJsonAsSingletonList("/rest/virtualhost/test");
+ Map<String, Object> hostDetails = getRestTestHelper().getJsonAsSingletonList("virtualhost/test");
@SuppressWarnings("unchecked")
List<Map<String, Object>> queues = (List<Map<String, Object>>) hostDetails.get(VirtualHostRestTest.VIRTUALHOST_QUEUES_ATTRIBUTE);
@@ -296,7 +292,7 @@ public class VirtualHostRestTest extends
String queueName = getTestQueueName();
createQueue(queueName, null, null);
- Map<String, Object> hostDetails = getRestTestHelper().getJsonAsSingletonList("/rest/virtualhost/test");
+ Map<String, Object> hostDetails = getRestTestHelper().getJsonAsSingletonList("virtualhost/test");
@SuppressWarnings("unchecked")
List<Map<String, Object>> queues = (List<Map<String, Object>>) hostDetails.get(VirtualHostRestTest.VIRTUALHOST_QUEUES_ATTRIBUTE);
@@ -311,7 +307,7 @@ public class VirtualHostRestTest extends
int responseCode = tryCreateQueue(queueName, "unsupported", null);
assertEquals("Unexpected response code", HttpServletResponse.SC_CONFLICT, responseCode);
- Map<String, Object> hostDetails = getRestTestHelper().getJsonAsSingletonList("/rest/virtualhost/test");
+ Map<String, Object> hostDetails = getRestTestHelper().getJsonAsSingletonList("virtualhost/test");
@SuppressWarnings("unchecked")
List<Map<String, Object>> queues = (List<Map<String, Object>>) hostDetails.get(VirtualHostRestTest.VIRTUALHOST_QUEUES_ATTRIBUTE);
@@ -325,13 +321,12 @@ public class VirtualHostRestTest extends
String queueName = getTestQueueName();
createQueue(queueName, null, null);
- String queueUrl = "/rest/queue/test/test/" + queueName;
+ String queueUrl = "queue/test/test/" + queueName;
List<Map<String, Object>> queues = getRestTestHelper().getJsonAsList(queueUrl);
assertEquals("Queue should exist", 1, queues.size());
- HttpURLConnection connection = getRestTestHelper().openManagementConnection(queueUrl, "DELETE");
- connection.connect();
- assertEquals("Unexpected response code", 200, connection.getResponseCode());
+ int statusCode = getRestTestHelper().submitRequest(queueUrl, "DELETE");
+ assertEquals("Unexpected response code", 200, statusCode);
queues = getRestTestHelper().getJsonAsList(queueUrl);
assertEquals("Queue should be deleted", 0, queues.size());
}
@@ -340,12 +335,10 @@ public class VirtualHostRestTest extends
{
String queueName = getTestQueueName();
createQueue(queueName, null, null);
- Map<String, Object> queueDetails = getRestTestHelper().getJsonAsSingletonList("/rest/queue/test/test/" + queueName);
-
- HttpURLConnection connection = getRestTestHelper().openManagementConnection("/rest/queue/test/test?id=" + queueDetails.get(Queue.ID), "DELETE");
- connection.connect();
- assertEquals("Unexpected response code", 200, connection.getResponseCode());
- List<Map<String, Object>> queues = getRestTestHelper().getJsonAsList("/rest/queue/test/test/" + queueName);
+ 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);
+ List<Map<String, Object>> queues = getRestTestHelper().getJsonAsList("queue/test/test/" + queueName);
assertEquals("Queue should be deleted", 0, queues.size());
}
@@ -354,10 +347,10 @@ public class VirtualHostRestTest extends
String exchangeName = getTestName();
createExchange(exchangeName, "direct");
- HttpURLConnection connection = getRestTestHelper().openManagementConnection("/rest/exchange/test/test/" + exchangeName, "DELETE");
- connection.connect();
- assertEquals("Unexpected response code", 200, connection.getResponseCode());
- List<Map<String, Object>> queues = getRestTestHelper().getJsonAsList("/rest/exchange/test/test/" + exchangeName);
+ int statusCode = getRestTestHelper().submitRequest("exchange/test/test/" + exchangeName, "DELETE");
+
+ assertEquals("Unexpected response code", 200, statusCode);
+ List<Map<String, Object>> queues = getRestTestHelper().getJsonAsList("exchange/test/test/" + exchangeName);
assertEquals("Exchange should be deleted", 0, queues.size());
}
@@ -365,12 +358,12 @@ public class VirtualHostRestTest extends
{
String exchangeName = getTestName();
createExchange(exchangeName, "direct");
- Map<String, Object> echangeDetails = getRestTestHelper().getJsonAsSingletonList("/rest/exchange/test/test/" + exchangeName);
+ Map<String, Object> echangeDetails = getRestTestHelper().getJsonAsSingletonList("exchange/test/test/" + exchangeName);
+
+ int statusCode = getRestTestHelper().submitRequest("exchange/test/test?id=" + echangeDetails.get(Exchange.ID), "DELETE");
- HttpURLConnection connection = getRestTestHelper().openManagementConnection("/rest/exchange/test/test?id=" + echangeDetails.get(Exchange.ID), "DELETE");
- connection.connect();
- assertEquals("Unexpected response code", 200, connection.getResponseCode());
- List<Map<String, Object>> queues = getRestTestHelper().getJsonAsList("/rest/exchange/test/test/" + exchangeName);
+ assertEquals("Unexpected response code", 200, statusCode);
+ List<Map<String, Object>> queues = getRestTestHelper().getJsonAsList("exchange/test/test/" + exchangeName);
assertEquals("Exchange should be deleted", 0, queues.size());
}
@@ -404,7 +397,7 @@ public class VirtualHostRestTest extends
lvqQueueAttributes.put(LastValueQueue.LVQ_KEY, "LVQ");
createQueue(queueName + "-lvq", "lvq", lvqQueueAttributes);
- Map<String, Object> hostDetails = getRestTestHelper().getJsonAsSingletonList("/rest/virtualhost/test");
+ Map<String, Object> hostDetails = getRestTestHelper().getJsonAsSingletonList("virtualhost/test");
@SuppressWarnings("unchecked")
List<Map<String, Object>> queues = (List<Map<String, Object>>) hostDetails.get(VirtualHostRestTest.VIRTUALHOST_QUEUES_ATTRIBUTE);
@@ -433,7 +426,7 @@ public class VirtualHostRestTest extends
attributes.put(AbstractVirtualHost.CREATE_DLQ_ON_CREATION, true);
//verify the starting state
- Map<String, Object> hostDetails = getRestTestHelper().getJsonAsSingletonList("/rest/virtualhost/test");
+ Map<String, Object> hostDetails = getRestTestHelper().getJsonAsSingletonList("virtualhost/test");
List<Map<String, Object>> queues = (List<Map<String, Object>>) hostDetails.get(VirtualHostRestTest.VIRTUALHOST_QUEUES_ATTRIBUTE);
List<Map<String, Object>> exchanges = (List<Map<String, Object>>) hostDetails.get(VirtualHostRestTest.VIRTUALHOST_EXCHANGES_ATTRIBUTE);
@@ -445,7 +438,7 @@ public class VirtualHostRestTest extends
createQueue(queueName, "standard", attributes);
//verify the new queue, as well as the DLQueue and DLExchange have been created
- hostDetails = getRestTestHelper().getJsonAsSingletonList("/rest/virtualhost/test");
+ hostDetails = getRestTestHelper().getJsonAsSingletonList("virtualhost/test");
queues = (List<Map<String, Object>>) hostDetails.get(VirtualHostRestTest.VIRTUALHOST_QUEUES_ATTRIBUTE);
exchanges = (List<Map<String, Object>>) hostDetails.get(VirtualHostRestTest.VIRTUALHOST_EXCHANGES_ATTRIBUTE);
@@ -466,17 +459,13 @@ public class VirtualHostRestTest extends
private void createExchange(String exchangeName, String exchangeType) throws IOException
{
- HttpURLConnection connection = getRestTestHelper().openManagementConnection("/rest/exchange/test/test/" + exchangeName, "PUT");
-
Map<String, Object> queueData = new HashMap<String, Object>();
queueData.put(Exchange.NAME, exchangeName);
queueData.put(Exchange.DURABLE, Boolean.TRUE);
queueData.put(Exchange.TYPE, exchangeType);
- getRestTestHelper().writeJsonRequest(connection, queueData);
- assertEquals("Unexpected response code", 201, connection.getResponseCode());
-
- connection.disconnect();
+ int statusCode = getRestTestHelper().submitRequest("exchange/test/test/" + exchangeName, "PUT", queueData);
+ assertEquals("Unexpected response code", 201, statusCode);
}
private void createQueue(String queueName, String queueType, Map<String, Object> attributes) throws IOException,
@@ -489,8 +478,6 @@ public class VirtualHostRestTest extends
private int tryCreateQueue(String queueName, String queueType, Map<String, Object> attributes) throws IOException,
JsonGenerationException, JsonMappingException
{
- HttpURLConnection connection = getRestTestHelper().openManagementConnection("/rest/queue/test/test/" + queueName, "PUT");
-
Map<String, Object> queueData = new HashMap<String, Object>();
queueData.put(Queue.NAME, queueName);
queueData.put(Queue.DURABLE, Boolean.TRUE);
@@ -503,10 +490,7 @@ public class VirtualHostRestTest extends
queueData.putAll(attributes);
}
- getRestTestHelper().writeJsonRequest(connection, queueData);
- int responseCode = connection.getResponseCode();
- connection.disconnect();
- return responseCode;
+ return getRestTestHelper().submitRequest("queue/test/test/" + queueName, "PUT", queueData);
}
private String createHost(String hostName, String storeType, String configPath) throws IOException, JsonGenerationException,
@@ -533,7 +517,7 @@ public class VirtualHostRestTest extends
hostData.put(VirtualHostNode.IS_MESSAGE_STORE_PROVIDER, true);
hostData.put(DurableConfigurationStore.STORE_PATH, storePath);
- return getRestTestHelper().submitRequest("/rest/virtualhostnode/" + hostName, "PUT", hostData);
+ return getRestTestHelper().submitRequest("virtualhostnode/" + hostName, "PUT", hostData);
}
private void assertNewVirtualHost(Map<String, Object> hostDetails)
Modified: qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/BrokerACLTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/BrokerACLTest.java?rev=1591948&r1=1591947&r2=1591948&view=diff
==============================================================================
--- qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/BrokerACLTest.java (original)
+++ qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/BrokerACLTest.java Fri May 2 15:29:25 2014
@@ -119,7 +119,7 @@ public class BrokerACLTest extends QpidR
assertAuthenticationProviderExists(providerName);
- responseCode = getRestTestHelper().submitRequest("/rest/authenticationprovider/" + providerName, "DELETE", null);
+ responseCode = getRestTestHelper().submitRequest("authenticationprovider/" + providerName, "DELETE");
assertEquals("Provider deletion should be allowed", 200, responseCode);
assertAuthenticationProviderDoesNotExist(TEST2_VIRTUALHOST);
@@ -137,7 +137,7 @@ public class BrokerACLTest extends QpidR
assertAuthenticationProviderExists(providerName);
getRestTestHelper().setUsernameAndPassword(DENIED_USER, DENIED_USER);
- responseCode = getRestTestHelper().submitRequest("/rest/authenticationprovider/" + providerName, "DELETE", null);
+ responseCode = getRestTestHelper().submitRequest("authenticationprovider/" + providerName, "DELETE");
assertEquals("Provider deletion should be denied", 403, responseCode);
assertAuthenticationProviderExists(providerName);
@@ -159,7 +159,7 @@ public class BrokerACLTest extends QpidR
attributes.put(AuthenticationProvider.TYPE, PlainPasswordDatabaseAuthenticationManager.PROVIDER_TYPE);
attributes.put(ExternalFileBasedAuthenticationManager.PATH, file.getAbsolutePath());
- int responseCode = getRestTestHelper().submitRequest("/rest/authenticationprovider/" + providerName, "PUT", attributes);
+ int responseCode = getRestTestHelper().submitRequest("authenticationprovider/" + providerName, "PUT", attributes);
assertEquals("Setting of provider attribites should be allowed", 200, responseCode);
}
@@ -169,8 +169,7 @@ public class BrokerACLTest extends QpidR
String providerName = TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER;
- Map<String, Object> providerData = getRestTestHelper().getJsonAsSingletonList(
- "/rest/authenticationprovider/" + providerName);
+ Map<String, Object> providerData = getRestTestHelper().getJsonAsSingletonList("authenticationprovider/" + providerName);
File file = TestFileUtils.createTempFile(this, ".users", "guest:guest\n" + ALLOWED_USER + ":" + ALLOWED_USER + "\n"
+ DENIED_USER + ":" + DENIED_USER);
@@ -182,10 +181,10 @@ public class BrokerACLTest extends QpidR
attributes.put(AuthenticationProvider.TYPE, AnonymousAuthenticationManager.PROVIDER_TYPE);
attributes.put(ExternalFileBasedAuthenticationManager.PATH, file.getAbsolutePath());
- int responseCode = getRestTestHelper().submitRequest("/rest/authenticationprovider/" + providerName, "PUT", attributes);
+ int responseCode = getRestTestHelper().submitRequest("authenticationprovider/" + providerName, "PUT", attributes);
assertEquals("Setting of provider attribites should be allowed", 403, responseCode);
- Map<String, Object> provider = getRestTestHelper().getJsonAsSingletonList("/rest/authenticationprovider/" + providerName);
+ Map<String, Object> provider = getRestTestHelper().getJsonAsSingletonList("authenticationprovider/" + providerName);
assertEquals("Unexpected PATH attribute value",
providerData.get(ExternalFileBasedAuthenticationManager.PATH),
provider.get(ExternalFileBasedAuthenticationManager.PATH));
@@ -223,7 +222,7 @@ public class BrokerACLTest extends QpidR
assertVirtualHostNodeExists(TEST2_VIRTUALHOST);
- int responseCode = getRestTestHelper().submitRequest("/rest/virtualhostnode/" + TEST2_VIRTUALHOST, "DELETE", null);
+ int responseCode = getRestTestHelper().submitRequest("virtualhostnode/" + TEST2_VIRTUALHOST, "DELETE");
assertEquals("Virtual host node deletion should be allowed", 200, responseCode);
assertVirtualHostNodeDoesNotExist(TEST2_VIRTUALHOST);
@@ -237,7 +236,7 @@ public class BrokerACLTest extends QpidR
getRestTestHelper().setUsernameAndPassword(DENIED_USER, DENIED_USER);
- int responseCode = getRestTestHelper().submitRequest("/rest/virtualhostnode/" + TEST2_VIRTUALHOST, "DELETE", null);
+ int responseCode = getRestTestHelper().submitRequest("virtualhostnode/" + TEST2_VIRTUALHOST, "DELETE");
assertEquals("Virtual host node deletion should be denied", 403, responseCode);
assertVirtualHostNodeExists(TEST2_VIRTUALHOST);
@@ -278,7 +277,7 @@ public class BrokerACLTest extends QpidR
getRestTestHelper().setUsernameAndPassword(DENIED_USER, DENIED_USER);
- int responseCode = getRestTestHelper().submitRequest("/rest/port/" + portName, "DELETE", null);
+ int responseCode = getRestTestHelper().submitRequest("port/" + portName, "DELETE");
assertEquals("Port deletion should be denied", 403, responseCode);
assertPortExists(portName);
@@ -293,7 +292,7 @@ public class BrokerACLTest extends QpidR
getRestTestHelper().setUsernameAndPassword(ALLOWED_USER, ALLOWED_USER);
- int responseCode = getRestTestHelper().submitRequest("/rest/port/" + portName, "DELETE", null);
+ int responseCode = getRestTestHelper().submitRequest("port/" + portName, "DELETE");
assertEquals("Port deletion should be allowed", 200, responseCode);
assertPortDoesNotExist(portName);
@@ -315,10 +314,10 @@ public class BrokerACLTest extends QpidR
Map<String, Object> attributes = new HashMap<String, Object>();
attributes.put(Port.NAME, portName);
attributes.put(Port.AUTHENTICATION_PROVIDER, ANONYMOUS_AUTHENTICATION_PROVIDER);
- responseCode = getRestTestHelper().submitRequest("/rest/port/" + portName, "PUT", attributes);
+ responseCode = getRestTestHelper().submitRequest("port/" + portName, "PUT", attributes);
assertEquals("Setting of port attribites should be allowed", 200, responseCode);
- Map<String, Object> port = getRestTestHelper().getJsonAsSingletonList("/rest/port/" + portName);
+ Map<String, Object> port = getRestTestHelper().getJsonAsSingletonList("port/" + portName);
assertEquals("Unexpected authentication provider attribute value", ANONYMOUS_AUTHENTICATION_PROVIDER,
port.get(Port.AUTHENTICATION_PROVIDER));
}
@@ -340,10 +339,10 @@ public class BrokerACLTest extends QpidR
attributes.put(Port.NAME, portName);
attributes.put(Port.PROTOCOLS, Arrays.asList(Protocol.AMQP_0_9));
attributes.put(Port.AUTHENTICATION_PROVIDER, ANONYMOUS_AUTHENTICATION_PROVIDER);
- responseCode = getRestTestHelper().submitRequest("/rest/port/" + portName, "PUT", attributes);
+ responseCode = getRestTestHelper().submitRequest("port/" + portName, "PUT", attributes);
assertEquals("Setting of port attribites should be denied", 403, responseCode);
- Map<String, Object> port = getRestTestHelper().getJsonAsSingletonList("/rest/port/" + portName);
+ Map<String, Object> port = getRestTestHelper().getJsonAsSingletonList("port/" + portName);
assertEquals("Unexpected authentication provider attribute value",
TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER, port.get(Port.AUTHENTICATION_PROVIDER));
}
@@ -393,7 +392,7 @@ public class BrokerACLTest extends QpidR
getRestTestHelper().setUsernameAndPassword(DENIED_USER, DENIED_USER);
- responseCode = getRestTestHelper().submitRequest("/rest/keystore/" + keyStoreName, "DELETE", null);
+ responseCode = getRestTestHelper().submitRequest("keystore/" + keyStoreName, "DELETE");
assertEquals("keystore deletion should be denied", 403, responseCode);
assertKeyStoreExistence(keyStoreName, true);
@@ -414,7 +413,7 @@ public class BrokerACLTest extends QpidR
getRestTestHelper().setUsernameAndPassword(ALLOWED_USER, ALLOWED_USER);
- responseCode = getRestTestHelper().submitRequest("/rest/keystore/" + keyStoreName, "DELETE", null);
+ responseCode = getRestTestHelper().submitRequest("keystore/" + keyStoreName, "DELETE");
assertEquals("keystore deletion should be allowed", 200, responseCode);
assertKeyStoreExistence(keyStoreName, false);
@@ -434,16 +433,16 @@ public class BrokerACLTest extends QpidR
assertEquals("keyStore creation should be allowed", 201, responseCode);
assertKeyStoreExistence(keyStoreName, true);
- Map<String, Object> keyStore = getRestTestHelper().getJsonAsSingletonList("/rest/keystore/" + keyStoreName);
+ Map<String, Object> keyStore = getRestTestHelper().getJsonAsSingletonList("keystore/" + keyStoreName);
assertEquals("Unexpected certificateAlias attribute value", initialCertAlias, keyStore.get(FileKeyStore.CERTIFICATE_ALIAS));
Map<String, Object> attributes = new HashMap<String, Object>();
attributes.put(KeyStore.NAME, keyStoreName);
attributes.put(FileKeyStore.CERTIFICATE_ALIAS, updatedCertAlias);
- responseCode = getRestTestHelper().submitRequest("/rest/keystore/" + keyStoreName, "PUT", attributes);
+ responseCode = getRestTestHelper().submitRequest("keystore/" + keyStoreName, "PUT", attributes);
assertEquals("Setting of keystore attributes should be allowed", 200, responseCode);
- keyStore = getRestTestHelper().getJsonAsSingletonList("/rest/keystore/" + keyStoreName);
+ keyStore = getRestTestHelper().getJsonAsSingletonList("keystore/" + keyStoreName);
assertEquals("Unexpected certificateAlias attribute value", updatedCertAlias, keyStore.get(FileKeyStore.CERTIFICATE_ALIAS));
}
@@ -461,7 +460,7 @@ public class BrokerACLTest extends QpidR
assertEquals("keyStore creation should be allowed", 201, responseCode);
assertKeyStoreExistence(keyStoreName, true);
- Map<String, Object> keyStore = getRestTestHelper().getJsonAsSingletonList("/rest/keystore/" + keyStoreName);
+ Map<String, Object> keyStore = getRestTestHelper().getJsonAsSingletonList("keystore/" + keyStoreName);
assertEquals("Unexpected certificateAlias attribute value", initialCertAlias, keyStore.get(FileKeyStore.CERTIFICATE_ALIAS));
getRestTestHelper().setUsernameAndPassword(DENIED_USER, DENIED_USER);
@@ -469,10 +468,10 @@ public class BrokerACLTest extends QpidR
Map<String, Object> attributes = new HashMap<String, Object>();
attributes.put(KeyStore.NAME, keyStoreName);
attributes.put(FileKeyStore.CERTIFICATE_ALIAS, updatedCertAlias);
- responseCode = getRestTestHelper().submitRequest("/rest/keystore/" + keyStoreName, "PUT", attributes);
+ responseCode = getRestTestHelper().submitRequest("keystore/" + keyStoreName, "PUT", attributes);
assertEquals("Setting of keystore attributes should be denied", 403, responseCode);
- keyStore = getRestTestHelper().getJsonAsSingletonList("/rest/keystore/" + keyStoreName);
+ keyStore = getRestTestHelper().getJsonAsSingletonList("keystore/" + keyStoreName);
assertEquals("Unexpected certificateAlias attribute value", initialCertAlias, keyStore.get(FileKeyStore.CERTIFICATE_ALIAS));
}
@@ -521,7 +520,7 @@ public class BrokerACLTest extends QpidR
getRestTestHelper().setUsernameAndPassword(DENIED_USER, DENIED_USER);
- responseCode = getRestTestHelper().submitRequest("/rest/truststore/" + trustStoreName, "DELETE", null);
+ responseCode = getRestTestHelper().submitRequest("truststore/" + trustStoreName, "DELETE");
assertEquals("truststore deletion should be denied", 403, responseCode);
assertTrustStoreExistence(trustStoreName, true);
@@ -542,7 +541,7 @@ public class BrokerACLTest extends QpidR
getRestTestHelper().setUsernameAndPassword(ALLOWED_USER, ALLOWED_USER);
- responseCode = getRestTestHelper().submitRequest("/rest/truststore/" + trustStoreName, "DELETE", null);
+ responseCode = getRestTestHelper().submitRequest("truststore/" + trustStoreName, "DELETE");
assertEquals("truststore deletion should be allowed", 200, responseCode);
assertTrustStoreExistence(trustStoreName, false);
@@ -562,16 +561,16 @@ public class BrokerACLTest extends QpidR
assertEquals("trustStore creation should be allowed", 201, responseCode);
assertTrustStoreExistence(trustStoreName, true);
- Map<String, Object> trustStore = getRestTestHelper().getJsonAsSingletonList("/rest/truststore/" + trustStoreName);
+ Map<String, Object> trustStore = getRestTestHelper().getJsonAsSingletonList("truststore/" + trustStoreName);
assertEquals("Unexpected peersOnly attribute value", initialPeersOnly, trustStore.get(FileTrustStore.PEERS_ONLY));
Map<String, Object> attributes = new HashMap<String, Object>();
attributes.put(TrustStore.NAME, trustStoreName);
attributes.put(FileTrustStore.PEERS_ONLY, updatedPeersOnly);
- responseCode = getRestTestHelper().submitRequest("/rest/truststore/" + trustStoreName, "PUT", attributes);
+ responseCode = getRestTestHelper().submitRequest("truststore/" + trustStoreName, "PUT", attributes);
assertEquals("Setting of truststore attributes should be allowed", 200, responseCode);
- trustStore = getRestTestHelper().getJsonAsSingletonList("/rest/truststore/" + trustStoreName);
+ trustStore = getRestTestHelper().getJsonAsSingletonList("truststore/" + trustStoreName);
assertEquals("Unexpected peersOnly attribute value", updatedPeersOnly, trustStore.get(FileTrustStore.PEERS_ONLY));
}
@@ -589,7 +588,7 @@ public class BrokerACLTest extends QpidR
assertEquals("trustStore creation should be allowed", 201, responseCode);
assertTrustStoreExistence(trustStoreName, true);
- Map<String, Object> trustStore = getRestTestHelper().getJsonAsSingletonList("/rest/truststore/" + trustStoreName);
+ Map<String, Object> trustStore = getRestTestHelper().getJsonAsSingletonList("truststore/" + trustStoreName);
assertEquals("Unexpected peersOnly attribute value", initialPeersOnly, trustStore.get(FileTrustStore.PEERS_ONLY));
getRestTestHelper().setUsernameAndPassword(DENIED_USER, DENIED_USER);
@@ -597,10 +596,10 @@ public class BrokerACLTest extends QpidR
Map<String, Object> attributes = new HashMap<String, Object>();
attributes.put(TrustStore.NAME, trustStoreName);
attributes.put(FileTrustStore.PEERS_ONLY, updatedPeersOnly);
- responseCode = getRestTestHelper().submitRequest("/rest/truststore/" + trustStoreName, "PUT", attributes);
+ responseCode = getRestTestHelper().submitRequest("truststore/" + trustStoreName, "PUT", attributes);
assertEquals("Setting of truststore attributes should be denied", 403, responseCode);
- trustStore = getRestTestHelper().getJsonAsSingletonList("/rest/truststore/" + trustStoreName);
+ trustStore = getRestTestHelper().getJsonAsSingletonList("truststore/" + trustStoreName);
assertEquals("Unexpected peersOnly attribute value", initialPeersOnly, trustStore.get(FileTrustStore.PEERS_ONLY));
}
@@ -613,17 +612,17 @@ public class BrokerACLTest extends QpidR
int initialSessionCountLimit = 256;
int updatedSessionCountLimit = 299;
- Map<String, Object> brokerAttributes = getRestTestHelper().getJsonAsSingletonList("/rest/broker");
+ Map<String, Object> brokerAttributes = getRestTestHelper().getJsonAsSingletonList("broker");
assertEquals("Unexpected alert repeat gap", initialSessionCountLimit,
brokerAttributes.get(Broker.CONNECTION_SESSION_COUNT_LIMIT));
Map<String, Object> newAttributes = new HashMap<String, Object>();
newAttributes.put(Broker.CONNECTION_SESSION_COUNT_LIMIT, updatedSessionCountLimit);
- int responseCode = getRestTestHelper().submitRequest("/rest/broker", "PUT", newAttributes);
+ int responseCode = getRestTestHelper().submitRequest("broker", "PUT", newAttributes);
assertEquals("Setting of port attribites should be allowed", 200, responseCode);
- brokerAttributes = getRestTestHelper().getJsonAsSingletonList("/rest/broker");
+ brokerAttributes = getRestTestHelper().getJsonAsSingletonList("broker");
assertEquals("Unexpected default alert repeat gap", updatedSessionCountLimit,
brokerAttributes.get(Broker.CONNECTION_SESSION_COUNT_LIMIT));
}
@@ -635,7 +634,7 @@ public class BrokerACLTest extends QpidR
int initialSessionCountLimit = 256;
int updatedSessionCountLimit = 299;
- Map<String, Object> brokerAttributes = getRestTestHelper().getJsonAsSingletonList("/rest/broker");
+ Map<String, Object> brokerAttributes = getRestTestHelper().getJsonAsSingletonList("broker");
assertEquals("Unexpected alert repeat gap", initialSessionCountLimit,
brokerAttributes.get(Broker.CONNECTION_SESSION_COUNT_LIMIT));
@@ -643,10 +642,10 @@ public class BrokerACLTest extends QpidR
Map<String, Object> newAttributes = new HashMap<String, Object>();
newAttributes.put(Broker.CONNECTION_SESSION_COUNT_LIMIT, updatedSessionCountLimit);
- int responseCode = getRestTestHelper().submitRequest("/rest/broker", "PUT", newAttributes);
+ int responseCode = getRestTestHelper().submitRequest("broker", "PUT", newAttributes);
assertEquals("Setting of port attribites should be allowed", 403, responseCode);
- brokerAttributes = getRestTestHelper().getJsonAsSingletonList("/rest/broker");
+ brokerAttributes = getRestTestHelper().getJsonAsSingletonList("broker");
assertEquals("Unexpected default alert repeat gap", initialSessionCountLimit,
brokerAttributes.get(Broker.CONNECTION_SESSION_COUNT_LIMIT));
}
@@ -696,7 +695,7 @@ public class BrokerACLTest extends QpidR
getRestTestHelper().setUsernameAndPassword(DENIED_USER, DENIED_USER);
- responseCode = getRestTestHelper().submitRequest("/rest/groupprovider/" + groupProviderName, "DELETE", null);
+ responseCode = getRestTestHelper().submitRequest("groupprovider/" + groupProviderName, "DELETE");
assertEquals("Group provider deletion should be denied", 403, responseCode);
assertGroupProviderExistence(groupProviderName, true);
@@ -717,7 +716,7 @@ public class BrokerACLTest extends QpidR
getRestTestHelper().setUsernameAndPassword(ALLOWED_USER, ALLOWED_USER);
- responseCode = getRestTestHelper().submitRequest("/rest/groupprovider/" + groupProviderName, "DELETE", null);
+ responseCode = getRestTestHelper().submitRequest("groupprovider/" + groupProviderName, "DELETE");
assertEquals("Group provider deletion should be allowed", 200, responseCode);
assertGroupProviderExistence(groupProviderName, false);
@@ -740,7 +739,7 @@ public class BrokerACLTest extends QpidR
attributes.put(GroupProvider.NAME, groupProviderName);
attributes.put(GroupProvider.TYPE, FileBasedGroupProviderImpl.GROUP_FILE_PROVIDER_TYPE);
attributes.put(FileBasedGroupProvider.PATH, "/path/to/file");
- responseCode = getRestTestHelper().submitRequest("/rest/groupprovider/" + groupProviderName, "PUT", attributes);
+ responseCode = getRestTestHelper().submitRequest("groupprovider/" + groupProviderName, "PUT", attributes);
assertEquals("Setting of group provider attributes should be allowed but not supported", 409, responseCode);
}
@@ -763,7 +762,7 @@ public class BrokerACLTest extends QpidR
attributes.put(GroupProvider.NAME, groupProviderName);
attributes.put(GroupProvider.TYPE, FileBasedGroupProviderImpl.GROUP_FILE_PROVIDER_TYPE);
attributes.put(FileBasedGroupProvider.PATH, "/path/to/file");
- responseCode = getRestTestHelper().submitRequest("/rest/groupprovider/" + groupProviderName, "PUT", attributes);
+ responseCode = getRestTestHelper().submitRequest("groupprovider/" + groupProviderName, "PUT", attributes);
assertEquals("Setting of group provider attributes should be denied", 403, responseCode);
}
@@ -812,7 +811,7 @@ public class BrokerACLTest extends QpidR
getRestTestHelper().setUsernameAndPassword(DENIED_USER, DENIED_USER);
- responseCode = getRestTestHelper().submitRequest("/rest/accesscontrolprovider/" + accessControlProviderName, "DELETE", null);
+ responseCode = getRestTestHelper().submitRequest("accesscontrolprovider/" + accessControlProviderName, "DELETE");
assertEquals("Access control provider deletion should be denied", 403, responseCode);
assertAccessControlProviderExistence(accessControlProviderName, true);
@@ -831,7 +830,7 @@ public class BrokerACLTest extends QpidR
assertAccessControlProviderExistence(accessControlProviderName, true);
- responseCode = getRestTestHelper().submitRequest("/rest/accesscontrolprovider/" + accessControlProviderName, "DELETE", null);
+ responseCode = getRestTestHelper().submitRequest("accesscontrolprovider/" + accessControlProviderName, "DELETE");
assertEquals("Access control provider deletion should be allowed", 200, responseCode);
assertAccessControlProviderExistence(accessControlProviderName, false);
@@ -854,7 +853,7 @@ public class BrokerACLTest extends QpidR
attributes.put(GroupProvider.NAME, accessControlProviderName);
attributes.put(GroupProvider.TYPE, FileBasedGroupProviderImpl.GROUP_FILE_PROVIDER_TYPE);
attributes.put(FileBasedGroupProvider.PATH, "/path/to/file");
- responseCode = getRestTestHelper().submitRequest("/rest/accesscontrolprovider/" + accessControlProviderName, "PUT", attributes);
+ responseCode = getRestTestHelper().submitRequest("accesscontrolprovider/" + accessControlProviderName, "PUT", attributes);
assertEquals("Setting of access control provider attributes should be allowed but not supported", 409, responseCode);
}
@@ -877,7 +876,7 @@ public class BrokerACLTest extends QpidR
attributes.put(GroupProvider.NAME, accessControlProviderName);
attributes.put(GroupProvider.TYPE, FileBasedGroupProviderImpl.GROUP_FILE_PROVIDER_TYPE);
attributes.put(FileBasedGroupProvider.PATH, "/path/to/file");
- responseCode = getRestTestHelper().submitRequest("/rest/accesscontrolprovider/" + accessControlProviderName, "PUT", attributes);
+ responseCode = getRestTestHelper().submitRequest("accesscontrolprovider/" + accessControlProviderName, "PUT", attributes);
assertEquals("Setting of access control provider attributes should be denied", 403, responseCode);
}
@@ -895,11 +894,11 @@ public class BrokerACLTest extends QpidR
attributes.put(HttpManagement.TIME_OUT, 10000);
int responseCode = getRestTestHelper().submitRequest(
- "/rest/plugin/" + TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT, "PUT", attributes);
+ "plugin/" + TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT, "PUT", attributes);
assertEquals("Setting of http management should be allowed", 200, responseCode);
Map<String, Object> details = getRestTestHelper().getJsonAsSingletonList(
- "/rest/plugin/" + TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT);
+ "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));
@@ -920,11 +919,11 @@ public class BrokerACLTest extends QpidR
attributes.put(HttpManagement.TIME_OUT, 10000);
int responseCode = getRestTestHelper().submitRequest(
- "/rest/plugin/" + TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT, "PUT", attributes);
+ "plugin/" + TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT, "PUT", attributes);
assertEquals("Setting of http management should be denied", 403, responseCode);
Map<String, Object> details = getRestTestHelper().getJsonAsSingletonList(
- "/rest/plugin/" + TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT);
+ "plugin/" + TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT);
assertEquals("Unexpected session timeout", HttpManagement.DEFAULT_TIMEOUT_IN_SECONDS,
details.get(HttpManagement.TIME_OUT));
@@ -947,7 +946,7 @@ public class BrokerACLTest extends QpidR
attributes.put(Port.PORT, findFreePort());
attributes.put(Port.AUTHENTICATION_PROVIDER, TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER);
- return getRestTestHelper().submitRequest("/rest/port/" + portName, "PUT", attributes);
+ return getRestTestHelper().submitRequest("port/" + portName, "PUT", attributes);
}
private void assertPortExists(String portName) throws Exception
@@ -962,19 +961,19 @@ public class BrokerACLTest extends QpidR
private void assertPortExistence(String portName, boolean exists) throws Exception
{
- List<Map<String, Object>> hosts = getRestTestHelper().getJsonAsList("/rest/port/" + portName);
+ List<Map<String, Object>> hosts = getRestTestHelper().getJsonAsList("port/" + portName);
assertEquals("Unexpected result", exists, !hosts.isEmpty());
}
private void assertKeyStoreExistence(String keyStoreName, boolean exists) throws Exception
{
- List<Map<String, Object>> keyStores = getRestTestHelper().getJsonAsList("/rest/keystore/" + keyStoreName);
+ List<Map<String, Object>> keyStores = getRestTestHelper().getJsonAsList("keystore/" + keyStoreName);
assertEquals("Unexpected result", exists, !keyStores.isEmpty());
}
private void assertTrustStoreExistence(String trustStoreName, boolean exists) throws Exception
{
- List<Map<String, Object>> trustStores = getRestTestHelper().getJsonAsList("/rest/truststore/" + trustStoreName);
+ List<Map<String, Object>> trustStores = getRestTestHelper().getJsonAsList("truststore/" + trustStoreName);
assertEquals("Unexpected result", exists, !trustStores.isEmpty());
}
@@ -985,7 +984,7 @@ public class BrokerACLTest extends QpidR
data.put(VirtualHostNode.TYPE, getTestProfileVirtualHostNodeType());
data.put(DurableConfigurationStore.STORE_PATH, getStoreLocation(virtualHostNodeName));
- return getRestTestHelper().submitRequest("/rest/virtualhostnode/" + virtualHostNodeName, "PUT", data);
+ return getRestTestHelper().submitRequest("virtualhostnode/" + virtualHostNodeName, "PUT", data);
}
private void assertVirtualHostNodeDoesNotExist(String name) throws Exception
@@ -1000,7 +999,7 @@ public class BrokerACLTest extends QpidR
private void assertVirtualHostNodeExistence(String name, boolean exists) throws Exception
{
- List<Map<String, Object>> hosts = getRestTestHelper().getJsonAsList("/rest/virtualhostnode/" + name);
+ List<Map<String, Object>> hosts = getRestTestHelper().getJsonAsList("virtualhostnode/" + name);
assertEquals("Node " + name + (exists ? " does not exist" : " exists" ), exists, !hosts.isEmpty());
}
@@ -1015,7 +1014,7 @@ public class BrokerACLTest extends QpidR
attributes.put(AuthenticationProvider.NAME, authenticationProviderName);
attributes.put(AuthenticationProvider.TYPE, AnonymousAuthenticationManager.PROVIDER_TYPE);
- return getRestTestHelper().submitRequest("/rest/authenticationprovider/" + authenticationProviderName, "PUT", attributes);
+ return getRestTestHelper().submitRequest("authenticationprovider/" + authenticationProviderName, "PUT", attributes);
}
private void assertAuthenticationProviderDoesNotExist(String authenticationProviderName) throws Exception
@@ -1030,7 +1029,7 @@ public class BrokerACLTest extends QpidR
private void assertAuthenticationProviderExistence(String authenticationProviderName, boolean exists) throws Exception
{
- String path = "/rest/authenticationprovider/" + authenticationProviderName;
+ String path = "authenticationprovider/" + authenticationProviderName;
List<Map<String, Object>> providers = getRestTestHelper().getJsonAsList(path);
assertEquals("Unexpected result", exists, !providers.isEmpty());
}
@@ -1043,7 +1042,7 @@ public class BrokerACLTest extends QpidR
keyStoreAttributes.put(FileKeyStore.PASSWORD, TestSSLConstants.KEYSTORE_PASSWORD);
keyStoreAttributes.put(FileKeyStore.CERTIFICATE_ALIAS, certAlias);
- return getRestTestHelper().submitRequest("/rest/keystore/" + name, "PUT", keyStoreAttributes);
+ return getRestTestHelper().submitRequest("keystore/" + name, "PUT", keyStoreAttributes);
}
private int createTrustStore(String name, boolean peersOnly) throws IOException, JsonGenerationException, JsonMappingException
@@ -1054,12 +1053,12 @@ public class BrokerACLTest extends QpidR
trustStoreAttributes.put(FileTrustStore.PASSWORD, TestSSLConstants.KEYSTORE_PASSWORD);
trustStoreAttributes.put(FileTrustStore.PEERS_ONLY, peersOnly);
- return getRestTestHelper().submitRequest("/rest/truststore/" + name, "PUT", trustStoreAttributes);
+ return getRestTestHelper().submitRequest("truststore/" + name, "PUT", trustStoreAttributes);
}
private void assertGroupProviderExistence(String groupProviderName, boolean exists) throws Exception
{
- String path = "/rest/groupprovider/" + groupProviderName;
+ String path = "groupprovider/" + groupProviderName;
List<Map<String, Object>> providers = getRestTestHelper().getJsonAsList(path);
assertEquals("Unexpected result", exists, !providers.isEmpty());
}
@@ -1072,12 +1071,12 @@ public class BrokerACLTest extends QpidR
attributes.put(GroupProvider.TYPE, FileBasedGroupProviderImpl.GROUP_FILE_PROVIDER_TYPE);
attributes.put(FileBasedGroupProvider.PATH, file.getAbsoluteFile());
- return getRestTestHelper().submitRequest("/rest/groupprovider/" + groupProviderName, "PUT", attributes);
+ return getRestTestHelper().submitRequest("groupprovider/" + groupProviderName, "PUT", attributes);
}
private void assertAccessControlProviderExistence(String accessControlProviderName, boolean exists) throws Exception
{
- String path = "/rest/accesscontrolprovider/" + accessControlProviderName;
+ String path = "accesscontrolprovider/" + accessControlProviderName;
List<Map<String, Object>> providers = getRestTestHelper().getJsonAsList(path);
assertEquals("Unexpected result", exists, !providers.isEmpty());
}
@@ -1090,6 +1089,6 @@ public class BrokerACLTest extends QpidR
attributes.put(AccessControlProvider.TYPE, FileAccessControlProviderConstants.ACL_FILE_PROVIDER_TYPE);
attributes.put(FileAccessControlProviderConstants.PATH, file.getAbsoluteFile());
- return getRestTestHelper().submitRequest("/rest/accesscontrolprovider/" + accessControlProviderName, "PUT", attributes);
+ return getRestTestHelper().submitRequest("accesscontrolprovider/" + accessControlProviderName, "PUT", attributes);
}
}
Modified: qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/ExchangeRestACLTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/ExchangeRestACLTest.java?rev=1591948&r1=1591947&r2=1591948&view=diff
==============================================================================
--- qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/ExchangeRestACLTest.java (original)
+++ qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/ExchangeRestACLTest.java Fri May 2 15:29:25 2014
@@ -77,11 +77,11 @@ public class ExchangeRestACLTest extends
Map<String, Object> queueData = new HashMap<String, Object>();
queueData.put(Queue.NAME, _queueName);
queueData.put(Queue.DURABLE, Boolean.TRUE);
- int status = getRestTestHelper().submitRequest("/rest/queue/test/test/" + _queueName, "PUT", queueData);
+ int status = getRestTestHelper().submitRequest("queue/test/test/" + _queueName, "PUT", queueData);
assertEquals("Unexpected status", 201, status);
_exchangeName = getTestName();
- _exchangeUrl = "/rest/exchange/test/test/" + _exchangeName;
+ _exchangeUrl = "exchange/test/test/" + _exchangeName;
}
public void testCreateExchangeAllowed() throws Exception
@@ -114,7 +114,7 @@ public class ExchangeRestACLTest extends
assertExchangeExists();
- responseCode = getRestTestHelper().submitRequest(_exchangeUrl, "DELETE", null);
+ responseCode = getRestTestHelper().submitRequest(_exchangeUrl, "DELETE");
assertEquals("Exchange deletion should be allowed", 200, responseCode);
assertExchangeDoesNotExist();
@@ -130,7 +130,7 @@ public class ExchangeRestACLTest extends
assertExchangeExists();
getRestTestHelper().setUsernameAndPassword(DENIED_USER, DENIED_USER);
- responseCode = getRestTestHelper().submitRequest(_exchangeUrl, "DELETE", null);
+ responseCode = getRestTestHelper().submitRequest(_exchangeUrl, "DELETE");
assertEquals("Exchange deletion should be denied", 403, responseCode);
assertExchangeExists();
@@ -222,7 +222,7 @@ public class ExchangeRestACLTest extends
attributes.put(Binding.QUEUE, _queueName);
attributes.put(Binding.EXCHANGE, "amq.direct");
- int responseCode = getRestTestHelper().submitRequest("/rest/binding/test/test/amq.direct/" + _queueName + "/" + bindingName, "PUT", attributes);
+ int responseCode = getRestTestHelper().submitRequest("binding/test/test/amq.direct/" + _queueName + "/" + bindingName, "PUT", attributes);
return responseCode;
}
@@ -238,7 +238,7 @@ public class ExchangeRestACLTest extends
private void assertBindingExistence(String bindingName, boolean exists) throws Exception
{
- List<Map<String, Object>> bindings = getRestTestHelper().getJsonAsList("/rest/binding/test/test/amq.direct/" + _queueName + "/" + bindingName);
+ List<Map<String, Object>> bindings = getRestTestHelper().getJsonAsList("binding/test/test/amq.direct/" + _queueName + "/" + bindingName);
assertEquals("Unexpected result", exists, !bindings.isEmpty());
}
}
Modified: qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/GroupRestACLTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/GroupRestACLTest.java?rev=1591948&r1=1591947&r2=1591948&view=diff
==============================================================================
--- qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/GroupRestACLTest.java (original)
+++ qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/GroupRestACLTest.java Fri May 2 15:29:25 2014
@@ -103,19 +103,19 @@ public class GroupRestACLTest extends Qp
super.setUp();
getRestTestHelper().setUsernameAndPassword(ALLOWED_USER, ALLOWED_USER);
- Map<String, Object> data = getRestTestHelper().getJsonAsSingletonList("/rest/groupprovider/" + FILE_GROUP_MANAGER);
+ Map<String, Object> data = getRestTestHelper().getJsonAsSingletonList("groupprovider/" + FILE_GROUP_MANAGER);
getRestTestHelper().assertNumberOfGroups(data, 3);
getRestTestHelper().createGroup("newGroup", FILE_GROUP_MANAGER);
- data = getRestTestHelper().getJsonAsSingletonList("/rest/groupprovider/" + FILE_GROUP_MANAGER);
+ data = getRestTestHelper().getJsonAsSingletonList("groupprovider/" + FILE_GROUP_MANAGER);
getRestTestHelper().assertNumberOfGroups(data, 4);
getRestTestHelper().setUsernameAndPassword(DENIED_USER, DENIED_USER);
getRestTestHelper().createGroup("anotherNewGroup", FILE_GROUP_MANAGER, HttpServletResponse.SC_FORBIDDEN);
- data = getRestTestHelper().getJsonAsSingletonList("/rest/groupprovider/" + FILE_GROUP_MANAGER);
+ data = getRestTestHelper().getJsonAsSingletonList("groupprovider/" + FILE_GROUP_MANAGER);
getRestTestHelper().assertNumberOfGroups(data, 4);
}
@@ -129,19 +129,19 @@ public class GroupRestACLTest extends Qp
super.setUp();
getRestTestHelper().setUsernameAndPassword(DENIED_USER, DENIED_USER);
- Map<String, Object> data = getRestTestHelper().getJsonAsSingletonList("/rest/groupprovider/" + FILE_GROUP_MANAGER);
+ Map<String, Object> data = getRestTestHelper().getJsonAsSingletonList("groupprovider/" + FILE_GROUP_MANAGER);
getRestTestHelper().assertNumberOfGroups(data, 3);
getRestTestHelper().removeGroup(OTHER_GROUP, FILE_GROUP_MANAGER, HttpServletResponse.SC_FORBIDDEN);
- data = getRestTestHelper().getJsonAsSingletonList("/rest/groupprovider/" + FILE_GROUP_MANAGER);
+ data = getRestTestHelper().getJsonAsSingletonList("groupprovider/" + FILE_GROUP_MANAGER);
getRestTestHelper().assertNumberOfGroups(data, 3);
getRestTestHelper().setUsernameAndPassword(ALLOWED_USER, ALLOWED_USER);
getRestTestHelper().removeGroup(OTHER_GROUP, FILE_GROUP_MANAGER);
- data = getRestTestHelper().getJsonAsSingletonList("/rest/groupprovider/" + FILE_GROUP_MANAGER);
+ data = getRestTestHelper().getJsonAsSingletonList("groupprovider/" + FILE_GROUP_MANAGER);
getRestTestHelper().assertNumberOfGroups(data, 2);
}
@@ -187,7 +187,7 @@ public class GroupRestACLTest extends Qp
private void assertNumberOfGroupMembers(String groupName, int expectedNumberOfMembers) throws IOException
{
- Map<String, Object> group = getRestTestHelper().getJsonAsSingletonList("/rest/group/" + FILE_GROUP_MANAGER + "/" + groupName);
+ Map<String, Object> group = getRestTestHelper().getJsonAsSingletonList("group/" + FILE_GROUP_MANAGER + "/" + groupName);
getRestTestHelper().assertNumberOfGroupMembers(group, expectedNumberOfMembers);
}
}
Modified: qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/LogViewerACLTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/LogViewerACLTest.java?rev=1591948&r1=1591947&r2=1591948&view=diff
==============================================================================
--- qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/LogViewerACLTest.java (original)
+++ qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/LogViewerACLTest.java Fri May 2 15:29:25 2014
@@ -52,7 +52,7 @@ public class LogViewerACLTest extends Qp
{
getRestTestHelper().setUsernameAndPassword(ALLOWED_USER, ALLOWED_USER);
- int responseCode = getRestTestHelper().submitRequest("/rest/logrecords", "GET", null);
+ int responseCode = getRestTestHelper().submitRequest("/service/logrecords", "GET");
assertEquals("Access to log records should be allowed", 200, responseCode);
}
@@ -60,7 +60,7 @@ public class LogViewerACLTest extends Qp
{
getRestTestHelper().setUsernameAndPassword(DENIED_USER, DENIED_USER);
- int responseCode = getRestTestHelper().submitRequest("/rest/logrecords", "GET", null);
+ int responseCode = getRestTestHelper().submitRequest("/service/logrecords", "GET");
assertEquals("Access to log records should be denied", 403, responseCode);
}
@@ -68,7 +68,7 @@ public class LogViewerACLTest extends Qp
{
getRestTestHelper().setUsernameAndPassword(ALLOWED_USER, ALLOWED_USER);
- int responseCode = getRestTestHelper().submitRequest("/rest/logfilenames", "GET", null);
+ int responseCode = getRestTestHelper().submitRequest("/service/logfilenames", "GET");
assertEquals("Access to log files should be allowed", 200, responseCode);
}
@@ -76,7 +76,7 @@ public class LogViewerACLTest extends Qp
{
getRestTestHelper().setUsernameAndPassword(DENIED_USER, DENIED_USER);
- int responseCode = getRestTestHelper().submitRequest("/rest/logfilenames", "GET", null);
+ int responseCode = getRestTestHelper().submitRequest("/service/logfilenames", "GET");
assertEquals("Access to log files should be denied", 403, responseCode);
}
@@ -84,7 +84,7 @@ public class LogViewerACLTest extends Qp
{
getRestTestHelper().setUsernameAndPassword(ALLOWED_USER, ALLOWED_USER);
- int responseCode = getRestTestHelper().submitRequest("/rest/logfile?l=appender%2fqpid.log", "GET", null);
+ int responseCode = getRestTestHelper().submitRequest("/service/logfile?l=appender%2fqpid.log", "GET");
assertEquals("Access to log files should be allowed", 404, responseCode);
}
@@ -92,7 +92,7 @@ public class LogViewerACLTest extends Qp
{
getRestTestHelper().setUsernameAndPassword(DENIED_USER, DENIED_USER);
- int responseCode = getRestTestHelper().submitRequest("/rest/logfile?l=appender%2fqpid.log", "GET", null);
+ int responseCode = getRestTestHelper().submitRequest("/service/logfile?l=appender%2fqpid.log", "GET");
assertEquals("Access to log files should be denied", 403, responseCode);
}
Modified: qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/QueueRestACLTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/QueueRestACLTest.java?rev=1591948&r1=1591947&r2=1591948&view=diff
==============================================================================
--- qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/QueueRestACLTest.java (original)
+++ qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/QueueRestACLTest.java Fri May 2 15:29:25 2014
@@ -44,7 +44,7 @@ public class QueueRestACLTest extends Qp
{
super.setUp();
_queueName = getTestName();
- _queueUrl = "/rest/queue/test/test/" + _queueName;
+ _queueUrl = "queue/test/test/" + _queueName;
}
@Override
@@ -95,7 +95,7 @@ public class QueueRestACLTest extends Qp
assertQueueExists();
- responseCode = getRestTestHelper().submitRequest(_queueUrl, "DELETE", null);
+ responseCode = getRestTestHelper().submitRequest(_queueUrl, "DELETE");
assertEquals("Queue deletion should be allowed", 200, responseCode);
assertQueueDoesNotExist();
@@ -111,7 +111,7 @@ public class QueueRestACLTest extends Qp
assertQueueExists();
getRestTestHelper().setUsernameAndPassword(DENIED_USER, DENIED_USER);
- responseCode = getRestTestHelper().submitRequest(_queueUrl, "DELETE", null);
+ responseCode = getRestTestHelper().submitRequest(_queueUrl, "DELETE");
assertEquals("Queue deletion should be denied", 403, responseCode);
assertQueueExists();
Modified: qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/UserPreferencesRestACLTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/UserPreferencesRestACLTest.java?rev=1591948&r1=1591947&r2=1591948&view=diff
==============================================================================
--- qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/UserPreferencesRestACLTest.java (original)
+++ qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/UserPreferencesRestACLTest.java Fri May 2 15:29:25 2014
@@ -40,7 +40,7 @@ import org.apache.qpid.test.utils.TestFi
public class UserPreferencesRestACLTest extends QpidRestTestCase
{
- private static final String REST_USER_PREFERENCES_BASE_URL = "/rest/userpreferences";
+ private static final String REST_USER_PREFERENCES_BASE_URL = "/service/userpreferences";
private static final String ALLOWED_USER = "webadmin";
private static final String DENIED_USER = "admin";
private static final String TEST_USER_PREFERENCES_GET_URL = REST_USER_PREFERENCES_BASE_URL + "/"
@@ -121,9 +121,9 @@ public class UserPreferencesRestACLTest
getRestTestHelper().setUsernameAndPassword(DENIED_USER, DENIED_USER);
int responseCode = getRestTestHelper().submitRequest(
- "/rest/userpreferences?user="
+ "/service/userpreferences?user="
+ URLEncoder.encode(TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER + "/" + ALLOWED_USER, "UTF-8"),
- "DELETE", null);
+ "DELETE");
assertEquals("Preferences deletion should be denied", 403, responseCode);
}
@@ -138,9 +138,9 @@ public class UserPreferencesRestACLTest
assertEquals("Unexpected saveTabs preference", false, preferences.get("saveTabs"));
int responseCode = getRestTestHelper().submitRequest(
- "/rest/userpreferences?user="
+ "/service/userpreferences?user="
+ URLEncoder.encode(TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER + "/" + DENIED_USER, "UTF-8"),
- "DELETE", null);
+ "DELETE");
assertEquals("Preferences deletion should be allowed", 200, responseCode);
preferences = getRestTestHelper().getJsonAsMap(userPreferencesUrl);
@@ -160,9 +160,9 @@ public class UserPreferencesRestACLTest
getRestTestHelper().setUsernameAndPassword(DENIED_USER, DENIED_USER);
int responseCode = getRestTestHelper().submitRequest(
- "/rest/userpreferences?user="
+ "/service/userpreferences?user="
+ URLEncoder.encode(TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER + "/" + ALLOWED_USER, "UTF-8"),
- "DELETE", null);
+ "DELETE");
assertEquals("Preferences deletion should be denied", 403, responseCode);
getRestTestHelper().setUsernameAndPassword(ALLOWED_USER, ALLOWED_USER);
Modified: qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/UserRestACLTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/UserRestACLTest.java?rev=1591948&r1=1591947&r2=1591948&view=diff
==============================================================================
--- qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/UserRestACLTest.java (original)
+++ qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/UserRestACLTest.java Fri May 2 15:29:25 2014
@@ -21,7 +21,6 @@ package org.apache.qpid.systest.rest.acl
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
-import java.net.HttpURLConnection;
import java.util.List;
import java.util.Map;
import java.util.Properties;
@@ -168,26 +167,24 @@ public class UserRestACLTest extends Qpi
private void checkPassword(String username, String password, boolean passwordExpectedToBeCorrect) throws IOException
{
getRestTestHelper().setUsernameAndPassword(username, password);
- HttpURLConnection connection = getRestTestHelper().openManagementConnection("/rest/user/"
- + TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER + "/", "GET");
- boolean passwordIsCorrect = connection.getResponseCode() == HttpServletResponse.SC_OK;
-
- connection.disconnect();
+ int responseCode = getRestTestHelper().submitRequest("user/"
+ + TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER + "/", "GET", (byte[])null);
+ boolean passwordIsCorrect = responseCode == HttpServletResponse.SC_OK;
assertEquals(passwordExpectedToBeCorrect, passwordIsCorrect);
}
private void assertUserDoesNotExist(String newUser) throws JsonParseException, JsonMappingException, IOException
{
- String path = "/rest/user/" + TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER + "/" + newUser;
+ String path = "user/" + TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER + "/" + newUser;
List<Map<String, Object>> userDetailsList = getRestTestHelper().getJsonAsList(path);
assertTrue(userDetailsList.isEmpty());
}
private void assertUserExists(String username) throws IOException
{
- String path = "/rest/user/" + TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER + "/" + username;
+ String path = "user/" + TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER + "/" + username;
Map<String, Object> userDetails = getRestTestHelper().getJsonAsSingletonList(path);
assertEquals(
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org