continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tryg...@apache.org
Subject svn commit: r219927 - in /maven/continuum/trunk/continuum-core/src: main/java/org/apache/maven/continuum/store/JdoContinuumStore.java test/java/org/apache/maven/continuum/store/NewModelTest.java
Date Wed, 20 Jul 2005 15:46:09 GMT
Author: trygvis
Date: Wed Jul 20 08:46:07 2005
New Revision: 219927

URL: http://svn.apache.org/viewcvs?rev=219927&view=rev
Log:
o Commiting for Jason.

Modified:
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java
    maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/store/NewModelTest.java

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java?rev=219927&r1=219926&r2=219927&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java
Wed Jul 20 08:46:07 2005
@@ -111,11 +111,83 @@
                 {
                     ContinuumSchedule schedule = (ContinuumSchedule) i.next();
 
-                    schedule.getProjects().remove( project );
+                    boolean r = schedule.getProjects().remove( project );
+
+                    System.out.println( "removed: " + r );
                 }
             }
 
-            project.setProjectGroup( null );
+            if ( project.getBuildGroups() != null && project.getBuildGroups().size()
> 0 )
+            {
+                Set buildGroups = project.getBuildGroups();
+
+                for ( Iterator i = buildGroups.iterator(); i.hasNext(); )
+                {
+                    ContinuumBuildGroup buildGroup = (ContinuumBuildGroup) i.next();
+
+                    boolean r = buildGroup.getProjects().remove( project );
+
+                    System.out.println( "removed: " + r );
+                }
+            }
+/*
+            System.out.println( "------------------------------------------" );
+            System.out.println( "Remove project" );
+            System.out.println( "------------------------------------------" );
+
+            System.out.println( "project.getId() = " + project.getId() );
+            System.out.println( "project.getBuildGroups() = " + project.getBuildGroups()
);
+            System.out.println( "project.getBuildGroups().size() = " + project.getBuildGroups().size()
);
+
+            if ( project.getBuildGroups() != null && project.getBuildGroups().size()
> 0 )
+            {
+                Set buildGroups = project.getBuildGroups();
+
+                for ( Iterator i = buildGroups.iterator(); i.hasNext(); )
+                {
+                    ContinuumBuildGroup buildGroup = (ContinuumBuildGroup) i.next();
+
+                    System.out.println( "buildGroup.getProjects() = " + buildGroup.getProjects()
);
+                    System.out.println( "buildGroup.getProjects().size() = " + buildGroup.getProjects().size()
);
+
+//                    boolean removed = buildGroup.getProjects().remove( project );
+//
+//                    System.out.println( "removed: " + removed );
+
+                    for ( Iterator j = buildGroup.getProjects().iterator(); j.hasNext();
)
+                    {
+                        ContinuumProject continuumProject = (ContinuumProject) j.next();
+
+                        System.out.println( "testing : " + continuumProject.getId() );
+                        if ( continuumProject.getId().equals( project.getId() ) )
+                        {
+                            System.out.println( "removing " + project.getId() + ", " + project
);
+
+                            j.remove();
+                        }
+                    }
+                }
+            }
+            System.out.println( "project.getBuildGroups() = " + project.getBuildGroups()
);
+            System.out.println( "project.getBuildGroups().size() = " + project.getBuildGroups().size()
);
+
+            System.out.println( "project = " + project );
+            System.out.println( "project.getProjectGroup() = " + project.getProjectGroup()
);
+*/
+            if ( project.getProjectGroup() != null )
+            {
+                ContinuumProjectGroup pg = project.getProjectGroup();
+
+                System.out.println( "before: " + pg.getProjects() );
+
+                boolean removed = pg.getProjects().remove( project );
+
+                System.out.println( "removed: " + removed );
+
+                System.out.println( "after: " + pg.getProjects() );
+            }
+
+            System.out.println( "------------------------------------------" );
 
             pm.deletePersistent( project );
 
@@ -145,7 +217,18 @@
 
             if ( project.getSchedules() != null && project.getSchedules().size()
> 0 )
             {
-                makePersistentAll( pm, project.getSchedules() );
+                pm.attachCopyAll( project.getSchedules(), true );
+            }
+
+            if ( project.getBuildGroups() != null && project.getBuildGroups().size()
> 0 )
+            {
+                for ( Iterator it = project.getBuildGroups().iterator(); it.hasNext(); )
+                {
+                    ContinuumBuildGroup buildGroup = (ContinuumBuildGroup) it.next();
+
+                    System.err.println( "buildGroup.id: " + buildGroup.getId() );
+                }
+                pm.attachCopyAll( project.getBuildGroups(), true );
             }
 
             pm.attachCopy( project, true );

