Author: [email protected]
Date: Tue Apr 10 17:10:19 2012
New Revision: 2211
Log:
[AMDATUAUTH-140] Removed hardcoded /rest path from HTTP tools
Modified:
trunk/amdatu-auth/test-integration/tests/src/test/java/org/amdatu/auth/test/integration/tests/UserAdminRESTTest.java
trunk/amdatu-auth/tools/itest/src/main/java/org/amdatu/auth/tools/itest/HttpTools.java
Modified:
trunk/amdatu-auth/test-integration/tests/src/test/java/org/amdatu/auth/test/integration/tests/UserAdminRESTTest.java
==============================================================================
---
trunk/amdatu-auth/test-integration/tests/src/test/java/org/amdatu/auth/test/integration/tests/UserAdminRESTTest.java
(original)
+++
trunk/amdatu-auth/test-integration/tests/src/test/java/org/amdatu/auth/test/integration/tests/UserAdminRESTTest.java
Tue Apr 10 17:10:19 2012
@@ -31,10 +31,10 @@
public void execute() throws Exception {
// Test the REST interface of the useradmin bundle. First wait before
it comes up
- ServiceTools.waitForURL(getHttpTools().getRESTBaseUrl() +
"/users/status", HttpStatus.SC_OK);
+ ServiceTools.waitForURL(getHttpTools().getBaseUrl() +
"/rest/users/status", HttpStatus.SC_OK);
// -1- First try to create a user and verify that a 401 error
(Unauthorized) is returned
- String url = "/users/" + TEST_USERNAME;
+ String url = "/rest/users/" + TEST_USERNAME;
getHttpTools().invokeHTTP(url, javax.ws.rs.HttpMethod.PUT,
HttpStatus.SC_UNAUTHORIZED);
// -2- Now login as Administrator
@@ -62,14 +62,14 @@
Thread.sleep(3000);
getHttpTools().switchHost(IP); // Switch to host by IP address
- ServiceTools.waitForURL(getHttpTools().getRESTBaseUrl() +
"/users/status", HttpStatus.SC_OK);
- getLogService().log(LogService.LOG_DEBUG, "UserAdmin REST service on
'" + getHttpTools().getRESTBaseUrl()
+ ServiceTools.waitForURL(getHttpTools().getBaseUrl() +
"/rest/users/status", HttpStatus.SC_OK);
+ getLogService().log(LogService.LOG_DEBUG, "UserAdmin REST service on
'" + getHttpTools().getBaseUrl()
+ "' now available");
// -7- Now verify that for this new tenant a new user 'Administrator'
should have been created, verify that.
// Note that since the token provider is also tenant specific, using
the same token for this
// request should return an unauthorized response
- url = "/users/Administrator";
+ url = "/rest/users/Administrator";
getHttpTools().invokeHTTP(url, javax.ws.rs.HttpMethod.GET,
HttpStatus.SC_UNAUTHORIZED);
// -8- So login as Administrator and try again
@@ -78,7 +78,7 @@
// -9- Create a new user on '127.0.0.1' and verify that this new user
comes available on this host
// and not on 'localhost'
- url = "/users/" + TEST_USERNAME;
+ url = "/rest/users/" + TEST_USERNAME;
getHttpTools().invokeHTTP(url, javax.ws.rs.HttpMethod.PUT,
HttpStatus.SC_OK);
getHttpTools().invokeHTTP(url, javax.ws.rs.HttpMethod.GET,
HttpStatus.SC_OK);
Modified:
trunk/amdatu-auth/tools/itest/src/main/java/org/amdatu/auth/tools/itest/HttpTools.java
==============================================================================
---
trunk/amdatu-auth/tools/itest/src/main/java/org/amdatu/auth/tools/itest/HttpTools.java
(original)
+++
trunk/amdatu-auth/tools/itest/src/main/java/org/amdatu/auth/tools/itest/HttpTools.java
Tue Apr 10 17:10:19 2012
@@ -123,9 +123,10 @@
}
}
- public String getRESTBaseUrl() throws Exception {
+ public String getBaseUrl() throws Exception {
if (m_restBaseUrl == null) {
- m_restBaseUrl = "http://" + HOSTNAME + ":" + PORTNR + "/rest";
+ m_restBaseUrl = "http://" + HOSTNAME + ":" + PORTNR;
+ m_host = HOSTNAME;
}
return m_restBaseUrl;
}
@@ -133,7 +134,7 @@
// Switch to a new host for REST invocations
public void switchHost(final String newHostName) {
m_host = newHostName;
- m_restBaseUrl = "http://" + newHostName + ":" + PORTNR + "/rest";
+ m_restBaseUrl = "http://" + newHostName + ":" + PORTNR;
}
/**
@@ -164,7 +165,7 @@
public String invokeHTTP(final String urlPostfix, final String httpMethod,
final String inputMimeType,
final Object content,
final int expectedStatus) throws Exception {
- String url = m_restBaseUrl + urlPostfix;
+ String url = getBaseUrl() + urlPostfix;
HttpClient httpClient = new HttpClient();
HttpMethod method = null;
_______________________________________________
Amdatu-commits mailing list
[email protected]
http://lists.amdatu.org/mailman/listinfo/amdatu-commits