continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r822551 - /continuum/branches/continuum-1.3.x/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java
Date Wed, 07 Oct 2009 02:17:10 GMT
Author: ctan
Date: Wed Oct  7 02:17:10 2009
New Revision: 822551

URL: http://svn.apache.org/viewvc?rev=822551&view=rev
Log:
fixed unit test for removing a project with build result

Modified:
    continuum/branches/continuum-1.3.x/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java

Modified: continuum/branches/continuum-1.3.x/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java?rev=822551&r1=822550&r2=822551&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java
(original)
+++ continuum/branches/continuum-1.3.x/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java
Wed Oct  7 02:17:10 2009
@@ -27,6 +27,7 @@
 import java.util.Map;
 
 import org.apache.continuum.buildmanager.BuildsManager;
+import org.apache.continuum.dao.BuildResultDao;
 import org.apache.continuum.dao.ProjectDao;
 import org.apache.continuum.model.release.ContinuumReleaseResult;
 import org.apache.continuum.model.repository.LocalRepository;
@@ -37,6 +38,7 @@
 import org.apache.maven.continuum.execution.ContinuumBuildExecutorConstants;
 import org.apache.maven.continuum.initialization.ContinuumInitializer;
 import org.apache.maven.continuum.model.project.BuildDefinition;
+import org.apache.maven.continuum.model.project.BuildResult;
 import org.apache.maven.continuum.model.project.Project;
 import org.apache.maven.continuum.model.project.ProjectGroup;
 import org.apache.maven.continuum.model.project.ProjectNotifier;
@@ -62,6 +64,8 @@
 
     private ProjectDao projectDao;
 
+    private BuildResultDao buildResultDao;
+
     @Override
     protected void setUp()
         throws Exception
@@ -170,39 +174,40 @@
     {
         Continuum continuum = (Continuum) lookup( Continuum.ROLE );
 
-        String url = getTestFile( "src/test-projects/project1/pom.xml" ).toURL().toExternalForm();
+        Project project = makeStubProject( "test-project" );
 
-        ContinuumProjectBuildingResult result = continuum.addMavenTwoProject( url );
+        ProjectGroup defaultGroup = getDefaultProjectGroup();
 
-        assertNotNull( result );
+        defaultGroup.addProject( project );
 
-        List<Project> projects = result.getProjects();
+        getProjectGroupDao().updateProjectGroup( defaultGroup );
 
-        assertEquals( 1, projects.size() );
+        project = getProjectDao().getProjectByName( "test-project" );
 
-        assertEquals( Project.class, projects.get( 0 ).getClass() );
+        assertNotNull ( project );
 
-        Project project = projects.get( 0 );
+        BuildResult buildResult = new BuildResult();
 
-        continuum.buildProject( project.getId() );
+        getBuildResultDao().addBuildResult( project, buildResult );
 
-        // wait for build to finish
-        Thread.sleep( 5000 );
+        Collection<BuildResult> brs = continuum.getBuildResultsForProject( project.getId()
);
+
+        assertEquals( "Build result of project was not added", 1, brs.size() );
 
         // delete project
         continuum.removeProject( project.getId() );
 
         try
         {
-            project = continuum.getProject( project.getId() );
-            
-            assertNull( project );
+            continuum.getProject( project.getId() );
 
             fail( "Project was not removed" );
         }
-        catch ( Exception e )
+        catch ( ContinuumException expected )
         {
-            // successfully removed project
+            brs = continuum.getBuildResultsForProject( project.getId() );
+
+            assertEquals( "Build result of project was not removed", 0, brs.size() );
         }
     }
 
@@ -620,4 +625,9 @@
     {
         return (Continuum) lookup( Continuum.ROLE );
     }
+
+    private BuildResultDao getBuildResultDao()
+    {
+        return (BuildResultDao) lookup( BuildResultDao.class.getName() );
+    }
 }



Mime
View raw message