Modified: maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/store/NewModelTest.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/store/NewModelTest.java?rev=219927&r1=219926&r2=219927&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/store/NewModelTest.java
(original)
+++ maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/store/NewModelTest.java
Wed Jul 20 08:46:07 2005
@@ -17,10 +17,11 @@
  */
 
 import org.apache.maven.continuum.AbstractContinuumTest;
-import org.apache.maven.continuum.project.MavenTwoProject;
-import org.apache.maven.continuum.project.ContinuumProjectGroup;
-import org.apache.maven.continuum.project.ContinuumProject;
 import org.apache.maven.continuum.project.ContinuumBuildGroup;
+import org.apache.maven.continuum.project.ContinuumProject;
+import org.apache.maven.continuum.project.ContinuumProjectGroup;
+
+import java.util.Collection;
 
 /**
  * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
@@ -29,7 +30,7 @@
 public class NewModelTest
     extends AbstractContinuumTest
 {
-    public void testBasic()
+    public void XXXtestBasic()
         throws Exception
     {
         // ----------------------------------------------------------------------
@@ -78,13 +79,13 @@
 
         ContinuumProject plexusComponentB = getStore().getProject( projectIdB );
 
-        assertNotNull( plexusComponentA.getProjectGroup() );
+        assertNotNull( "componentA.projectGroup == null", plexusComponentA.getProjectGroup()
);
 
-        assertNotNull( plexusComponentB.getProjectGroup() );
+        assertNotNull( "componentB.projectGroup == null", plexusComponentB.getProjectGroup()
);
 
-        assertEquals( plexusGroup.getId(), plexusComponentA.getProjectGroup().getId() );
+        assertEquals( "projectGroup.id != componentA.projectGroup.id", plexusGroup.getId(),
plexusComponentA.getProjectGroup().getId() );
 
-        assertEquals( plexusGroup.getId(), plexusComponentB.getProjectGroup().getId() );
+        assertEquals( "projectGroup.id != componentA.projectGroup.id", plexusGroup.getId(),
plexusComponentB.getProjectGroup().getId() );
 
         // ----------------------------------------------------------------------
         //
@@ -98,17 +99,43 @@
 
         buildGroup = getStore().getBuildGroup( buildGroupId );
 
-        componentA.getBuildGroups().add( buildGroup );
+        System.err.println( "buildGroup.id: " + buildGroup.getId() );
+
+        // ----------------------------------------------------------------------
+        // Add component A to the build group
+        // ----------------------------------------------------------------------
+
+//        componentA.getBuildGroups().add( buildGroup );
+
+        componentA.addBuildGroup( buildGroup );
 
         getStore().updateProject( componentA );
 
+        // ----------------------------------------------------------------------
+        // Assert that the project has a build group
+        // ----------------------------------------------------------------------
+
         componentA = getStore().getProject( componentA.getId() );
 
         assertNotNull( componentA.getBuildGroups() );
 
         assertEquals( 1, componentA.getBuildGroups().size() );
 
-        assertEquals( buildGroupId, ((ContinuumBuildGroup) componentA.getBuildGroups().iterator().next()).getId()
);
+        // ----------------------------------------------------------------------
+        // Assert that the build group has a project
+        // ----------------------------------------------------------------------
+
+//        buildGroup = (ContinuumBuildGroup) componentA.getBuildGroups().iterator().next();
+//
+//        assertEquals( "buildGroupId", buildGroupId, buildGroup.getId() );
+
+        buildGroup = getStore().getBuildGroup( buildGroupId );
+
+        assertEquals( "buildGroupId", buildGroupId, buildGroup.getId() );
+
+        assertEquals( "buildGroup.projects.size", 1, buildGroup.getProjects().size() );
+
+        assertEquals( projectIdA, ((ContinuumProject) buildGroup.getProjects().iterator().next()
).getId() );
 
         // ----------------------------------------------------------------------
         //
@@ -117,6 +144,10 @@
         getStore().removeProject( componentA.getId() );
 
         getStore().removeProject( componentB.getId() );
+
+        Collection projects = getStore().getAllProjects();
+
+        assertEquals( "projects.size", 0, projects.size() );
 
         buildGroup = getStore().getBuildGroup( buildGroupId );
 



Mime
View raw message