You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@continuum.apache.org by ev...@apache.org on 2007/01/12 11:31:54 UTC

svn commit: r495539 - in /maven/continuum/trunk/continuum-store/src/test/java/org/apache/maven/continuum/store: AbstractContinuumStoreTestCase.java ContinuumStoreTest.java

Author: evenisse
Date: Fri Jan 12 02:31:54 2007
New Revision: 495539

URL: http://svn.apache.org/viewvc?view=rev&rev=495539
Log:
[CONTINUUM-1103] Add more tests on build definitions update
Submitted by: Marcelo Takeshi Fukushima 

Modified:
    maven/continuum/trunk/continuum-store/src/test/java/org/apache/maven/continuum/store/AbstractContinuumStoreTestCase.java
    maven/continuum/trunk/continuum-store/src/test/java/org/apache/maven/continuum/store/ContinuumStoreTest.java

Modified: maven/continuum/trunk/continuum-store/src/test/java/org/apache/maven/continuum/store/AbstractContinuumStoreTestCase.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-store/src/test/java/org/apache/maven/continuum/store/AbstractContinuumStoreTestCase.java?view=diff&rev=495539&r1=495538&r2=495539
==============================================================================
--- maven/continuum/trunk/continuum-store/src/test/java/org/apache/maven/continuum/store/AbstractContinuumStoreTestCase.java (original)
+++ maven/continuum/trunk/continuum-store/src/test/java/org/apache/maven/continuum/store/AbstractContinuumStoreTestCase.java Fri Jan 12 02:31:54 2007
@@ -272,20 +272,22 @@
         testProfile3.setId( profile3.getId() );
 
         BuildDefinition testGroupBuildDefinition1 =
-            createTestBuildDefinition( "arguments1", "buildFile1", "goals1", profile1, schedule2 );
+            createTestBuildDefinition( "arguments1", "buildFile1", "goals1", profile1, schedule2, false, false );
         BuildDefinition testGroupBuildDefinition2 =
-            createTestBuildDefinition( "arguments2", "buildFile2", "goals2", profile1, schedule1 );
+            createTestBuildDefinition( "arguments2", "buildFile2", "goals2", profile1, schedule1, false, false );
         BuildDefinition testGroupBuildDefinition3 =
-            createTestBuildDefinition( "arguments3", "buildFile3", "goals3", profile2, schedule1 );
-        BuildDefinition testGroupBuildDefinition4 = createTestBuildDefinition( null, null, "deploy", null, null );
+            createTestBuildDefinition( "arguments3", "buildFile3", "goals3", profile2, schedule1, false, false );
+        BuildDefinition testGroupBuildDefinition4 =
+            createTestBuildDefinition( null, null, "deploy", null, null, false, false );
 
         BuildDefinition testBuildDefinition1 =
-            createTestBuildDefinition( "arguments11", "buildFile11", "goals11", profile2, schedule1 );
+            createTestBuildDefinition( "arguments11", "buildFile11", "goals11", profile2, schedule1, false, false );
         BuildDefinition testBuildDefinition2 =
-            createTestBuildDefinition( "arguments12", "buildFile12", "goals12", profile2, schedule2 );
+            createTestBuildDefinition( "arguments12", "buildFile12", "goals12", profile2, schedule2, false, false );
         BuildDefinition testBuildDefinition3 =
-            createTestBuildDefinition( "arguments13", "buildFile13", "goals13", profile1, schedule2 );
-        BuildDefinition testBuildDefinition4 = createTestBuildDefinition( null, null, "deploy", null, null );
+            createTestBuildDefinition( "arguments13", "buildFile13", "goals13", profile1, schedule2, false, false );
+        BuildDefinition testBuildDefinition4 =
+            createTestBuildDefinition( null, null, "deploy", null, null, false, false );
 
         ProjectGroup group = createTestProjectGroup( defaultProjectGroup );
 
@@ -631,11 +633,13 @@
     {
         return createTestBuildDefinition( buildDefinition.getArguments(), buildDefinition.getBuildFile(),
                                           buildDefinition.getGoals(), buildDefinition.getProfile(),
-                                          buildDefinition.getSchedule() );
+                                          buildDefinition.getSchedule(), buildDefinition.isDefaultForProject(),
+                                          buildDefinition.isBuildFresh() );
     }
 
     protected static BuildDefinition createTestBuildDefinition( String arguments, String buildFile, String goals,
-                                                                Profile profile, Schedule schedule )
+                                                                Profile profile, Schedule schedule,
+                                                                boolean defaultForProject, boolean buildFresh )
     {
         BuildDefinition definition = new BuildDefinition();
         definition.setArguments( arguments );
@@ -643,6 +647,8 @@
         definition.setGoals( goals );
         definition.setProfile( profile );
         definition.setSchedule( schedule );
+        definition.setDefaultForProject( defaultForProject );
+        definition.setBuildFresh( buildFresh );
         return definition;
     }
 
@@ -868,7 +874,8 @@
             assertNotSame( expectedSchedule, actualSchedule );
             assertEquals( "compare schedule - id", expectedSchedule.getId(), actualSchedule.getId() );
             assertEquals( "compare schedule - name", expectedSchedule.getName(), actualSchedule.getName() );
