assertEquals( Collections.singletonList( artifact ), repository.getArtifacts( TEST_REPO_ID ) );
}
+ public void testGetArtifactsByRepoIdMultipleCopies()
+ throws Exception
+ {
+ ArtifactMetadata artifact = createArtifact();
+ repository.updateArtifact( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact );
+
+ ArtifactMetadata secondArtifact = createArtifact();
+ secondArtifact.setRepositoryId( OTHER_REPO_ID );
+ repository.updateArtifact( OTHER_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, secondArtifact );
+
+ // test it restricts to the appropriate repository
+ assertEquals( Collections.singletonList( artifact ), repository.getArtifacts( TEST_REPO_ID ) );
+ assertEquals( Collections.singletonList( secondArtifact ), repository.getArtifacts( OTHER_REPO_ID ) );
+ }
+
public void testGetNamespacesWithSparseDepth()
throws Exception
{
static final String FACET_NODE_TYPE = "archiva:facet";
- private static final String QUERY_ARTIFACTS = "SELECT * FROM [" + ARTIFACT_NODE_TYPE + "]";
+ private static final String QUERY_ARTIFACTS = "SELECT * FROM [" + ARTIFACT_NODE_TYPE + "] AS artifact";
private final Map<String, MetadataFacetFactory> metadataFacetFactories;
{
List<ArtifactMetadata> artifacts;
- String q = QUERY_ARTIFACTS;
+ String q = QUERY_ARTIFACTS + " WHERE ISDESCENDANTNODE(artifact,'/" + getRepositoryContentPath( repositoryId ) +
+ "')";
try
{