Date upper = new Date( artifact.getWhenGathered().getTime() - 10000 );
assertTrue( repository.getArtifactsByDateRange( TEST_REPO_ID, null, upper ).isEmpty() );
+ }
+
+ public void testGetArtifactsByRepoId()
+ {
+ repository.updateNamespace( TEST_REPO_ID, TEST_NAMESPACE );
+ repository.updateProject( TEST_REPO_ID, createProject() );
+ ArtifactMetadata artifact = createArtifact();
+ repository.updateArtifact( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact );
+ assertFalse( repository.getArtifacts(TEST_REPO_ID).isEmpty());
+
+
}
public void testGetNamespacesWithSparseDepth()
{
properties.remove( name );
}
-
+
// clear the facet contents so old properties are no longer written
clearMetadataFacetProperties( versionMetadata, properties );
}
}
}
}
-
+
private void clearMetadataFacetProperties( ProjectVersionMetadata versionMetadata, Properties properties )
{
List<Object> propsToRemove = new ArrayList<Object>();
}
}
}
-
+
for( Object key : propsToRemove )
{
properties.remove( key );
properties.remove( "artifact:sha1:" + id );
properties.remove( "artifact:version:" + id );
properties.remove( "artifact:facetIds:" + id );
-
+
String prefix = "artifact:facet:" + id + ":";
for ( Object key : new ArrayList( properties.keySet() ) )
{
return artifact1.getWhenGathered().compareTo( artifact2.getWhenGathered() );
}
}
+
+ public List<ArtifactMetadata> getArtifacts( String repoId )
+ {
+
+ List<ArtifactMetadata> artifacts = new ArrayList<ArtifactMetadata>();
+ for ( String ns : getRootNamespaces( repoId ) )
+ {
+ getArtifacts( artifacts, repoId, ns );
+ }
+ return artifacts;
+ }
+
+ private void getArtifacts( List<ArtifactMetadata> artifacts, String repoId, String ns )
+ {
+ for ( String namespace : getNamespaces( repoId, ns ) )
+ {
+ getArtifacts( artifacts, repoId, ns + "." + namespace );
+ }
+
+ for ( String project : getProjects( repoId, ns ) )
+ {
+ for ( String version : getProjectVersions( repoId, ns, project ) )
+ {
+ for ( ArtifactMetadata artifact : getArtifacts( repoId, ns, project, version ) )
+ {
+
+ artifacts.add( artifact );
+
+ }
+ }
+ }
+ }
}