]> source.dussan.org Git - archiva.git/commitdiff
add a rest method to validate if managed repository location already exists.
authorOlivier Lamy <olamy@apache.org>
Tue, 17 Jan 2012 22:35:08 +0000 (22:35 +0000)
committerOlivier Lamy <olamy@apache.org>
Tue, 17 Jan 2012 22:35:08 +0000 (22:35 +0000)
So move RepositoryCommonValidator to admin api and add the interface

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1232615 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/RepositoryCommonValidator.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/AbstractRepositoryAdmin.java
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/DefaultRepositoryCommonValidator.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/RepositoryCommonValidator.java [deleted file]
archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/ManagedRepositoriesService.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultManagedRepositoriesService.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/ManagedRepositoriesServiceTest.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/action/admin/repositories/AbstractRepositoriesAdminAction.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/AddManagedRepositoryActionTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/EditManagedRepositoryActionTest.java

diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/RepositoryCommonValidator.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/RepositoryCommonValidator.java
new file mode 100644 (file)
index 0000000..6c862c1
--- /dev/null
@@ -0,0 +1,60 @@
+package org.apache.archiva.admin.model;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.archiva.admin.model.beans.AbstractRepository;
+import org.apache.archiva.admin.model.beans.ManagedRepository;
+
+/**
+ * apply basic repository validation : id and name.
+ * Check if already exists.
+ *
+ * @author Olivier Lamy
+ * @since 1.4-M3
+ */
+public interface RepositoryCommonValidator
+{
+
+    public static final String REPOSITORY_ID_VALID_EXPRESSION = "^[a-zA-Z0-9._-]+$";
+
+    public static final String REPOSITORY_NAME_VALID_EXPRESSION = "^([a-zA-Z0-9.)/_(-]|\\s)+$";
+
+
+    void basicValidation( AbstractRepository abstractRepository, boolean update )
+        throws RepositoryAdminException;
+
+    /**
+     * validate cronExpression and location format
+     *
+     * @param managedRepository
+     * @since 1.4-M2
+     */
+    void validateManagedRepository( ManagedRepository managedRepository )
+        throws RepositoryAdminException;
+
+    /**
+     * replace some interpolations ${appserver.base} with correct values
+     *
+     * @param directory
+     * @return
+     */
+    String removeExpressions( String directory );
+
+
+}
index bb26445e80f3852a97b2e6646f4d791a4d73ac10..bed10a5a13e16b3e55bac33515b94c9b9f6554ce 100644 (file)
@@ -20,6 +20,7 @@ package org.apache.archiva.admin.repository;
 
 import org.apache.archiva.admin.model.AuditInformation;
 import org.apache.archiva.admin.model.RepositoryAdminException;
