]> source.dussan.org Git - archiva.git/commitdiff
fix some test compilation issues in webapp module : will fix unit later, must compile...
authorOlivier Lamy <olamy@apache.org>
Sat, 11 Jun 2011 12:17:34 +0000 (12:17 +0000)
committerOlivier Lamy <olamy@apache.org>
Sat, 11 Jun 2011 12:17:34 +0000 (12:17 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1134584 13f79535-47bb-0310-9956-ffa450edef68

23 files changed:
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteManagedRepositoryAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/EditManagedRepositoryAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/interceptor/ConfigurationInterceptor.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/startup/SecuritySynchronization.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/AbstractActionTestCase.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/DeleteArtifactActionTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/SearchActionTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/ShowArtifactActionTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/UploadActionTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/appearance/AbstractOrganizationInfoActionTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/appearance/EditOrganizationInfoActionTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/appearance/OrganizationInfoActionTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/DisableProxyConnectorActionTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/ProxyConnectorsActionTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/SortProxyConnectorsActionTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteRemoteRepositoryActionTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteRepositoryGroupActionTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/EditRemoteRepositoryActionTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoryGroupsActionTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/scanning/RepositoryScanningActionTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/reports/GenerateReportActionTest.java
archiva-modules/pom.xml
pom.xml

index bd72df5420ea810fd456f952538f30ce4af856c4..7fc927b6d85ee84f79172fde6cf61455a166bfa0 100644 (file)
@@ -42,7 +42,7 @@ import java.util.Map;
  * DeleteManagedRepositoryAction
  *
  * @version $Id$
- * @plexus.component role="com.opensymphony.xwork2.Action" role-hint="deleteManagedRepositoryAction" instantiation-strategy="per-lookup"
+ * plexus.component role="com.opensymphony.xwork2.Action" role-hint="deleteManagedRepositoryAction" instantiation-strategy="per-lookup"
  */
 @Controller( "deleteManagedRepositoryAction" )
 @Scope( "prototype" )
index 0937d82a4d0951bffae7f3072a375658cfd96bc3..88233b278c8fd6d6cfe506904e910b34973e1c6c 100644 (file)
@@ -41,7 +41,7 @@ import java.io.IOException;
  * AddManagedRepositoryAction
  *
  * @version $Id$
- * @plexus.component role="com.opensymphony.xwork2.Action" role-hint="editManagedRepositoryAction" instantiation-strategy="per-lookup"
+ * plexus.component role="com.opensymphony.xwork2.Action" role-hint="editManagedRepositoryAction" instantiation-strategy="per-lookup"
  */
 @Controller( "editManagedRepositoryAction" )
 @Scope( "prototype" )
index b498c82f988de32f18d09a7a7dfd43489f5c184b..050c68e73f6ea447b05214932dda3d9c84240bc2 100644 (file)
@@ -32,7 +32,7 @@ import javax.servlet.ServletContext;
 /**
  * An interceptor that makes the configuration bits available, both to the application and the webapp
  *
- * @plexus.component role="com.opensymphony.xwork2.interceptor.Interceptor"
+ * plexus.component role="com.opensymphony.xwork2.interceptor.Interceptor"
  * role-hint="configurationInterceptor"
  */
 @Service( "configurationInterceptor" )
index 6f59721d5e6cccf9a813876b1b02db32910bd055..df510e80e5e178a826f4b22160c14c5d7e323332 100644 (file)
@@ -76,7 +76,7 @@ public class SecuritySynchronization
     private RBACManager rbacManager;
 
     /**
-     * @plexus.requirement role="org.codehaus.plexus.redback.system.check.EnvironmentCheck"
+     * plexus.requirement role="org.codehaus.plexus.redback.system.check.EnvironmentCheck"
      */
     private Map<String, EnvironmentCheck> checkers;
 
index d4115e7cd33e708ff97903e8ebaf1e523a1b1433..8c6934ee65caeebc0cd9b398181d0668bd014ce5 100644 (file)
@@ -19,6 +19,7 @@ package org.apache.maven.archiva.web.action;
  * under the License.
  */
 
+import java.io.File;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -223,4 +224,15 @@ public abstract class AbstractActionTestCase
         stack.getContext().put( ActionContext.CONTAINER, container );
         ActionContext.setContext( new ActionContext( stack.getContext() ) );
     }
+
+    public static String getBasedir()
+    {
+       String basedir = System.getProperty( "basedir" );
+        if ( basedir == null )
+        {
+            basedir = new File( "" ).getAbsolutePath();
+        }
+
+        return basedir;
+    }
 }
index 0d14c6cb3c6b724f4534ee429048f659b0cd14bd..e64593c491fd2e69aa3e0d47636d16ca1e5b5a18 100644 (file)
@@ -32,7 +32,7 @@ import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
 import org.apache.maven.archiva.repository.ManagedRepositoryContent;
 import org.apache.maven.archiva.repository.RepositoryContentFactory;
 import org.apache.maven.archiva.repository.content.ManagedDefaultRepositoryContent;
-import org.codehaus.plexus.spring.PlexusInSpringTestCase;
+import org.apache.struts2.StrutsSpringTestCase;
 import org.easymock.MockControl;
 import org.easymock.classextension.MockClassControl;
 
@@ -43,7 +43,7 @@ import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
 public class DeleteArtifactActionTest
