]> source.dussan.org Git - archiva.git/commitdiff
[MRM-1511] api to configure LegacyArtifactPath : use it in webapp
authorOlivier Lamy <olamy@apache.org>
Thu, 8 Sep 2011 20:15:50 +0000 (20:15 +0000)
committerOlivier Lamy <olamy@apache.org>
Thu, 8 Sep 2011 20:15:50 +0000 (20:15 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1166883 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/legacy/AddLegacyArtifactPathAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/legacy/DeleteLegacyArtifactPathAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/legacy/LegacyArtifactPathAction.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/legacy/AddLegacyArtifactPathActionTest.java

index 858045667d4b9f580d6f4bf15240a0d03d3f524c..998e96eb1159de0639d23468fd3f2087edcf0bc8 100644 (file)
@@ -19,17 +19,14 @@ package org.apache.maven.archiva.web.action.admin.legacy;
  * under the License.
  */
 
-import org.apache.maven.archiva.configuration.ArchivaConfiguration;
-import org.apache.maven.archiva.configuration.Configuration;
-import org.apache.maven.archiva.configuration.IndeterminateConfigurationException;
-import org.apache.maven.archiva.configuration.LegacyArtifactPath;
-import org.apache.maven.archiva.model.ArtifactReference;
-import org.apache.maven.archiva.repository.ManagedRepositoryContent;
-import org.codehaus.plexus.registry.RegistryException;
-
 import com.opensymphony.xwork2.Preparable;
 import com.opensymphony.xwork2.Validateable;
+import org.apache.archiva.admin.repository.RepositoryAdminException;
+import org.apache.archiva.admin.repository.admin.ArchivaAdministration;
+import org.apache.archiva.admin.repository.admin.LegacyArtifactPath;
 import org.apache.commons.lang.StringUtils;
+import org.apache.maven.archiva.model.ArtifactReference;
+import org.apache.maven.archiva.repository.ManagedRepositoryContent;
 import org.apache.maven.archiva.web.action.AbstractActionSupport;
 import org.springframework.context.annotation.Scope;
 import org.springframework.stereotype.Controller;
@@ -50,10 +47,10 @@ public class AddLegacyArtifactPathAction
 {
 
     @Inject
-    private ArchivaConfiguration archivaConfiguration;
+    private ArchivaAdministration archivaAdministration;
 
     @Inject
-    @Named(value = "managedRepositoryContent#legacy")
+    @Named( value = "managedRepositoryContent#legacy" )
     private ManagedRepositoryContent repositoryContent;
 
 
@@ -82,28 +79,36 @@ public class AddLegacyArtifactPathAction
 
     public String commit()
     {
-        this.legacyArtifactPath.setArtifact( this.groupId + ":" + this.artifactId + ":" + this.version + ":" +
-            this.classifier + ":" + this.type );
+        this.legacyArtifactPath.setArtifact(
+            this.groupId + ":" + this.artifactId + ":" + this.version + ":" + this.classifier + ":" + this.type );
 
         // Check the proposed Artifact macthes the path
         ArtifactReference artifact = new ArtifactReference();
 
-               artifact.setGroupId( this.groupId );
-               artifact.setArtifactId( this.artifactId );
-               artifact.setClassifier( this.classifier );
-               artifact.setVersion( this.version );
-               artifact.setType( this.type );
+        artifact.setGroupId( this.groupId );
+        artifact.setArtifactId( this.artifactId );
+        artifact.setClassifier( this.classifier );
+        artifact.setVersion( this.version );
+        artifact.setType( this.type );
 
         String path = repositoryContent.toPath( artifact );
-        if ( ! path.equals( this.legacyArtifactPath.getPath() ) )
+        if ( !path.equals( this.legacyArtifactPath.getPath() ) )
         {
             addActionError( "artifact reference does not match the initial path : " + path );
             return ERROR;
         }
 
-        Configuration configuration = archivaConfiguration.getConfiguration();
-        configuration.addLegacyArtifactPath( legacyArtifactPath );
-        return saveConfiguration( configuration );
+        try
+        {
+            getArchivaAdministration().addLegacyArtifactPath( legacyArtifactPath );
+        }
+        catch ( RepositoryAdminException e )
+        {
+            log.error( e.getMessage(), e );
+            addActionError( "Error occured " + e.getMessage() );
+            return INPUT;
+        }
+        return SUCCESS;
     }
 
     public LegacyArtifactPath getLegacyArtifactPath()
@@ -122,55 +127,34 @@ public class AddLegacyArtifactPathAction
         trimAllRequestParameterValues();
     }
 
-    protected String saveConfiguration( Configuration configuration )
-    {
-        try
-        {
-            archivaConfiguration.save( configuration );
-            addActionMessage( "Successfully saved configuration" );
-        }
-        catch ( IndeterminateConfigurationException e )
-        {
-            addActionError( e.getMessage() );
-            return INPUT;
-        }
-        catch ( RegistryException e )
-        {
-            addActionError( "Configuration Registry Exception: " + e.getMessage() );
-            return INPUT;
-        }
-
-        return SUCCESS;
-    }
-
     private void trimAllRequestParameterValues()
     {
-        if(StringUtils.isNotEmpty(legacyArtifactPath.getPath()))
+        if ( StringUtils.isNotEmpty( legacyArtifactPath.getPath() ) )
         {
-            legacyArtifactPath.setPath(legacyArtifactPath.getPath().trim());
+            legacyArtifactPath.setPath( legacyArtifactPath.getPath().trim() );
         }
 
-        if(StringUtils.isNotEmpty(groupId))
+        if ( StringUtils.isNotEmpty( groupId ) )
         {
             groupId = groupId.trim();
         }
 
-        if(StringUtils.isNotEmpty(artifactId))
+        if ( StringUtils.isNotEmpty( artifactId ) )
         {
             artifactId = artifactId.trim();
         }
 
-        if(StringUtils.isNotEmpty(version))
+        if ( StringUtils.isNotEmpty( version ) )
         {
             version = version.trim();
         }
 
-        if(StringUtils.isNotEmpty(classifier))
+        if ( StringUtils.isNotEmpty( classifier ) )
         {
             classifier = classifier.trim();
         }
 
-        if(StringUtils.isNotEmpty(type))
+        if ( StringUtils.isNotEmpty( type ) )
         {
             type = type.trim();
         }
@@ -225,4 +209,14 @@ public class AddLegacyArtifactPathAction
     {
         this.type = type;
     }
+
+    public ArchivaAdministration getArchivaAdministration()
+    {
+        return archivaAdministration;
+    }
+
+    public void setArchivaAdministration( ArchivaAdministration archivaAdministration )
+    {
+        this.archivaAdministration = archivaAdministration;
+    }
 }
index 430a917d8692b9c032f2313f069b526d31d26535..a40ce1c6ffb748462573946393539b57184cb0d7 100644 (file)
@@ -19,17 +19,13 @@ package org.apache.maven.archiva.web.action.admin.legacy;
  * under the License.\r
  */\r
 \r
-import org.apache.maven.archiva.configuration.ArchivaConfiguration;\r
-import org.apache.maven.archiva.configuration.Configuration;\r
-import org.apache.maven.archiva.configuration.IndeterminateConfigurationException;\r
-import org.apache.maven.archiva.configuration.LegacyArtifactPath;\r
+import org.apache.archiva.admin.repository.RepositoryAdminException;\r
+import org.apache.archiva.admin.repository.admin.ArchivaAdministration;\r
 import org.apache.maven.archiva.web.action.AbstractActionSupport;\r
-import org.codehaus.plexus.registry.RegistryException;\r
 import org.springframework.context.annotation.Scope;\r
 import org.springframework.stereotype.Controller;\r
 \r
 import javax.inject.Inject;\r
-import java.util.Iterator;\r
 \r
 /**\r
  * Delete a LegacyArtifactPath to archiva configuration\r
@@ -43,44 +39,22 @@ public class DeleteLegacyArtifactPathAction
 {\r
 \r
     @Inject\r
-    private ArchivaConfiguration archivaConfiguration;\r
+    private ArchivaAdministration archivaAdministration;\r
 \r
     private String path;\r
 \r
     public String delete()\r
     {\r
         log.info( "remove [" + path + "] from legacy artifact path resolution" );\r
-        Configuration configuration = archivaConfiguration.getConfiguration();\r
-        for ( Iterator<LegacyArtifactPath> iterator = configuration.getLegacyArtifactPaths().iterator();\r
-              iterator.hasNext(); )\r
-        {\r
-            LegacyArtifactPath legacyArtifactPath = (LegacyArtifactPath) iterator.next();\r
-            if ( legacyArtifactPath.match( path ) )\r
-            {\r
-                iterator.remove();\r
-            }\r
-        }\r
-        return saveConfiguration( configuration );\r
-    }\r
-\r
-    protected String saveConfiguration( Configuration configuration )\r
-    {\r
         try\r
         {\r
-            archivaConfiguration.save( configuration );\r
-            addActionMessage( "Successfully saved configuration" );\r
-        }\r
-        catch ( IndeterminateConfigurationException e )\r
-        {\r
-            addActionError( e.getMessage() );\r
-            return INPUT;\r
+            getArchivaAdministration().deleteLegacyArtifactPath( path );\r
         }\r
-        catch ( RegistryException e )\r
+        catch ( RepositoryAdminException e )\r
         {\r
-            addActionError( "Configuration Registry Exception: " + e.getMessage() );\r
-            return INPUT;\r
+            log.error( e.getMessage(), e );\r
+            addActionError( "Exception during delete " + e.getMessage() );\r
         }\r
-\r
         return SUCCESS;\r
     }\r
 \r
@@ -93,4 +67,14 @@ public class DeleteLegacyArtifactPathAction
     {\r
         this.path = path;\r
     }\r
+\r
+    public ArchivaAdministration getArchivaAdministration()\r
+    {\r
+        return archivaAdministration;\r
+    }\r
+\r
+    public void setArchivaAdministration( ArchivaAdministration archivaAdministration )\r
+    {\r
+        this.archivaAdministration = archivaAdministration;\r
+    }\r
 }\r
index 381faf29c360dfcf9e4fd33f1586ad57f3acf820..1aadd0a6b339492b6e860fc8c994fd0b2c1ed701 100644 (file)
@@ -20,12 +20,12 @@ package org.apache.maven.archiva.web.action.admin.legacy;
  */\r
 \r
 import com.opensymphony.xwork2.Preparable;\r
+import org.apache.archiva.admin.repository.RepositoryAdminException;\r
+import org.apache.archiva.admin.repository.admin.ArchivaAdministration;\r
+import org.apache.archiva.admin.repository.admin.LegacyArtifactPath;\r
 import org.apache.archiva.security.common.ArchivaRoleConstants;\r
-import org.apache.maven.archiva.configuration.ArchivaConfiguration;\r
-import org.apache.maven.archiva.configuration.Configuration;\r
-import org.apache.maven.archiva.configuration.LegacyArtifactPath;\r
-import org.apache.maven.archiva.web.action.AbstractActionSupport;\r
 import org.apache.archiva.web.util.ContextUtils;\r
+import org.apache.maven.archiva.web.action.AbstractActionSupport;\r
 import org.apache.struts2.interceptor.ServletRequestAware;\r
 import org.codehaus.plexus.redback.rbac.Resource;\r
 import org.codehaus.redback.integration.interceptor.SecureAction;\r
@@ -52,7 +52,7 @@ public class LegacyArtifactPathAction
 {\r
 \r
     @Inject\r
-    private ArchivaConfiguration archivaConfiguration;\r
+    private ArchivaAdministration archivaAdministration;\r
 \r
     private List<LegacyArtifactPath> legacyArtifactPaths;\r
 \r
@@ -79,10 +79,9 @@ public class LegacyArtifactPathAction
     }\r
 \r
     public void prepare()\r
+        throws RepositoryAdminException\r
     {\r
-        Configuration config = archivaConfiguration.getConfiguration();\r
-\r
-        legacyArtifactPaths = new ArrayList<LegacyArtifactPath>( config.getLegacyArtifactPaths() );\r
+        legacyArtifactPaths = new ArrayList<LegacyArtifactPath>( getArchivaAdministration().getLegacyArtifactPaths() );\r
     }\r
 \r
     public List<LegacyArtifactPath> getLegacyArtifactPaths()\r
@@ -94,4 +93,14 @@ public class LegacyArtifactPathAction
     {\r
         return baseUrl;\r
     }\r
+\r
+    public ArchivaAdministration getArchivaAdministration()\r
+    {\r
+        return archivaAdministration;\r
+    }\r
+\r
+    public void setArchivaAdministration( ArchivaAdministration archivaAdministration )\r
+    {\r
+        this.archivaAdministration = archivaAdministration;\r
+    }\r
 }\r