+import org.apache.archiva.admin.model.RepositoryCommonValidator;
 import org.apache.archiva.audit.AuditEvent;
 import org.apache.archiva.audit.AuditListener;
 import org.apache.archiva.configuration.ArchivaConfiguration;
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/DefaultRepositoryCommonValidator.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/DefaultRepositoryCommonValidator.java
new file mode 100644 (file)
index 0000000..5ee256b
--- /dev/null
@@ -0,0 +1,186 @@
+package org.apache.archiva.admin.repository;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.archiva.admin.model.RepositoryAdminException;
+import org.apache.archiva.admin.model.RepositoryCommonValidator;
+import org.apache.archiva.admin.model.beans.AbstractRepository;
+import org.apache.archiva.admin.model.beans.ManagedRepository;
+import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
+import org.apache.archiva.configuration.ArchivaConfiguration;
+import org.apache.archiva.configuration.Configuration;
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.validator.GenericValidator;
+import org.codehaus.plexus.registry.Registry;
+import org.codehaus.redback.components.scheduler.CronExpressionValidator;
+import org.springframework.stereotype.Service;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+
+/**
+ * apply basic repository validation : id and name.
+ * Check if already exists.
+ *
+ * @author Olivier Lamy
+ * @since 1.4-M1
+ */
+@Service
+public class DefaultRepositoryCommonValidator
+    implements RepositoryCommonValidator
+{
+
+    @Inject
+    private ArchivaConfiguration archivaConfiguration;
+
+    @Inject
+    @Named( value = "commons-configuration" )
+    private Registry registry;
+
+    /**
+     * @param abstractRepository
+     * @param update             in update mode if yes already exists won't be check
+     * @throws RepositoryAdminException
+     */
+    public void basicValidation( AbstractRepository abstractRepository, boolean update )
+        throws RepositoryAdminException
+    {
+        Configuration config = archivaConfiguration.getConfiguration();
+
+        String repoId = abstractRepository.getId();
+
+        if ( !update )
+        {
+
+            if ( config.getManagedRepositoriesAsMap().containsKey( repoId ) )
+            {
+                throw new RepositoryAdminException( "Unable to add new repository with id [" + repoId
+                                                        + "], that id already exists as a managed repository." );
+            }
+            else if ( config.getRepositoryGroupsAsMap().containsKey( repoId ) )
+            {
+                throw new RepositoryAdminException( "Unable to add new repository with id [" + repoId
+                                                        + "], that id already exists as a repository group." );
+            }
+            else if ( config.getRemoteRepositoriesAsMap().containsKey( repoId ) )
+            {
+                throw new RepositoryAdminException( "Unable to add new repository with id [" + repoId
+                                                        + "], that id already exists as a remote repository." );
+            }
+        }
+
+        if ( StringUtils.isBlank( repoId ) )
+        {
+            throw new RepositoryAdminException( "Repository ID cannot be empty." );
+        }
+
+        if ( !GenericValidator.matchRegexp( repoId, REPOSITORY_ID_VALID_EXPRESSION ) )
+        {
+            throw new RepositoryAdminException(
+                "Invalid repository ID. Identifier must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-)." );
+        }
+
+        String name = abstractRepository.getName();
+
+        if ( StringUtils.isBlank( name ) )
+        {
+            throw new RepositoryAdminException( "repository name cannot be empty" );
+        }
+
+        if ( !GenericValidator.matchRegexp( name, REPOSITORY_NAME_VALID_EXPRESSION ) )
+        {
+            throw new RepositoryAdminException(
+                "Invalid repository name. Repository Name must only contain alphanumeric characters, white-spaces(' '), "
+                    + "forward-slashes(/), open-parenthesis('('), close-parenthesis(')'),  underscores(_), dots(.), and dashes(-)." );
+        }
+
+    }
+
+    /**
+     * validate cronExpression and location format
+     *
+     * @param managedRepository
+     * @since 1.4-M2
+     */
+    public void validateManagedRepository( ManagedRepository managedRepository )
+        throws RepositoryAdminException
+    {
+        String cronExpression = managedRepository.getCronExpression();
+        // FIXME : olamy can be empty to avoid scheduled scan ?
+        if ( StringUtils.isNotBlank( cronExpression ) )
+        {
+            CronExpressionValidator validator = new CronExpressionValidator();
+
+            if ( !validator.validate( cronExpression ) )
+            {
+                throw new RepositoryAdminException( "Invalid cron expression.", "cronExpression" );
+            }
+        }
+        else
+        {
+            throw new RepositoryAdminException( "Cron expression cannot be empty." );
+        }
+
+        String repoLocation = removeExpressions( managedRepository.getLocation() );
+
+        if ( !GenericValidator.matchRegexp( repoLocation,
+                                            ManagedRepositoryAdmin.REPOSITORY_LOCATION_VALID_EXPRESSION ) )
+        {
+            throw new RepositoryAdminException(
+                "Invalid repository location. Directory must only contain alphanumeric characters, equals(=), question-marks(?), "
+                    + "exclamation-points(!), ampersands(&amp;), forward-slashes(/), back-slashes(\\), underscores(_), dots(.), colons(:), tildes(~), and dashes(-).",
+                "location" );
+        }
+    }
+
+    /**
+     * replace some interpolations ${appserver.base} with correct values
+     *
+     * @param directory
+     * @return
+     */
+    public String removeExpressions( String directory )
+    {
+        String value = StringUtils.replace( directory, "${appserver.base}",
+                                            getRegistry().getString( "appserver.base", "${appserver.base}" ) );
+        value = StringUtils.replace( value, "${appserver.home}",
+                                     getRegistry().getString( "appserver.home", "${appserver.home}" ) );
+        return value;
+    }
+
+    public ArchivaConfiguration getArchivaConfiguration()
+    {
+        return archivaConfiguration;
+    }
+
+    public void setArchivaConfiguration( ArchivaConfiguration archivaConfiguration )
+    {
+        this.archivaConfiguration = archivaConfiguration;
+    }
+
+    public Registry getRegistry()
+    {
+        return registry;
+    }
+
+    public void setRegistry( Registry registry )
+    {
+        this.registry = registry;
+    }
+}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/RepositoryCommonValidator.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/RepositoryCommonValidator.java
deleted file mode 100644 (file)
index 05756fd..0000000
+++ /dev/null
@@ -1,189 +0,0 @@
-package org.apache.archiva.admin.repository;
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.archiva.admin.model.RepositoryAdminException;
-import org.apache.archiva.admin.model.beans.AbstractRepository;
-import org.apache.archiva.admin.model.beans.ManagedRepository;
-import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
-import org.apache.archiva.configuration.ArchivaConfiguration;
-import org.apache.archiva.configuration.Configuration;
-import org.apache.commons.lang.StringUtils;
-import org.apache.commons.validator.GenericValidator;
-import org.codehaus.plexus.registry.Registry;
-import org.codehaus.redback.components.scheduler.CronExpressionValidator;
-import org.springframework.stereotype.Service;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-
-/**
- * apply basic repository validation : id and name.
- * Check if already exists.
- *
- * @author Olivier Lamy
- * @since 1.4-M1
- */
-@Service
-public class RepositoryCommonValidator
-{
-
-    public static final String REPOSITORY_ID_VALID_EXPRESSION = "^[a-zA-Z0-9._-]+$";
-
-    public static final String REPOSITORY_NAME_VALID_EXPRESSION = "^([a-zA-Z0-9.)/_(-]|\\s)+$";
-
-
-    @Inject
-    private ArchivaConfiguration archivaConfiguration;
-
-    @Inject
-    @Named( value = "commons-configuration" )
-    private Registry registry;
-
-    /**
-     * @param abstractRepository
-     * @param update             in update mode if yes already exists won't be check
-     * @throws RepositoryAdminException
-     */
-    public void basicValidation( AbstractRepository abstractRepository, boolean update )
-        throws RepositoryAdminException
-    {
-        Configuration config = archivaConfiguration.getConfiguration();
-
-        String repoId = abstractRepository.getId();
-
-        if ( !update )
-        {
-
-            if ( config.getManagedRepositoriesAsMap().containsKey( repoId ) )
-            {
-                throw new RepositoryAdminException( "Unable to add new repository with id [" + repoId
-                                                        + "], that id already exists as a managed repository." );
-            }
-            else if ( config.getRepositoryGroupsAsMap().containsKey( repoId ) )
-            {
-                throw new RepositoryAdminException( "Unable to add new repository with id [" + repoId
-                                                        + "], that id already exists as a repository group." );
-            }
-            else if ( config.getRemoteRepositoriesAsMap().containsKey( repoId ) )
-            {
-                throw new RepositoryAdminException( "Unable to add new repository with id [" + repoId
-                                                        + "], that id already exists as a remote repository." );
-            }
-        }
-
-        if ( StringUtils.isBlank( repoId ) )
-        {
-            throw new RepositoryAdminException( "Repository ID cannot be empty." );
-        }
-
-        if ( !GenericValidator.matchRegexp( repoId, REPOSITORY_ID_VALID_EXPRESSION ) )
-        {
-            throw new RepositoryAdminException(
-                "Invalid repository ID. Identifier must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-)." );
-        }
-
-        String name = abstractRepository.getName();
-
-        if ( StringUtils.isBlank( name ) )
-        {
-            throw new RepositoryAdminException( "repository name cannot be empty" );
-        }
-
-        if ( !GenericValidator.matchRegexp( name, REPOSITORY_NAME_VALID_EXPRESSION ) )
-        {
-            throw new RepositoryAdminException(
-                "Invalid repository name. Repository Name must only contain alphanumeric characters, white-spaces(' '), "
-                    + "forward-slashes(/), open-parenthesis('('), close-parenthesis(')'),  underscores(_), dots(.), and dashes(-)." );
-        }
-
-    }
-
-    /**
-     * validate cronExpression and location format
-     *
-     * @param managedRepository
-     * @since 1.4-M2
-     */
-    public void validateManagedRepository( ManagedRepository managedRepository )
-        throws RepositoryAdminException
-    {
-        String cronExpression = managedRepository.getCronExpression();
-        // FIXME : olamy can be empty to avoid scheduled scan ?
-        if ( StringUtils.isNotBlank( cronExpression ) )
-        {
-            CronExpressionValidator validator = new CronExpressionValidator();
-
-            if ( !validator.validate( cronExpression ) )
-            {
-                throw new RepositoryAdminException( "Invalid cron expression.", "cronExpression" );
-            }
-        }
-        else
-        {
-            throw new RepositoryAdminException( "Cron expression cannot be empty." );
-        }
-
-        String repoLocation = removeExpressions( managedRepository.getLocation() );
-
-        if ( !GenericValidator.matchRegexp( repoLocation,
-                                            ManagedRepositoryAdmin.REPOSITORY_LOCATION_VALID_EXPRESSION ) )
-        {
-            throw new RepositoryAdminException(
-                "Invalid repository location. Directory must only contain alphanumeric characters, equals(=), question-marks(?), "
-                    + "exclamation-points(!), ampersands(&amp;), forward-slashes(/), back-slashes(\\), underscores(_), dots(.), colons(:), tildes(~), and dashes(-).",
-                "location" );
-        }
-    }
-
-    /**
-     * replace some interpolations ${appserver.base} with correct values
-     *
-     * @param directory
-     * @return
-     */
-    public String removeExpressions( String directory )
-    {
-        String value = StringUtils.replace( directory, "${appserver.base}",
-                                            getRegistry().getString( "appserver.base", "${appserver.base}" ) );
-        value = StringUtils.replace( value, "${appserver.home}",
-                                     getRegistry().getString( "appserver.home", "${appserver.home}" ) );
-        return value;
-    }
-
-    public ArchivaConfiguration getArchivaConfiguration()
-    {
-        return archivaConfiguration;
-    }
-
-    public void setArchivaConfiguration( ArchivaConfiguration archivaConfiguration )
-    {
-        this.archivaConfiguration = archivaConfiguration;
-    }
-
-    public Registry getRegistry()
-    {
-        return registry;
-    }
-
-    public void setRegistry( Registry registry )
-    {
-        this.registry = registry;
-    }
-}
index 0f3ed07607321d061a9d7a20af891623656182b5..095b5a090c46d21abf50347648a850af12f3cc42 100644 (file)
@@ -80,5 +80,12 @@ public interface ManagedRepositoriesService
     Boolean updateManagedRepository( ManagedRepository managedRepository )
         throws ArchivaRestServiceException;
 
