From 62874fbff52f8c30af6032ea000bde9304a71914 Mon Sep 17 00:00:00 2001 From: Filip Hanik Date: Mon, 18 May 2015 07:38:20 -0600 Subject: [PATCH] Fix client names with dot do not work This is Spring Framework MVC behavior as described in http://stackoverflow.com/questions/16332092/spring-mvc-pathvariable-with-dot-is-getting-truncated https://www.pivotaltracker.com/story/show/90572716 [#90572716] --- login/src/main/resources/login-ui.xml | 1 + .../main/webapp/WEB-INF/spring-servlet.xml | 2 -- .../login/AccountsControllerMockMvcTests.java | 6 ++---- .../ClientAdminEndpointsMockMvcTests.java | 21 +++++++++++++------ 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/login/src/main/resources/login-ui.xml b/login/src/main/resources/login-ui.xml index c09cf5a32a9..2107809f1b0 100644 --- a/login/src/main/resources/login-ui.xml +++ b/login/src/main/resources/login-ui.xml @@ -267,6 +267,7 @@ + diff --git a/uaa/src/main/webapp/WEB-INF/spring-servlet.xml b/uaa/src/main/webapp/WEB-INF/spring-servlet.xml index 105604fc934..89f8f3fb354 100755 --- a/uaa/src/main/webapp/WEB-INF/spring-servlet.xml +++ b/uaa/src/main/webapp/WEB-INF/spring-servlet.xml @@ -219,8 +219,6 @@ - - diff --git a/uaa/src/test/java/org/cloudfoundry/identity/uaa/login/AccountsControllerMockMvcTests.java b/uaa/src/test/java/org/cloudfoundry/identity/uaa/login/AccountsControllerMockMvcTests.java index 8007ce07d9d..7ecb9ce611a 100644 --- a/uaa/src/test/java/org/cloudfoundry/identity/uaa/login/AccountsControllerMockMvcTests.java +++ b/uaa/src/test/java/org/cloudfoundry/identity/uaa/login/AccountsControllerMockMvcTests.java @@ -45,7 +45,6 @@ import static org.junit.Assert.assertTrue; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; -import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.redirectedUrl; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @@ -111,7 +110,7 @@ public static void stopMailServer() throws Exception { public void testCreateActivationEmailPage() throws Exception { ((MockEnvironment) webApplicationContext.getEnvironment()).setProperty("login.brand", "oss"); - mockMvc.perform(get("/create_account.do")) + mockMvc.perform(get("/create_account")) .andExpect(content().string(containsString("Create your account"))) .andExpect(content().string(not(containsString("Pivotal ID")))); } @@ -120,7 +119,7 @@ public void testCreateActivationEmailPage() throws Exception { public void testCreateActivationEmailPageWithPivotalBrand() throws Exception { ((MockEnvironment) webApplicationContext.getEnvironment()).setProperty("login.brand", "pivotal"); - mockMvc.perform(get("/create_account.do")) + mockMvc.perform(get("/create_account")) .andExpect(content().string(containsString("Create your Pivotal ID"))) .andExpect(content().string(not(containsString("Create your account")))); } @@ -274,7 +273,6 @@ public void testCreatingAnAccountInAnotherZoneWithNoClientRedirect() throws Exce MvcResult mvcResult = mockMvc.perform(get("/verify_user") .param("code", "test" + generator.counter.get()) .with(new SetServerNameRequestPostProcessor("mysubdomain.localhost"))) - .andDo(print()) .andExpect(status().isFound()) .andExpect(redirectedUrl("home")) .andReturn(); diff --git a/uaa/src/test/java/org/cloudfoundry/identity/uaa/mock/clients/ClientAdminEndpointsMockMvcTests.java b/uaa/src/test/java/org/cloudfoundry/identity/uaa/mock/clients/ClientAdminEndpointsMockMvcTests.java index 8c9bd7f9a67..9001257a392 100644 --- a/uaa/src/test/java/org/cloudfoundry/identity/uaa/mock/clients/ClientAdminEndpointsMockMvcTests.java +++ b/uaa/src/test/java/org/cloudfoundry/identity/uaa/mock/clients/ClientAdminEndpointsMockMvcTests.java @@ -157,10 +157,10 @@ private void setupAdminUserToken() throws Exception { ClientDetails adminClient = createAdminClient(adminToken); adminUserToken = testClient.getUserOAuthAccessToken(adminClient.getClientId(), - "secret", - testUser.getUsername(), - testPassword, - "uaa.admin,clients.read,clients.write"); + "secret", + testUser.getUsername(), + testPassword, + "uaa.admin,clients.read,clients.write"); } @AfterClass @@ -265,7 +265,7 @@ public void testUpdateClientsTxSuccess() throws Exception { assertEquals(new Integer(120), client.getRefreshTokenValiditySeconds()); } //create and then update events - verify(applicationEventPublisher, times(count*2)).publishEvent(captor.capture()); + verify(applicationEventPublisher, times(count * 2)).publishEvent(captor.capture()); int index = 0; for (AbstractUaaEvent event : captor.getAllValues()) { if (index