import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
Properties properties = readOrCreateProperties( directory, PROJECT_VERSION_METADATA_KEY );
- List<String> versions = new ArrayList<String>();
+ Set<String> versions = new HashSet<String>();
for ( Map.Entry entry : properties.entrySet() )
{
String name = (String) entry.getKey();
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
repository.updateArtifact( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact1 );
repository.updateArtifact( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact2 );
- assertEquals( Arrays.asList( version2, version1 ),
+ assertEquals( new HashSet<String>( Arrays.asList( version2, version1 ) ),
+ repository.getArtifactVersions( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT,
+ TEST_PROJECT_VERSION ) );
+ }
+
+ public void testGetArtifactVersionsMultipleArtifactsSingleVersion()
+ {
+ ArtifactMetadata artifact1 = createArtifact();
+ artifact1.setId( TEST_PROJECT + "-" + TEST_PROJECT_VERSION + ".jar" );
+ ArtifactMetadata artifact2 = createArtifact();
+ artifact2.setId( TEST_PROJECT + "-" + TEST_PROJECT_VERSION + "-sources.jar" );
+ repository.updateArtifact( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact1 );
+ repository.updateArtifact( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact2 );
+
+ assertEquals( Collections.singleton( TEST_PROJECT_VERSION ),
repository.getArtifactVersions( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT,
TEST_PROJECT_VERSION ) );
}