archiva-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From och...@apache.org
Subject svn commit: r1477941 - in /archiva/trunk/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src: main/java/org/apache/archiva/rest/services/ test/java/org/apache/archiva/rest/services/
Date Wed, 01 May 2013 10:07:11 GMT
Author: oching
Date: Wed May  1 10:07:11 2013
New Revision: 1477941

URL: http://svn.apache.org/r1477941
Log:
[MRM-1757] remove trailing '/' in application url if present + unit test

Modified:
    archiva/trunk/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultArchivaAdministrationService.java
    archiva/trunk/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/ArchivaAdministrationServiceTest.java

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultArchivaAdministrationService.java
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultArchivaAdministrationService.java?rev=1477941&r1=1477940&r2=1477941&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultArchivaAdministrationService.java
(original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultArchivaAdministrationService.java
Wed May  1 10:07:11 2013
@@ -366,6 +366,10 @@ public class DefaultArchivaAdministratio
     {
         try
         {
+            // fix for MRM-1757
+            // strip any trailing '/' at the end of the url so it won't affect url/link calculations
in UI
+            uiConfiguration.setApplicationUrl(StringUtils.stripEnd(uiConfiguration.getApplicationUrl(),
"/"));
+
             archivaAdministration.updateUiConfiguration( uiConfiguration );
         }
         catch ( RepositoryAdminException e )

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/ArchivaAdministrationServiceTest.java
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/ArchivaAdministrationServiceTest.java?rev=1477941&r1=1477940&r2=1477941&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/ArchivaAdministrationServiceTest.java
(original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/ArchivaAdministrationServiceTest.java
Wed May  1 10:07:11 2013
@@ -141,6 +141,35 @@ public class ArchivaAdministrationServic
     }
 
     @Test
+    public void uiConfigurationUpdate_ApplicationUrlHasTrailingSlash()
+        throws Exception {
+
+        UiConfiguration ui = getArchivaAdministrationService().getUiConfiguration();
+        assertNotNull( ui );
+        assertNull( ui.getApplicationUrl() );
+
+        String url = "http://foo.fr/bar/";
+        ui.setApplicationUrl( url );
+
+        getArchivaAdministrationService().setUiConfiguration( ui );
+
+        ui = getArchivaAdministrationService().getUiConfiguration();
+
+        assertEquals( "http://foo.fr/bar", ui.getApplicationUrl() );
+
+        // test if multiple '/' is trailing
+        url = "http://foo.fr/bar//";
+
+        ui.setApplicationUrl(url);
+
+        getArchivaAdministrationService().setUiConfiguration(ui);
+
+        ui = getArchivaAdministrationService().getUiConfiguration();
+
+        assertEquals( "http://foo.fr/bar", ui.getApplicationUrl() );
+    }
+
+    @Test
     public void getKnownContentAdminRepositoryConsumer()
         throws Exception
     {



Mime
View raw message