-    extends PlexusInSpringTestCase
+    extends StrutsSpringTestCase
 {
     private DeleteArtifactAction action;
 
@@ -67,7 +67,13 @@ public class DeleteArtifactActionTest
 
     private static final String VERSION = "1.0";
 
-    private static final String REPO_LOCATION = getBasedir() + "/target/test-classes/test-repo";
+    private static final String REPO_LOCATION = "target/test-classes/test-repo";
+
+    @Override
+    protected String[] getContextLocations()
+    {
+        return new String[]{ "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" };
+    }
 
     @Override
     protected void setUp()
@@ -75,7 +81,8 @@ public class DeleteArtifactActionTest
     {
         super.setUp();
 
-        action = (DeleteArtifactAction) lookup( Action.class.getName(), "deleteArtifactAction" );
+        //action = (DeleteArtifactAction) lookup( Action.class.getName(), "deleteArtifactAction" );
+        action = (DeleteArtifactAction) getActionProxy( "/deleteArtifact" ).getAction();
         assertNotNull( action );
 
         configurationControl = MockControl.createControl( ArchivaConfiguration.class );
@@ -90,8 +97,11 @@ public class DeleteArtifactActionTest
         RepositorySession repositorySession = mock( RepositorySession.class );
         when( repositorySession.getRepository() ).thenReturn( metadataRepository );
 
-        TestRepositorySessionFactory repositorySessionFactory = (TestRepositorySessionFactory) lookup(
-            RepositorySessionFactory.class );
+        //TestRepositorySessionFactory repositorySessionFactory = (TestRepositorySessionFactory) lookup(
+        //    RepositorySessionFactory.class );
+
+        TestRepositorySessionFactory repositorySessionFactory = new TestRepositorySessionFactory();
+
         repositorySessionFactory.setRepositorySession( repositorySession );
 
         action.setConfiguration( configuration );
index 352d524490a373930932017bee08503931b4874e..ba8994c33e33229dbda7999b8230af809d32cfb5 100644 (file)
@@ -29,11 +29,9 @@ import org.apache.archiva.indexer.util.SearchUtil;
 import org.apache.archiva.metadata.model.ArtifactMetadata;
 import org.apache.archiva.metadata.repository.MetadataRepository;
 import org.apache.archiva.metadata.repository.RepositorySession;
-import org.apache.archiva.metadata.repository.RepositorySessionFactory;
 import org.apache.archiva.metadata.repository.memory.TestRepositorySessionFactory;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 import org.apache.maven.archiva.security.UserRepositories;
-import org.codehaus.plexus.spring.PlexusInSpringTestCase;
 import org.easymock.MockControl;
 
 import java.util.ArrayList;
@@ -77,7 +75,8 @@ public class SearchActionTest
         action = new SearchAction();
 
         session = mock( RepositorySession.class );
-        TestRepositorySessionFactory factory = (TestRepositorySessionFactory) lookup( RepositorySessionFactory.class );
+        //TestRepositorySessionFactory factory = (TestRepositorySessionFactory) lookup( RepositorySessionFactory.class );
+        TestRepositorySessionFactory factory = new TestRepositorySessionFactory();
         factory.setRepositorySession( session );
         action.setRepositorySessionFactory( factory );
 
@@ -425,8 +424,8 @@ public class SearchActionTest
         control.expectAndReturn( metadataRepository.getArtifactsByChecksum( TEST_REPO, TEST_CHECKSUM ),
                                  Collections.singletonList( artifact ) );
 
-        userReposControl.expectAndReturn( userRepos.getObservableRepositoryIds( GUEST ), Collections.singletonList(
-            TEST_REPO ) );
+        userReposControl.expectAndReturn( userRepos.getObservableRepositoryIds( GUEST ),
+                                          Collections.singletonList( TEST_REPO ) );
 
         control.replay();
         userReposControl.replay();
@@ -453,8 +452,8 @@ public class SearchActionTest
                                                           createArtifact( "archiva-indexer", "1.0" ) );
         control.expectAndReturn( metadataRepository.getArtifactsByChecksum( TEST_REPO, TEST_CHECKSUM ), artifacts );
 
-        userReposControl.expectAndReturn( userRepos.getObservableRepositoryIds( GUEST ), Collections.singletonList(
-            TEST_REPO ) );
+        userReposControl.expectAndReturn( userRepos.getObservableRepositoryIds( GUEST ),
+                                          Collections.singletonList( TEST_REPO ) );
 
         control.replay();
         userReposControl.replay();
@@ -490,8 +489,8 @@ public class SearchActionTest
         control.expectAndReturn( metadataRepository.getArtifactsByChecksum( TEST_REPO, TEST_CHECKSUM ),
                                  Collections.<ArtifactMetadata>emptyList() );
 
-        userReposControl.expectAndReturn( userRepos.getObservableRepositoryIds( GUEST ), Collections.singletonList(
-            TEST_REPO ) );
+        userReposControl.expectAndReturn( userRepos.getObservableRepositoryIds( GUEST ),
+                                          Collections.singletonList( TEST_REPO ) );
 
         control.replay();
         userReposControl.replay();
index abbcf4f9b83fb30a2333485e33fd1bd17503d622..480b318ee22e1640e259eb9e8cf76c93461190c6 100644 (file)
@@ -39,6 +39,7 @@ import org.apache.maven.archiva.repository.ManagedRepositoryContent;
 import org.apache.maven.archiva.repository.RepositoryContentFactory;
 import org.apache.maven.archiva.repository.content.ManagedDefaultRepositoryContent;
 
+import java.io.File;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
@@ -72,7 +73,7 @@ public class ShowArtifactActionTest
 
     public void testInstantiation()
     {
-        assertFalse( action == lookup( Action.class, ACTION_HINT ) );
+        assertFalse( action == getActionProxy( "/showArtifact" ).getAction() );
     }
 
     public void testGetArtifactUniqueRelease()
@@ -630,15 +631,16 @@ public class ShowArtifactActionTest
         throws Exception
     {
         super.setUp();
-        action = (ShowArtifactAction) lookup( Action.class, ACTION_HINT );
+        action = (ShowArtifactAction) getActionProxy( "/showArtifact" ).getAction();
 
         metadataResolver = new TestMetadataResolver();
         MetadataRepository repo = mock( MetadataRepository.class );
         RepositorySession repositorySession = mock( RepositorySession.class );
         when( repositorySession.getResolver() ).thenReturn( metadataResolver );
         when( repositorySession.getRepository() ).thenReturn( repo );
-        TestRepositorySessionFactory repositorySessionFactory = (TestRepositorySessionFactory) lookup(
-            RepositorySessionFactory.class );
+        //TestRepositorySessionFactory repositorySessionFactory = (TestRepositorySessionFactory) lookup(
+        //    RepositorySessionFactory.class );
+        TestRepositorySessionFactory repositorySessionFactory = new TestRepositorySessionFactory();
         repositorySessionFactory.setRepositorySession( repositorySession );
 
         RepositoryContentFactory factory = mock( RepositoryContentFactory.class );
@@ -646,7 +648,7 @@ public class ShowArtifactActionTest
 
         ManagedRepositoryConfiguration config = new ManagedRepositoryConfiguration();
         config.setId( TEST_REPO );
-        config.setLocation( getTestFile( "target/test-repo" ).getAbsolutePath() );
+        config.setLocation( new File( "target/test-repo" ).getAbsolutePath() );
 
         ManagedRepositoryContent content = new ManagedDefaultRepositoryContent();
         content.setRepository( config );
index 0291101100d576ecc2ea28ec05d3d468dd8ab228..c8930ab66fd011c1d66d9dfc1427825a2c1a90b5 100644 (file)
@@ -39,7 +39,6 @@ import org.apache.maven.archiva.repository.RepositoryNotFoundException;
 import org.apache.maven.archiva.repository.content.ManagedDefaultRepositoryContent;
 import org.apache.maven.archiva.repository.metadata.MetadataTools;
 import org.apache.maven.archiva.repository.metadata.RepositoryMetadataReader;
-import org.codehaus.plexus.spring.PlexusInSpringTestCase;
 import org.easymock.MockControl;
 import org.easymock.classextension.MockClassControl;
 
index e0e93b403f3acb7972037b99ed5921b1f7d83811..b4132eacdb7690d4bfb6e3821ef61f6c518ca0b6 100644 (file)
@@ -7,16 +7,17 @@ import org.easymock.MockControl;
 
 /**
  */
-public abstract class AbstractOrganizationInfoActionTest extends AbstractWebworkTestCase
+public abstract class AbstractOrganizationInfoActionTest
+    extends AbstractWebworkTestCase
 {
     protected MockControl archivaConfigurationControl;
-    
+
     protected ArchivaConfiguration configuration;
-    
+
     protected AbstractAppearanceAction action;
-    
+
     protected Configuration config;
-    
+
     protected abstract AbstractAppearanceAction getAction();
 
     @Override
@@ -24,20 +25,20 @@ public abstract class AbstractOrganizationInfoActionTest extends AbstractWebwork
         throws Exception
     {
         super.setUp();
-        
+
         config = new Configuration();
         archivaConfigurationControl = MockControl.createControl( ArchivaConfiguration.class );
         configuration = (ArchivaConfiguration) archivaConfigurationControl.getMock();
-        
+
         configuration.getConfiguration();
-        archivaConfigurationControl.setReturnValue(config, 1, 2);
-        
-        configuration.save(config);
-        archivaConfigurationControl.setVoidCallable(1, 2);
-        
+        archivaConfigurationControl.setReturnValue( config, 1, 2 );
+
+        configuration.save( config );
+        archivaConfigurationControl.setVoidCallable( 1, 2 );
+
         archivaConfigurationControl.replay();
     }
-    
+
     protected void reloadAction()
     {
         action = getAction();
index 7aff5f7cc10ea51a75ec55f75de8dd3d0ce7c9ca..41223bda701bbe992035d40b1d3a4003a5a132f2 100644 (file)
@@ -19,22 +19,20 @@ package org.apache.maven.archiva.web.action.admin.appearance;
  * under the License.
  */
 
-import com.opensymphony.xwork2.Action;
-import com.opensymphony.xwork2.ObjectFactory;
 import com.opensymphony.xwork2.validator.ActionValidatorManager;
+import org.apache.maven.archiva.configuration.OrganisationInformation;
+import org.apache.maven.archiva.web.action.admin.repositories.DefaultActionValidatorManagerFactory;
+import org.apache.maven.archiva.web.validator.utils.ValidatorUtil;
+
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-import com.opensymphony.xwork2.validator.DefaultActionValidatorManager;
-import org.apache.maven.archiva.configuration.OrganisationInformation;
-import org.apache.maven.archiva.web.action.admin.repositories.DefaultActionValidatorManagerFactory;
-import org.apache.maven.archiva.web.validator.utils.ValidatorUtil;
-
 /**
  */
-public class EditOrganizationInfoActionTest extends AbstractOrganizationInfoActionTest
+public class EditOrganizationInfoActionTest
+    extends AbstractOrganizationInfoActionTest
 {
     private static final String EMPTY_STRING = "";
 
@@ -56,7 +54,8 @@ public class EditOrganizationInfoActionTest extends AbstractOrganizationInfoActi
     private ActionValidatorManager actionValidatorManager;
 
     @Override
-    public void setUp() throws Exception
+    public void setUp()
+        throws Exception
     {
         super.setUp();
 
@@ -68,44 +67,45 @@ public class EditOrganizationInfoActionTest extends AbstractOrganizationInfoActi
     public void testOrganisationInfoSaves()
         throws Exception
     {
-        config.setOrganisationInfo(new OrganisationInformation());
+        config.setOrganisationInfo( new OrganisationInformation() );
         OrganisationInformation orginfo = config.getOrganisationInfo();
-        orginfo.setLogoLocation("LOGO");
-        orginfo.setName("NAME");
-        orginfo.setUrl("URL");
-        
-        configuration.save(config);
-        
+        orginfo.setLogoLocation( "LOGO" );
+        orginfo.setName( "NAME" );
+        orginfo.setUrl( "URL" );
+
+        configuration.save( config );
+
         reloadAction();
-        
+
         action.prepare();
-        
-        assertEquals("LOGO", action.getOrganisationLogo());
-        assertEquals("NAME", action.getOrganisationName());
-        assertEquals("URL", action.getOrganisationUrl());
-        
-        action.setOrganisationLogo("LOGO1");
-        action.setOrganisationName("NAME1");
-        action.setOrganisationUrl("URL1");
-        
+
+        assertEquals( "LOGO", action.getOrganisationLogo() );
+        assertEquals( "NAME", action.getOrganisationName() );
+        assertEquals( "URL", action.getOrganisationUrl() );
+
+        action.setOrganisationLogo( "LOGO1" );
+        action.setOrganisationName( "NAME1" );
+        action.setOrganisationUrl( "URL1" );
+
         action.execute();
-        
-        assertEquals("LOGO1", orginfo.getLogoLocation());
-        assertEquals("NAME1", orginfo.getName());
-        assertEquals("URL1", orginfo.getUrl());
+
+        assertEquals( "LOGO1", orginfo.getLogoLocation() );
+        assertEquals( "NAME1", orginfo.getName() );
+        assertEquals( "URL1", orginfo.getUrl() );
     }
 
-    public void testStruts2ValidationFrameworkWithNullInputs() throws Exception
+    public void testStruts2ValidationFrameworkWithNullInputs()
+        throws Exception
     {
         // prep
         action = getAction();
-        populateOrganisationValues(action, null, null, null);
+        populateOrganisationValues( action, null, null, null );
 
         // test
-        actionValidatorManager.validate(action, EMPTY_STRING);
+        actionValidatorManager.validate( action, EMPTY_STRING );
 
         // verify
-        assertTrue(action.hasFieldErrors());
+        assertTrue( action.hasFieldErrors() );
 
         Map<String, List<String>> fieldErrors = action.getFieldErrors();
 
@@ -114,23 +114,24 @@ public class EditOrganizationInfoActionTest extends AbstractOrganizationInfoActi
 
         // populate
         List<String> expectedErrorMessages = new ArrayList<String>();
-        expectedErrorMessages.add("You must enter a name");
-        expectedFieldErrors.put("organisationName", expectedErrorMessages);
+        expectedErrorMessages.add( "You must enter a name" );
+        expectedFieldErrors.put( "organisationName", expectedErrorMessages );
 
-        ValidatorUtil.assertFieldErrors(expectedFieldErrors, fieldErrors);
+        ValidatorUtil.assertFieldErrors( expectedFieldErrors, fieldErrors );
     }
 
-    public void testStruts2ValidationFrameworkWithBlankInputs() throws Exception
+    public void testStruts2ValidationFrameworkWithBlankInputs()
+        throws Exception
     {
         // prep
         action = getAction();
-        populateOrganisationValues(action, EMPTY_STRING, EMPTY_STRING, EMPTY_STRING);
+        populateOrganisationValues( action, EMPTY_STRING, EMPTY_STRING, EMPTY_STRING );
 
         // test
-        actionValidatorManager.validate(action, EMPTY_STRING);
+        actionValidatorManager.validate( action, EMPTY_STRING );
 
         // verify
-        assertTrue(action.hasFieldErrors());
+        assertTrue( action.hasFieldErrors() );
 
         Map<String, List<String>> fieldErrors = action.getFieldErrors();
 
@@ -139,23 +140,25 @@ public class EditOrganizationInfoActionTest extends AbstractOrganizationInfoActi
 
         // populate
         List<String> expectedErrorMessages = new ArrayList<String>();
-        expectedErrorMessages.add("You must enter a name");
-        expectedFieldErrors.put("organisationName", expectedErrorMessages);
+        expectedErrorMessages.add( "You must enter a name" );
+        expectedFieldErrors.put( "organisationName", expectedErrorMessages );
 
-        ValidatorUtil.assertFieldErrors(expectedFieldErrors, fieldErrors);
+        ValidatorUtil.assertFieldErrors( expectedFieldErrors, fieldErrors );
     }
 
-    public void testStruts2ValidationFrameworkWithInvalidInputs() throws Exception
+    public void testStruts2ValidationFrameworkWithInvalidInputs()
+        throws Exception
     {
         // prep
         action = getAction();
-        populateOrganisationValues(action, ORGANISATION_NAME_INVALID_INPUT, ORGANISATION_URL_INVALID_INPUT, ORGANISATION_LOGO_INVALID_INPUT);
+        populateOrganisationValues( action, ORGANISATION_NAME_INVALID_INPUT, ORGANISATION_URL_INVALID_INPUT,
+                                    ORGANISATION_LOGO_INVALID_INPUT );
 
         // test
-        actionValidatorManager.validate(action, EMPTY_STRING);
+        actionValidatorManager.validate( action, EMPTY_STRING );
 
         // verify
-        assertTrue(action.hasFieldErrors());
+        assertTrue( action.hasFieldErrors() );
 
         Map<String, List<String>> fieldErrors = action.getFieldErrors();
 
@@ -164,43 +167,48 @@ public class EditOrganizationInfoActionTest extends AbstractOrganizationInfoActi
 
         // populate
         List<String> expectedErrorMessages = new ArrayList<String>();
-        expectedErrorMessages.add("Organisation name must only contain alphanumeric characters, white-spaces(' '), equals(=), question-marks(?), exclamation-points(!), ampersands(&), forward-slashes(/), back-slashes(\\), underscores(_), dots(.), colons(:), tildes(~), and dashes(-).");
-        expectedFieldErrors.put("organisationName", expectedErrorMessages);
+        expectedErrorMessages.add(
+            "Organisation name must only contain alphanumeric characters, white-spaces(' '), equals(=), question-marks(?), exclamation-points(!), ampersands(&), forward-slashes(/), back-slashes(\\), underscores(_), dots(.), colons(:), tildes(~), and dashes(-)." );
+        expectedFieldErrors.put( "organisationName", expectedErrorMessages );
 
         expectedErrorMessages = new ArrayList<String>();
-        expectedErrorMessages.add("You must enter a URL");
-        expectedFieldErrors.put("organisationUrl", expectedErrorMessages);
+        expectedErrorMessages.add( "You must enter a URL" );
+        expectedFieldErrors.put( "organisationUrl", expectedErrorMessages );
 
         expectedErrorMessages = new ArrayList<String>();
-        expectedErrorMessages.add("You must enter a URL");
-        expectedFieldErrors.put("organisationLogo", expectedErrorMessages);
+        expectedErrorMessages.add( "You must enter a URL" );
+        expectedFieldErrors.put( "organisationLogo", expectedErrorMessages );
 
-        ValidatorUtil.assertFieldErrors(expectedFieldErrors, fieldErrors);
+        ValidatorUtil.assertFieldErrors( expectedFieldErrors, fieldErrors );
     }
 
-    public void testStruts2ValidationFrameworkWithValidInputs() throws Exception
+    public void testStruts2ValidationFrameworkWithValidInputs()
+        throws Exception
     {
         // prep
         action = getAction();
-        populateOrganisationValues(action, ORGANISATION_NAME_VALID_INPUT, ORGANISATION_URL_VALID_INPUT, ORGANISATION_LOGO_VALID_INPUT);
+        populateOrganisationValues( action, ORGANISATION_NAME_VALID_INPUT, ORGANISATION_URL_VALID_INPUT,
+                                    ORGANISATION_LOGO_VALID_INPUT );
 
         // test
-        actionValidatorManager.validate(action, EMPTY_STRING);
+        actionValidatorManager.validate( action, EMPTY_STRING );
 
         // verify
-        assertFalse(action.hasFieldErrors());
+        assertFalse( action.hasFieldErrors() );
     }
 
-    private void populateOrganisationValues(AbstractAppearanceAction abstractAppearanceAction , String name, String url, String logo)
+    private void populateOrganisationValues( AbstractAppearanceAction abstractAppearanceAction, String name, String url,
+                                             String logo )
     {
-        abstractAppearanceAction.setOrganisationName(name);
-        abstractAppearanceAction.setOrganisationUrl(url);
-        abstractAppearanceAction.setOrganisationLogo(logo);
+        abstractAppearanceAction.setOrganisationName( name );
+        abstractAppearanceAction.setOrganisationUrl( url );
+        abstractAppearanceAction.setOrganisationLogo( logo );
     }
 
     @Override
-    protected AbstractAppearanceAction getAction() 
+    protected AbstractAppearanceAction getAction()
     {
-        return (EditOrganisationInfoAction) lookup( Action.class.getName(), "editOrganisationInfo" );
+        //return (EditOrganisationInfoAction) lookup( Action.class.getName(), "editOrganisationInfo" );
+        return (EditOrganisationInfoAction) getActionProxy( "/admin/editOrganisationInfo" ).getAction();
     }
 }
index 336f1097fd94cf5b63380cd20a7a297eb0e76bfe..2682bc21ebe8825e1ec31bd199d610d8e621b99a 100644 (file)
@@ -21,35 +21,36 @@ package org.apache.maven.archiva.web.action.admin.appearance;
 
 import org.apache.maven.archiva.configuration.OrganisationInformation;
 
-import com.opensymphony.xwork2.Action;
-
 /**
  */
-public class OrganizationInfoActionTest extends AbstractOrganizationInfoActionTest
-{ 
+public class OrganizationInfoActionTest
+    extends AbstractOrganizationInfoActionTest
+{
     public void testOrganisationInfoLoads()
         throws Exception
     {
-        config.setOrganisationInfo(new OrganisationInformation());
+        config.setOrganisationInfo( new OrganisationInformation() );
         OrganisationInformation orginfo = config.getOrganisationInfo();
-        orginfo.setLogoLocation("LOGO");
-        orginfo.setName("NAME");
-        orginfo.setUrl("URL");
-        
-        configuration.save(config);
-        
+        orginfo.setLogoLocation( "LOGO" );
+        orginfo.setName( "NAME" );
+        orginfo.setUrl( "URL" );
+
+        configuration.save( config );
+
         reloadAction();
-        
+
         action.prepare();
-        
-        assertEquals("URL", action.getOrganisationUrl());
-        assertEquals("NAME", action.getOrganisationName());
-        assertEquals("LOGO", action.getOrganisationLogo());
+
+        assertEquals( "URL", action.getOrganisationUrl() );
+        assertEquals( "NAME", action.getOrganisationName() );
+        assertEquals( "LOGO", action.getOrganisationLogo() );
     }
 
     @Override
-    protected AbstractAppearanceAction getAction() 
+    protected AbstractAppearanceAction getAction()
     {
-        return (OrganisationInfoAction) lookup( Action.class.getName(), "organisationInfo" );
+        //return (OrganisationInfoAction) lookup( Action.class.getName(), "organisationInfo" );
+
+        return (OrganisationInfoAction) getActionProxy( "/admin/organisationInfo" ).getAction();
     }
 }
index becbd156ef66d929b3b342ee4498650f50445657..a719018931df7c72e6db196f5ecce7cc38a96b32 100644 (file)
@@ -25,22 +25,23 @@ import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
 import org.apache.maven.archiva.configuration.ProxyConnectorConfiguration;
 import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
 import org.apache.maven.archiva.web.action.AbstractWebworkTestCase;
-import org.codehaus.redback.integration.interceptor.SecureActionBundle;
 import org.codehaus.plexus.registry.RegistryException;
+import org.codehaus.redback.integration.interceptor.SecureActionBundle;
 import org.easymock.MockControl;
 
-public class DisableProxyConnectorActionTest extends AbstractWebworkTestCase
+public class DisableProxyConnectorActionTest
+    extends AbstractWebworkTestCase
 {
     private static final String TEST_TARGET_ID = "central";
 
     private static final String TEST_SOURCE_ID = "corporate";
-    
+
     private DisableProxyConnectorAction action;
-    
+
     private MockControl archivaConfigurationControl;
 
     private ArchivaConfiguration archivaConfiguration;
-    
+
     public void testConfirmDisableBadSourceOrTarget()
         throws Exception
     {
@@ -132,8 +133,9 @@ public class DisableProxyConnectorActionTest extends AbstractWebworkTestCase
 
         // Test the configuration.
         assertEquals( 1, archivaConfiguration.getConfiguration().getProxyConnectors().size() );
-        ProxyConnectorConfiguration config = (ProxyConnectorConfiguration)archivaConfiguration.getConfiguration().getProxyConnectors().get(0);
-        assertTrue(config.isDisabled());
+        ProxyConnectorConfiguration config =
+            (ProxyConnectorConfiguration) archivaConfiguration.getConfiguration().getProxyConnectors().get( 0 );
+        assertTrue( config.isDisabled() );
     }
 
     public void testSecureActionBundle()
@@ -146,7 +148,7 @@ public class DisableProxyConnectorActionTest extends AbstractWebworkTestCase
         assertTrue( bundle.requiresAuthentication() );
         assertEquals( 1, bundle.getAuthorizationTuples().size() );
     }
-    
+
     public void testConfirmEnable()
         throws Exception
     {
@@ -161,7 +163,7 @@ public class DisableProxyConnectorActionTest extends AbstractWebworkTestCase
         assertEquals( Action.INPUT, status );
         assertNoErrors( action );
     }
-    
+
     private Configuration createInitialConfiguration()
     {
         Configuration config = new Configuration();
@@ -182,8 +184,8 @@ public class DisableProxyConnectorActionTest extends AbstractWebworkTestCase
         ProxyConnectorConfiguration connector = new ProxyConnectorConfiguration();
         connector.setSourceRepoId( TEST_SOURCE_ID );
         connector.setTargetRepoId( TEST_TARGET_ID );
-        
-        connector.setDisabled(false);
+
+        connector.setDisabled( false );
 
         config.addProxyConnector( connector );
 
@@ -210,7 +212,8 @@ public class DisableProxyConnectorActionTest extends AbstractWebworkTestCase
     {
         super.setUp();
 
-        action = (DisableProxyConnectorAction) lookup( Action.class.getName(), "disableProxyConnectorAction" );
+        //action = (DisableProxyConnectorAction) lookup( Action.class.getName(), "disableProxyConnectorAction" );
+        action = (DisableProxyConnectorAction) getActionProxy( "/admin/disableProxyConnector" ).getAction();
 
         archivaConfigurationControl = MockControl.createControl( ArchivaConfiguration.class );
         archivaConfiguration = (ArchivaConfiguration) archivaConfigurationControl.getMock();
index 5fde0bbc284386c431ad02cd47f91318e91a72fc..519350759e7540cd1eca2571fc287452e77dcc71 100644 (file)
@@ -58,7 +58,9 @@ public class ProxyConnectorsActionTest
     {
         super.setUp();
 
-        action = (ProxyConnectorsAction) lookup( Action.class.getName(), "proxyConnectorsAction" );
+        //action = (ProxyConnectorsAction) lookup( Action.class.getName(), "proxyConnectorsAction" );
+
+        action = (ProxyConnectorsAction) getActionProxy("/admin/proxyConnectors" ).getAction();
 
         archivaConfigurationControl = MockControl.createControl( ArchivaConfiguration.class );
         archivaConfiguration = (ArchivaConfiguration) archivaConfigurationControl.getMock();
index fa9b969b9c69484a304b0b72441262f1dc3df0ec..dcfff827e31b30813a0b503f85a57cd7f8e06476 100644 (file)
@@ -20,7 +20,6 @@ package org.apache.maven.archiva.web.action.admin.connectors.proxy;
  */
 
 import com.opensymphony.xwork2.Action;
-
 import org.apache.commons.lang.StringUtils;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 import org.apache.maven.archiva.configuration.Configuration;
@@ -30,15 +29,15 @@ import org.apache.maven.archiva.configuration.ProxyConnectorConfiguration;
 import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
 import org.apache.maven.archiva.configuration.functors.ProxyConnectorConfigurationOrderComparator;
 import org.apache.maven.archiva.web.action.AbstractWebworkTestCase;
-import org.codehaus.redback.integration.interceptor.SecureActionBundle;
 import org.codehaus.plexus.registry.RegistryException;
+import org.codehaus.redback.integration.interceptor.SecureActionBundle;
 import org.easymock.MockControl;
 
 import java.util.Collections;
 import java.util.List;
 
 /**
- * SortProxyConnectorsActionTest 
+ * SortProxyConnectorsActionTest
  *
  * @version $Id$
  */
@@ -81,7 +80,7 @@ public class SortProxyConnectorsActionTest
         String status = action.sortDown();
         assertEquals( Action.SUCCESS, status );
 
-        assertOrder( new String[] { JAVAX, CENTRAL, CODEHAUS } );
+        assertOrder( new String[]{ JAVAX, CENTRAL, CODEHAUS } );
     }
 
     public void testSortDownPastEnd()
@@ -97,7 +96,7 @@ public class SortProxyConnectorsActionTest
         assertEquals( Action.SUCCESS, status );
 
         // No order change.
-        assertOrder( new String[] { CENTRAL, JAVAX, CODEHAUS } );
+        assertOrder( new String[]{ CENTRAL, JAVAX, CODEHAUS } );
     }
 
     public void testSortUp()
@@ -111,11 +110,11 @@ public class SortProxyConnectorsActionTest
         String status = action.sortUp();
         assertEquals( Action.SUCCESS, status );
 
-        assertOrder( new String[] { CENTRAL, CODEHAUS, JAVAX } );
+        assertOrder( new String[]{ CENTRAL, CODEHAUS, JAVAX } );
     }
 
     public void testSortUpPastBeginning()
-    throws Exception
+        throws Exception
     {
         expectConfigurationRequests( 7 );
         archivaConfigurationControl.replay();
@@ -127,7 +126,7 @@ public class SortProxyConnectorsActionTest
         assertEquals( Action.SUCCESS, status );
 
         // No order change.
-        assertOrder( new String[] { CENTRAL, JAVAX, CODEHAUS } );
+        assertOrder( new String[]{ CENTRAL, JAVAX, CODEHAUS } );
     }
 
     private void assertOrder( String[] targetRepoOrder )
@@ -137,8 +136,8 @@ public class SortProxyConnectorsActionTest
 
         for ( ProxyConnectorConfiguration connector : connectors )
         {
-            assertEquals( "All connectors in list should have the same source id (in this test)", CORPORATE, connector
-                .getSourceRepoId() );
+            assertEquals( "All connectors in list should have the same source id (in this test)", CORPORATE,
+                          connector.getSourceRepoId() );
         }
 
         assertEquals( targetRepoOrder.length, connectors.size() );
@@ -243,7 +242,8 @@ public class SortProxyConnectorsActionTest
     {
         super.setUp();
 
-        action = (SortProxyConnectorsAction) lookup( Action.class.getName(), "sortProxyConnectorsAction" );
+        //action = (SortProxyConnectorsAction) lookup( Action.class.getName(), "sortProxyConnectorsAction" );
+        action = (SortProxyConnectorsAction) getActionProxy( "/admin/sortProxyConnectors" ).getAction();
 
         archivaConfigurationControl = MockControl.createControl( ArchivaConfiguration.class );
         archivaConfiguration = (ArchivaConfiguration) archivaConfigurationControl.getMock();
index fdd0fa1ee5cf2f35f20a290336e9d3a8e99fd39e..ea03dc1afeb6430384cc1bb0d3b64c56005b582e 100644 (file)
@@ -28,13 +28,12 @@ import org.apache.maven.archiva.configuration.ProxyConnectorConfiguration;
 import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
 import org.apache.maven.archiva.web.action.AbstractActionTestCase;
 import org.codehaus.plexus.registry.RegistryException;
-import org.codehaus.plexus.spring.PlexusInSpringTestCase;
 import org.easymock.MockControl;
 
 import java.util.Collections;
 
 /**
- * DeleteRemoteRepositoryActionTest 
+ * DeleteRemoteRepositoryActionTest
  *
  * @version $Id$
  */
@@ -54,7 +53,8 @@ public class DeleteRemoteRepositoryActionTest
     {
         super.setUp();
 
-        action = (DeleteRemoteRepositoryAction) lookup( Action.class.getName(), "deleteRemoteRepositoryAction" );
+        //action = (DeleteRemoteRepositoryAction) lookup( Action.class.getName(), "deleteRemoteRepositoryAction" );
+        action = (DeleteRemoteRepositoryAction) getActionProxy( "/admin/deleteRemoteRepository" ).getAction();
 
         archivaConfigurationControl = MockControl.createControl( ArchivaConfiguration.class );
         archivaConfiguration = (ArchivaConfiguration) archivaConfigurationControl.getMock();
@@ -90,26 +90,28 @@ public class DeleteRemoteRepositoryActionTest
         throws RegistryException, IndeterminateConfigurationException
     {
         Configuration configuration = createConfigurationForEditing( createRepository() );
-        configuration.addManagedRepository( createManagedRepository( "internal", getTestPath( "target/repo/internal" ) ) );
-        configuration.addManagedRepository( createManagedRepository( "snapshots", getTestPath( "target/repo/snapshots" ) ) );
-        configuration.addProxyConnector( createProxyConnector( "internal", REPO_ID) );
-        
+        configuration.addManagedRepository(
+            createManagedRepository( "internal", "target/repo/internal" ));
+        configuration.addManagedRepository(
+            createManagedRepository( "snapshots", "target/repo/snapshots" ) );
+        configuration.addProxyConnector( createProxyConnector( "internal", REPO_ID ) );
+
         archivaConfiguration.getConfiguration();
         archivaConfigurationControl.setReturnValue( configuration, 4 );
-        
+
         archivaConfiguration.save( configuration );
         archivaConfigurationControl.replay();
-        
+
         action.setRepoid( REPO_ID );
-        
+
         action.prepare();
         assertEquals( REPO_ID, action.getRepoid() );
         RemoteRepositoryConfiguration repository = action.getRepository();
         assertNotNull( repository );
         assertRepositoryEquals( repository, createRepository() );
-        
+
         assertEquals( 1, configuration.getProxyConnectors().size() );
-        
+
         String status = action.delete();
         assertEquals( Action.SUCCESS, status );
 
@@ -151,7 +153,7 @@ public class DeleteRemoteRepositoryActionTest
         configuration.addRemoteRepository( repositoryConfiguration );
         return configuration;
     }
-    
+
     private RemoteRepositoryConfiguration createRepository()
     {
         RemoteRepositoryConfiguration r = new RemoteRepositoryConfiguration();
@@ -159,7 +161,7 @@ public class DeleteRemoteRepositoryActionTest
         populateRepository( r );
         return r;
     }
-    
+
     private void assertRepositoryEquals( RemoteRepositoryConfiguration expectedRepository,
                                          RemoteRepositoryConfiguration actualRepository )
     {
@@ -168,7 +170,7 @@ public class DeleteRemoteRepositoryActionTest
         assertEquals( expectedRepository.getUrl(), actualRepository.getUrl() );
         assertEquals( expectedRepository.getName(), actualRepository.getName() );
     }
-    
+
     private ManagedRepositoryConfiguration createManagedRepository( String string, String testPath )
     {
         ManagedRepositoryConfiguration r = new ManagedRepositoryConfiguration();
@@ -202,6 +204,6 @@ public class DeleteRemoteRepositoryActionTest
         repository.setUrl( "url" );
         repository.setLayout( "default" );
     }
-    
+
     // TODO: what about removing proxied content if a proxy is removed?
 }
index 7a03e676ab3a4e2783607d3104510e2bd7838431..bc5c5a972525fc534531763f3ed5955a318114e4 100644 (file)
@@ -19,25 +19,21 @@ package org.apache.maven.archiva.web.action.admin.repositories;
  * under the License.
  */
 
-import java.util.Collections;
-
+import com.opensymphony.xwork2.Action;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 import org.apache.maven.archiva.configuration.Configuration;
 import org.apache.maven.archiva.configuration.RepositoryGroupConfiguration;
 import org.apache.maven.archiva.web.action.AbstractActionTestCase;
-import org.codehaus.plexus.spring.PlexusInSpringTestCase;
 import org.codehaus.redback.integration.interceptor.SecureActionBundle;
 import org.codehaus.redback.integration.interceptor.SecureActionException;
 import org.easymock.MockControl;
 
-import com.opensymphony.xwork2.Action;
+import java.util.Collections;
 
 /**
  * DeleteRepositoryGroupActionTest
- * 
- * @version
  */
-public class DeleteRepositoryGroupActionTest 
+public class DeleteRepositoryGroupActionTest
     extends AbstractActionTestCase
 {
     private static final String REPO_GROUP_ID = "repo-group-ident";
@@ -52,21 +48,22 @@ public class DeleteRepositoryGroupActionTest
         throws Exception
     {
         super.setUp();
-        
-        action = (DeleteRepositoryGroupAction) lookup ( Action.class.getName(), "deleteRepositoryGroupAction" );
-        
+
+        //action = (DeleteRepositoryGroupAction) lookup ( Action.class.getName(), "deleteRepositoryGroupAction" );
+        action = (DeleteRepositoryGroupAction) getActionProxy( "/admin/deleteRepositoryGroup" ).getAction();
+
         archivaConfigurationControl = MockControl.createControl( ArchivaConfiguration.class );
         archivaConfiguration = (ArchivaConfiguration) archivaConfigurationControl.getMock();
         action.setArchivaConfiguration( archivaConfiguration );
     }
-    
+
     public void testSecureActionBundle()
         throws SecureActionException
-       {
+    {
         archivaConfiguration.getConfiguration();
         archivaConfigurationControl.setReturnValue( new Configuration() );
         archivaConfigurationControl.replay();
-       
+
         action.prepare();
         SecureActionBundle bundle = action.getSecureActionBundle();
         assertTrue( bundle.requiresAuthentication() );
@@ -78,11 +75,11 @@ public class DeleteRepositoryGroupActionTest
     {
         RepositoryGroupConfiguration origRepoGroup = createRepositoryGroup();
         Configuration configuration = createConfigurationForEditing( origRepoGroup );
-    
+
         archivaConfiguration.getConfiguration();
         archivaConfigurationControl.setReturnValue( configuration );
         archivaConfigurationControl.replay();
-        
+
         action.setRepoGroupId( REPO_GROUP_ID );
 
         action.prepare();
@@ -97,20 +94,20 @@ public class DeleteRepositoryGroupActionTest
         throws Exception
     {
         Configuration configuration = createConfigurationForEditing( createRepositoryGroup() );
-       
+
         archivaConfiguration.getConfiguration();
         archivaConfigurationControl.setReturnValue( configuration, 3 );
         archivaConfiguration.save( configuration );
         archivaConfigurationControl.replay();
-       
+
         action.setRepoGroupId( REPO_GROUP_ID );
-       
+
         action.prepare();
         assertEquals( REPO_GROUP_ID, action.getRepoGroupId() );
         RepositoryGroupConfiguration repoGroup = action.getRepositoryGroup();
         assertNotNull( repoGroup );
         assertEquals( Collections.singletonList( repoGroup ), configuration.getRepositoryGroups() );
-       
+
         String status = action.delete();
         assertEquals( Action.SUCCESS, status );
         assertTrue( configuration.getRepositoryGroups().isEmpty() );
@@ -120,21 +117,21 @@ public class DeleteRepositoryGroupActionTest
         throws Exception
     {
         RepositoryGroupConfiguration origRepoGroup = createRepositoryGroup();
-        Configuration configuration = createConfigurationForEditing ( origRepoGroup );
-       
+        Configuration configuration = createConfigurationForEditing( origRepoGroup );
+
         archivaConfiguration.getConfiguration();
         archivaConfigurationControl.setReturnValue( configuration, 2 );
 
         archivaConfiguration.save( configuration );
         archivaConfigurationControl.replay();
-        
+
         action.setRepoGroupId( REPO_GROUP_ID );
-        
+
         action.prepare();
         assertEquals( REPO_GROUP_ID, action.getRepoGroupId() );
         RepositoryGroupConfiguration repoGroup = action.getRepositoryGroup();
         assertNotNull( repoGroup );
-        
+
         String status = action.execute();
         assertEquals( Action.SUCCESS, status );
         assertEquals( Collections.singletonList( repoGroup ), configuration.getRepositoryGroups() );
@@ -146,12 +143,12 @@ public class DeleteRepositoryGroupActionTest
         configuration.addRepositoryGroup( repoGroup );
         return configuration;
     }
-    
+
     private RepositoryGroupConfiguration createRepositoryGroup()
     {
         RepositoryGroupConfiguration repoGroup = new RepositoryGroupConfiguration();
         repoGroup.setId( REPO_GROUP_ID );
-       
+
         return repoGroup;
     }
 }
index 1e27bd04f4dbbd1f054feb5456fb6ef045357187..dface6a7ce76a929b933b21fc644f33c14d50bf2 100644 (file)
@@ -23,9 +23,9 @@ import com.opensymphony.xwork2.Action;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 import org.apache.maven.archiva.configuration.Configuration;
 import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
+import org.apache.struts2.StrutsSpringTestCase;
 import org.codehaus.redback.integration.interceptor.SecureActionBundle;
 import org.codehaus.redback.integration.interceptor.SecureActionException;
-import org.codehaus.plexus.spring.PlexusInSpringTestCase;
 import org.easymock.MockControl;
 
 import java.util.Collections;
@@ -36,7 +36,7 @@ import java.util.Collections;
  * @version $Id$
  */
 public class EditRemoteRepositoryActionTest
-    extends PlexusInSpringTestCase
+    extends StrutsSpringTestCase
 {
     private static final String REPO_ID = "remote-repo-ident";
 
@@ -46,6 +46,12 @@ public class EditRemoteRepositoryActionTest
 
     private ArchivaConfiguration archivaConfiguration;
 
+    @Override
+    protected String[] getContextLocations()
+    {
+        return new String[]{ "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" };
+    }
+
     public void testEditRemoteRepository()
         throws Exception
     {
@@ -147,7 +153,9 @@ public class EditRemoteRepositoryActionTest
     {
         super.setUp();
 
-        action = (EditRemoteRepositoryAction) lookup( Action.class.getName(), "editRemoteRepositoryAction" );
+        //action = (EditRemoteRepositoryAction) lookup( Action.class.getName(), "editRemoteRepositoryAction" );
+
+        action = (EditRemoteRepositoryAction) getActionProxy( "editRemoteRepository" ).getAction();
 
         archivaConfigurationControl = MockControl.createControl( ArchivaConfiguration.class );
         archivaConfiguration = (ArchivaConfiguration) archivaConfigurationControl.getMock();
index c339e1f26ad5ea588dfb9ba8bfc989f110fdabb9..3e8f28b84756a41bdbcd0c0368d5300348fb15a0 100644 (file)
@@ -19,9 +19,9 @@ package org.apache.maven.archiva.web.action.admin.repositories;
  * under the License.
  */
 
-import java.util.Collections;
-import java.util.List;
-
+import com.meterware.servletunit.ServletRunner;
+import com.meterware.servletunit.ServletUnitClient;
+import com.opensymphony.xwork2.Action;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 import org.apache.maven.archiva.configuration.Configuration;
 import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
@@ -29,12 +29,10 @@ import org.apache.maven.archiva.configuration.RepositoryGroupConfiguration;
 import org.apache.maven.archiva.web.action.AbstractActionTestCase;
 import org.codehaus.redback.integration.interceptor.SecureActionBundle;
 import org.codehaus.redback.integration.interceptor.SecureActionException;
-import org.codehaus.plexus.spring.PlexusInSpringTestCase;
 import org.easymock.MockControl;
 
-import com.meterware.servletunit.ServletRunner;
-import com.meterware.servletunit.ServletUnitClient;
-import com.opensymphony.xwork2.Action;
+import java.util.Collections;
+import java.util.List;
 
 /**
  * RepositoryGroupsActionTest
@@ -61,7 +59,8 @@ public class RepositoryGroupsActionTest
     {
         super.setUp();
        
-        action = (RepositoryGroupsAction) lookup( Action.class.getName(), "repositoryGroupsAction" );
+        //action = (RepositoryGroupsAction) lookup( Action.class.getName(), "repositoryGroupsAction" );
+        action = (RepositoryGroupsAction) getActionProxy( "/admin/repositoryGroups" );
            
         archivaConfigurationControl = MockControl.createControl( ArchivaConfiguration.class );
         archivaConfiguration = (ArchivaConfiguration) archivaConfigurationControl.getMock();
index 99a6afc69ba29b821af703cb0c7fa173d8ee3de9..e53a8be0b2437977ec9aa02f4fb389e71ef642a8 100644 (file)
@@ -1,15 +1,14 @@
 package org.apache.maven.archiva.web.action.admin.scanning;
 
-import java.util.ArrayList;
-import java.util.List;
-
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 import org.apache.maven.archiva.configuration.Configuration;
 import org.apache.maven.archiva.configuration.RepositoryScanningConfiguration;
 import org.apache.maven.archiva.web.action.AbstractActionTestCase;
-import org.codehaus.plexus.spring.PlexusInSpringTestCase;
 import org.easymock.MockControl;
 
+import java.util.ArrayList;
+import java.util.List;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
index d19c24c9db83515e21092c6f5a4d5c0976fab9d3..6eb06565d62430f7eb830a434dea193417f498f4 100644 (file)
@@ -23,7 +23,6 @@ import com.opensymphony.xwork2.Action;
 import org.apache.archiva.metadata.model.MetadataFacet;
 import org.apache.archiva.metadata.repository.MetadataRepository;
 import org.apache.archiva.metadata.repository.RepositorySession;
-import org.apache.archiva.metadata.repository.RepositorySessionFactory;
 import org.apache.archiva.metadata.repository.memory.TestRepositorySessionFactory;
 import org.apache.archiva.metadata.repository.stats.RepositoryStatistics;
 import org.apache.archiva.metadata.repository.stats.RepositoryStatisticsManager;
@@ -74,16 +73,9 @@ public class GenerateReportActionTest
     {
         super.setUp();
 
-        try
-        {
-            action = (GenerateReportAction) lookup( Action.class, "generateReport" );
-        }
-        catch ( Exception e )
-        {
-            // clean up cache - TODO: move handling to plexus-spring
-            applicationContext.close();
-            throw e;
-        }
+        //action = (GenerateReportAction) lookup( Action.class, "generateReport" );
+
+        action = (GenerateReportAction) getActionProxy( "/admin/generateReport" ).getAction();
 
         repositoryStatisticsManagerControl = MockControl.createControl( RepositoryStatisticsManager.class );
         repositoryStatisticsManager = (RepositoryStatisticsManager) repositoryStatisticsManagerControl.getMock();
@@ -95,7 +87,9 @@ public class GenerateReportActionTest
         RepositorySession repositorySession = mock( RepositorySession.class );
         when( repositorySession.getRepository() ).thenReturn( metadataRepository );
 
-        TestRepositorySessionFactory factory = (TestRepositorySessionFactory) lookup( RepositorySessionFactory.class );
+        //TestRepositorySessionFactory factory = (TestRepositorySessionFactory) lookup( RepositorySessionFactory.class );
+
+        TestRepositorySessionFactory factory = new TestRepositorySessionFactory();
         factory.setRepositorySession( repositorySession );
     }
 
@@ -189,8 +183,9 @@ public class GenerateReportActionTest
     public void testGenerateStatisticsSingleRepo()
         throws Exception
     {
-        repositoryStatisticsManagerControl.expectAndReturn( repositoryStatisticsManager.getStatisticsInRange(
-            metadataRepository, INTERNAL, null, null ), Collections.singletonList( createDefaultStats() ) );
+        repositoryStatisticsManagerControl.expectAndReturn(
+            repositoryStatisticsManager.getStatisticsInRange( metadataRepository, INTERNAL, null, null ),
+            Collections.singletonList( createDefaultStats() ) );
 
         repositoryStatisticsManagerControl.replay();
         prepareAction( Collections.singletonList( INTERNAL ), Collections.singletonList( SNAPSHOTS ) );
@@ -204,8 +199,9 @@ public class GenerateReportActionTest
         throws Exception
 
     {
-        repositoryStatisticsManagerControl.expectAndReturn( repositoryStatisticsManager.getStatisticsInRange(
-            metadataRepository, INTERNAL, null, null ), Collections.<Object>emptyList() );
+        repositoryStatisticsManagerControl.expectAndReturn(
+            repositoryStatisticsManager.getStatisticsInRange( metadataRepository, INTERNAL, null, null ),
+            Collections.<Object>emptyList() );
         repositoryStatisticsManagerControl.replay();
         prepareAction( Collections.singletonList( INTERNAL ), Collections.singletonList( SNAPSHOTS ) );
 
@@ -220,8 +216,9 @@ public class GenerateReportActionTest
         throws Exception
 
     {
-        repositoryStatisticsManagerControl.expectAndReturn( repositoryStatisticsManager.getStatisticsInRange(
-            metadataRepository, INTERNAL, null, null ), Collections.singletonList( createDefaultStats() ) );
+        repositoryStatisticsManagerControl.expectAndReturn(
+            repositoryStatisticsManager.getStatisticsInRange( metadataRepository, INTERNAL, null, null ),
+            Collections.singletonList( createDefaultStats() ) );
         repositoryStatisticsManagerControl.replay();
         action.setPage( 2 );
         prepareAction( Collections.singletonList( INTERNAL ), Collections.singletonList( SNAPSHOTS ) );
@@ -236,10 +233,12 @@ public class GenerateReportActionTest
         throws Exception
 
     {
-        repositoryStatisticsManagerControl.expectAndReturn( repositoryStatisticsManager.getStatisticsInRange(
-            metadataRepository, SNAPSHOTS, null, null ), Collections.<Object>emptyList() );
-        repositoryStatisticsManagerControl.expectAndReturn( repositoryStatisticsManager.getStatisticsInRange(
-            metadataRepository, INTERNAL, null, null ), Collections.<Object>emptyList() );
+        repositoryStatisticsManagerControl.expectAndReturn(
+            repositoryStatisticsManager.getStatisticsInRange( metadataRepository, SNAPSHOTS, null, null ),
+            Collections.<Object>emptyList() );
+        repositoryStatisticsManagerControl.expectAndReturn(
+            repositoryStatisticsManager.getStatisticsInRange( metadataRepository, INTERNAL, null, null ),
+            Collections.<Object>emptyList() );
         repositoryStatisticsManagerControl.replay();
         prepareAction( Arrays.asList( SNAPSHOTS, INTERNAL ), Collections.<String>emptyList() );
 
@@ -256,10 +255,12 @@ public class GenerateReportActionTest
         throws Exception
 
     {
-        repositoryStatisticsManagerControl.expectAndReturn( repositoryStatisticsManager.getStatisticsInRange(
-            metadataRepository, SNAPSHOTS, null, null ), Collections.singletonList( createDefaultStats() ) );
-        repositoryStatisticsManagerControl.expectAndReturn( repositoryStatisticsManager.getStatisticsInRange(
-            metadataRepository, INTERNAL, null, null ), Collections.singletonList( createDefaultStats() ) );
+        repositoryStatisticsManagerControl.expectAndReturn(
+            repositoryStatisticsManager.getStatisticsInRange( metadataRepository, SNAPSHOTS, null, null ),
+            Collections.singletonList( createDefaultStats() ) );
+        repositoryStatisticsManagerControl.expectAndReturn(
+            repositoryStatisticsManager.getStatisticsInRange( metadataRepository, INTERNAL, null, null ),
+            Collections.singletonList( createDefaultStats() ) );
 
         repositoryStatisticsManagerControl.replay();
         prepareAction( Arrays.asList( SNAPSHOTS, INTERNAL ), Collections.<String>emptyList() );
@@ -273,8 +274,9 @@ public class GenerateReportActionTest
         throws Exception
     {
         Date date = new Date();
-        repositoryStatisticsManagerControl.expectAndReturn( repositoryStatisticsManager.getStatisticsInRange(
-            metadataRepository, SNAPSHOTS, null, null ), Collections.singletonList( createStats( date ) ) );
+        repositoryStatisticsManagerControl.expectAndReturn(
+            repositoryStatisticsManager.getStatisticsInRange( metadataRepository, SNAPSHOTS, null, null ),
+            Collections.singletonList( createStats( date ) ) );
         repositoryStatisticsManagerControl.replay();
 
         prepareAction( Arrays.asList( SNAPSHOTS ), Arrays.asList( INTERNAL ) );
@@ -285,18 +287,20 @@ public class GenerateReportActionTest
         assertFalse( action.hasFieldErrors() );
 
         assertEquals(
-            "Date of Scan,Total File Count,Total Size,Artifact Count,Group Count,Project Count,Plugins,Archetypes,Jars,Wars\n" +
-                date + ",0,0,0,0,0,0,0,0,0\n", IOUtils.toString( action.getInputStream() ) );
+            "Date of Scan,Total File Count,Total Size,Artifact Count,Group Count,Project Count,Plugins,Archetypes,Jars,Wars\n"
+                date + ",0,0,0,0,0,0,0,0,0\n", IOUtils.toString( action.getInputStream() ) );
         repositoryStatisticsManagerControl.verify();
     }
 
     public void testDownloadStatisticsMultipleRepos()
         throws Exception
     {
-        repositoryStatisticsManagerControl.expectAndReturn( repositoryStatisticsManager.getStatisticsInRange(
-            metadataRepository, SNAPSHOTS, null, null ), Collections.singletonList( createDefaultStats() ) );
-        repositoryStatisticsManagerControl.expectAndReturn( repositoryStatisticsManager.getStatisticsInRange(
-            metadataRepository, INTERNAL, null, null ), Collections.singletonList( createDefaultStats() ) );
+        repositoryStatisticsManagerControl.expectAndReturn(
+            repositoryStatisticsManager.getStatisticsInRange( metadataRepository, SNAPSHOTS, null, null ),
+            Collections.singletonList( createDefaultStats() ) );
+        repositoryStatisticsManagerControl.expectAndReturn(
+            repositoryStatisticsManager.getStatisticsInRange( metadataRepository, INTERNAL, null, null ),
+            Collections.singletonList( createDefaultStats() ) );
         repositoryStatisticsManagerControl.replay();
         prepareAction( Arrays.asList( SNAPSHOTS, INTERNAL ), Collections.<String>emptyList() );
 
@@ -367,8 +371,9 @@ public class GenerateReportActionTest
         throws Exception
 
     {
-        repositoryStatisticsManagerControl.expectAndReturn( repositoryStatisticsManager.getStatisticsInRange(
-            metadataRepository, INTERNAL, null, null ), Collections.<Object>emptyList() );
+        repositoryStatisticsManagerControl.expectAndReturn(
+            repositoryStatisticsManager.getStatisticsInRange( metadataRepository, INTERNAL, null, null ),
+            Collections.<Object>emptyList() );
         repositoryStatisticsManagerControl.replay();
         prepareAction( Collections.singletonList( INTERNAL ), Collections.singletonList( SNAPSHOTS ) );
 
@@ -393,10 +398,12 @@ public class GenerateReportActionTest
         throws Exception
 
     {
-        repositoryStatisticsManagerControl.expectAndReturn( repositoryStatisticsManager.getStatisticsInRange(
-            metadataRepository, SNAPSHOTS, null, null ), Collections.<Object>emptyList() );
-        repositoryStatisticsManagerControl.expectAndReturn( repositoryStatisticsManager.getStatisticsInRange(
-            metadataRepository, INTERNAL, null, null ), Collections.<Object>emptyList() );
+        repositoryStatisticsManagerControl.expectAndReturn(
+            repositoryStatisticsManager.getStatisticsInRange( metadataRepository, SNAPSHOTS, null, null ),
+            Collections.<Object>emptyList() );
+        repositoryStatisticsManagerControl.expectAndReturn(
+            repositoryStatisticsManager.getStatisticsInRange( metadataRepository, INTERNAL, null, null ),
+            Collections.<Object>emptyList() );
         repositoryStatisticsManagerControl.replay();
         prepareAction( Arrays.asList( SNAPSHOTS, INTERNAL ), Collections.<String>emptyList() );
 
@@ -411,10 +418,12 @@ public class GenerateReportActionTest
     public void testDownloadStatisticsMultipleRepoInStrutsFormat()
         throws Exception
     {
-        repositoryStatisticsManagerControl.expectAndReturn( repositoryStatisticsManager.getStatisticsInRange(
-            metadataRepository, SNAPSHOTS, null, null ), Collections.singletonList( createDefaultStats() ) );
-        repositoryStatisticsManagerControl.expectAndReturn( repositoryStatisticsManager.getStatisticsInRange(
-            metadataRepository, INTERNAL, null, null ), Collections.singletonList( createDefaultStats() ) );
+        repositoryStatisticsManagerControl.expectAndReturn(
+            repositoryStatisticsManager.getStatisticsInRange( metadataRepository, SNAPSHOTS, null, null ),
+            Collections.singletonList( createDefaultStats() ) );
+        repositoryStatisticsManagerControl.expectAndReturn(
+            repositoryStatisticsManager.getStatisticsInRange( metadataRepository, INTERNAL, null, null ),
+            Collections.singletonList( createDefaultStats() ) );
         repositoryStatisticsManagerControl.replay();
         prepareAction( Arrays.asList( SNAPSHOTS, INTERNAL ), Collections.<String>emptyList() );
 
@@ -434,17 +443,15 @@ public class GenerateReportActionTest
         RepositoryProblemFacet problem1 = createProblem( GROUP_ID, "artifactId", INTERNAL );
         RepositoryProblemFacet problem2 = createProblem( GROUP_ID, "artifactId-2", INTERNAL );
 
-        metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( INTERNAL,
-                                                                                         RepositoryProblemFacet.FACET_ID ),
-                                                   Arrays.asList( problem1.getName(), problem2.getName() ) );
-        metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( INTERNAL,
-                                                                                        RepositoryProblemFacet.FACET_ID,
-                                                                                        problem1.getName() ),
-                                                   problem1 );
-        metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( INTERNAL,
-                                                                                        RepositoryProblemFacet.FACET_ID,
-                                                                                        problem2.getName() ),
-                                                   problem2 );
+        metadataRepositoryControl.expectAndReturn(
+            metadataRepository.getMetadataFacets( INTERNAL, RepositoryProblemFacet.FACET_ID ),
+            Arrays.asList( problem1.getName(), problem2.getName() ) );
+        metadataRepositoryControl.expectAndReturn(
+            metadataRepository.getMetadataFacet( INTERNAL, RepositoryProblemFacet.FACET_ID, problem1.getName() ),
+            problem1 );
+        metadataRepositoryControl.expectAndReturn(
+            metadataRepository.getMetadataFacet( INTERNAL, RepositoryProblemFacet.FACET_ID, problem2.getName() ),
+            problem2 );
         metadataRepositoryControl.replay();
 
         action.setRepositoryId( INTERNAL );
@@ -483,20 +490,18 @@ public class GenerateReportActionTest
     {
         RepositoryProblemFacet problem1 = createProblem( GROUP_ID, "artifactId", INTERNAL );
         RepositoryProblemFacet problem2 = createProblem( GROUP_ID, "artifactId-2", SNAPSHOTS );
-        metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( INTERNAL,
-                                                                                         RepositoryProblemFacet.FACET_ID ),
-                                                   Arrays.asList( problem1.getName() ) );
-        metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( SNAPSHOTS,
-                                                                                         RepositoryProblemFacet.FACET_ID ),
-                                                   Arrays.asList( problem2.getName() ) );
-        metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( INTERNAL,
-                                                                                        RepositoryProblemFacet.FACET_ID,
-                                                                                        problem1.getName() ),
-                                                   problem1 );
-        metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( SNAPSHOTS,
-                                                                                        RepositoryProblemFacet.FACET_ID,
-                                                                                        problem2.getName() ),
-                                                   problem2 );
+        metadataRepositoryControl.expectAndReturn(
+            metadataRepository.getMetadataFacets( INTERNAL, RepositoryProblemFacet.FACET_ID ),
+            Arrays.asList( problem1.getName() ) );
+        metadataRepositoryControl.expectAndReturn(
+            metadataRepository.getMetadataFacets( SNAPSHOTS, RepositoryProblemFacet.FACET_ID ),
+            Arrays.asList( problem2.getName() ) );
+        metadataRepositoryControl.expectAndReturn(
+            metadataRepository.getMetadataFacet( INTERNAL, RepositoryProblemFacet.FACET_ID, problem1.getName() ),
+            problem1 );
+        metadataRepositoryControl.expectAndReturn(
+            metadataRepository.getMetadataFacet( SNAPSHOTS, RepositoryProblemFacet.FACET_ID, problem2.getName() ),
+            problem2 );
         metadataRepositoryControl.replay();
 
         action.setRepositoryId( GenerateReportAction.ALL_REPOSITORIES );
@@ -506,8 +511,8 @@ public class GenerateReportActionTest
         String result = action.execute();
         assertSuccessResult( result );
 
-        assertEquals( Arrays.asList( INTERNAL, SNAPSHOTS ), new ArrayList<String>(
-            action.getRepositoriesMap().keySet() ) );
+        assertEquals( Arrays.asList( INTERNAL, SNAPSHOTS ),
+                      new ArrayList<String>( action.getRepositoriesMap().keySet() ) );
         assertEquals( Arrays.asList( problem1 ), action.getRepositoriesMap().get( INTERNAL ) );
         assertEquals( Arrays.asList( problem2 ), action.getRepositoriesMap().get( SNAPSHOTS ) );
 
@@ -519,17 +524,15 @@ public class GenerateReportActionTest
     {
         RepositoryProblemFacet problem1 = createProblem( GROUP_ID, "artifactId", INTERNAL );
         RepositoryProblemFacet problem2 = createProblem( GROUP_ID, "artifactId-2", INTERNAL );
-        metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( INTERNAL,
-                                                                                         RepositoryProblemFacet.FACET_ID ),
-                                                   Arrays.asList( problem1.getName(), problem2.getName() ) );
-        metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( INTERNAL,
-                                                                                        RepositoryProblemFacet.FACET_ID,
-                                                                                        problem1.getName() ),
-                                                   problem1 );
-        metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( INTERNAL,
-                                                                                        RepositoryProblemFacet.FACET_ID,
-                                                                                        problem2.getName() ),
-                                                   problem2 );
+        metadataRepositoryControl.expectAndReturn(
+            metadataRepository.getMetadataFacets( INTERNAL, RepositoryProblemFacet.FACET_ID ),
+            Arrays.asList( problem1.getName(), problem2.getName() ) );
+        metadataRepositoryControl.expectAndReturn(
+            metadataRepository.getMetadataFacet( INTERNAL, RepositoryProblemFacet.FACET_ID, problem1.getName() ),
+            problem1 );
+        metadataRepositoryControl.expectAndReturn(
+            metadataRepository.getMetadataFacet( INTERNAL, RepositoryProblemFacet.FACET_ID, problem2.getName() ),
+            problem2 );
         metadataRepositoryControl.replay();
 
         action.setGroupId( GROUP_ID );
@@ -551,20 +554,18 @@ public class GenerateReportActionTest
     {
         RepositoryProblemFacet problem1 = createProblem( GROUP_ID, "artifactId", INTERNAL );
         RepositoryProblemFacet problem2 = createProblem( GROUP_ID, "artifactId-2", SNAPSHOTS );
-        metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( INTERNAL,
-                                                                                         RepositoryProblemFacet.FACET_ID ),
-                                                   Arrays.asList( problem1.getName() ) );
-        metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( SNAPSHOTS,
-                                                                                         RepositoryProblemFacet.FACET_ID ),
-                                                   Arrays.asList( problem2.getName() ) );
-        metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( INTERNAL,
-                                                                                        RepositoryProblemFacet.FACET_ID,
-                                                                                        problem1.getName() ),
-                                                   problem1 );
-        metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( SNAPSHOTS,
-                                                                                        RepositoryProblemFacet.FACET_ID,
-                                                                                        problem2.getName() ),
-                                                   problem2 );
+        metadataRepositoryControl.expectAndReturn(
+            metadataRepository.getMetadataFacets( INTERNAL, RepositoryProblemFacet.FACET_ID ),
+            Arrays.asList( problem1.getName() ) );
+        metadataRepositoryControl.expectAndReturn(
+            metadataRepository.getMetadataFacets( SNAPSHOTS, RepositoryProblemFacet.FACET_ID ),
+            Arrays.asList( problem2.getName() ) );
+        metadataRepositoryControl.expectAndReturn(
+            metadataRepository.getMetadataFacet( INTERNAL, RepositoryProblemFacet.FACET_ID, problem1.getName() ),
+            problem1 );
+        metadataRepositoryControl.expectAndReturn(
+            metadataRepository.getMetadataFacet( SNAPSHOTS, RepositoryProblemFacet.FACET_ID, problem2.getName() ),
+            problem2 );
         metadataRepositoryControl.replay();
 
         action.setGroupId( GROUP_ID );
@@ -575,8 +576,8 @@ public class GenerateReportActionTest
         String result = action.execute();
         assertSuccessResult( result );
 
-        assertEquals( Arrays.asList( INTERNAL, SNAPSHOTS ), new ArrayList<String>(
-            action.getRepositoriesMap().keySet() ) );
+        assertEquals( Arrays.asList( INTERNAL, SNAPSHOTS ),
+                      new ArrayList<String>( action.getRepositoriesMap().keySet() ) );
         assertEquals( Arrays.asList( problem1 ), action.getRepositoriesMap().get( INTERNAL ) );
         assertEquals( Arrays.asList( problem2 ), action.getRepositoriesMap().get( SNAPSHOTS ) );
 
@@ -586,9 +587,9 @@ public class GenerateReportActionTest
     public void testHealthReportSingleRepoByIncorrectGroupId()
         throws Exception
     {
-        metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( INTERNAL,
-                                                                                         RepositoryProblemFacet.FACET_ID ),
-                                                   Collections.<MetadataFacet>emptyList() );
+        metadataRepositoryControl.expectAndReturn(
+            metadataRepository.getMetadataFacets( INTERNAL, RepositoryProblemFacet.FACET_ID ),
+            Collections.<MetadataFacet>emptyList() );
         metadataRepositoryControl.replay();
 
         action.setGroupId( "not.it" );
@@ -608,9 +609,9 @@ public class GenerateReportActionTest
         throws IOException
     {
         assertEquals(
-            "Repository,Total File Count,Total Size,Artifact Count,Group Count,Project Count,Plugins,Archetypes,Jars,Wars\n" +
-                "snapshots,0,0,0,0,0,0,0,0,0\n" + "internal,0,0,0,0,0,0,0,0,0\n", IOUtils.toString(
-            action.getInputStream() ) );
+            "Repository,Total File Count,Total Size,Artifact Count,Group Count,Project Count,Plugins,Archetypes,Jars,Wars\n"
+                + "snapshots,0,0,0,0,0,0,0,0,0\n" + "internal,0,0,0,0,0,0,0,0,0\n",
+            IOUtils.toString( action.getInputStream() ) );
     }
 
     private RepositoryProblemFacet createProblem( String groupId, String artifactId, String repoId )
index 4eae4ba24df48af1f49265ac9586b3ef202844aa..f38236274105fa24d5841d6043e591e478a42b42 100644 (file)
           <linksource>true</linksource>
           <show>private</show>
           <tags>
-            <tag>
-              <name>plexus.component</name>
-              <placement>t</placement>
-              <head>Component definition:</head>
-            </tag>
-            <tag>
-              <name>plexus.configuration</name>
-              <placement>f</placement>
-              <head>Configuration:</head>
-            </tag>
-            <tag>
-              <name>plexus.requirement</name>
-              <placement>f</placement>
-              <head>Requirement:</head>
-            </tag>
             <tag>
               <name>todo</name>
               <placement>a</placement>
diff --git a/pom.xml b/pom.xml
index a902ef05747b67956b029cca56c11f4923b95b74..58a3647a3f825058e39d9d25cf20a479c7b0e58e 100644 (file)
--- a/pom.xml
+++ b/pom.xml
           </execution>
         </executions>
       </plugin>
-      <plugin>
-        <groupId>org.codehaus.plexus</groupId>
-        <artifactId>plexus-component-metadata</artifactId>
-        <version>1.0-beta-3.0.5</version>
-        <executions>
-          <execution>
-            <id>generate</id>
-            <phase>generate-resources</phase>
-            <goals>
-              <goal>generate-metadata</goal>
-            </goals>
-          </execution>
-        </executions>
-      </plugin>
     </plugins>
     <pluginManagement>
       <plugins>