private List<KnownRepositoryContentConsumer> selectedKnownConsumers;
private List<InvalidRepositoryContentConsumer> selectedInvalidConsumers;
+
+ private Date startTime;
/**
* <p>
// Run the repository consumers
try
{
- Closure triggerBeginScan = new TriggerBeginScanClosure( repository, new Date( System.currentTimeMillis() ) );
+ Closure triggerBeginScan = new TriggerBeginScanClosure( repository, getStartTime() );
List<KnownRepositoryContentConsumer> selectedKnownConsumers = getSelectedKnownConsumers();
List<InvalidRepositoryContentConsumer> selectedInvalidConsumers = getSelectedInvalidConsumers();
{
this.selectedInvalidConsumers = selectedInvalidConsumers;
}
+
+ public void setStartTime( Date startTime )
+ {
+ this.startTime = startTime;
+ }
+
+ public Date getStartTime()
+ {
+ if( startTime == null )
+ {
+ startTime = new Date( System.currentTimeMillis() );
+ }
+ return startTime;
+ }
}
import java.io.File;
import java.util.Arrays;
import java.util.Collections;
+import java.util.Date;
import java.util.List;
import java.util.Map;
ManagedRepositoryConfiguration repo = createRepository( "id", "name", getTestFile( "target/test-repo" ) );
File testFile = getTestFile( "target/test-repo/path/to/test-file.txt" );
- selectedKnownConsumer.beginScan( repo, null );
+ Date startTime = new Date( System.currentTimeMillis() );
+
+ selectedKnownConsumer.beginScan( repo, startTime );
selectedKnownConsumer.getExcludes();
knownControl.setReturnValue( Collections.EMPTY_LIST );
selectedKnownConsumer.getIncludes();
// knownConsumer.completeScan();
knownControl.replay();
- selectedInvalidConsumer.beginScan( repo, null );
+ selectedInvalidConsumer.beginScan( repo, startTime );
// invalidConsumer.completeScan();
invalidControl.replay();
+ consumers.setStartTime( startTime );
consumers.executeConsumers( repo, testFile );
knownControl.verify();
File notIncludedTestFile = getTestFile( "target/test-repo/path/to/test-file.xml" );
- selectedKnownConsumer.beginScan( repo, null );
+ selectedKnownConsumer.beginScan( repo, startTime );
selectedKnownConsumer.getExcludes();
knownControl.setReturnValue( Collections.EMPTY_LIST );
selectedKnownConsumer.getIncludes();
// knownConsumer.completeScan();
knownControl.replay();
- selectedInvalidConsumer.beginScan( repo, null );
+ selectedInvalidConsumer.beginScan( repo, startTime );
selectedInvalidConsumer.processFile( _OS( "path/to/test-file.xml" ) );
selectedInvalidConsumer.getId();
invalidControl.setReturnValue( "invalid" );
File excludedTestFile = getTestFile( "target/test-repo/path/to/test-file.txt" );
- selectedKnownConsumer.beginScan( repo, null );
+ selectedKnownConsumer.beginScan( repo, startTime );
selectedKnownConsumer.getExcludes();
knownControl.setReturnValue( Collections.singletonList( "**/test-file.txt" ) );
// knownConsumer.completeScan();
knownControl.replay();
- selectedInvalidConsumer.beginScan( repo, null );
+ selectedInvalidConsumer.beginScan( repo, startTime );
selectedInvalidConsumer.processFile( _OS( "path/to/test-file.txt" ) );
selectedInvalidConsumer.getId();
invalidControl.setReturnValue( "invalid" );