aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-base
diff options
context:
space:
mode:
authorMaria Odea B. Ching <oching@apache.org>2008-04-28 06:21:54 +0000
committerMaria Odea B. Ching <oching@apache.org>2008-04-28 06:21:54 +0000
commit0b42dd6a563d6fc6d8353ff113a9594af6e18f2e (patch)
treefc5a4190c8c083e6adabce060b85ce5796308fb4 /archiva-modules/archiva-base
parentae9d0d6a1248e1d1ac5f0980dbee34651b95b42b (diff)
downloadarchiva-0b42dd6a563d6fc6d8353ff113a9594af6e18f2e.tar.gz
archiva-0b42dd6a563d6fc6d8353ff113a9594af6e18f2e.zip
-added startTime variable to contain when the consumers were executed
-added get and set method for the variable to be able to set it in the tests git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@652068 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/archiva-base')
-rw-r--r--archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumers.java18
-rw-r--r--archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumersTest.java16
2 files changed, 27 insertions, 7 deletions
diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumers.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumers.java
index 549aba12a..045ed6a8b 100644
--- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumers.java
+++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumers.java
@@ -71,6 +71,8 @@ public class RepositoryContentConsumers
private List<KnownRepositoryContentConsumer> selectedKnownConsumers;
private List<InvalidRepositoryContentConsumer> selectedInvalidConsumers;
+
+ private Date startTime;
/**
* <p>
@@ -264,7 +266,7 @@ public class RepositoryContentConsumers
// 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();
@@ -307,4 +309,18 @@ public class RepositoryContentConsumers
{
this.selectedInvalidConsumers = selectedInvalidConsumers;
}
+
+ public void setStartTime( Date startTime )
+ {
+ this.startTime = startTime;
+ }
+
+ public Date getStartTime()
+ {
+ if( startTime == null )
+ {
+ startTime = new Date( System.currentTimeMillis() );
+ }
+ return startTime;
+ }
}
diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumersTest.java b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumersTest.java
index e39878fce..06fd18abb 100644
--- a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumersTest.java
+++ b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumersTest.java
@@ -29,6 +29,7 @@ import org.easymock.MockControl;
import java.io.File;
import java.util.Arrays;
import java.util.Collections;
+import java.util.Date;
import java.util.List;
import java.util.Map;
@@ -209,7 +210,9 @@ public class RepositoryContentConsumersTest
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();
@@ -218,10 +221,11 @@ public class RepositoryContentConsumersTest
// 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();
@@ -232,7 +236,7 @@ public class RepositoryContentConsumersTest
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();
@@ -240,7 +244,7 @@ public class RepositoryContentConsumersTest
// 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" );
@@ -257,13 +261,13 @@ public class RepositoryContentConsumersTest
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" );