index f8e89b15d14e1a91de9b97e47c3a6b4308920ff0..77b82513fbbcc9d9f5f75c898feb7aae7ece3987 100644 (file)
@@ -20,17 +20,18 @@ package org.apache.maven.archiva.web.action.admin.legacy;
  */
 
 import com.opensymphony.xwork2.validator.ActionValidatorManager;
+import junit.framework.TestCase;
+import org.apache.archiva.admin.repository.admin.LegacyArtifactPath;
+import org.apache.archiva.web.validator.utils.ValidatorUtil;
+import org.apache.maven.archiva.web.action.admin.repositories.DefaultActionValidatorManagerFactory;
+
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-import junit.framework.TestCase;
-import org.apache.maven.archiva.configuration.LegacyArtifactPath;
-import org.apache.maven.archiva.web.action.admin.repositories.DefaultActionValidatorManagerFactory;
-import org.apache.archiva.web.validator.utils.ValidatorUtil;
-
-public class AddLegacyArtifactPathActionTest extends TestCase
+public class AddLegacyArtifactPathActionTest
+    extends TestCase
 {
     private static final String EMPTY_STRING = "";
 
@@ -66,26 +67,29 @@ public class AddLegacyArtifactPathActionTest extends TestCase
     private ActionValidatorManager actionValidatorManager;
 
     @Override
-    public void setUp() throws Exception
+    public void setUp()
+        throws Exception
     {
         addLegacyArtifactPathAction = new AddLegacyArtifactPathAction();
-        
+
         DefaultActionValidatorManagerFactory factory = new DefaultActionValidatorManagerFactory();
 
         actionValidatorManager = factory.createDefaultActionValidatorManager();
     }
 
-    public void testStruts2ValidationFrameworkWithNullInputs() throws Exception
+    public void testStruts2ValidationFrameworkWithNullInputs()
+        throws Exception
     {
         // prep
-        LegacyArtifactPath legacyArtifactPath = createLegacyArtifactPath(null);
-        populateAddLegacyArtifactPathActionFields(addLegacyArtifactPathAction, legacyArtifactPath, null, null, null, null, null);
+        LegacyArtifactPath legacyArtifactPath = createLegacyArtifactPath( null );
+        populateAddLegacyArtifactPathActionFields( addLegacyArtifactPathAction, legacyArtifactPath, null, null, null,
+                                                   null, null );
 
         // test
-        actionValidatorManager.validate(addLegacyArtifactPathAction, EMPTY_STRING);
+        actionValidatorManager.validate( addLegacyArtifactPathAction, EMPTY_STRING );
 
         // verify
-        assertTrue(addLegacyArtifactPathAction.hasFieldErrors());
+        assertTrue( addLegacyArtifactPathAction.hasFieldErrors() );
 
         Map<String, List<String>> fieldErrors = addLegacyArtifactPathAction.getFieldErrors();
 
@@ -94,39 +98,41 @@ public class AddLegacyArtifactPathActionTest extends TestCase
 
         // populate
         List<String> expectedErrorMessages = new ArrayList<String>();
-        expectedErrorMessages.add("You must enter a legacy path.");
-        expectedFieldErrors.put("legacyArtifactPath.path", expectedErrorMessages);
+        expectedErrorMessages.add( "You must enter a legacy path." );
+        expectedFieldErrors.put( "legacyArtifactPath.path", expectedErrorMessages );
 
         expectedErrorMessages = new ArrayList<String>();
-        expectedErrorMessages.add("You must enter a groupId.");
-        expectedFieldErrors.put("groupId", expectedErrorMessages);
+        expectedErrorMessages.add( "You must enter a groupId." );
+        expectedFieldErrors.put( "groupId", expectedErrorMessages );
 
         expectedErrorMessages = new ArrayList<String>();
-        expectedErrorMessages.add("You must enter an artifactId.");
-        expectedFieldErrors.put("artifactId", expectedErrorMessages);
+        expectedErrorMessages.add( "You must enter an artifactId." );
+        expectedFieldErrors.put( "artifactId", expectedErrorMessages );
 
         expectedErrorMessages = new ArrayList<String>();
-        expectedErrorMessages.add("You must enter a version.");
-        expectedFieldErrors.put("version", expectedErrorMessages);
+        expectedErrorMessages.add( "You must enter a version." );
+        expectedFieldErrors.put( "version", expectedErrorMessages );
 
         expectedErrorMessages = new ArrayList<String>();
-        expectedErrorMessages.add("You must enter a type.");
-        expectedFieldErrors.put("type", expectedErrorMessages);
+        expectedErrorMessages.add( "You must enter a type." );
+        expectedFieldErrors.put( "type", expectedErrorMessages );
 
-        ValidatorUtil.assertFieldErrors(expectedFieldErrors, fieldErrors);
+        ValidatorUtil.assertFieldErrors( expectedFieldErrors, fieldErrors );
     }
 
-    public void testStruts2ValidationFrameworkWithBlankInputs() throws Exception
+    public void testStruts2ValidationFrameworkWithBlankInputs()
+        throws Exception
     {
         // prep
-        LegacyArtifactPath legacyArtifactPath = createLegacyArtifactPath(EMPTY_STRING);
-        populateAddLegacyArtifactPathActionFields(addLegacyArtifactPathAction, legacyArtifactPath, EMPTY_STRING, EMPTY_STRING, EMPTY_STRING, EMPTY_STRING, EMPTY_STRING);
+        LegacyArtifactPath legacyArtifactPath = createLegacyArtifactPath( EMPTY_STRING );
+        populateAddLegacyArtifactPathActionFields( addLegacyArtifactPathAction, legacyArtifactPath, EMPTY_STRING,
+                                                   EMPTY_STRING, EMPTY_STRING, EMPTY_STRING, EMPTY_STRING );
 
         // test
-        actionValidatorManager.validate(addLegacyArtifactPathAction, EMPTY_STRING);
+        actionValidatorManager.validate( addLegacyArtifactPathAction, EMPTY_STRING );
 
         // verify
-        assertTrue(addLegacyArtifactPathAction.hasFieldErrors());
+        assertTrue( addLegacyArtifactPathAction.hasFieldErrors() );
 
         Map<String, List<String>> fieldErrors = addLegacyArtifactPathAction.getFieldErrors();
 
@@ -135,39 +141,43 @@ public class AddLegacyArtifactPathActionTest extends TestCase
 
         // populate
         List<String> expectedErrorMessages = new ArrayList<String>();
-        expectedErrorMessages.add("You must enter a legacy path.");
-        expectedFieldErrors.put("legacyArtifactPath.path", expectedErrorMessages);
+        expectedErrorMessages.add( "You must enter a legacy path." );
+        expectedFieldErrors.put( "legacyArtifactPath.path", expectedErrorMessages );
 
         expectedErrorMessages = new ArrayList<String>();
-        expectedErrorMessages.add("You must enter a groupId.");
-        expectedFieldErrors.put("groupId", expectedErrorMessages);
+        expectedErrorMessages.add( "You must enter a groupId." );
+        expectedFieldErrors.put( "groupId", expectedErrorMessages );
 
         expectedErrorMessages = new ArrayList<String>();
-        expectedErrorMessages.add("You must enter an artifactId.");
-        expectedFieldErrors.put("artifactId", expectedErrorMessages);
+        expectedErrorMessages.add( "You must enter an artifactId." );
+        expectedFieldErrors.put( "artifactId", expectedErrorMessages );
 
         expectedErrorMessages = new ArrayList<String>();
-        expectedErrorMessages.add("You must enter a version.");
-        expectedFieldErrors.put("version", expectedErrorMessages);
+        expectedErrorMessages.add( "You must enter a version." );
+        expectedFieldErrors.put( "version", expectedErrorMessages );
 
         expectedErrorMessages = new ArrayList<String>();
-        expectedErrorMessages.add("You must enter a type.");
-        expectedFieldErrors.put("type", expectedErrorMessages);
+        expectedErrorMessages.add( "You must enter a type." );
+        expectedFieldErrors.put( "type", expectedErrorMessages );
 
-        ValidatorUtil.assertFieldErrors(expectedFieldErrors, fieldErrors);
+        ValidatorUtil.assertFieldErrors( expectedFieldErrors, fieldErrors );
     }
 
-    public void testStruts2ValidationFrameworkWithInvalidInputs() throws Exception
+    public void testStruts2ValidationFrameworkWithInvalidInputs()
+        throws Exception
     {
         // prep
-        LegacyArtifactPath legacyArtifactPath = createLegacyArtifactPath(LEGACY_ARTIFACT_PATH_PATH_INVALID_INPUT);
-        populateAddLegacyArtifactPathActionFields(addLegacyArtifactPathAction, legacyArtifactPath, GROUP_ID_INVALID_INPUT, ARTIFACT_ID_INVALID_INPUT, VERSION_INVALID_INPUT, CLASSIFIER_INVALID_INPUT, TYPE_INVALID_INPUT);
+        LegacyArtifactPath legacyArtifactPath = createLegacyArtifactPath( LEGACY_ARTIFACT_PATH_PATH_INVALID_INPUT );
+        populateAddLegacyArtifactPathActionFields( addLegacyArtifactPathAction, legacyArtifactPath,
+                                                   GROUP_ID_INVALID_INPUT, ARTIFACT_ID_INVALID_INPUT,
+                                                   VERSION_INVALID_INPUT, CLASSIFIER_INVALID_INPUT,
+                                                   TYPE_INVALID_INPUT );
 
         // test
-        actionValidatorManager.validate(addLegacyArtifactPathAction, EMPTY_STRING);
+        actionValidatorManager.validate( addLegacyArtifactPathAction, EMPTY_STRING );
 
         // verify
-        assertTrue(addLegacyArtifactPathAction.hasFieldErrors());
+        assertTrue( addLegacyArtifactPathAction.hasFieldErrors() );
 
         Map<String, List<String>> fieldErrors = addLegacyArtifactPathAction.getFieldErrors();
 
@@ -176,59 +186,71 @@ public class AddLegacyArtifactPathActionTest extends TestCase
 
         // populate
         List<String> expectedErrorMessages = new ArrayList<String>();
-        expectedErrorMessages.add("Legacy path must only contain alphanumeric characters, forward-slashes(/), back-slashes(\\), underscores(_), dots(.), and dashes(-).");
-        expectedFieldErrors.put("legacyArtifactPath.path", expectedErrorMessages);
+        expectedErrorMessages.add(
+            "Legacy path must only contain alphanumeric characters, forward-slashes(/), back-slashes(\\), underscores(_), dots(.), and dashes(-)." );
+        expectedFieldErrors.put( "legacyArtifactPath.path", expectedErrorMessages );
 
         expectedErrorMessages = new ArrayList<String>();
-        expectedErrorMessages.add("Group id must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-).");
-        expectedFieldErrors.put("groupId", expectedErrorMessages);
+        expectedErrorMessages.add(
+            "Group id must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-)." );
+        expectedFieldErrors.put( "groupId", expectedErrorMessages );
 
         expectedErrorMessages = new ArrayList<String>();
-        expectedErrorMessages.add("Artifact id must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-).");
-        expectedFieldErrors.put("artifactId", expectedErrorMessages);
+        expectedErrorMessages.add(
+            "Artifact id must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-)." );
+        expectedFieldErrors.put( "artifactId", expectedErrorMessages );
 
         expectedErrorMessages = new ArrayList<String>();
-        expectedErrorMessages.add("Version must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-).");
-        expectedFieldErrors.put("version", expectedErrorMessages);
+        expectedErrorMessages.add(
+            "Version must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-)." );
+        expectedFieldErrors.put( "version", expectedErrorMessages );
 
         expectedErrorMessages = new ArrayList<String>();
-        expectedErrorMessages.add("Classifier must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-).");
-        expectedFieldErrors.put("classifier", expectedErrorMessages);
+        expectedErrorMessages.add(
+            "Classifier must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-)." );
+        expectedFieldErrors.put( "classifier", expectedErrorMessages );
 
         expectedErrorMessages = new ArrayList<String>();
-        expectedErrorMessages.add("Type must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-).");
-        expectedFieldErrors.put("type", expectedErrorMessages);
+        expectedErrorMessages.add(
+            "Type must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-)." );
+        expectedFieldErrors.put( "type", expectedErrorMessages );
 
-        ValidatorUtil.assertFieldErrors(expectedFieldErrors, fieldErrors);
+        ValidatorUtil.assertFieldErrors( expectedFieldErrors, fieldErrors );
     }
 
-    public void testStruts2ValidationFrameworkWithValidInputs() throws Exception
+    public void testStruts2ValidationFrameworkWithValidInputs()
+        throws Exception
     {
         // prep
-        LegacyArtifactPath legacyArtifactPath = createLegacyArtifactPath(LEGACY_ARTIFACT_PATH_PATH_VALID_INPUT);
-        populateAddLegacyArtifactPathActionFields(addLegacyArtifactPathAction, legacyArtifactPath, GROUP_ID_VALID_INPUT, ARTIFACT_ID_VALID_INPUT, VERSION_VALID_INPUT, CLASSIFIER_VALID_INPUT, TYPE_VALID_INPUT);
+        LegacyArtifactPath legacyArtifactPath = createLegacyArtifactPath( LEGACY_ARTIFACT_PATH_PATH_VALID_INPUT );
+        populateAddLegacyArtifactPathActionFields( addLegacyArtifactPathAction, legacyArtifactPath,
+                                                   GROUP_ID_VALID_INPUT, ARTIFACT_ID_VALID_INPUT, VERSION_VALID_INPUT,
+                                                   CLASSIFIER_VALID_INPUT, TYPE_VALID_INPUT );
 
         // test
-        actionValidatorManager.validate(addLegacyArtifactPathAction, EMPTY_STRING);
+        actionValidatorManager.validate( addLegacyArtifactPathAction, EMPTY_STRING );
 
         // verify
-        assertFalse(addLegacyArtifactPathAction.hasFieldErrors());
+        assertFalse( addLegacyArtifactPathAction.hasFieldErrors() );
     }
 
-    private LegacyArtifactPath createLegacyArtifactPath(String path)
+    private LegacyArtifactPath createLegacyArtifactPath( String path )
     {
         LegacyArtifactPath legacyArtifactPath = new LegacyArtifactPath();
-        legacyArtifactPath.setPath(path);
+        legacyArtifactPath.setPath( path );
         return legacyArtifactPath;
     }
 
-    private void populateAddLegacyArtifactPathActionFields(AddLegacyArtifactPathAction addLegacyArtifactPathAction, LegacyArtifactPath legacyArtifactPath, String groupId, String artifactId, String version, String classifier, String type)
+    private void populateAddLegacyArtifactPathActionFields( AddLegacyArtifactPathAction addLegacyArtifactPathAction,
+                                                            LegacyArtifactPath legacyArtifactPath, String groupId,
+                                                            String artifactId, String version, String classifier,
+                                                            String type )
     {
-        addLegacyArtifactPathAction.setLegacyArtifactPath(legacyArtifactPath);
-        addLegacyArtifactPathAction.setGroupId(groupId);
-        addLegacyArtifactPathAction.setArtifactId(artifactId);
-        addLegacyArtifactPathAction.setVersion(version);
-        addLegacyArtifactPathAction.setClassifier(classifier);
-        addLegacyArtifactPathAction.setType(type);
+        addLegacyArtifactPathAction.setLegacyArtifactPath( legacyArtifactPath );
+        addLegacyArtifactPathAction.setGroupId( groupId );
+        addLegacyArtifactPathAction.setArtifactId( artifactId );
+        addLegacyArtifactPathAction.setVersion( version );
+        addLegacyArtifactPathAction.setClassifier( classifier );
+        addLegacyArtifactPathAction.setType( type );
     }
 }