continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tryg...@apache.org
Subject svn commit: r224630 - in /maven/continuum/trunk: continuum-api/src/main/java/org/apache/maven/continuum/ continuum-core/src/main/java/org/apache/maven/continuum/ continuum-core/src/main/java/org/apache/maven/continuum/core/action/ continuum-core/src/ma...
Date Sun, 24 Jul 2005 16:51:30 GMT
Author: trygvis
Date: Sun Jul 24 09:51:16 2005
New Revision: 224630

URL: http://svn.apache.org/viewcvs?rev=224630&view=rev
Log:
o Removing the default project group getter from the Continuum interface.
o When adding projects in the test cases and if the project doesn't already
  have a project group add it to a default project group. Note that this is not
  the same default group thing that was in the Continuum interface.
o When storing the project, put the stored object back into the context to make
  sure that the object is persistable later (the object put back will be a
  detached JDO object).

Modified:
    maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/StoreProjectAction.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/StoreProjectGroupAction.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ValidateProject.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/initialization/DefaultContinuumInitializer.java
    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/ContinuumTypicalUsageTest.java
    maven/continuum/trunk/continuum-test/src/main/java/org/apache/maven/continuum/AbstractContinuumTest.java

Modified: maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java?rev=224630&r1=224629&r2=224630&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
(original)
+++ maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
Sun Jul 24 09:51:16 2005
@@ -226,7 +226,5 @@
     // Defaults
     // ----------------------------------------------------------------------
 
-    ContinuumProjectGroup getDefaultProjectGroup();
-
     ContinuumBuildSettings getDefaultBuildSettings();
 }

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java?rev=224630&r1=224629&r2=224630&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
Sun Jul 24 09:51:16 2005
@@ -497,11 +497,6 @@
             }
         }
 
-        if ( projectGroup == null )
-        {
-            projectGroup = getDefaultProjectGroup();
-        }
-
         // ----------------------------------------------------------------------
         // Save all the projects
         // TODO: Validate all the projects before saving them
@@ -780,11 +775,6 @@
         {
             throw logAndCreateException( "Error while removing project from schedule.", e
);
         }
-    }
-
-    public ContinuumProjectGroup getDefaultProjectGroup()
-    {
-        return initializer.getDefaultProjectGroup();
     }
 
     public ContinuumBuildSettings getDefaultBuildSettings()

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/StoreProjectAction.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/StoreProjectAction.java?rev=224630&r1=224629&r2=224630&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/StoreProjectAction.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/StoreProjectAction.java
Sun Jul 24 09:51:16 2005
@@ -63,6 +63,8 @@
 
         project.setCommandLineArguments( StringUtils.clean( project.getCommandLineArguments()
) );
 
-        getStore().updateProject( project );
+        project = getStore().updateProject( project );
+
+        context.put( KEY_UNVALIDATED_PROJECT, project );
     }
 }

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/StoreProjectGroupAction.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/StoreProjectGroupAction.java?rev=224630&r1=224629&r2=224630&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/StoreProjectGroupAction.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/StoreProjectGroupAction.java
Sun Jul 24 09:51:16 2005
@@ -61,6 +61,8 @@
 
         projectGroup.setWorkingDirectory( projectWorkingDirectory.getAbsolutePath() );
 
-        getStore().updateProjectGroup( projectGroup );
+        projectGroup = getStore().updateProjectGroup( projectGroup );
+
+        context.put( KEY_UNVALIDATED_PROJECT_GROUP, projectGroup );
     }
 }

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ValidateProject.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ValidateProject.java?rev=224630&r1=224629&r2=224630&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ValidateProject.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ValidateProject.java
Sun Jul 24 09:51:16 2005
@@ -58,6 +58,7 @@
 //        assertStringNotEmpty( project.getPath(), "path" );
 //        assertStringNotEmpty( project.getGroupId(), "group id" );
 //        assertStringNotEmpty( project.getArtifactId(), "artifact id" );
+        // TODO: check for project group
 
         // TODO: validate that the SCM provider id
 

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/initialization/DefaultContinuumInitializer.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/initialization/DefaultContinuumInitializer.java?rev=224630&r1=224629&r2=224630&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/initialization/DefaultContinuumInitializer.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/initialization/DefaultContinuumInitializer.java
Sun Jul 24 09:51:16 2005
@@ -101,7 +101,7 @@
 
         try
         {
-            store.updateProjectGroup( defaultProjectGroup );
+            defaultProjectGroup = store.updateProjectGroup( defaultProjectGroup );
         }
         catch ( ContinuumStoreException e )
         {

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=224630&r1=224629&r2=224630&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
Sun Jul 24 09:51:16 2005
@@ -808,7 +808,8 @@
     {
         return (ContinuumProjectGroup) getObjectFromQuery( ContinuumProjectGroup.class,
                                                            "name",
-                                                           name );
+                                                           name,
+                                                           PROJECT_GROUP_DETAIL_FG );
     }
 
     public ContinuumProjectGroup getProjectGroupByGroupId( String groupId )
@@ -816,7 +817,8 @@
     {
         return (ContinuumProjectGroup) getObjectFromQuery( ContinuumProjectGroup.class,
                                                            "groupId",
-                                                           groupId );
+                                                           groupId,
+                                                           PROJECT_GROUP_DETAIL_FG );
 
     }
 
@@ -1088,20 +1090,6 @@
         return (ContinuumSchedule) pm.getObjectById( id );
     }
 