-            assertEquals( "compare schedule - desc", expectedSchedule.getDescription(), actualSchedule.getDescription() );
+            assertEquals( "compare schedule - desc", expectedSchedule.getDescription(),
+                          actualSchedule.getDescription() );
             assertEquals( "compare schedule - delay", expectedSchedule.getDelay(), actualSchedule.getDelay() );
             assertEquals( "compare schedule - cron", expectedSchedule.getCronExpression(),
                           actualSchedule.getCronExpression() );
@@ -981,6 +988,10 @@
                       actualBuildDefinition.getBuildFile() );
         assertEquals( "compare build definition - goals", expectedBuildDefinition.getGoals(),
                       actualBuildDefinition.getGoals() );
+        assertEquals( "compare build definition - build fresh", expectedBuildDefinition.isBuildFresh(),
+                      actualBuildDefinition.isBuildFresh() );
+        assertEquals( "compare build definition - defaultForProject", expectedBuildDefinition.isDefaultForProject(),
+                      actualBuildDefinition.isDefaultForProject() );
     }
 
     protected static void assertDevelopersEqual( List expectedDevelopers, List actualDevelopers )

Modified: maven/continuum/trunk/continuum-store/src/test/java/org/apache/maven/continuum/store/ContinuumStoreTest.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-store/src/test/java/org/apache/maven/continuum/store/ContinuumStoreTest.java?view=diff&rev=495539&r1=495538&r2=495539
==============================================================================
--- maven/continuum/trunk/continuum-store/src/test/java/org/apache/maven/continuum/store/ContinuumStoreTest.java (original)
+++ maven/continuum/trunk/continuum-store/src/test/java/org/apache/maven/continuum/store/ContinuumStoreTest.java Fri Jan 12 02:31:54 2007
@@ -39,7 +39,9 @@
 /**
  * @author <a href="mailto:brett@apache.org">Brett Porter</a>
  * @version $Id$
- * @todo I think this should have all the JDO stuff from the abstract test, and the abstract test should use a mock continuum store with the exception of the integration tests which should be running against a fully deployed plexus application instead
+ * @todo I think this should have all the JDO stuff from the abstract test, and the abstract test
+ * should use a mock continuum store with the exception of the integration tests which should be
+ * running against a fully deployed plexus application instead
  * @todo review for ambiguities and ensure it is all encapsulated in the store, otherwise the code may make the same mistake about not deleting things, etc
  */
 public class ContinuumStoreTest
@@ -209,7 +211,7 @@
     {
         Project retrievedProject = store.getProjectWithCheckoutResult( testProject1.getId() );
         assertProjectEquals( testProject1, retrievedProject );
-        assertScmResultEquals( testCheckoutResult1, retrievedProject.getCheckoutResult()  );
+        assertScmResultEquals( testCheckoutResult1, retrievedProject.getCheckoutResult() );
         checkProjectFetchGroup( retrievedProject, true, false, false, false );
     }
 
@@ -729,8 +731,8 @@
 
         Profile profile = store.getProfile( testProfile1.getId() );
         Schedule schedule = store.getSchedule( testSchedule1.getId() );
-        BuildDefinition buildDefinition =
-            createTestBuildDefinition( "TABDTP arguments", "TABDTP buildFile", "TABDTP goals", profile, schedule );
+        BuildDefinition buildDefinition = createTestBuildDefinition( "TABDTP arguments", "TABDTP buildFile",
+                                                                     "TABDTP goals", profile, schedule, false, false );
         BuildDefinition copy = createTestBuildDefinition( buildDefinition );
         project.addBuildDefinition( buildDefinition );
         store.updateProject( project );
@@ -749,12 +751,13 @@
         Project project = store.getProjectWithAllDetails( testProject1.getId() );
 
         BuildDefinition newBuildDefinition = (BuildDefinition) project.getBuildDefinitions().get( 0 );
-        // If we use "arguments1.1", jpox-rc2 store "arguments11", weird
-        String arguments = "arguments11";
+        newBuildDefinition.setBuildFresh( true );
+        new BuildDefinition().setDefaultForProject( true );
+        String arguments = "arguments1.1";
         newBuildDefinition.setArguments( arguments );
 
         BuildDefinition copy = createTestBuildDefinition( newBuildDefinition );
-        store.updateProject( project );
+        store.storeBuildDefinition( newBuildDefinition );
 
         project = store.getProjectWithAllDetails( testProject1.getId() );
         assertEquals( "check # build defs", 2, project.getBuildDefinitions().size() );
@@ -840,8 +843,8 @@
 
         Profile profile = store.getProfile( testProfile1.getId() );
         Schedule schedule = store.getSchedule( testSchedule1.getId() );
-        BuildDefinition buildDefinition =
-            createTestBuildDefinition( "TABDTPG arguments", "TABDTPG buildFile", "TABDTPG goals", profile, schedule );
+        BuildDefinition buildDefinition = createTestBuildDefinition( "TABDTPG arguments", "TABDTPG buildFile",
+                                                                     "TABDTPG goals", profile, schedule, false, false );
         BuildDefinition copy = createTestBuildDefinition( buildDefinition );
         projectGroup.addBuildDefinition( buildDefinition );
         store.updateProjectGroup( projectGroup );