mirror of https://github.com/apache/archiva.git
[MRM-134] remove old timestamp code and tests
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@439937 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0d7b2b158b
commit
2fb806d300
|
@ -74,7 +74,6 @@ public abstract class AbstractArtifactDiscoverer
|
|||
artifacts.add( artifact );
|
||||
}
|
||||
// TODO: else add to excluded? [!]
|
||||
// TODO! excluded/kickout tracking should be optional
|
||||
}
|
||||
catch ( DiscovererException e )
|
||||
{
|
||||
|
|
|
@ -52,13 +52,6 @@ public abstract class AbstractDiscoverer
|
|||
*/
|
||||
private boolean trackOmittedPaths;
|
||||
|
||||
/** TODO!
|
||||
* @plexus.configuration default-value="60000"
|
||||
protected int blackoutPeriod;
|
||||
|
||||
protected static final String DATE_FMT = "yyyyMMddHHmmss";
|
||||
*/
|
||||
|
||||
/**
|
||||
* Add a path to the list of files that were kicked out due to being invalid.
|
||||
*
|
||||
|
|
|
@ -51,9 +51,6 @@ public abstract class AbstractArtifactDiscovererTest
|
|||
factory = (ArtifactFactory) lookup( ArtifactFactory.ROLE );
|
||||
|
||||
repository = getRepository();
|
||||
|
||||
// TODO!
|
||||
// removeTimestampMetadata();
|
||||
}
|
||||
|
||||
protected ArtifactRepository getRepository()
|
||||
|
@ -87,174 +84,4 @@ public abstract class AbstractArtifactDiscovererTest
|
|||
{
|
||||
return factory.createArtifactWithClassifier( groupId, artifactId, version, type, classifier );
|
||||
}
|
||||
|
||||
/* TODO!
|
||||
public void testUpdatedInRepository()
|
||||
throws ComponentLookupException, DiscovererException, ParseException, IOException
|
||||
{
|
||||
// Set repository time to 1-1-2000, a time in the distant past so definitely updated
|
||||
discoverer.setLastCheckedTime( repository, UPDATE_OPERATION,
|
||||
new SimpleDateFormat( "yyyy-MM-dd", Locale.US ).parse( "2000-01-01" ) );
|
||||
|
||||
List artifacts = discoverUpdateArtifactsWithSnapshots();
|
||||
assertNotNull( "Check artifacts not null", artifacts );
|
||||
|
||||
assertTrue( "Check included",
|
||||
artifacts.contains( createArtifact( "org.apache.maven.update", "test-updated", "1.0" ) ) );
|
||||
|
||||
// try again with the updated timestamp
|
||||
artifacts = discoverUpdateArtifactsWithSnapshots();
|
||||
assertNotNull( "Check artifacts not null", artifacts );
|
||||
|
||||
assertFalse( "Check not included",
|
||||
artifacts.contains( createArtifact( "org.apache.maven.update", "test-updated", "1.0" ) ) );
|
||||
}
|
||||
|
||||
public void testNotUpdatedInRepository()
|
||||
throws ComponentLookupException, DiscovererException, IOException
|
||||
{
|
||||
// Set repository time to now, which is after any artifacts, so definitely not updated
|
||||
discoverer.setLastCheckedTime( repository, UPDATE_OPERATION, new Date() );
|
||||
|
||||
List artifacts = discoverUpdateArtifactsWithSnapshots();
|
||||
assertNotNull( "Check artifacts not null", artifacts );
|
||||
|
||||
assertFalse( "Check not included",
|
||||
artifacts.contains( createArtifact( "org.apache.maven.update", "test-not-updated", "1.0" ) ) );
|
||||
}
|
||||
|
||||
public void testNotUpdatedInRepositoryForcedDiscovery()
|
||||
throws ComponentLookupException, DiscovererException, IOException
|
||||
{
|
||||
discoverer.resetLastCheckedTime( repository, UPDATE_OPERATION );
|
||||
|
||||
List artifacts = discoverUpdateArtifactsWithSnapshots();
|
||||
assertNotNull( "Check artifacts not null", artifacts );
|
||||
|
||||
assertTrue( "Check included",
|
||||
artifacts.contains( createArtifact( "org.apache.maven.update", "test-not-updated", "1.0" ) ) );
|
||||
|
||||
// try again with the updated timestamp
|
||||
artifacts = discoverUpdateArtifactsWithSnapshots();
|
||||
assertNotNull( "Check artifacts not null", artifacts );
|
||||
|
||||
assertFalse( "Check not included",
|
||||
artifacts.contains( createArtifact( "org.apache.maven.update", "test-not-updated", "1.0" ) ) );
|
||||
}
|
||||
|
||||
public void testUpdatedInRepositoryBlackout()
|
||||
throws ComponentLookupException, DiscovererException, IOException
|
||||
{
|
||||
discoverer.resetLastCheckedTime( repository, UPDATE_OPERATION );
|
||||
|
||||
Artifact artifact = createArtifact( "org.apache.maven.update", "test-not-updated", "1.0" );
|
||||
artifact.getFile().setLastModified( System.currentTimeMillis() );
|
||||
|
||||
List artifacts = discoverUpdateArtifactsWithSnapshots();
|
||||
assertNotNull( "Check artifacts not null", artifacts );
|
||||
|
||||
assertFalse( "Check not included", artifacts.contains( artifact ) );
|
||||
|
||||
// try again with the updated timestamp
|
||||
artifacts = discoverUpdateArtifactsWithSnapshots();
|
||||
assertNotNull( "Check artifacts not null", artifacts );
|
||||
|
||||
assertFalse( "Check not included", artifacts.contains( artifact ) );
|
||||
}
|
||||
|
||||
public void testUpdatedInRepositoryNotBlackout()
|
||||
throws ComponentLookupException, DiscovererException, IOException
|
||||
{
|
||||
discoverer.resetLastCheckedTime( repository, UPDATE_OPERATION );
|
||||
|
||||
Artifact artifact = createArtifact( "org.apache.maven.update", "test-not-updated", "1.0" );
|
||||
artifact.getFile().setLastModified( System.currentTimeMillis() - 61000 );
|
||||
|
||||
List artifacts = discoverUpdateArtifactsWithSnapshots();
|
||||
assertNotNull( "Check artifacts not null", artifacts );
|
||||
|
||||
assertTrue( "Check included", artifacts.contains( artifact ) );
|
||||
|
||||
// try again with the updated timestamp
|
||||
artifacts = discoverUpdateArtifactsWithSnapshots();
|
||||
assertNotNull( "Check artifacts not null", artifacts );
|
||||
|
||||
assertFalse( "Check not included", artifacts.contains( artifact ) );
|
||||
}
|
||||
|
||||
public void testNotUpdatedInRepositoryForcedDiscoveryMetadataAlreadyExists()
|
||||
throws ComponentLookupException, DiscovererException, IOException
|
||||
{
|
||||
discoverer.setLastCheckedTime( repository, UPDATE_OPERATION, new Date() );
|
||||
|
||||
discoverer.resetLastCheckedTime( repository, UPDATE_OPERATION );
|
||||
|
||||
List artifacts = discoverUpdateArtifactsWithSnapshots();
|
||||
assertNotNull( "Check artifacts not null", artifacts );
|
||||
|
||||
assertTrue( "Check included",
|
||||
artifacts.contains( createArtifact( "org.apache.maven.update", "test-not-updated", "1.0" ) ) );
|
||||
|
||||
// try again with the updated timestamp
|
||||
artifacts = discoverUpdateArtifactsWithSnapshots();
|
||||
assertNotNull( "Check artifacts not null", artifacts );
|
||||
|
||||
assertFalse( "Check not included",
|
||||
artifacts.contains( createArtifact( "org.apache.maven.update", "test-not-updated", "1.0" ) ) );
|
||||
}
|
||||
|
||||
public void testNotUpdatedInRepositoryForcedDiscoveryOtherMetadataAlreadyExists()
|
||||
throws ComponentLookupException, DiscovererException, IOException
|
||||
{
|
||||
discoverer.setLastCheckedTime( repository, "test", new Date() );
|
||||
|
||||
discoverer.resetLastCheckedTime( repository, UPDATE_OPERATION );
|
||||
|
||||
List artifacts = discoverUpdateArtifactsWithSnapshots();
|
||||
assertNotNull( "Check artifacts not null", artifacts );
|
||||
|
||||
assertTrue( "Check included",
|
||||
artifacts.contains( createArtifact( "org.apache.maven.update", "test-not-updated", "1.0" ) ) );
|
||||
|
||||
// try again with the updated timestamp
|
||||
artifacts = discoverUpdateArtifactsWithSnapshots();
|
||||
assertNotNull( "Check artifacts not null", artifacts );
|
||||
|
||||
assertFalse( "Check not included",
|
||||
artifacts.contains( createArtifact( "org.apache.maven.update", "test-not-updated", "1.0" ) ) );
|
||||
}
|
||||
|
||||
public void testNoRepositoryMetadata()
|
||||
throws ComponentLookupException, DiscovererException, ParseException, IOException
|
||||
{
|
||||
removeTimestampMetadata();
|
||||
|
||||
// should find all
|
||||
List artifacts = discoverArtifactsWithSnapshots();
|
||||
assertNotNull( "Check artifacts not null", artifacts );
|
||||
|
||||
assertTrue( "Check included",
|
||||
artifacts.contains( createArtifact( "org.apache.maven.update", "test-updated", "1.0" ) ) );
|
||||
}
|
||||
|
||||
private List discoverUpdateArtifactsWithSnapshots()
|
||||
throws DiscovererException
|
||||
{
|
||||
return discoverer.discoverArtifacts( repository, UPDATE_OPERATION, null, new AcceptAllArtifactFilter() );
|
||||
}
|
||||
|
||||
private List discoverArtifactsWithSnapshots()
|
||||
throws DiscovererException
|
||||
{
|
||||
return discoverer.discoverArtifacts( repository, TEST_OPERATION, null, new AcceptAllArtifactFilter() );
|
||||
}
|
||||
|
||||
private void removeTimestampMetadata()
|
||||
{
|
||||
// remove the metadata that tracks time
|
||||
File file = new File( repository.getBasedir(), "maven-metadata.xml" );
|
||||
file.delete();
|
||||
assertFalse( file.exists() );
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
|
|
@ -163,118 +163,6 @@ public class DefaultMetadataDiscovererTest
|
|||
assertTrue( "Check included", containsMetadata( metadataPaths, metadata ) );
|
||||
}
|
||||
|
||||
/* TODO!
|
||||
public void testUpdatedInRepository()
|
||||
throws ComponentLookupException, DiscovererException, ParseException, IOException
|
||||
{
|
||||
// Set repository time to 1-1-2000, a time in the distant past so definitely updated
|
||||
discoverer.setLastCheckedTime( repository, "update",
|
||||
new SimpleDateFormat( "yyyy-MM-dd", Locale.US ).parse( "2000-01-01" ) );
|
||||
|
||||
List metadataPaths = discoverer.discoverMetadata( repository, "update", null );
|
||||
assertNotNull( "Check metadata not null", metadataPaths );
|
||||
|
||||
RepositoryMetadata metadata =
|
||||
new ArtifactRepositoryMetadata( createArtifact( "org.apache.maven.update", "test-updated" ) );
|
||||
assertTrue( "Check included", containsMetadata( metadataPaths, metadata ) );
|
||||
|
||||
// try again with the updated timestamp
|
||||
metadataPaths = discoverer.discoverMetadata( repository, "update", null );
|
||||
assertNotNull( "Check metadata not null", metadataPaths );
|
||||
|
||||
assertFalse( "Check not included", containsMetadata( metadataPaths, metadata ) );
|
||||
}
|
||||
|
||||
public void testNotUpdatedInRepository()
|
||||
throws ComponentLookupException, DiscovererException, IOException
|
||||
{
|
||||
// Set repository time to now, which is after any artifacts, so definitely not updated
|
||||
discoverer.setLastCheckedTime( repository, "update", new Date() );
|
||||
|
||||
List metadataPaths = discoverer.discoverMetadata( repository, "update", null );
|
||||
assertNotNull( "Check metadata not null", metadataPaths );
|
||||
|
||||
RepositoryMetadata metadata =
|
||||
new ArtifactRepositoryMetadata( createArtifact( "org.apache.maven.update", "test-not-updated" ) );
|
||||
assertFalse( "Check not included", containsMetadata( metadataPaths, metadata ) );
|
||||
}
|
||||
|
||||
public void testNotUpdatedInRepositoryForcedDiscovery()
|
||||
throws ComponentLookupException, DiscovererException, IOException
|
||||
{
|
||||
discoverer.resetLastCheckedTime( repository, "update" );
|
||||
|
||||
List metadataPaths = discoverer.discoverMetadata( repository, "update", null );
|
||||
assertNotNull( "Check metadata not null", metadataPaths );
|
||||
|
||||
RepositoryMetadata metadata =
|
||||
new ArtifactRepositoryMetadata( createArtifact( "org.apache.maven.update", "test-not-updated" ) );
|
||||
assertTrue( "Check included", containsMetadata( metadataPaths, metadata ) );
|
||||
|
||||
// try again with the updated timestamp
|
||||
metadataPaths = discoverer.discoverMetadata( repository, "update", null );
|
||||
assertNotNull( "Check metadata not null", metadataPaths );
|
||||
|
||||
assertFalse( "Check not included", containsMetadata( metadataPaths, metadata ) );
|
||||
}
|
||||
|
||||
public void testNotUpdatedInRepositoryForcedDiscoveryMetadataAlreadyExists()
|
||||
throws ComponentLookupException, DiscovererException, IOException
|
||||
{
|
||||
discoverer.setLastCheckedTime( repository, "update", new Date() );
|
||||
|
||||
discoverer.resetLastCheckedTime( repository, "update" );
|
||||
|
||||
List metadataPaths = discoverer.discoverMetadata( repository, "update", null );
|
||||
assertNotNull( "Check metadata not null", metadataPaths );
|
||||
|
||||
RepositoryMetadata metadata =
|
||||
new ArtifactRepositoryMetadata( createArtifact( "org.apache.maven.update", "test-not-updated" ) );
|
||||
assertTrue( "Check included", containsMetadata( metadataPaths, metadata ) );
|
||||
|
||||
// try again with the updated timestamp
|
||||
metadataPaths = discoverer.discoverMetadata( repository, "update", null );
|
||||
assertNotNull( "Check metadata not null", metadataPaths );
|
||||
|
||||
assertFalse( "Check not included", containsMetadata( metadataPaths, metadata ) );
|
||||
}
|
||||
|
||||
public void testNotUpdatedInRepositoryForcedDiscoveryOtherMetadataAlreadyExists()
|
||||
throws ComponentLookupException, DiscovererException, IOException
|
||||
{
|
||||
discoverer.setLastCheckedTime( repository, "test", new Date() );
|
||||
|
||||
discoverer.resetLastCheckedTime( repository, "update" );
|
||||
|
||||
List metadataPaths = discoverer.discoverMetadata( repository, "update", null );
|
||||
assertNotNull( "Check metadata not null", metadataPaths );
|
||||
|
||||
RepositoryMetadata metadata =
|
||||
new ArtifactRepositoryMetadata( createArtifact( "org.apache.maven.update", "test-not-updated" ) );
|
||||
assertTrue( "Check included", containsMetadata( metadataPaths, metadata ) );
|
||||
|
||||
// try again with the updated timestamp
|
||||
metadataPaths = discoverer.discoverMetadata( repository, "update", null );
|
||||
assertNotNull( "Check metadata not null", metadataPaths );
|
||||
|
||||
assertFalse( "Check not included", containsMetadata( metadataPaths, metadata ) );
|
||||
}
|
||||
|
||||
public void testNoRepositoryMetadata()
|
||||
throws ComponentLookupException, DiscovererException, ParseException, IOException
|
||||
{
|
||||
removeTimestampMetadata();
|
||||
|
||||
// should find all
|
||||
List metadataPaths = discoverer.discoverMetadata( repository, TEST_OPERATION, null );
|
||||
assertNotNull( "Check metadata not null", metadataPaths );
|
||||
|
||||
RepositoryMetadata metadata =
|
||||
new ArtifactRepositoryMetadata( createArtifact( "org.apache.maven.update", "test-updated" ) );
|
||||
assertTrue( "Check included", containsMetadata( metadataPaths, metadata ) );
|
||||
}
|
||||
*/
|
||||
|
||||
protected Artifact createArtifact( String groupId, String artifactId )
|
||||
{
|
||||
return createArtifact( groupId, artifactId, "1.0" );
|
||||
|
|
Loading…
Reference in New Issue