+    @Path( "fileLocationExists/{fileLocation}" )
+    @GET
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+    @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
+    Boolean fileLocationExists( @PathParam( "fileLocation" ) String fileLocation )
+        throws ArchivaRestServiceException;
+
 
 }
index a9f51284cfc849d3b4689961a528ef7b1f852818..0b02b472e2e54001d1fe664eea5758e17f91d467 100644 (file)
@@ -19,6 +19,7 @@ package org.apache.archiva.rest.services;
  */
 
 import org.apache.archiva.admin.model.RepositoryAdminException;
+import org.apache.archiva.admin.model.RepositoryCommonValidator;
 import org.apache.archiva.admin.model.beans.ManagedRepository;
 import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
 import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
@@ -28,6 +29,7 @@ import org.apache.commons.lang.StringUtils;
 import org.springframework.stereotype.Service;
 
 import javax.inject.Inject;
+import java.io.File;
 import java.util.Collections;
 import java.util.List;
 
@@ -47,6 +49,9 @@ public class DefaultManagedRepositoriesService
     @Inject
     private PlexusSisuBridge plexusSisuBridge;
 
+    @Inject
+    private RepositoryCommonValidator repositoryCommonValidator;
+
 
     public List<ManagedRepository> getManagedRepositories()
         throws ArchivaRestServiceException
