continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r759429 - in /continuum/trunk: continuum-data-management/data-management-jdo/src/main/java/org/apache/maven/continuum/management/ continuum-data-management/data-management-jdo/src/test/resources/ continuum-store/src/test/java/org/apache/mav...
Date Sat, 28 Mar 2009 04:43:13 GMT
Author: ctan
Date: Sat Mar 28 04:43:11 2009
New Revision: 759429

URL: http://svn.apache.org/viewvc?rev=759429&view=rev
Log:
[CONTINUUM-2159] set builddefinitions in builddefinitiontemplate to null during restore and
fixed tests


Modified:
    continuum/trunk/continuum-data-management/data-management-jdo/src/main/java/org/apache/maven/continuum/management/JdoDataManagementTool.java
    continuum/trunk/continuum-data-management/data-management-jdo/src/test/resources/expected.xml
    continuum/trunk/continuum-store/src/test/java/org/apache/maven/continuum/store/AbstractContinuumStoreTestCase.java
    continuum/trunk/continuum-store/src/test/java/org/apache/maven/continuum/store/ContinuumStoreTest.java

Modified: continuum/trunk/continuum-data-management/data-management-jdo/src/main/java/org/apache/maven/continuum/management/JdoDataManagementTool.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-data-management/data-management-jdo/src/main/java/org/apache/maven/continuum/management/JdoDataManagementTool.java?rev=759429&r1=759428&r2=759429&view=diff
==============================================================================
--- continuum/trunk/continuum-data-management/data-management-jdo/src/main/java/org/apache/maven/continuum/management/JdoDataManagementTool.java
(original)
+++ continuum/trunk/continuum-data-management/data-management-jdo/src/main/java/org/apache/maven/continuum/management/JdoDataManagementTool.java
Sat Mar 28 04:43:11 2009
@@ -312,13 +312,13 @@
             ProjectGroup projectGroup = (ProjectGroup) i.next();
 
             // first, we must map up any schedules, etc.
-            processBuildDefinitions( projectGroup.getBuildDefinitions(), schedules, profiles,
localRepositories );
+            processBuildDefinitions( projectGroup.getBuildDefinitions(), schedules, profiles
);
 
             for ( Iterator j = projectGroup.getProjects().iterator(); j.hasNext(); )
             {
                 Project project = (Project) j.next();
 
-                processBuildDefinitions( project.getBuildDefinitions(), schedules, profiles,
localRepositories );
+                processBuildDefinitions( project.getBuildDefinitions(), schedules, profiles
);
             }
             
             if ( projectGroup.getLocalRepository() != null )
@@ -408,6 +408,8 @@
 
         for ( BuildDefinitionTemplate template : (List<BuildDefinitionTemplate>) database.getBuildDefinitionTemplates()
)
         {
+            template.setBuildDefinitions( null );
+
             template = 
                 (BuildDefinitionTemplate) PlexusJdoUtils.addObject( pmf.getPersistenceManager(),
template );
         }
@@ -432,8 +434,7 @@
     }
     
     private static void processBuildDefinitions( List buildDefinitions, Map<Integer, Schedule>
schedules,
-                                                 Map<Integer, Profile> profiles,
-                                                 Map<Integer, LocalRepository> localRepositories
)
+                                                 Map<Integer, Profile> profiles )
     {
         for ( Iterator i = buildDefinitions.iterator(); i.hasNext(); )
         {

Modified: continuum/trunk/continuum-data-management/data-management-jdo/src/test/resources/expected.xml
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-data-management/data-management-jdo/src/test/resources/expected.xml?rev=759429&r1=759428&r2=759429&view=diff
==============================================================================
--- continuum/trunk/continuum-data-management/data-management-jdo/src/test/resources/expected.xml
(original)
+++ continuum/trunk/continuum-data-management/data-management-jdo/src/test/resources/expected.xml
Sat Mar 28 04:43:11 2009
@@ -563,6 +563,16 @@
       <releaseGoal>releaseGoal</releaseGoal>
     </continuumReleaseResult>
   </continuumReleaseResults>
+  <buildDefinitionTemplates>
+    <buildDefinitionTemplate>
+      <id>1</id>
+      <name>template2</name>
+      <type>type2</type>
+      <buildDefinitions>
+        <buildDefinition id="1"></buildDefinition>
+      </buildDefinitions>
+    </buildDefinitionTemplate>
+  </buildDefinitionTemplates>
   <buildQueues>
     <buildQueue>
       <id>1</id>

Modified: continuum/trunk/continuum-store/src/test/java/org/apache/maven/continuum/store/AbstractContinuumStoreTestCase.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-store/src/test/java/org/apache/maven/continuum/store/AbstractContinuumStoreTestCase.java?rev=759429&r1=759428&r2=759429&view=diff
==============================================================================
--- continuum/trunk/continuum-store/src/test/java/org/apache/maven/continuum/store/AbstractContinuumStoreTestCase.java
(original)
+++ continuum/trunk/continuum-store/src/test/java/org/apache/maven/continuum/store/AbstractContinuumStoreTestCase.java
Sat Mar 28 04:43:11 2009
@@ -19,6 +19,7 @@
  * under the License.
  */
 
+import org.apache.continuum.dao.BuildDefinitionTemplateDao;
 import org.apache.continuum.dao.BuildQueueDao;
 import org.apache.continuum.dao.ContinuumReleaseResultDao;
 import org.apache.continuum.dao.DaoUtils;
@@ -39,6 +40,7 @@
 import org.apache.continuum.model.repository.RepositoryPurgeConfiguration;
 import org.apache.maven.continuum.installation.InstallationService;
 import org.apache.maven.continuum.model.project.BuildDefinition;
+import org.apache.maven.continuum.model.project.BuildDefinitionTemplate;
 import org.apache.maven.continuum.model.project.BuildQueue;
 import org.apache.maven.continuum.model.project.BuildResult;
 import org.apache.maven.continuum.model.project.Project;
@@ -95,6 +97,8 @@
 
     protected BuildQueueDao buildQueueDao;
 
+    protected BuildDefinitionTemplateDao buildDefinitionTemplateDao;
+
     protected ProjectGroup defaultProjectGroup;
 
     protected ProjectGroup testProjectGroup2;
@@ -188,6 +192,8 @@
         releaseResultDao = (ContinuumReleaseResultDao) lookup( ContinuumReleaseResultDao.class.getName()
);
 
         buildQueueDao = (BuildQueueDao) lookup( BuildQueueDao.class.getName() );
+
+        buildDefinitionTemplateDao = (BuildDefinitionTemplateDao) lookup( BuildDefinitionTemplateDao.class.getName()
);
     }
 
     protected void createBuildDatabase( boolean isTestFromDataManagementTool )
@@ -526,6 +532,15 @@
         BuildDefinition testBuildDefinition4 =
             createTestBuildDefinition( null, null, "deploy", null, null, false, false );
 
+        BuildDefinitionTemplate testBuildDefinitionTemplate1 = createTestBuildDefinitionTemplate(
"template2", "type2", false );
+        testBuildDefinitionTemplate1.addBuildDefinition( 
+            createTestBuildDefinition( "arguments14", "buildFile14", "goals14", profile1,
schedule1, false, false ) );
+
+        if ( addToStore )
+        {
+            buildDefinitionTemplateDao.addBuildDefinitionTemplate( testBuildDefinitionTemplate1
);
+        }
+
         ProjectGroup group = createTestProjectGroup( defaultProjectGroup );
 
         Project project1 = createTestProject( testProject1 );
@@ -1609,6 +1624,16 @@
         assertEquals( "compare build queue - name", expectedConfig.getName(), actualConfig.getName()
);
     }
 