-    private ContinuumProjectGroup getContinuumProjectGroup( PersistenceManager pm,
-                                                            String projectGroupId,
-                                                            boolean details )
-    {
-        if ( details )
-        {
-            pm.getFetchPlan().addGroup( PROJECT_GROUP_DETAIL_FG );
-        }
-
-        Object id = pm.newObjectIdInstance( ContinuumProjectGroup.class, projectGroupId );
-
-        return (ContinuumProjectGroup) pm.getObjectById( id );
-    }
-
     // ----------------------------------------------------------------------
     //
     // ----------------------------------------------------------------------
@@ -1185,7 +1173,10 @@
         }
     }
 
-    private Object getObjectFromQuery( Class clazz, String idField, String id )
+    private Object getObjectFromQuery( Class clazz,
+                                       String idField,
+                                       String id,
+                                       String fetchGroup )
         throws ContinuumStoreException
     {
         PersistenceManager pm = pmf.getPersistenceManager();
@@ -1203,6 +1194,8 @@
             query.declareParameters( "String " + idField );
 
             query.setFilter( "this." + idField + " == " + idField );
+
+            query.getFetchPlan().addGroup( fetchGroup );
 
             Collection result = (Collection) query.execute( id );
 

Modified: maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/store/ContinuumTypicalUsageTest.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/store/ContinuumTypicalUsageTest.java?rev=224630&r1=224629&r2=224630&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/store/ContinuumTypicalUsageTest.java
(original)
+++ maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/store/ContinuumTypicalUsageTest.java
Sun Jul 24 09:51:16 2005
@@ -57,7 +57,8 @@
     {
         Continuum continuum = (Continuum) lookup( Continuum.ROLE );
 
-        ContinuumProjectGroup defaultProjectGroup = continuum.getDefaultProjectGroup();
+        ContinuumProjectGroup defaultProjectGroup = AbstractContinuumTest.getDefaultProjectGroup(
getStore() );
+            //continuum.getDefaultProjectGroup();
 
         // ----------------------------------------------------------------------
         // At this point we can now accept new projects into the system
@@ -75,10 +76,10 @@
 
         getStore().updateProjectGroup( defaultProjectGroup );
 
-        assertEquals( DefaultContinuumInitializer.DEFAULT_PROJECT_GROUP_NAME, project.getProjectGroup().getName()
);
+        assertEquals( defaultProjectGroup.getName(), project.getProjectGroup().getName()
);
 
-        assertEquals( DefaultContinuumInitializer.DEFAULT_PROJECT_GROUP_DESCRIPTION, project.getProjectGroup().getDescription()
);
+        assertEquals( defaultProjectGroup.getDescription(), project.getProjectGroup().getDescription()
);
 
-        assertEquals( DefaultContinuumInitializer.DEFAULT_PROJECT_GROUP_ID, project.getProjectGroup().getGroupId()
);
+        assertEquals( defaultProjectGroup.getGroupId(), project.getProjectGroup().getGroupId()
);
     }
 }

Modified: maven/continuum/trunk/continuum-test/src/main/java/org/apache/maven/continuum/AbstractContinuumTest.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-test/src/main/java/org/apache/maven/continuum/AbstractContinuumTest.java?rev=224630&r1=224629&r2=224630&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-test/src/main/java/org/apache/maven/continuum/AbstractContinuumTest.java
(original)
+++ maven/continuum/trunk/continuum-test/src/main/java/org/apache/maven/continuum/AbstractContinuumTest.java
Sun Jul 24 09:51:16 2005
@@ -47,6 +47,12 @@
 public abstract class AbstractContinuumTest
     extends PlexusTestCase
 {
+    /**
+     * When adding projects using addProject( project ) the project will be
+     * put in this group. All project has to belong to a group.
+     */
+    private static ContinuumProjectGroup defaultProjectGroup;
+
     // ----------------------------------------------------------------------
     //
     // ----------------------------------------------------------------------
@@ -67,6 +73,26 @@
         configurationService.setBuildOutputDirectory( getTestFile( "target/build-output"
) );
     }
 
+    public static ContinuumProjectGroup getDefaultProjectGroup( ContinuumStore store )
+        throws ContinuumStoreException
+    {
+        if ( defaultProjectGroup == null )
+        {
+            ContinuumProjectGroup projectGroup = new ContinuumProjectGroup();
+
+            projectGroup.setName( "Test Project Group" );
+
+            projectGroup.setGroupId( "foo.test" );
+
+            projectGroup.setDescription( "This is the default group that all projects will
be " +
+                                         "added to when using addProject()." );
+
+            defaultProjectGroup = store.addProjectGroup( projectGroup );
+        }
+
+        return defaultProjectGroup;
+    }
+
     // ----------------------------------------------------------------------
     // Store
     // ----------------------------------------------------------------------
@@ -191,9 +217,22 @@
                                                       MavenTwoProject project )
         throws Exception
     {
+        if ( project.getProjectGroup() != null )
+        {
+            project.setProjectGroup( getDefaultProjectGroup( store ) );
+        }
+
+        // ----------------------------------------------------------------------
+        //
+        // ----------------------------------------------------------------------
+
         ContinuumProject addedProject = store.addProject( project );
 
         assertNotNull( addedProject );
+
+        // ----------------------------------------------------------------------
+        //
+        // ----------------------------------------------------------------------
 
         ScmResult scmResult = new ScmResult();
 



Mime
View raw message