@@ -132,4 +137,10 @@ public class DefaultManagedRepositoriesService
         }
     }
 
+    public Boolean fileLocationExists( String fileLocation )
+        throws ArchivaRestServiceException
+    {
+        String location = repositoryCommonValidator.removeExpressions( fileLocation );
+        return new File( location ).exists();
+    }
 }
index 12ececb973d77a848944d158c090e2d39b3f20ec..47a896eee855ef6b6b3aa5dc1209ac45d750ad63 100644 (file)
@@ -23,6 +23,8 @@ import org.apache.archiva.admin.model.beans.ManagedRepository;
 import org.apache.archiva.rest.api.services.ManagedRepositoriesService;
 import org.junit.Test;
 
+import java.io.File;
+
 /**
  * @author Olivier Lamy
  */
@@ -80,5 +82,19 @@ public class ManagedRepositoriesServiceTest
 
     }
 
+    //@Test
+    public void fileLocationExists()
+        throws Exception
+    {
+        ManagedRepositoriesService service = getManagedRepositoriesService( authorizationHeader );
+        File target = new File( "target" );
+
+        assertTrue( service.fileLocationExists( target.getCanonicalPath() ) );
+
+        // normally should not exists :-)
+        assertFalse( service.fileLocationExists( "/fooofofof/foddfdofd/dedede/kdeo" ) );
+
+    }
+
 
 }
index f1ba9f62f6d2773de21bdbcdad0dd7ab4e7da478..c5719c30fb8058a947926de36c57f95546191213 100644 (file)
@@ -19,8 +19,9 @@ package org.apache.archiva.web.action.admin.repositories;
  * under the License.
  */
 
