import org.apache.archiva.metadata.model.ProjectVersionReference;
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.TestMetadataResolver;
import org.apache.archiva.metadata.repository.memory.TestRepositorySessionFactory;
import org.apache.archiva.metadata.repository.storage.maven2.MavenArtifactFacet;
private ShowArtifactAction action;
- private static final List<ArtifactMetadata> TEST_SNAPSHOT_ARTIFACTS = Arrays.asList( createArtifact(
- TEST_TS_SNAPSHOT_VERSION ), createArtifact( "1.0-20091120.222222-2", "20091120.222222", 2 ), createArtifact(
- "1.0-20091123.333333-3", "20091123.333333", 3 ) );
+ private static final List<ArtifactMetadata> TEST_SNAPSHOT_ARTIFACTS =
+ Arrays.asList( createArtifact( TEST_TS_SNAPSHOT_VERSION ),
+ createArtifact( "1.0-20091120.222222-2", "20091120.222222", 2 ),
+ createArtifact( "1.0-20091123.333333-3", "20091123.333333", 3 ) );
private static final long TEST_SIZE = 12345L;
public void testGetArtifactUniqueRelease()
{
- metadataResolver.setProjectVersion( TEST_REPO, TEST_GROUP_ID, TEST_ARTIFACT_ID, createProjectModel(
- TEST_VERSION ) );
+ metadataResolver.setProjectVersion( TEST_REPO, TEST_GROUP_ID, TEST_ARTIFACT_ID,
+ createProjectModel( TEST_VERSION ) );
setActionParameters();
public void testGetArtifactUniqueSnapshot()
{
- metadataResolver.setProjectVersion( TEST_REPO, TEST_GROUP_ID, TEST_ARTIFACT_ID, createProjectModel(
- TEST_SNAPSHOT_VERSION ) );
+ metadataResolver.setProjectVersion( TEST_REPO, TEST_GROUP_ID, TEST_ARTIFACT_ID,
+ createProjectModel( TEST_SNAPSHOT_VERSION ) );
metadataResolver.setArtifacts( TEST_REPO, TEST_GROUP_ID, TEST_ARTIFACT_ID, TEST_SNAPSHOT_VERSION,
TEST_SNAPSHOT_ARTIFACTS );
public void testGetArtifactUniqueSnapshotTimestamped()
{
- metadataResolver.setProjectVersion( TEST_REPO, TEST_GROUP_ID, TEST_ARTIFACT_ID, createProjectModel(
- TEST_SNAPSHOT_VERSION ) );
+ metadataResolver.setProjectVersion( TEST_REPO, TEST_GROUP_ID, TEST_ARTIFACT_ID,
+ createProjectModel( TEST_SNAPSHOT_VERSION ) );
metadataResolver.setArtifacts( TEST_REPO, TEST_GROUP_ID, TEST_ARTIFACT_ID, TEST_SNAPSHOT_VERSION,
TEST_SNAPSHOT_ARTIFACTS );
public void testGetArtifactNotInObservableRepos()
{
- metadataResolver.setProjectVersion( OTHER_TEST_REPO, TEST_GROUP_ID, TEST_ARTIFACT_ID, createProjectModel(
- TEST_VERSION ) );
+ metadataResolver.setProjectVersion( OTHER_TEST_REPO, TEST_GROUP_ID, TEST_ARTIFACT_ID,
+ createProjectModel( TEST_VERSION ) );
setActionParameters();
public void testGetArtifactOnlySeenInSecondObservableRepo()
{
setObservableRepos( Arrays.asList( OTHER_TEST_REPO, TEST_REPO ) );
- metadataResolver.setProjectVersion( TEST_REPO, TEST_GROUP_ID, TEST_ARTIFACT_ID, createProjectModel(
- TEST_VERSION ) );
+ metadataResolver.setProjectVersion( TEST_REPO, TEST_GROUP_ID, TEST_ARTIFACT_ID,
+ createProjectModel( TEST_VERSION ) );
setActionParameters();
public void testGetArtifactSeenInBothObservableRepo()
{
setObservableRepos( Arrays.asList( TEST_REPO, OTHER_TEST_REPO ) );
- metadataResolver.setProjectVersion( TEST_REPO, TEST_GROUP_ID, TEST_ARTIFACT_ID, createProjectModel(
- TEST_VERSION ) );
- metadataResolver.setProjectVersion( OTHER_TEST_REPO, TEST_GROUP_ID, TEST_ARTIFACT_ID, createProjectModel(
- TEST_VERSION ) );
+ metadataResolver.setProjectVersion( TEST_REPO, TEST_GROUP_ID, TEST_ARTIFACT_ID,
+ createProjectModel( TEST_VERSION ) );
+ metadataResolver.setProjectVersion( OTHER_TEST_REPO, TEST_GROUP_ID, TEST_ARTIFACT_ID,
+ createProjectModel( TEST_VERSION ) );
setActionParameters();
public void testGetArtifactCanOnlyObserveInOneOfTwoRepos()
{
setObservableRepos( Arrays.asList( TEST_REPO ) );
- metadataResolver.setProjectVersion( OTHER_TEST_REPO, TEST_GROUP_ID, TEST_ARTIFACT_ID, createProjectModel(
- TEST_VERSION ) );
- metadataResolver.setProjectVersion( TEST_REPO, TEST_GROUP_ID, TEST_ARTIFACT_ID, createProjectModel(
- TEST_VERSION ) );
+ metadataResolver.setProjectVersion( OTHER_TEST_REPO, TEST_GROUP_ID, TEST_ARTIFACT_ID,
+ createProjectModel( TEST_VERSION ) );
+ metadataResolver.setProjectVersion( TEST_REPO, TEST_GROUP_ID, TEST_ARTIFACT_ID,
+ createProjectModel( TEST_VERSION ) );
setActionParameters();
metadataResolver.setProjectVersion( TEST_REPO, TEST_GROUP_ID, TEST_ARTIFACT_ID, versionMetadata );
ProjectVersionReference dependee1 = createReference( "artifactId1" );
ProjectVersionReference dependee2 = createReference( "artifactId2" );
- metadataResolver.setProjectReferences( TEST_REPO, TEST_GROUP_ID, TEST_ARTIFACT_ID, TEST_VERSION, Arrays.asList(
- dependee1, dependee2 ) );
+ metadataResolver.setProjectReferences( TEST_REPO, TEST_GROUP_ID, TEST_ARTIFACT_ID, TEST_VERSION,
+ Arrays.asList( dependee1, dependee2 ) );
setActionParameters();
assertEquals( artifact.getVersion(), actual.getVersion() );
assertEquals( TEST_TYPE, actual.getType() );
assertEquals( "12.06 K", actual.getSize() );
- assertEquals( artifact.getNamespace() + "/" + artifact.getProject() + "/" + TEST_SNAPSHOT_VERSION + "/" +
- artifact.getId(), actual.getPath() );
+ assertEquals( artifact.getNamespace() + "/" + artifact.getProject() + "/" + TEST_SNAPSHOT_VERSION + "/"
+ + artifact.getId(), actual.getPath() );
}
}
ml1.setSubscribeAddress( prefix + "-subscribe@" );
ml1.setUnsubscribeAddress( prefix + "-unsubscribe@" );
ml1.setMainArchiveUrl( prefix + "-archive-url" );
- ml1.setOtherArchives( Arrays.asList( "other-" + prefix + "-archive-url-1",
- "other-" + prefix + "-archive-url-2" ) );
+ ml1.setOtherArchives(
+ Arrays.asList( "other-" + prefix + "-archive-url-1", "other-" + prefix + "-archive-url-2" ) );
return ml1;
}
RepositorySession repositorySession = mock( RepositorySession.class );
when( repositorySession.getResolver() ).thenReturn( metadataResolver );
when( repositorySession.getRepository() ).thenReturn( repo );
- //TestRepositorySessionFactory repositorySessionFactory = (TestRepositorySessionFactory) lookup(
- // RepositorySessionFactory.class );
- TestRepositorySessionFactory repositorySessionFactory = new TestRepositorySessionFactory();
+ TestRepositorySessionFactory repositorySessionFactory =
+ applicationContext.getBean( "repositorySessionFactory#test", TestRepositorySessionFactory.class );
repositorySessionFactory.setRepositorySession( repositorySession );
RepositoryContentFactory factory = mock( RepositoryContentFactory.class );
+
action.setRepositoryFactory( factory );
ManagedRepositoryConfiguration config = new ManagedRepositoryConfiguration();
Configuration configuration = new Configuration();
configuration.addManagedRepository( config );
when( archivaConfig.getConfiguration() ).thenReturn( configuration );
+
+ when( factory.getArchivaConfiguration() ).thenReturn( archivaConfig );
+
}
}