]> source.dussan.org Git - archiva.git/commitdiff
adding in some tests for making sure the tasks are executing correctly
authorJesse McConnell <jmcconnell@apache.org>
Fri, 13 Apr 2007 19:58:09 +0000 (19:58 +0000)
committerJesse McConnell <jmcconnell@apache.org>
Fri, 13 Apr 2007 19:58:09 +0000 (19:58 +0000)
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/branches@528637 13f79535-47bb-0310-9956-ffa450edef68

archiva-jpox-database-refactor/archiva-scheduled/pom.xml
archiva-jpox-database-refactor/archiva-scheduled/src/test/java/org/apache/maven/archiva/scheduled/executors/ArchivaScheduledTaskExecutorTest.java

index eab4dd58cb080953fdf98d8d3dda2f203ae23ec6..ce05eb74c87a680cb98d4baf06f3c8b4b707c5f7 100644 (file)
       <groupId>org.apache.maven.archiva</groupId>
       <artifactId>archiva-database-consumers</artifactId>
     </dependency>
-    <dependency>
-      <groupId>org.apache.maven.archiva</groupId>
-      <artifactId>archiva-lucene-consumers</artifactId>
-    </dependency>
     <dependency>
       <groupId>org.codehaus.plexus</groupId>
       <artifactId>plexus-taskqueue</artifactId>
index 19516a4481b526f3f85d2cd15ba5878ebaaf45cb..7a60d5f999ce0e1acde191041c69ba0c29bce984 100644 (file)
@@ -22,6 +22,7 @@ package org.apache.maven.archiva.scheduled.executors;
 import java.io.File;
 import java.net.URL;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Map;
 import java.util.Properties;
 
@@ -31,8 +32,12 @@ import javax.jdo.PersistenceManagerFactory;
 
 import org.apache.commons.lang.StringUtils;
 import org.apache.maven.archiva.database.ArchivaDAO;
+import org.apache.maven.archiva.database.ArtifactDAO;
 import org.apache.maven.archiva.database.RepositoryDAO;
+import org.apache.maven.archiva.database.constraints.ArtifactsProcessedConstraint;
+import org.apache.maven.archiva.model.ArchivaArtifact;
 import org.apache.maven.archiva.model.ArchivaRepository;
+import org.apache.maven.archiva.scheduled.tasks.DatabaseTask;
 import org.apache.maven.archiva.scheduled.tasks.RepositoryTask;
 import org.codehaus.plexus.PlexusTestCase;
 import org.codehaus.plexus.jdo.DefaultConfigurableJdoFactory;
@@ -163,10 +168,34 @@ public class ArchivaScheduledTaskExecutorTest
 
         RepositoryTask repoTask = new RepositoryTask();
         
-        repoTask.setName( "testTask" );
+        repoTask.setName( "testRepoTask" );
         repoTask.setRepositoryId( "testRepo" );
         
         taskExecutor.executeTask( repoTask );
+        
+        ArtifactDAO adao = dao.getArtifactDAO();
+        
+        ArchivaArtifact artifact = adao.getArtifact( "javax.sql", "jdbc", "2.0", null, "jar" );
+        
+        assertNotNull( artifact );
+        
+        List results = dao.getArtifactDAO().queryArtifacts( new ArtifactsProcessedConstraint( false ) );
+        
+        assertNotNull( results );
+        assertEquals("Incorrect number of unprocessed artifacts detected.", results.size(), 8 );
+        
+        DatabaseTask dataTask = new DatabaseTask();
+        
+        dataTask.setName( "testDataTask" );
+
+        taskExecutor.executeTask( dataTask );
+        
+        List newResults = dao.getArtifactDAO().queryArtifacts( new ArtifactsProcessedConstraint( false ) );
+        
+        assertNotNull( newResults );
+        assertEquals("Incorrect number of unprocessed artifacts detected.", newResults.size(), 0 );
+        assertEquals("Incorrect number of processed artifacts detected.", newResults.size(), 8 );
+        
 
     }