+    protected static BuildDefinitionTemplate createTestBuildDefinitionTemplate( String name,
String type, boolean continuumDefault )
+    {
+        BuildDefinitionTemplate template = new BuildDefinitionTemplate();
+        template.setName( name );
+        template.setType( type );
+        template.setContinuumDefault( continuumDefault );
+
+        return template;
+    }
+
     /**
      * Setup JDO Factory
      *

Modified: continuum/trunk/continuum-store/src/test/java/org/apache/maven/continuum/store/ContinuumStoreTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-store/src/test/java/org/apache/maven/continuum/store/ContinuumStoreTest.java?rev=759429&r1=759428&r2=759429&view=diff
==============================================================================
--- continuum/trunk/continuum-store/src/test/java/org/apache/maven/continuum/store/ContinuumStoreTest.java
(original)
+++ continuum/trunk/continuum-store/src/test/java/org/apache/maven/continuum/store/ContinuumStoreTest.java
Sat Mar 28 04:43:11 2009
@@ -965,13 +965,13 @@
         new BuildDefinition().setDefaultForProject( true );
         String arguments = "arguments1.1";
         newBuildDefinition.setArguments( arguments );
-
         BuildDefinition copy = createTestBuildDefinition( newBuildDefinition );
         buildDefinitionDao.storeBuildDefinition( newBuildDefinition );
 
         project = projectDao.getProjectWithAllDetails( testProject1.getId() );
         assertEquals( "check # build defs", 2, project.getBuildDefinitions().size() );
         BuildDefinition retrievedBuildDefinition = (BuildDefinition) project.getBuildDefinitions().get(
0 );
+        
         assertBuildDefinitionEquals( copy, retrievedBuildDefinition );
         assertScheduleEquals( testSchedule1, retrievedBuildDefinition.getSchedule() );
         assertProfileEquals( testProfile2, retrievedBuildDefinition.getProfile() );
@@ -1078,6 +1078,7 @@
             projectGroupDao.getProjectGroupWithBuildDetailsByProjectGroupId( defaultProjectGroup.getId()
);
 
         BuildDefinition newBuildDefinition = (BuildDefinition) projectGroup.getBuildDefinitions().get(
0 );
+
         // If we use "arguments1.1", jpox-rc2 store "arguments11", weird
         String arguments = "arguments1";
         newBuildDefinition.setArguments( arguments );
@@ -1133,7 +1134,7 @@
         assertTrue( template.isContinuumDefault() );
         assertEquals( 1, template.getBuildDefinitions().size() );
         assertEquals( all + 1, buildDefinitionDao.getAllBuildDefinitions().size() );
-        assertEquals( 1, buildDefinitionTemplateDao.getAllBuildDefinitionTemplate().size()
);
+        assertEquals( 2, buildDefinitionTemplateDao.getAllBuildDefinitionTemplate().size()
);
 
         template = buildDefinitionTemplateDao
             .getContinuumBuildDefinitionTemplateWithType( ContinuumBuildExecutorConstants.MAVEN_TWO_BUILD_EXECUTOR
);
@@ -1141,7 +1142,7 @@
         assertNotNull( template );
         assertEquals( 1, template.getBuildDefinitions().size() );
 
-        assertEquals( 1, buildDefinitionTemplateDao.getAllBuildDefinitionTemplate().size()
);
+        assertEquals( 2, buildDefinitionTemplateDao.getAllBuildDefinitionTemplate().size()
);
     }
 
     public void testAddLocalRepository()



Mime
View raw message