Switching to new API

This commit is contained in:
Martin Stockhammer 2020-06-07 19:09:02 +02:00
parent 91900a6376
commit aa8de8c74b
3 changed files with 10 additions and 9 deletions

View File

@ -47,7 +47,7 @@ public class ArchivaRepositoryScanningTaskExecutorPhase1Test
taskExecutor.executeTask( repoTask ); taskExecutor.executeTask( repoTask );
Collection<ArtifactReference> unprocessedResultList = testConsumer.getConsumed(); Collection<String> unprocessedResultList = testConsumer.getConsumed();
assertNotNull( unprocessedResultList ); assertNotNull( unprocessedResultList );
assertEquals( "Incorrect number of unprocessed artifacts detected.", 8, unprocessedResultList.size() ); assertEquals( "Incorrect number of unprocessed artifacts detected.", 8, unprocessedResultList.size() );

View File

@ -58,7 +58,7 @@ public class ArchivaRepositoryScanningTaskExecutorPhase2Test
taskExecutor.executeTask( repoTask ); taskExecutor.executeTask( repoTask );
// check no artifacts processed // check no artifacts processed
Collection<ArtifactReference> unprocessedResultList = testConsumer.getConsumed(); Collection<String> unprocessedResultList = testConsumer.getConsumed();
assertNotNull( unprocessedResultList ); assertNotNull( unprocessedResultList );
assertEquals( "Incorrect number of unprocessed artifacts detected. No new artifacts should have been found.", 0, assertEquals( "Incorrect number of unprocessed artifacts detected. No new artifacts should have been found.", 0,
@ -139,7 +139,7 @@ public class ArchivaRepositoryScanningTaskExecutorPhase2Test
taskExecutor.executeTask( repoTask ); taskExecutor.executeTask( repoTask );
// check no artifacts processed // check no artifacts processed
Collection<ArtifactReference> unprocessedResultList = testConsumer.getConsumed(); Collection<String> unprocessedResultList = testConsumer.getConsumed();
assertNotNull( unprocessedResultList ); assertNotNull( unprocessedResultList );
assertEquals( "Incorrect number of unprocessed artifacts detected. One new artifact should have been found.", 1, assertEquals( "Incorrect number of unprocessed artifacts detected. One new artifact should have been found.", 1,
unprocessedResultList.size() ); unprocessedResultList.size() );
@ -186,7 +186,7 @@ public class ArchivaRepositoryScanningTaskExecutorPhase2Test
taskExecutor.executeTask( repoTask ); taskExecutor.executeTask( repoTask );
// check no artifacts processed // check no artifacts processed
Collection<ArtifactReference> unprocessedResultList = testConsumer.getConsumed(); Collection<String> unprocessedResultList = testConsumer.getConsumed();
assertNotNull( unprocessedResultList ); assertNotNull( unprocessedResultList );
assertEquals( "Incorrect number of unprocessed artifacts detected. One new artifact should have been found.", 1, assertEquals( "Incorrect number of unprocessed artifacts detected. One new artifact should have been found.", 1,
unprocessedResultList.size() ); unprocessedResultList.size() );
@ -219,7 +219,7 @@ public class ArchivaRepositoryScanningTaskExecutorPhase2Test
taskExecutor.executeTask( repoTask ); taskExecutor.executeTask( repoTask );
Collection<ArtifactReference> unprocessedResultList = testConsumer.getConsumed(); Collection<String> unprocessedResultList = testConsumer.getConsumed();
assertNotNull( unprocessedResultList ); assertNotNull( unprocessedResultList );
assertEquals( "Incorrect number of unprocessed artifacts detected.", 8, unprocessedResultList.size() ); assertEquals( "Incorrect number of unprocessed artifacts detected.", 8, unprocessedResultList.size() );

View File

@ -43,7 +43,7 @@ public class TestConsumer
extends AbstractMonitoredConsumer extends AbstractMonitoredConsumer
implements KnownRepositoryContentConsumer implements KnownRepositoryContentConsumer
{ {
private Set<ArtifactReference> consumed = new HashSet<ArtifactReference>(); private Set<String> consumed = new HashSet<>();
@Inject @Inject
private RepositoryContentFactory factory; private RepositoryContentFactory factory;
@ -98,11 +98,12 @@ public class TestConsumer
{ {
try try
{ {
consumed.add( repository.toArtifactReference( path ) ); repository.toItemSelector( path );
consumed.add( path );
} }
catch ( LayoutException e ) catch ( LayoutException e )
{ {
throw new ConsumerException( e.getMessage(), e ); // Layout exception for specific paths
} }
} }
} }
@ -125,7 +126,7 @@ public class TestConsumer
completeScan(); completeScan();
} }
public Collection<ArtifactReference> getConsumed() public Collection<String> getConsumed()
{ {
return consumed; return consumed;
} }