* 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" )
* 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" )
/**
* 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" )
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;
* under the License.
*/
+import java.io.File;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
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;
+ }
}
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;
import static org.mockito.Mockito.when;
public class DeleteArtifactActionTest
- extends PlexusInSpringTestCase
+ extends StrutsSpringTestCase
{
private DeleteArtifactAction action;
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()
{
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 );
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 );
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;
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 );
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();
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();
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();
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;
public void testInstantiation()
{
- assertFalse( action == lookup( Action.class, ACTION_HINT ) );
+ assertFalse( action == getActionProxy( "/showArtifact" ).getAction() );
}
public void testGetArtifactUniqueRelease()
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 );
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 );
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;
/**
*/
-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
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();
* 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 = "";
private ActionValidatorManager actionValidatorManager;
@Override
- public void setUp() throws Exception
+ public void setUp()
+ throws Exception
{
super.setUp();
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();
// 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();
// 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();
// 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();
}
}
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();
}
}
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
{
// 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()
assertTrue( bundle.requiresAuthentication() );
assertEquals( 1, bundle.getAuthorizationTuples().size() );
}
-
+
public void testConfirmEnable()
throws Exception
{
assertEquals( Action.INPUT, status );
assertNoErrors( action );
}
-
+
private Configuration createInitialConfiguration()
{
Configuration config = new Configuration();
ProxyConnectorConfiguration connector = new ProxyConnectorConfiguration();
connector.setSourceRepoId( TEST_SOURCE_ID );
connector.setTargetRepoId( TEST_TARGET_ID );
-
- connector.setDisabled(false);
+
+ connector.setDisabled( false );
config.addProxyConnector( connector );
{
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();
{
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();
*/
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;
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$
*/
String status = action.sortDown();
assertEquals( Action.SUCCESS, status );
- assertOrder( new String[] { JAVAX, CENTRAL, CODEHAUS } );
+ assertOrder( new String[]{ JAVAX, CENTRAL, CODEHAUS } );
}
public void testSortDownPastEnd()
assertEquals( Action.SUCCESS, status );
// No order change.
- assertOrder( new String[] { CENTRAL, JAVAX, CODEHAUS } );
+ assertOrder( new String[]{ CENTRAL, JAVAX, CODEHAUS } );
}
public void testSortUp()
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();
assertEquals( Action.SUCCESS, status );
// No order change.
- assertOrder( new String[] { CENTRAL, JAVAX, CODEHAUS } );
+ assertOrder( new String[]{ CENTRAL, JAVAX, CODEHAUS } );
}
private void assertOrder( String[] targetRepoOrder )
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() );
{
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();
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$
*/
{
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();
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 );
configuration.addRemoteRepository( repositoryConfiguration );
return configuration;
}
-
+
private RemoteRepositoryConfiguration createRepository()
{
RemoteRepositoryConfiguration r = new RemoteRepositoryConfiguration();
populateRepository( r );
return r;
}
-
+
private void assertRepositoryEquals( RemoteRepositoryConfiguration expectedRepository,
RemoteRepositoryConfiguration actualRepository )
{
assertEquals( expectedRepository.getUrl(), actualRepository.getUrl() );
assertEquals( expectedRepository.getName(), actualRepository.getName() );
}
-
+
private ManagedRepositoryConfiguration createManagedRepository( String string, String testPath )
{
ManagedRepositoryConfiguration r = new ManagedRepositoryConfiguration();
repository.setUrl( "url" );
repository.setLayout( "default" );
}
-
+
// TODO: what about removing proxied content if a proxy is removed?
}
* 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";
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() );
{
RepositoryGroupConfiguration origRepoGroup = createRepositoryGroup();
Configuration configuration = createConfigurationForEditing( origRepoGroup );
-
+
archivaConfiguration.getConfiguration();
archivaConfigurationControl.setReturnValue( configuration );
archivaConfigurationControl.replay();
-
+
action.setRepoGroupId( REPO_GROUP_ID );
action.prepare();
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() );
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() );
configuration.addRepositoryGroup( repoGroup );
return configuration;
}
-
+
private RepositoryGroupConfiguration createRepositoryGroup()
{
RepositoryGroupConfiguration repoGroup = new RepositoryGroupConfiguration();
repoGroup.setId( REPO_GROUP_ID );
-
+
return repoGroup;
}
}
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;
* @version $Id$
*/
public class EditRemoteRepositoryActionTest
- extends PlexusInSpringTestCase
+ extends StrutsSpringTestCase
{
private static final String REPO_ID = "remote-repo-ident";
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
{
{
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();
* 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;
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
{
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();
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
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;
{
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();
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 );
}
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 ) );
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 ) );
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 ) );
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() );
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() );
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 ) );
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() );
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 ) );
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() );
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() );
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 );
{
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 );
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 ) );
{
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 );
{
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 );
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 ) );
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" );
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 )
<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>
</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>