+import org.apache.archiva.admin.model.RepositoryCommonValidator;
 import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
-import org.apache.archiva.admin.repository.RepositoryCommonValidator;
+import org.apache.archiva.admin.repository.DefaultRepositoryCommonValidator;
 import org.apache.archiva.audit.Auditable;
 import org.apache.archiva.security.common.ArchivaRoleConstants;
 import org.apache.archiva.web.action.AbstractActionSupport;
index 8eeba40bdf110f1bee5b817500ad1e6b31cb8580..89d2cc91bfe101b14b65c18a2493bc2eb65fb459 100644 (file)
@@ -21,7 +21,7 @@ package org.apache.archiva.web.action.admin.repositories;
 
 import com.opensymphony.xwork2.Action;
 import org.apache.archiva.admin.model.beans.ManagedRepository;
-import org.apache.archiva.admin.repository.RepositoryCommonValidator;
+import org.apache.archiva.admin.repository.DefaultRepositoryCommonValidator;
 import org.apache.archiva.admin.repository.managed.DefaultManagedRepositoryAdmin;
 import org.apache.archiva.configuration.ArchivaConfiguration;
 import org.apache.archiva.configuration.Configuration;
@@ -99,14 +99,14 @@ public class AddManagedRepositoryActionTest
         ( (DefaultManagedRepositoryAdmin) getManagedRepositoryAdmin() ).setRepositoryTaskScheduler(
             repositoryTaskScheduler );
 
-        RepositoryCommonValidator repositoryCommonValidator = new RepositoryCommonValidator();
-        repositoryCommonValidator.setArchivaConfiguration( archivaConfiguration );
-        repositoryCommonValidator.setRegistry( registry );
+        DefaultRepositoryCommonValidator defaultRepositoryCommonValidator = new DefaultRepositoryCommonValidator();
+        defaultRepositoryCommonValidator.setArchivaConfiguration( archivaConfiguration );
+        defaultRepositoryCommonValidator.setRegistry( registry );
 
         ( (DefaultManagedRepositoryAdmin) getManagedRepositoryAdmin() ).setRepositoryCommonValidator(
-            repositoryCommonValidator );
+            defaultRepositoryCommonValidator );
 
-        action.setRepositoryCommonValidator( repositoryCommonValidator );
+        action.setRepositoryCommonValidator( defaultRepositoryCommonValidator );
 
         action.setManagedRepositoryAdmin( getManagedRepositoryAdmin() );
 
index fe16df9f4edd6744a29ae14fffd41876dc91af19..2dcb8f7d8302527b95a21b029925fe9feb8c6673 100644 (file)
@@ -22,7 +22,7 @@ package org.apache.archiva.web.action.admin.repositories;
 import com.opensymphony.xwork2.Action;
 import org.apache.archiva.admin.model.RepositoryAdminException;
 import org.apache.archiva.admin.model.beans.ManagedRepository;
-import org.apache.archiva.admin.repository.RepositoryCommonValidator;
+import org.apache.archiva.admin.repository.DefaultRepositoryCommonValidator;
 import org.apache.archiva.admin.repository.managed.DefaultManagedRepositoryAdmin;
 import org.apache.archiva.audit.AuditListener;
 import org.apache.archiva.configuration.ArchivaConfiguration;
@@ -121,14 +121,14 @@ public class EditManagedRepositoryActionTest
         ( (DefaultManagedRepositoryAdmin) getManagedRepositoryAdmin() ).setAuditListeners(
             new ArrayList<AuditListener>( 0 ) );
 
-        RepositoryCommonValidator repositoryCommonValidator = new RepositoryCommonValidator();
-        repositoryCommonValidator.setArchivaConfiguration( archivaConfiguration );
-        repositoryCommonValidator.setRegistry( registry );
+        DefaultRepositoryCommonValidator defaultRepositoryCommonValidator = new DefaultRepositoryCommonValidator();
+        defaultRepositoryCommonValidator.setArchivaConfiguration( archivaConfiguration );
+        defaultRepositoryCommonValidator.setRegistry( registry );
 
         ( (DefaultManagedRepositoryAdmin) getManagedRepositoryAdmin() ).setRepositoryCommonValidator(
-            repositoryCommonValidator );
+            defaultRepositoryCommonValidator );
 
-        action.setRepositoryCommonValidator( repositoryCommonValidator );
+        action.setRepositoryCommonValidator( defaultRepositoryCommonValidator );
 
         action.setManagedRepositoryAdmin( getManagedRepositoryAdmin() );