mirror of https://github.com/apache/archiva.git
[MRM-1290] correct hardcoding in getDependees
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@885315 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
99f6382dd3
commit
9aabebcdf5
|
@ -36,11 +36,9 @@ import org.apache.maven.archiva.database.ArchivaDAO;
|
||||||
import org.apache.maven.archiva.database.ArchivaDatabaseException;
|
import org.apache.maven.archiva.database.ArchivaDatabaseException;
|
||||||
import org.apache.maven.archiva.database.ArtifactDAO;
|
import org.apache.maven.archiva.database.ArtifactDAO;
|
||||||
import org.apache.maven.archiva.database.ObjectNotFoundException;
|
import org.apache.maven.archiva.database.ObjectNotFoundException;
|
||||||
import org.apache.maven.archiva.database.ProjectModelDAO;
|
|
||||||
import org.apache.maven.archiva.database.browsing.BrowsingResults;
|
import org.apache.maven.archiva.database.browsing.BrowsingResults;
|
||||||
import org.apache.maven.archiva.database.browsing.RepositoryBrowsing;
|
import org.apache.maven.archiva.database.browsing.RepositoryBrowsing;
|
||||||
import org.apache.maven.archiva.database.constraints.ArtifactsByChecksumConstraint;
|
import org.apache.maven.archiva.database.constraints.ArtifactsByChecksumConstraint;
|
||||||
import org.apache.maven.archiva.database.constraints.ArtifactsRelatedConstraint;
|
|
||||||
import org.apache.maven.archiva.database.constraints.UniqueVersionConstraint;
|
import org.apache.maven.archiva.database.constraints.UniqueVersionConstraint;
|
||||||
import org.apache.maven.archiva.model.ArchivaArtifact;
|
import org.apache.maven.archiva.model.ArchivaArtifact;
|
||||||
import org.apache.maven.archiva.model.ArchivaProjectModel;
|
import org.apache.maven.archiva.model.ArchivaProjectModel;
|
||||||
|
@ -258,7 +256,7 @@ public class SearchServiceImpl
|
||||||
List<Artifact> artifacts = new ArrayList<Artifact>();
|
List<Artifact> artifacts = new ArrayList<Artifact>();
|
||||||
List<String> observableRepos = xmlRpcUserRepositories.getObservableRepositories();
|
List<String> observableRepos = xmlRpcUserRepositories.getObservableRepositories();
|
||||||
|
|
||||||
List<ArchivaProjectModel> dependees = repoBrowsing.getUsedBy( "", observableRepos, "org.apache.archiva", "archiva-test", "1.0" );
|
List<ArchivaProjectModel> dependees = repoBrowsing.getUsedBy( "", observableRepos, groupId, artifactId, version );
|
||||||
for( ArchivaProjectModel model : dependees )
|
for( ArchivaProjectModel model : dependees )
|
||||||
{
|
{
|
||||||
Artifact artifact =
|
Artifact artifact =
|
||||||
|
|
|
@ -76,6 +76,10 @@ public class SearchServiceImplTest
|
||||||
|
|
||||||
private RepositoryBrowsing repoBrowsing;
|
private RepositoryBrowsing repoBrowsing;
|
||||||
|
|
||||||
|
private static final String ARCHIVA_TEST_ARTIFACT_ID = "archiva-xmlrpc-test";
|
||||||
|
|
||||||
|
private static final String ARCHIVA_TEST_GROUP_ID = "org.apache.archiva";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setUp()
|
public void setUp()
|
||||||
throws Exception
|
throws Exception
|
||||||
|
@ -115,12 +119,12 @@ public class SearchServiceImplTest
|
||||||
versions.add( "1.0" );
|
versions.add( "1.0" );
|
||||||
|
|
||||||
SearchResultHit resultHit = new SearchResultHit();
|
SearchResultHit resultHit = new SearchResultHit();
|
||||||
resultHit.setGroupId( "org.apache.archiva" );
|
resultHit.setGroupId( ARCHIVA_TEST_GROUP_ID );
|
||||||
resultHit.setArtifactId( "archiva-webapp" );
|
resultHit.setArtifactId( "archiva-webapp" );
|
||||||
resultHit.setVersions( versions );
|
resultHit.setVersions( versions );
|
||||||
resultHit.setRepositoryId( null );
|
resultHit.setRepositoryId( null );
|
||||||
|
|
||||||
results.addHit( SearchUtil.getHitId( "org.apache.archiva", "archiva-webapp" ), resultHit );
|
results.addHit( SearchUtil.getHitId( ARCHIVA_TEST_GROUP_ID, "archiva-webapp" ), resultHit );
|
||||||
|
|
||||||
SearchResultLimits limits = new SearchResultLimits( SearchResultLimits.ALL_PAGES );
|
SearchResultLimits limits = new SearchResultLimits( SearchResultLimits.ALL_PAGES );
|
||||||
|
|
||||||
|
@ -130,14 +134,14 @@ public class SearchServiceImplTest
|
||||||
resultHit.getArtifactId() ) ), null );
|
resultHit.getArtifactId() ) ), null );
|
||||||
|
|
||||||
ArchivaProjectModel model = new ArchivaProjectModel();
|
ArchivaProjectModel model = new ArchivaProjectModel();
|
||||||
model.setGroupId( "org.apache.archiva" );
|
model.setGroupId( ARCHIVA_TEST_GROUP_ID );
|
||||||
model.setArtifactId( "archiva-webapp" );
|
model.setArtifactId( "archiva-webapp" );
|
||||||
model.setVersion( "1.0" );
|
model.setVersion( "1.0" );
|
||||||
model.setPackaging( "war" );
|
model.setPackaging( "war" );
|
||||||
|
|
||||||
repoBrowsingControl.expectAndReturn( repoBrowsing.selectVersion( "", observableRepoIds, "org.apache.archiva", "archiva-webapp", "1.0" ), model );
|
repoBrowsingControl.expectAndReturn( repoBrowsing.selectVersion( "", observableRepoIds, ARCHIVA_TEST_GROUP_ID, "archiva-webapp", "1.0" ), model );
|
||||||
|
|
||||||
repoBrowsingControl.expectAndReturn( repoBrowsing.getRepositoryId( "", observableRepoIds, "org.apache.archiva", "archiva-webapp", "1.0" ), "repo1.mirror" );
|
repoBrowsingControl.expectAndReturn( repoBrowsing.getRepositoryId( "", observableRepoIds, ARCHIVA_TEST_GROUP_ID, "archiva-webapp", "1.0" ), "repo1.mirror" );
|
||||||
|
|
||||||
userReposControl.replay();
|
userReposControl.replay();
|
||||||
searchControl.replay();
|
searchControl.replay();
|
||||||
|
@ -155,7 +159,7 @@ public class SearchServiceImplTest
|
||||||
assertEquals( 1, artifacts.size() );
|
assertEquals( 1, artifacts.size() );
|
||||||
|
|
||||||
Artifact artifact = artifacts.get( 0 );
|
Artifact artifact = artifacts.get( 0 );
|
||||||
assertEquals( "org.apache.archiva", artifact.getGroupId() );
|
assertEquals( ARCHIVA_TEST_GROUP_ID, artifact.getGroupId() );
|
||||||
assertEquals( "archiva-webapp", artifact.getArtifactId() );
|
assertEquals( "archiva-webapp", artifact.getArtifactId() );
|
||||||
assertEquals( "1.0", artifact.getVersion() );
|
assertEquals( "1.0", artifact.getVersion() );
|
||||||
assertEquals( "war", artifact.getType() );
|
assertEquals( "war", artifact.getType() );
|
||||||
|
@ -179,11 +183,11 @@ public class SearchServiceImplTest
|
||||||
|
|
||||||
SearchResultHit resultHit = new SearchResultHit();
|
SearchResultHit resultHit = new SearchResultHit();
|
||||||
resultHit.setRepositoryId( null );
|
resultHit.setRepositoryId( null );
|
||||||
resultHit.setGroupId( "org.apache.archiva" );
|
resultHit.setGroupId( ARCHIVA_TEST_GROUP_ID );
|
||||||
resultHit.setArtifactId( "archiva-test" );
|
resultHit.setArtifactId( ARCHIVA_TEST_ARTIFACT_ID );
|
||||||
resultHit.setVersions( versions );
|
resultHit.setVersions( versions );
|
||||||
|
|
||||||
results.addHit( SearchUtil.getHitId( "org.apache.archiva", "archiva-test" ), resultHit );
|
results.addHit( SearchUtil.getHitId( ARCHIVA_TEST_GROUP_ID, ARCHIVA_TEST_ARTIFACT_ID ), resultHit );
|
||||||
|
|
||||||
SearchResultLimits limits = new SearchResultLimits( SearchResultLimits.ALL_PAGES );
|
SearchResultLimits limits = new SearchResultLimits( SearchResultLimits.ALL_PAGES );
|
||||||
|
|
||||||
|
@ -192,9 +196,11 @@ public class SearchServiceImplTest
|
||||||
archivaDAOControl.expectAndReturn( archivaDAO.query( new UniqueVersionConstraint( observableRepoIds, resultHit.getGroupId(),
|
archivaDAOControl.expectAndReturn( archivaDAO.query( new UniqueVersionConstraint( observableRepoIds, resultHit.getGroupId(),
|
||||||
resultHit.getArtifactId() ) ), null );
|
resultHit.getArtifactId() ) ), null );
|
||||||
|
|
||||||
repoBrowsingControl.expectAndReturn( repoBrowsing.selectVersion( "", observableRepoIds, "org.apache.archiva", "archiva-test", "1.0" ), null );
|
repoBrowsingControl.expectAndReturn( repoBrowsing.selectVersion( "", observableRepoIds, ARCHIVA_TEST_GROUP_ID,
|
||||||
|
ARCHIVA_TEST_ARTIFACT_ID, "1.0" ), null );
|
||||||
|
|
||||||
repoBrowsingControl.expectAndReturn( repoBrowsing.getRepositoryId( "", observableRepoIds, "org.apache.archiva", "archiva-test", "1.0" ), null );
|
repoBrowsingControl.expectAndReturn( repoBrowsing.getRepositoryId( "", observableRepoIds, ARCHIVA_TEST_GROUP_ID,
|
||||||
|
ARCHIVA_TEST_ARTIFACT_ID, "1.0" ), null );
|
||||||
|
|
||||||
userReposControl.replay();
|
userReposControl.replay();
|
||||||
searchControl.replay();
|
searchControl.replay();
|
||||||
|
@ -212,8 +218,8 @@ public class SearchServiceImplTest
|
||||||
assertEquals( 1, artifacts.size() );
|
assertEquals( 1, artifacts.size() );
|
||||||
|
|
||||||
Artifact artifact = artifacts.get( 0 );
|
Artifact artifact = artifacts.get( 0 );
|
||||||
assertEquals( "org.apache.archiva", artifact.getGroupId() );
|
assertEquals( ARCHIVA_TEST_GROUP_ID, artifact.getGroupId() );
|
||||||
assertEquals( "archiva-test", artifact.getArtifactId() );
|
assertEquals( ARCHIVA_TEST_ARTIFACT_ID, artifact.getArtifactId() );
|
||||||
assertEquals( "1.0", artifact.getVersion() );
|
assertEquals( "1.0", artifact.getVersion() );
|
||||||
assertEquals( "jar", artifact.getType() );
|
assertEquals( "jar", artifact.getType() );
|
||||||
assertNull( "Repository should be null since the model was not found in the database!", artifact.getRepositoryId() );
|
assertNull( "Repository should be null since the model was not found in the database!", artifact.getRepositoryId() );
|
||||||
|
@ -292,8 +298,8 @@ public class SearchServiceImplTest
|
||||||
versions.add( "1.0" );
|
versions.add( "1.0" );
|
||||||
|
|
||||||
SearchResultHit resultHit = new SearchResultHit();
|
SearchResultHit resultHit = new SearchResultHit();
|
||||||
resultHit.setGroupId( "org.apache.archiva" );
|
resultHit.setGroupId( ARCHIVA_TEST_GROUP_ID );
|
||||||
resultHit.setArtifactId( "archiva-test" );
|
resultHit.setArtifactId( ARCHIVA_TEST_ARTIFACT_ID );
|
||||||
resultHit.setVersions( versions );
|
resultHit.setVersions( versions );
|
||||||
resultHit.setRepositoryId( null );
|
resultHit.setRepositoryId( null );
|
||||||
|
|
||||||
|
@ -307,14 +313,16 @@ public class SearchServiceImplTest
|
||||||
searchControl.expectAndDefaultReturn( search.search( "", observableRepoIds, "archiva", limits, null ), results );
|
searchControl.expectAndDefaultReturn( search.search( "", observableRepoIds, "archiva", limits, null ), results );
|
||||||
|
|
||||||
ArchivaProjectModel model = new ArchivaProjectModel();
|
ArchivaProjectModel model = new ArchivaProjectModel();
|
||||||
model.setGroupId( "org.apache.archiva" );
|
model.setGroupId( ARCHIVA_TEST_GROUP_ID );
|
||||||
model.setArtifactId( "archiva-test" );
|
model.setArtifactId( ARCHIVA_TEST_ARTIFACT_ID );
|
||||||
model.setVersion( "1.0" );
|
model.setVersion( "1.0" );
|
||||||
model.setPackaging( "jar" );
|
model.setPackaging( "jar" );
|
||||||
|
|
||||||
repoBrowsingControl.expectAndReturn( repoBrowsing.selectVersion( "", observableRepoIds, "org.apache.archiva", "archiva-test", "1.0" ), model );
|
repoBrowsingControl.expectAndReturn( repoBrowsing.selectVersion( "", observableRepoIds, ARCHIVA_TEST_GROUP_ID,
|
||||||
|
ARCHIVA_TEST_ARTIFACT_ID, "1.0" ), model );
|
||||||
|
|
||||||
repoBrowsingControl.expectAndReturn( repoBrowsing.getRepositoryId( "", observableRepoIds, "org.apache.archiva", "archiva-test", "1.0" ), "repo1.mirror" );
|
repoBrowsingControl.expectAndReturn( repoBrowsing.getRepositoryId( "", observableRepoIds, ARCHIVA_TEST_GROUP_ID,
|
||||||
|
ARCHIVA_TEST_ARTIFACT_ID, "1.0" ), "repo1.mirror" );
|
||||||
|
|
||||||
userReposControl.replay();
|
userReposControl.replay();
|
||||||
searchControl.replay();
|
searchControl.replay();
|
||||||
|
@ -332,8 +340,8 @@ public class SearchServiceImplTest
|
||||||
assertEquals( 1, artifacts.size() );
|
assertEquals( 1, artifacts.size() );
|
||||||
|
|
||||||
Artifact artifact = artifacts.get( 0 );
|
Artifact artifact = artifacts.get( 0 );
|
||||||
assertEquals( "org.apache.archiva", artifact.getGroupId() );
|
assertEquals( ARCHIVA_TEST_GROUP_ID, artifact.getGroupId() );
|
||||||
assertEquals( "archiva-test", artifact.getArtifactId() );
|
assertEquals( ARCHIVA_TEST_ARTIFACT_ID, artifact.getArtifactId() );
|
||||||
assertEquals( "1.0", artifact.getVersion() );
|
assertEquals( "1.0", artifact.getVersion() );
|
||||||
assertEquals( "jar", artifact.getType() );
|
assertEquals( "jar", artifact.getType() );
|
||||||
assertNotNull( "Repository should not be null!", artifact.getRepositoryId() );
|
assertNotNull( "Repository should not be null!", artifact.getRepositoryId() );
|
||||||
|
@ -374,7 +382,7 @@ public class SearchServiceImplTest
|
||||||
|
|
||||||
ArtifactsByChecksumConstraint constraint = new ArtifactsByChecksumConstraint( "a1b2c3aksjhdasfkdasasd" );
|
ArtifactsByChecksumConstraint constraint = new ArtifactsByChecksumConstraint( "a1b2c3aksjhdasfkdasasd" );
|
||||||
List<ArchivaArtifact> artifacts = new ArrayList<ArchivaArtifact>();
|
List<ArchivaArtifact> artifacts = new ArrayList<ArchivaArtifact>();
|
||||||
ArchivaArtifact artifact = new ArchivaArtifact( "org.apache.archiva", "archiva-test", "1.0", "", "jar", "test-repo" );
|
ArchivaArtifact artifact = new ArchivaArtifact( ARCHIVA_TEST_GROUP_ID, ARCHIVA_TEST_ARTIFACT_ID, "1.0", "", "jar", "test-repo" );
|
||||||
artifact.getModel().setWhenGathered( whenGathered );
|
artifact.getModel().setWhenGathered( whenGathered );
|
||||||
artifacts.add( artifact );
|
artifacts.add( artifact );
|
||||||
|
|
||||||
|
@ -414,51 +422,58 @@ public class SearchServiceImplTest
|
||||||
versions.add( "1.2" );
|
versions.add( "1.2" );
|
||||||
versions.add( "1.2.1-SNAPSHOT" );
|
versions.add( "1.2.1-SNAPSHOT" );
|
||||||
|
|
||||||
BrowsingResults results = new BrowsingResults( "org.apache.archiva", "archiva-test" );
|
BrowsingResults results = new BrowsingResults( ARCHIVA_TEST_GROUP_ID, ARCHIVA_TEST_ARTIFACT_ID );
|
||||||
results.setSelectedRepositoryIds( observableRepoIds );
|
results.setSelectedRepositoryIds( observableRepoIds );
|
||||||
results.setVersions( versions );
|
results.setVersions( versions );
|
||||||
|
|
||||||
List<ArchivaArtifact> archivaArtifacts = new ArrayList<ArchivaArtifact>();
|
List<ArchivaArtifact> archivaArtifacts = new ArrayList<ArchivaArtifact>();
|
||||||
ArchivaArtifact archivaArtifact = new ArchivaArtifact( "org.apache.archiva", "archiva-test", versions.get( 0 ), "", "pom", "repo1.mirror" );
|
ArchivaArtifact archivaArtifact = new ArchivaArtifact( ARCHIVA_TEST_GROUP_ID, ARCHIVA_TEST_ARTIFACT_ID, versions.get( 0 ), "", "pom", "repo1.mirror" );
|
||||||
archivaArtifact.getModel().setWhenGathered( whenGathered );
|
archivaArtifact.getModel().setWhenGathered( whenGathered );
|
||||||
archivaArtifacts.add( archivaArtifact );
|
archivaArtifacts.add( archivaArtifact );
|
||||||
|
|
||||||
archivaArtifact = new ArchivaArtifact( "org.apache.archiva", "archiva-test", versions.get( 1 ), "", "pom", "public.releases" );
|
archivaArtifact = new ArchivaArtifact( ARCHIVA_TEST_GROUP_ID, ARCHIVA_TEST_ARTIFACT_ID, versions.get( 1 ), "", "pom", "public.releases" );
|
||||||
archivaArtifact.getModel().setWhenGathered( whenGathered );
|
archivaArtifact.getModel().setWhenGathered( whenGathered );
|
||||||
archivaArtifacts.add( archivaArtifact );
|
archivaArtifacts.add( archivaArtifact );
|
||||||
|
|
||||||
archivaArtifact = new ArchivaArtifact( "org.apache.archiva", "archiva-test", versions.get( 2 ), "", "pom", "repo1.mirror" );
|
archivaArtifact = new ArchivaArtifact( ARCHIVA_TEST_GROUP_ID, ARCHIVA_TEST_ARTIFACT_ID, versions.get( 2 ), "", "pom", "repo1.mirror" );
|
||||||
archivaArtifact.getModel().setWhenGathered( whenGathered );
|
archivaArtifact.getModel().setWhenGathered( whenGathered );
|
||||||
archivaArtifacts.add( archivaArtifact );
|
archivaArtifacts.add( archivaArtifact );
|
||||||
|
|
||||||
archivaArtifact = new ArchivaArtifact( "org.apache.archiva", "archiva-test", versions.get( 3 ), "", "pom", "public.releases" );
|
archivaArtifact = new ArchivaArtifact( ARCHIVA_TEST_GROUP_ID, ARCHIVA_TEST_ARTIFACT_ID, versions.get( 3 ), "", "pom", "public.releases" );
|
||||||
archivaArtifact.getModel().setWhenGathered( whenGathered );
|
archivaArtifact.getModel().setWhenGathered( whenGathered );
|
||||||
archivaArtifacts.add( archivaArtifact );
|
archivaArtifacts.add( archivaArtifact );
|
||||||
|
|
||||||
archivaArtifact = new ArchivaArtifact( "org.apache.archiva", "archiva-test", versions.get( 4 ), "", "pom", "repo1.mirror" );
|
archivaArtifact = new ArchivaArtifact( ARCHIVA_TEST_GROUP_ID, ARCHIVA_TEST_ARTIFACT_ID, versions.get( 4 ), "", "pom", "repo1.mirror" );
|
||||||
archivaArtifact.getModel().setWhenGathered( whenGathered );
|
archivaArtifact.getModel().setWhenGathered( whenGathered );
|
||||||
archivaArtifacts.add( archivaArtifact );
|
archivaArtifacts.add( archivaArtifact );
|
||||||
|
|
||||||
archivaArtifact = new ArchivaArtifact( "org.apache.archiva", "archiva-test", versions.get( 5 ), "", "pom", "public.releases" );
|
archivaArtifact = new ArchivaArtifact( ARCHIVA_TEST_GROUP_ID, ARCHIVA_TEST_ARTIFACT_ID, versions.get( 5 ), "", "pom", "public.releases" );
|
||||||
archivaArtifact.getModel().setWhenGathered( whenGathered );
|
archivaArtifact.getModel().setWhenGathered( whenGathered );
|
||||||
archivaArtifacts.add( archivaArtifact );
|
archivaArtifacts.add( archivaArtifact );
|
||||||
|
|
||||||
userReposControl.expectAndReturn( userRepos.getObservableRepositories(), observableRepoIds );
|
userReposControl.expectAndReturn( userRepos.getObservableRepositories(), observableRepoIds );
|
||||||
repoBrowsingControl.expectAndReturn( repoBrowsing.selectArtifactId( "", observableRepoIds, "org.apache.archiva", "archiva-test" ), results );
|
repoBrowsingControl.expectAndReturn( repoBrowsing.selectArtifactId( "", observableRepoIds, ARCHIVA_TEST_GROUP_ID,
|
||||||
|
ARCHIVA_TEST_ARTIFACT_ID ), results );
|
||||||
archivaDAOControl.expectAndReturn( archivaDAO.getArtifactDAO(), artifactDAO );
|
archivaDAOControl.expectAndReturn( archivaDAO.getArtifactDAO(), artifactDAO );
|
||||||
|
|
||||||
artifactDAOControl.expectAndDefaultReturn( artifactDAO.getArtifact( "org.apache.archiva", "archiva-test", versions.get( 0 ), "", "pom", "repo1.mirror" ), archivaArtifacts.get( 0 ) );
|
artifactDAOControl.expectAndDefaultReturn( artifactDAO.getArtifact( ARCHIVA_TEST_GROUP_ID,
|
||||||
artifactDAOControl.expectAndDefaultReturn( artifactDAO.getArtifact( "org.apache.archiva", "archiva-test", versions.get( 1 ), "", "pom", "public.releases" ), archivaArtifacts.get( 1 ) );
|
ARCHIVA_TEST_ARTIFACT_ID, versions.get( 0 ), "", "pom", "repo1.mirror" ), archivaArtifacts.get( 0 ) );
|
||||||
artifactDAOControl.expectAndDefaultReturn( artifactDAO.getArtifact( "org.apache.archiva", "archiva-test", versions.get( 2 ), "", "pom", "repo1.mirror" ), archivaArtifacts.get( 2 ) );
|
artifactDAOControl.expectAndDefaultReturn( artifactDAO.getArtifact( ARCHIVA_TEST_GROUP_ID,
|
||||||
artifactDAOControl.expectAndDefaultReturn( artifactDAO.getArtifact( "org.apache.archiva", "archiva-test", versions.get( 3 ), "", "pom", "public.releases" ), archivaArtifacts.get( 3 ) );
|
ARCHIVA_TEST_ARTIFACT_ID, versions.get( 1 ), "", "pom", "public.releases" ), archivaArtifacts.get( 1 ) );
|
||||||
artifactDAOControl.expectAndDefaultReturn( artifactDAO.getArtifact( "org.apache.archiva", "archiva-test", versions.get( 4 ), "", "pom", "repo1.mirror" ), archivaArtifacts.get( 4 ) );
|
artifactDAOControl.expectAndDefaultReturn( artifactDAO.getArtifact( ARCHIVA_TEST_GROUP_ID,
|
||||||
artifactDAOControl.expectAndDefaultReturn( artifactDAO.getArtifact( "org.apache.archiva", "archiva-test", versions.get( 5 ), "", "pom", "public.releases" ), archivaArtifacts.get( 5 ) );
|
ARCHIVA_TEST_ARTIFACT_ID, versions.get( 2 ), "", "pom", "repo1.mirror" ), archivaArtifacts.get( 2 ) );
|
||||||
|
artifactDAOControl.expectAndDefaultReturn( artifactDAO.getArtifact( ARCHIVA_TEST_GROUP_ID,
|
||||||
|
ARCHIVA_TEST_ARTIFACT_ID, versions.get( 3 ), "", "pom", "public.releases" ), archivaArtifacts.get( 3 ) );
|
||||||
|
artifactDAOControl.expectAndDefaultReturn( artifactDAO.getArtifact( ARCHIVA_TEST_GROUP_ID,
|
||||||
|
ARCHIVA_TEST_ARTIFACT_ID, versions.get( 4 ), "", "pom", "repo1.mirror" ), archivaArtifacts.get( 4 ) );
|
||||||
|
artifactDAOControl.expectAndDefaultReturn( artifactDAO.getArtifact( ARCHIVA_TEST_GROUP_ID,
|
||||||
|
ARCHIVA_TEST_ARTIFACT_ID, versions.get( 5 ), "", "pom", "public.releases" ), archivaArtifacts.get( 5 ) );
|
||||||
|
|
||||||
userReposControl.replay();
|
userReposControl.replay();
|
||||||
repoBrowsingControl.replay();
|
repoBrowsingControl.replay();
|
||||||
artifactDAOControl.replay();
|
artifactDAOControl.replay();
|
||||||
|
|
||||||
List<Artifact> artifacts = searchService.getArtifactVersions( "org.apache.archiva", "archiva-test" );
|
List<Artifact> artifacts = searchService.getArtifactVersions( ARCHIVA_TEST_GROUP_ID, ARCHIVA_TEST_ARTIFACT_ID );
|
||||||
|
|
||||||
userReposControl.verify();
|
userReposControl.verify();
|
||||||
repoBrowsingControl.verify();
|
repoBrowsingControl.verify();
|
||||||
|
@ -492,8 +507,8 @@ public class SearchServiceImplTest
|
||||||
observableRepoIds.add( "public.releases" );
|
observableRepoIds.add( "public.releases" );
|
||||||
|
|
||||||
ArchivaProjectModel model = new ArchivaProjectModel();
|
ArchivaProjectModel model = new ArchivaProjectModel();
|
||||||
model.setGroupId( "org.apache.archiva" );
|
model.setGroupId( ARCHIVA_TEST_GROUP_ID );
|
||||||
model.setArtifactId( "archiva-test" );
|
model.setArtifactId( ARCHIVA_TEST_ARTIFACT_ID );
|
||||||
model.setVersion( "1.0" );
|
model.setVersion( "1.0" );
|
||||||
|
|
||||||
org.apache.maven.archiva.model.Dependency dependency = new org.apache.maven.archiva.model.Dependency();
|
org.apache.maven.archiva.model.Dependency dependency = new org.apache.maven.archiva.model.Dependency();
|
||||||
|
@ -513,12 +528,12 @@ public class SearchServiceImplTest
|
||||||
|
|
||||||
userReposControl.expectAndReturn( userRepos.getObservableRepositories(), observableRepoIds );
|
userReposControl.expectAndReturn( userRepos.getObservableRepositories(), observableRepoIds );
|
||||||
repoBrowsingControl.expectAndReturn(
|
repoBrowsingControl.expectAndReturn(
|
||||||
repoBrowsing.selectVersion( "", observableRepoIds, "org.apache.archiva", "archiva-test", "1.0" ), model );
|
repoBrowsing.selectVersion( "", observableRepoIds, ARCHIVA_TEST_GROUP_ID, ARCHIVA_TEST_ARTIFACT_ID, "1.0" ), model );
|
||||||
|
|
||||||
repoBrowsingControl.replay();
|
repoBrowsingControl.replay();
|
||||||
userReposControl.replay();
|
userReposControl.replay();
|
||||||
|
|
||||||
List<Dependency> dependencies = searchService.getDependencies( "org.apache.archiva", "archiva-test", "1.0" );
|
List<Dependency> dependencies = searchService.getDependencies( ARCHIVA_TEST_GROUP_ID, ARCHIVA_TEST_ARTIFACT_ID, "1.0" );
|
||||||
|
|
||||||
repoBrowsingControl.verify();
|
repoBrowsingControl.verify();
|
||||||
userReposControl.verify();
|
userReposControl.verify();
|
||||||
|
@ -536,14 +551,14 @@ public class SearchServiceImplTest
|
||||||
|
|
||||||
userReposControl.expectAndReturn( userRepos.getObservableRepositories(), observableRepoIds );
|
userReposControl.expectAndReturn( userRepos.getObservableRepositories(), observableRepoIds );
|
||||||
repoBrowsingControl.expectAndThrow(
|
repoBrowsingControl.expectAndThrow(
|
||||||
repoBrowsing.selectVersion( "", observableRepoIds, "org.apache.archiva", "archiva-test", "1.0" ), new ObjectNotFoundException( "Artifact does not exist." ) );
|
repoBrowsing.selectVersion( "", observableRepoIds, ARCHIVA_TEST_GROUP_ID, ARCHIVA_TEST_ARTIFACT_ID, "1.0" ), new ObjectNotFoundException( "Artifact does not exist." ) );
|
||||||
|
|
||||||
userReposControl.replay();
|
userReposControl.replay();
|
||||||
repoBrowsingControl.replay();
|
repoBrowsingControl.replay();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
searchService.getDependencies( "org.apache.archiva", "archiva-test", "1.0" );
|
searchService.getDependencies( ARCHIVA_TEST_GROUP_ID, ARCHIVA_TEST_ARTIFACT_ID, "1.0" );
|
||||||
fail( "An exception should have been thrown." );
|
fail( "An exception should have been thrown." );
|
||||||
}
|
}
|
||||||
catch ( Exception e )
|
catch ( Exception e )
|
||||||
|
@ -555,22 +570,18 @@ public class SearchServiceImplTest
|
||||||
repoBrowsingControl.verify();
|
repoBrowsingControl.verify();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get dependency tree */
|
|
||||||
|
|
||||||
public void testGetDependencyTreeArtifactExists()
|
public void testGetDependencyTreeArtifactExists()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetDependencyTreeArtifactDoesNotExist()
|
public void testGetDependencyTreeArtifactDoesNotExist()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get dependees */
|
|
||||||
|
|
||||||
public void testGetDependees()
|
public void testGetDependees()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -581,26 +592,27 @@ public class SearchServiceImplTest
|
||||||
|
|
||||||
List<ArchivaProjectModel> dependeeModels = new ArrayList<ArchivaProjectModel>();
|
List<ArchivaProjectModel> dependeeModels = new ArrayList<ArchivaProjectModel>();
|
||||||
ArchivaProjectModel dependeeModel = new ArchivaProjectModel();
|
ArchivaProjectModel dependeeModel = new ArchivaProjectModel();
|
||||||
dependeeModel.setGroupId( "org.apache.archiva" );
|
dependeeModel.setGroupId( ARCHIVA_TEST_GROUP_ID );
|
||||||
dependeeModel.setArtifactId( "archiva-dependee-one" );
|
dependeeModel.setArtifactId( "archiva-dependee-one" );
|
||||||
dependeeModel.setVersion( "1.0" );
|
dependeeModel.setVersion( "1.0" );
|
||||||
dependeeModel.setWhenIndexed( date );
|
dependeeModel.setWhenIndexed( date );
|
||||||
dependeeModels.add( dependeeModel );
|
dependeeModels.add( dependeeModel );
|
||||||
|
|
||||||
dependeeModel = new ArchivaProjectModel();
|
dependeeModel = new ArchivaProjectModel();
|
||||||
dependeeModel.setGroupId( "org.apache.archiva" );
|
dependeeModel.setGroupId( ARCHIVA_TEST_GROUP_ID );
|
||||||
dependeeModel.setArtifactId( "archiva-dependee-two" );
|
dependeeModel.setArtifactId( "archiva-dependee-two" );
|
||||||
dependeeModel.setVersion( "1.0" );
|
dependeeModel.setVersion( "1.0" );
|
||||||
dependeeModel.setWhenIndexed( date );
|
dependeeModel.setWhenIndexed( date );
|
||||||
dependeeModels.add( dependeeModel );
|
dependeeModels.add( dependeeModel );
|
||||||
|
|
||||||
userReposControl.expectAndReturn( userRepos.getObservableRepositories(), observableRepoIds );
|
userReposControl.expectAndReturn( userRepos.getObservableRepositories(), observableRepoIds );
|
||||||
repoBrowsingControl.expectAndReturn( repoBrowsing.getUsedBy( "", observableRepoIds, "org.apache.archiva", "archiva-test", "1.0" ), dependeeModels );
|
repoBrowsingControl.expectAndReturn( repoBrowsing.getUsedBy( "", observableRepoIds, ARCHIVA_TEST_GROUP_ID,
|
||||||
|
ARCHIVA_TEST_ARTIFACT_ID, "1.0" ), dependeeModels );
|
||||||
|
|
||||||
repoBrowsingControl.replay();
|
repoBrowsingControl.replay();
|
||||||
userReposControl.replay();
|
userReposControl.replay();
|
||||||
|
|
||||||
List<Artifact> dependees = searchService.getDependees( "org.apache.archiva", "archiva-test", "1.0" );
|
List<Artifact> dependees = searchService.getDependees( ARCHIVA_TEST_GROUP_ID, ARCHIVA_TEST_ARTIFACT_ID, "1.0" );
|
||||||
|
|
||||||
repoBrowsingControl.verify();
|
repoBrowsingControl.verify();
|
||||||
userReposControl.verify();
|
userReposControl.verify();
|
||||||
|
@ -609,7 +621,7 @@ public class SearchServiceImplTest
|
||||||
assertEquals( 2, dependees.size() );
|
assertEquals( 2, dependees.size() );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*public void testGetDependeesArtifactDoesNotExist()
|
public void testGetDependeesArtifactDoesNotExist()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
Date date = new Date();
|
Date date = new Date();
|
||||||
|
@ -619,39 +631,35 @@ public class SearchServiceImplTest
|
||||||
|
|
||||||
List dependeeModels = new ArrayList();
|
List dependeeModels = new ArrayList();
|
||||||
ArchivaProjectModel dependeeModel = new ArchivaProjectModel();
|
ArchivaProjectModel dependeeModel = new ArchivaProjectModel();
|
||||||
dependeeModel.setGroupId( "org.apache.archiva" );
|
dependeeModel.setGroupId( ARCHIVA_TEST_GROUP_ID );
|
||||||
dependeeModel.setArtifactId( "archiva-dependee-one" );
|
dependeeModel.setArtifactId( "archiva-dependee-one" );
|
||||||
dependeeModel.setVersion( "1.0" );
|
dependeeModel.setVersion( "1.0" );
|
||||||
dependeeModel.setWhenIndexed( date );
|
dependeeModel.setWhenIndexed( date );
|
||||||
dependeeModels.add( dependeeModel );
|
dependeeModels.add( dependeeModel );
|
||||||
|
|
||||||
dependeeModel = new ArchivaProjectModel();
|
dependeeModel = new ArchivaProjectModel();
|
||||||
dependeeModel.setGroupId( "org.apache.archiva" );
|
dependeeModel.setGroupId( ARCHIVA_TEST_GROUP_ID );
|
||||||
dependeeModel.setArtifactId( "archiva-dependee-two" );
|
dependeeModel.setArtifactId( "archiva-dependee-two" );
|
||||||
dependeeModel.setVersion( "1.0" );
|
dependeeModel.setVersion( "1.0" );
|
||||||
dependeeModel.setWhenIndexed( date );
|
dependeeModel.setWhenIndexed( date );
|
||||||
dependeeModels.add( dependeeModel );
|
dependeeModels.add( dependeeModel );
|
||||||
|
|
||||||
userReposControl.expectAndReturn( userRepos.getObservableRepositories(), observableRepoIds );
|
userReposControl.expectAndReturn( userRepos.getObservableRepositories(), observableRepoIds );
|
||||||
repoBrowsingControl.expectAndReturn( repoBrowsing.getUsedBy( "", observableRepoIds, "org.apache.archiva", "archiva-test", "1.0" ), dependeeModels );
|
repoBrowsingControl.expectAndReturn( repoBrowsing.getUsedBy( "", observableRepoIds, ARCHIVA_TEST_GROUP_ID,
|
||||||
|
ARCHIVA_TEST_ARTIFACT_ID, "1.0" ), null );
|
||||||
|
|
||||||
repoBrowsingControl.replay();
|
repoBrowsingControl.replay();
|
||||||
userReposControl.replay();
|
userReposControl.replay();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
List<Artifact> dependees = searchService.getDependees( "org.apache.archiva", "archiva-test", "1.0" );
|
List<Artifact> dependees = searchService.getDependees( ARCHIVA_TEST_GROUP_ID, ARCHIVA_TEST_ARTIFACT_ID, "1.0" );
|
||||||
fail( "An exception should have been thrown." );
|
fail( "An exception should have been thrown." );
|
||||||
}
|
}
|
||||||
catch ( Exception e )
|
catch ( Exception e )
|
||||||
{
|
{
|
||||||
assertEquals( "Artifact does not exist." )
|
|
||||||
}
|
|
||||||
|
|
||||||
repoBrowsingControl.verify();
|
repoBrowsingControl.verify();
|
||||||
userReposControl.verify();
|
userReposControl.verify();
|
||||||
|
}
|
||||||
assertNotNull( dependees );
|
}
|
||||||
assertEquals( 2, dependees.size() );
|
|
||||||
}*/
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue