diff --git a/uaa/src/test/java/org/cloudfoundry/identity/uaa/login/AccountsControllerIntegrationTest.java b/uaa/src/test/java/org/cloudfoundry/identity/uaa/login/AccountsControllerIntegrationTest.java index 4624da8d4ec..91fc496ba34 100644 --- a/uaa/src/test/java/org/cloudfoundry/identity/uaa/login/AccountsControllerIntegrationTest.java +++ b/uaa/src/test/java/org/cloudfoundry/identity/uaa/login/AccountsControllerIntegrationTest.java @@ -158,7 +158,7 @@ public void testCreatingAnAccount() throws Exception { .param("code", "test"+generator.counter.get())) .andDo(print()) .andExpect(status().isFound()) - .andExpect(redirectedUrl("http://localhost:8080/uaa/home")) + .andExpect(redirectedUrl("home")) .andReturn(); SecurityContext securityContext = (SecurityContext) mvcResult.getRequest().getSession().getAttribute(HttpSessionSecurityContextRepository.SPRING_SECURITY_CONTEXT_KEY); @@ -187,7 +187,7 @@ public void testCreatingAnAccountWithAnEmptyClientId() throws Exception { .param("code", "test"+generator.counter.get())) .andDo(print()) .andExpect(status().isFound()) - .andExpect(redirectedUrl("http://localhost:8080/uaa/home")) + .andExpect(redirectedUrl("home")) .andReturn(); SecurityContext securityContext = (SecurityContext) mvcResult.getRequest().getSession().getAttribute(HttpSessionSecurityContextRepository.SPRING_SECURITY_CONTEXT_KEY); @@ -276,7 +276,7 @@ public void testCreatingAnAccountInAnotherZoneWithNoClientRedirect() throws Exce .with(new SetServerNameRequestPostProcessor("mysubdomain.localhost"))) .andDo(print()) .andExpect(status().isFound()) - .andExpect(redirectedUrl("http://mysubdomain.localhost:8080/uaa/home")) + .andExpect(redirectedUrl("home")) .andReturn(); SecurityContext securityContext = (SecurityContext) mvcResult.getRequest().getSession().getAttribute(HttpSessionSecurityContextRepository.SPRING_SECURITY_CONTEXT_KEY); diff --git a/uaa/src/test/java/org/cloudfoundry/identity/uaa/scim/endpoints/ScimUserEndpointsMockMvcTests.java b/uaa/src/test/java/org/cloudfoundry/identity/uaa/scim/endpoints/ScimUserEndpointsMockMvcTests.java index fe7de97d50d..e75e067ea08 100644 --- a/uaa/src/test/java/org/cloudfoundry/identity/uaa/scim/endpoints/ScimUserEndpointsMockMvcTests.java +++ b/uaa/src/test/java/org/cloudfoundry/identity/uaa/scim/endpoints/ScimUserEndpointsMockMvcTests.java @@ -12,7 +12,6 @@ *******************************************************************************/ package org.cloudfoundry.identity.uaa.scim.endpoints; -import org.apache.commons.lang.RandomStringUtils; import org.cloudfoundry.identity.uaa.oauth.client.ClientDetailsModification; import org.cloudfoundry.identity.uaa.scim.ScimUser; import org.cloudfoundry.identity.uaa.scim.ScimUserProvisioning; @@ -42,7 +41,6 @@ import static org.springframework.http.MediaType.APPLICATION_JSON; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.put; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.header; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @@ -141,7 +139,7 @@ public void testVerifyUserWithScimCreateToken() throws Exception { @Test public void testCreateUserInZone() throws Exception { - String subdomain = RandomStringUtils.random(8); + String subdomain = generator.generate(); createOtherIdentityZone(subdomain); String zoneAdminToken = testClient.getClientCredentialsOAuthAccessToken("admin", "admin-secret", "scim.write", subdomain); @@ -151,10 +149,10 @@ public void testCreateUserInZone() throws Exception { @Test public void testCreateUserInOtherZoneIsUnauthorized() throws Exception { - String subdomain = RandomStringUtils.random(8); + String subdomain = generator.generate(); createOtherIdentityZone(subdomain); - String otherSubdomain = RandomStringUtils.random(8); + String otherSubdomain = generator.generate(); createOtherIdentityZone(otherSubdomain); String zoneAdminToken = testClient.getClientCredentialsOAuthAccessToken("admin", "admin-secret", "scim.write", subdomain); @@ -173,7 +171,7 @@ public void testCreateUserInOtherZoneIsUnauthorized() throws Exception { private IdentityZone createOtherIdentityZone(String subdomain) throws Exception { - String identityToken = testClient.getClientCredentialsOAuthAccessToken("identity", "identitysecret", "zones.create", null); + String identityToken = testClient.getClientCredentialsOAuthAccessToken("identity", "identitysecret", "zones.create"); IdentityZone identityZone = MultitenancyFixture.identityZone(subdomain, subdomain); IdentityZoneCreationRequest creationRequest = new IdentityZoneCreationRequest(); @@ -185,7 +183,7 @@ private IdentityZone createOtherIdentityZone(String subdomain) throws Exception clientDetails.add(client); creationRequest.setClientDetails(clientDetails); - mockMvc.perform(put("/identity-zones/" + subdomain) + mockMvc.perform(post("/identity-zones") .header("Authorization", "Bearer " + identityToken) .contentType(APPLICATION_JSON) .accept(APPLICATION_JSON)