continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tryg...@apache.org
Subject svn commit: r220230 [1/2] - in /maven/continuum/trunk: continuum-api/src/main/java/org/apache/maven/continuum/ continuum-api/src/main/java/org/apache/maven/continuum/store/ continuum-core-it/src/test/java/org/apache/maven/continuum/it/ continuum-core/s...
Date Fri, 22 Jul 2005 02:49:23 GMT
Author: trygvis
Date: Thu Jul 21 19:49:22 2005
New Revision: 220230

URL: http://svn.apache.org/viewcvs?rev=220230&view=rev
Log:
Doing some refactoring, making all methods in the Store return the object added
instead of it's key.

Modified:
    maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
    maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java
    maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/ContinuumXmlRpcClient.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/buildcontroller/DefaultBuildController.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/ContinuumCore.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/DefaultContinuumCore.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ExecuteBuilderContinuumAction.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/StoreCheckOutScmResultAction.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/UpdateProjectFromWorkingDirectoryContinuumAction.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/buildqueue/BuildQueueTest.java
    maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/notification/ContinuumNotificationDispatcherTest.java
    maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/store/AbstractContinuumStoreTest.java
    maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/store/ContinuumTypicalUsageTest.java
    maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/store/NewModelTest.java
    maven/continuum/trunk/continuum-model/pom.xml
    maven/continuum/trunk/continuum-model/src/main/resources/META-INF/package.jdo
    maven/continuum/trunk/continuum-model/src/main/resources/continuum.mdo
    maven/continuum/trunk/continuum-test/src/main/java/org/apache/maven/continuum/AbstractContinuumTest.java
    maven/continuum/trunk/continuum-xmlrpc/src/test/java/org/apache/maven/continuum/xmlrpc/ContinuumXmlRpcTest.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=220230&r1=220229&r2=220230&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 Thu Jul 21 19:49:22 2005
@@ -190,10 +190,10 @@
      ContinuumSchedule getSchedule( String scheduleId )
         throws ContinuumException;
 
-     void addSchedule( ContinuumSchedule schedule )
+    ContinuumSchedule addSchedule( ContinuumSchedule schedule )
         throws ContinuumException;
 
-     void updateSchedule( ContinuumSchedule schedule )
+    ContinuumSchedule updateSchedule( ContinuumSchedule schedule )
         throws ContinuumException;
 
      void removeSchedule( String scheduleId )
@@ -203,10 +203,9 @@
     // Project scheduling
     // ----------------------------------------------------------------------
 
-    public void addProjectToSchedule( ContinuumProject project, ContinuumSchedule schedule )
+    ContinuumSchedule addProjectToSchedule( ContinuumProject project, ContinuumSchedule schedule )
         throws ContinuumException;
 
-    public void removeProjectFromSchedule( ContinuumProject project, ContinuumSchedule schedule )
+    void removeProjectFromSchedule( ContinuumProject project, ContinuumSchedule schedule )
         throws ContinuumException;
-     
 }

Modified: maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java?rev=220230&r1=220229&r2=220230&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java (original)
+++ maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java Thu Jul 21 19:49:22 2005
@@ -25,6 +25,7 @@
 import org.apache.maven.continuum.project.ContinuumProjectGroup;
 import org.apache.maven.continuum.project.ContinuumBuildGroup;
 import org.apache.maven.continuum.project.ContinuumBuildSettings;
+import org.apache.maven.continuum.project.ContinuumNotifier;
 import org.apache.maven.continuum.scm.ScmResult;
 
 /**
@@ -39,13 +40,13 @@
     // ContinuumProject Mutators
     // ----------------------------------------------------------------------
 
-    String addProject( ContinuumProject project )
+    ContinuumProject addProject( ContinuumProject project )
         throws ContinuumStoreException;
 
     void removeProject( String projectId )
         throws ContinuumStoreException;
 
-    void updateProject( ContinuumProject project )
+    ContinuumProject updateProject( ContinuumProject project )
         throws ContinuumStoreException;
 
     // ----------------------------------------------------------------------
@@ -74,10 +75,10 @@
     // Build
     // ----------------------------------------------------------------------
 
-    String addBuild( String projectId, ContinuumBuild build )
+    ContinuumBuild addBuild( String projectId, ContinuumBuild build )
         throws ContinuumStoreException;
 
-    void updateBuild( ContinuumBuild build )
+    ContinuumBuild updateBuild( ContinuumBuild build )
         throws ContinuumStoreException;
 
     void setBuildOutput( String buildId, String output )
@@ -102,20 +103,20 @@
     // Notifiers
     // ----------------------------------------------------------------------
 
-    void removeNotifier( Object notifier )
+    void removeNotifier( ContinuumNotifier notifier )
         throws ContinuumStoreException;
 
-    void storeNotifier( Object notifier )
+    ContinuumNotifier storeNotifier( ContinuumNotifier notifier )
         throws ContinuumStoreException;
 
     // ----------------------------------------------------------------------
     // Schedules
     // ----------------------------------------------------------------------
 
-    String addSchedule( ContinuumSchedule schedule )
+    ContinuumSchedule addSchedule( ContinuumSchedule schedule )
         throws ContinuumStoreException;
 
-    void updateSchedule( ContinuumSchedule schedule )
+    ContinuumSchedule updateSchedule( ContinuumSchedule schedule )
         throws ContinuumStoreException;
 
     void removeSchedule( String scheduleId )
@@ -131,10 +132,10 @@
     // Project Groups
     // ----------------------------------------------------------------------
 
-    String addProjectGroup( ContinuumProjectGroup projectGroup )
+    ContinuumProjectGroup addProjectGroup( ContinuumProjectGroup projectGroup )
         throws ContinuumStoreException;
 
-    void updateProjectGroup( ContinuumProjectGroup projectGroup )
+    ContinuumProjectGroup updateProjectGroup( ContinuumProjectGroup projectGroup )
         throws ContinuumStoreException;
 
     void removeProjectGroup( String projectGroupId )
@@ -153,10 +154,10 @@
     // Build Group
     // ----------------------------------------------------------------------
 
-    String addBuildGroup( ContinuumBuildGroup buildGroup )
+    ContinuumBuildGroup addBuildGroup( ContinuumBuildGroup buildGroup )
         throws ContinuumStoreException;
 
-    void updateBuildGroup( ContinuumBuildGroup buildGroup )
+    ContinuumBuildGroup updateBuildGroup( ContinuumBuildGroup buildGroup )
         throws ContinuumStoreException;
 
     void removeBuildGroup( String buildGroupId )
@@ -172,10 +173,10 @@
     // Build settings
     // ----------------------------------------------------------------------
 
-    String addBuildSettings( ContinuumBuildSettings buildSettings )
+    ContinuumBuildSettings addBuildSettings( ContinuumBuildSettings buildSettings )
         throws ContinuumStoreException;
 
-    void updateBuildSettings( ContinuumBuildSettings buildSettings )
+    ContinuumBuildSettings updateBuildSettings( ContinuumBuildSettings buildSettings )
         throws ContinuumStoreException;
 
     void removeBuildSettings( String buildSettingsId )

Modified: maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/ContinuumXmlRpcClient.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/ContinuumXmlRpcClient.java?rev=220230&r1=220229&r2=220230&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/ContinuumXmlRpcClient.java (original)
+++ maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/ContinuumXmlRpcClient.java Thu Jul 21 19:49:22 2005
@@ -83,6 +83,16 @@
         client = new XmlRpcClientLite( host, port );
     }
 
+    public String getHost()
+    {
+        return host;
+    }
+
+    public int getPort()
+    {
+        return port;
+    }
+
     // ----------------------------------------------------------------------
     // Project
     // ----------------------------------------------------------------------
@@ -344,13 +354,13 @@
         throw new UnsupportedOperationException();
     }
 
-    public void addSchedule( ContinuumSchedule schedule )
+    public ContinuumSchedule addSchedule( ContinuumSchedule schedule )
         throws ContinuumException
     {
         throw new UnsupportedOperationException();
     }
 
-    public void updateSchedule( ContinuumSchedule schedule )
+    public ContinuumSchedule updateSchedule( ContinuumSchedule schedule )
         throws ContinuumException
     {
         throw new UnsupportedOperationException();
@@ -431,7 +441,7 @@
 
         try
         {
-            helper.hashtableToObject( (Hashtable) returnValue, object );
+            helper.hashtableToObject( returnValue, object );
         }
         catch ( IntrospectionException e )
         {

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=220230&r1=220229&r2=220230&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 Thu Jul 21 19:49:22 2005
@@ -598,12 +598,12 @@
         }
     }
 
-    public void addSchedule( ContinuumSchedule schedule )
+    public ContinuumSchedule addSchedule( ContinuumSchedule schedule )
         throws ContinuumException
     {
         try
         {
-            store.addSchedule( schedule );
+            return store.addSchedule( schedule );
         }
         catch ( ContinuumStoreException ex )
         {
@@ -611,12 +611,12 @@
         }
     }
 
-    public void updateSchedule( ContinuumSchedule schedule )
+    public ContinuumSchedule updateSchedule( ContinuumSchedule schedule )
         throws ContinuumException
     {
         try
         {
-            store.updateSchedule( schedule );
+            return store.updateSchedule( schedule );
         }
         catch ( ContinuumStoreException ex )
         {
@@ -641,14 +641,14 @@
     // Project scheduling
     // ----------------------------------------------------------------------
 
-    public void addProjectToSchedule( ContinuumProject project, ContinuumSchedule schedule )
+    public ContinuumSchedule addProjectToSchedule( ContinuumProject project, ContinuumSchedule schedule )
         throws ContinuumException
     {
         schedule.addProject( project );
 
         try
         {
-            store.updateSchedule( schedule );
+            return store.updateSchedule( schedule );
         }
         catch ( ContinuumStoreException e )
         {

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java?rev=220230&r1=220229&r2=220230&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java (original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java Thu Jul 21 19:49:22 2005
@@ -108,7 +108,9 @@
             {
                 actionManager.lookup( "check-working-directory" ).execute( actionContext );
 
-                boolean workingDirectoryExists = AbstractContinuumAction.getBoolean( actionContext, AbstractContinuumAction.KEY_WORKING_DIRECTORY_EXISTS );
+                boolean workingDirectoryExists =
+                    AbstractContinuumAction.getBoolean( actionContext,
+                                                        AbstractContinuumAction.KEY_WORKING_DIRECTORY_EXISTS );
 
                 if ( workingDirectoryExists )
                 {
@@ -141,7 +143,7 @@
                         if ( !StringUtils.isEmpty( checkoutErrorMessage ) )
                         {
                             error = "Error message:" + System.getProperty( "line.separator" );
-                            error = checkoutErrorException;
+                            error += checkoutErrorException;
                         }
 
                         if ( !StringUtils.isEmpty( checkoutErrorException ) )
@@ -152,7 +154,7 @@
 
                         build.setError( error );
 
-                        buildId = storeBuild( project, build );
+                        buildId = storeBuild( project, build ).getId();
 
                         return;
                      }
@@ -174,9 +176,10 @@
 
                 ContinuumBuild build = makeBuildResult( scmResult, startTime, forced );
 
+                // This can happen if the "update project from scm" action fails
+
                 String error;
 
-                // This can happen if the "update project from scm" action fails
                 if ( e instanceof ContinuumScmException )
                 {
                     ContinuumScmException ex = (ContinuumScmException) e;
@@ -204,7 +207,7 @@
 
                 build.setError( error );
 
-                buildId = storeBuild( project, build );
+                buildId = storeBuild( project, build ).getId();
 
                 project.setState( ContinuumProjectState.ERROR );
             }
@@ -240,14 +243,14 @@
     //
     // ----------------------------------------------------------------------
 
-    private String storeBuild( ContinuumProject project, ContinuumBuild build )
+    private ContinuumBuild storeBuild( ContinuumProject project, ContinuumBuild build )
         throws ContinuumStoreException
     {
-        String buildId = store.addBuild( project.getId(), build );
+        build = store.addBuild( project.getId(), build );
 
-        getLogger().info( "Build id: '" + buildId + "'." );
+        getLogger().info( "Build id: '" + build.getId() + "'." );
 
-        return buildId;
+        return build;
     }
 
     private ContinuumBuild makeBuildResult( ScmResult scmResult,

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/ContinuumCore.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/ContinuumCore.java?rev=220230&r1=220229&r2=220230&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/ContinuumCore.java (original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/ContinuumCore.java Thu Jul 21 19:49:22 2005
@@ -23,6 +23,7 @@
 import org.apache.maven.continuum.execution.manager.BuildExecutorManager;
 import org.apache.maven.continuum.project.ContinuumBuild;
 import org.apache.maven.continuum.project.ContinuumProject;
+import org.apache.maven.continuum.project.ContinuumNotifier;
 import org.apache.maven.continuum.project.builder.manager.ContinuumProjectBuilderManager;
 import org.apache.maven.continuum.scm.ScmResult;
 import org.apache.maven.continuum.scm.ContinuumScm;
@@ -42,7 +43,7 @@
     void removeProject( String projectId )
         throws ContinuumException;
 
-    void updateProject( ContinuumProject project )
+    ContinuumProject updateProject( ContinuumProject project )
         throws ContinuumException;
 
     ContinuumProject getProject( String projectId )
@@ -57,10 +58,10 @@
     void buildProject( String projectId, boolean force )
         throws ContinuumException;
 
-    void removeNotifier( Object oid )
+    void removeNotifier( ContinuumNotifier oid )
         throws ContinuumException;
 
-    void storeNotifier( Object notifier )
+    ContinuumNotifier storeNotifier( ContinuumNotifier notifier )
         throws ContinuumException;
 
     // ----------------------------------------------------------------------

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/DefaultContinuumCore.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/DefaultContinuumCore.java?rev=220230&r1=220229&r2=220230&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/DefaultContinuumCore.java (original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/DefaultContinuumCore.java Thu Jul 21 19:49:22 2005
@@ -18,6 +18,7 @@
 
 import java.io.File;
 import java.io.InputStream;
+import java.io.IOException;
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
@@ -29,6 +30,7 @@
 import org.apache.maven.continuum.execution.manager.BuildExecutorManager;
 import org.apache.maven.continuum.project.ContinuumBuild;
 import org.apache.maven.continuum.project.ContinuumProject;
+import org.apache.maven.continuum.project.ContinuumNotifier;
 import org.apache.maven.continuum.project.builder.manager.ContinuumProjectBuilderManager;
 import org.apache.maven.continuum.scm.ScmResult;
 import org.apache.maven.continuum.scm.ContinuumScm;
@@ -146,7 +148,7 @@
         }
         catch ( TaskQueueException e )
         {
-            throw new ContinuumException( "Error while getting the queue snapshot." );
+            throw new ContinuumException( "Error while getting the queue snapshot.", e );
         }
 
         for ( Iterator it = queue.iterator(); it.hasNext(); )
@@ -179,12 +181,12 @@
     //
     // ----------------------------------------------------------------------
 
-    public void removeNotifier( Object oid )
+    public void removeNotifier( ContinuumNotifier notifier )
         throws ContinuumException
     {
         try
         {
-            store.removeNotifier( oid );
+            store.removeNotifier( notifier );
         }
         catch ( ContinuumStoreException ex )
         {
@@ -192,12 +194,12 @@
         }
     }
 
-    public void storeNotifier( Object oid )
+    public ContinuumNotifier storeNotifier( ContinuumNotifier notifier )
         throws ContinuumException
     {
         try
         {
-            store.storeNotifier( oid );
+            return store.storeNotifier( notifier );
         }
         catch ( ContinuumStoreException ex )
         {
@@ -209,14 +211,14 @@
     //
     // ----------------------------------------------------------------------
 
-    public void updateProject( ContinuumProject project )
+    public ContinuumProject updateProject( ContinuumProject project )
         throws ContinuumException
     {
         try
         {
             project.setCommandLineArguments( StringUtils.clean( project.getCommandLineArguments() ) );
 
-            store.updateProject( project );
+            return store.updateProject( project );
         }
         catch ( ContinuumStoreException ex )
         {
@@ -229,9 +231,7 @@
     {
         try
         {
-            ContinuumProject project = store.getProject( projectId );
-
-            return project;
+            return store.getProject( projectId );
         }
         catch ( ContinuumStoreException ex )
         {
@@ -295,9 +295,7 @@
     {
         try
         {
-            ContinuumBuild b = store.getBuild( buildId );
-
-            return b;
+            return store.getBuild( buildId );
         }
         catch ( ContinuumStoreException e )
         {
@@ -465,17 +463,24 @@
 
     private String getVersion()
     {
-        InputStream resourceAsStream;
         try
         {
             Properties properties = new Properties();
-            resourceAsStream = this.getClass().getClassLoader().getResourceAsStream(
-                "META-INF/maven/org.apache.maven.continuum/continuum-core/pom.properties" );
+
+            String name = "META-INF/maven/org.apache.maven.continuum/continuum-core/pom.properties";
+
+            InputStream resourceAsStream = this.getClass().getClassLoader().getResourceAsStream( name );
+
+            if ( resourceAsStream == null )
+            {
+                return "unknown";
+            }
+
             properties.load( resourceAsStream );
 
             return properties.getProperty( "version", "unknown" );
         }
-        catch ( Exception e )
+        catch ( IOException e )
         {
             return "unknown";
         }

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ExecuteBuilderContinuumAction.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ExecuteBuilderContinuumAction.java?rev=220230&r1=220229&r2=220230&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ExecuteBuilderContinuumAction.java (original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ExecuteBuilderContinuumAction.java Thu Jul 21 19:49:22 2005
@@ -78,7 +78,7 @@
 
         build.setScmResult( scmResult );
 
-        String buildId = getStore().addBuild( project.getId(), build );
+        String buildId = getStore().addBuild( project.getId(), build ).getId();
 
         context.put( KEY_BUILD_ID, buildId );
 
@@ -119,7 +119,7 @@
 
             getStore().setBuildOutput( buildId, output );
 
-            getStore().updateBuild( build );
+            build = getStore().updateBuild( build );
 
             getNotifier().goalsCompleted( project, build );
         }

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/StoreCheckOutScmResultAction.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/StoreCheckOutScmResultAction.java?rev=220230&r1=220229&r2=220230&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/StoreCheckOutScmResultAction.java (original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/StoreCheckOutScmResultAction.java Thu Jul 21 19:49:22 2005
@@ -32,7 +32,7 @@
     extends AbstractContinuumAction
 {
     public void execute( Map context )
-        throws Exception
+        throws TaskExecutionException
     {
         try
         {

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=220230&r1=220229&r2=220230&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 Thu Jul 21 19:49:22 2005
@@ -4,6 +4,7 @@
 package org.apache.maven.continuum.core.action;
 
 import org.apache.maven.continuum.ContinuumException;
+import org.apache.maven.continuum.store.ContinuumStoreException;
 import org.apache.maven.continuum.project.ContinuumProject;
 
 import java.io.File;
@@ -19,7 +20,7 @@
     extends AbstractContinuumAction
 {
     public void execute( Map context )
-        throws Exception
+        throws ContinuumException, ContinuumStoreException
     {
         ContinuumProject project = getUnvalidatedProject( context );
 
@@ -27,17 +28,15 @@
         //
         // ----------------------------------------------------------------------
 
-        String projectId = getStore().addProject( project );
+        project = getStore().addProject( project );
 
-        project = getStore().getProject( projectId );
-
-        context.put( KEY_PROJECT_ID, projectId );
+        context.put( KEY_PROJECT_ID, project.getId() );
 
         // ----------------------------------------------------------------------
         // Set the working directory
         // ----------------------------------------------------------------------
 
-        File projectWorkingDirectory = new File( getCore().getWorkingDirectory(), projectId );
+        File projectWorkingDirectory = new File( getCore().getWorkingDirectory(), project.getId() );
 
         if ( !projectWorkingDirectory.exists() && !projectWorkingDirectory.mkdirs() )
         {

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateProjectFromWorkingDirectoryContinuumAction.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateProjectFromWorkingDirectoryContinuumAction.java?rev=220230&r1=220229&r2=220230&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateProjectFromWorkingDirectoryContinuumAction.java (original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateProjectFromWorkingDirectoryContinuumAction.java Thu Jul 21 19:49:22 2005
@@ -20,7 +20,10 @@
 import java.io.File;
 
 import org.apache.maven.continuum.execution.ContinuumBuildExecutor;
+import org.apache.maven.continuum.execution.ContinuumBuildExecutorException;
 import org.apache.maven.continuum.project.ContinuumProject;
+import org.apache.maven.continuum.store.ContinuumStoreException;
+import org.apache.maven.continuum.ContinuumException;
 
 /**
  * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
@@ -30,7 +33,7 @@
     extends AbstractContinuumAction
 {
     public void execute( Map context )
-        throws Exception
+        throws ContinuumStoreException, ContinuumException, ContinuumBuildExecutorException
     {
         ContinuumProject project = getProject( context );
 

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=220230&r1=220229&r2=220230&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 Thu Jul 21 19:49:22 2005
@@ -74,9 +74,7 @@
 
         try
         {
-            String id = store.addBuildSettings( defaultBuildSettings );
-
-            defaultBuildSettings = store.getBuildSettings( id );
+            defaultBuildSettings = store.addBuildSettings( defaultBuildSettings );
         }
         catch ( ContinuumStoreException e )
         {
@@ -85,17 +83,24 @@
 
         defaultProjectGroup = createDefaultProjectGroup();
 
+        try
+        {
+            defaultProjectGroup = store.addProjectGroup( defaultProjectGroup );
+        }
+        catch ( ContinuumStoreException e )
+        {
+            throw new ContinuumInitializationException( "Error storing default Continuum project group.", e );
+        }
+
         defaultProjectGroup.addBuildSetting( defaultBuildSettings );
 
         try
         {
-            String id = store.addProjectGroup( defaultProjectGroup );
-
-            defaultProjectGroup = store.getProjectGroup( id );
+            store.updateProjectGroup( defaultProjectGroup );
         }
         catch ( ContinuumStoreException e )
         {
-            throw new ContinuumInitializationException( "Error storing default Continuum project group.", e );
+            throw new ContinuumInitializationException( "Error updating default Continuum project group.", 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=220230&r1=220229&r2=220230&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 Thu Jul 21 19:49:22 2005
@@ -36,6 +36,7 @@
 import org.apache.maven.continuum.project.ContinuumProjectGroup;
 import org.apache.maven.continuum.project.ContinuumBuildGroup;
 import org.apache.maven.continuum.project.ContinuumBuildSettings;
+import org.apache.maven.continuum.project.ContinuumNotifier;
 import org.apache.maven.continuum.scm.ScmResult;
 
 import org.codehaus.plexus.jdo.JdoFactory;
@@ -62,6 +63,24 @@
     private PersistenceManagerFactory pmf;
 
     // ----------------------------------------------------------------------
+    // Fetch Groups
+    // ----------------------------------------------------------------------
+
+    private static final String PROJECT_DETAIL_FG = "project-detail";
+
+    private static final String BUILD_DETAIL_FG = "build-detail";
+
+    private static final String NOTIFIER_DETAIL_FG = "notifier-detail";
+
+    private static final String BUILD_GROUP_DETAIL_FG = "build-group-detail";
+
+    private static final String PROJECT_GROUP_DETAIL_FG = "project-group-detail";
+
+    private static final String SCHEDULE_DETAIL_FG = "schedule-detail";
+
+    private static final String BUILD_SETTINGS_DETAIL_FG = "build-settings-detail";
+
+    // ----------------------------------------------------------------------
     // Component Lifecycle
     // ----------------------------------------------------------------------
 
@@ -75,10 +94,10 @@
     // ContinuumStore Implementation
     // ----------------------------------------------------------------------
 
-    public String addProject( ContinuumProject project )
+    public ContinuumProject addProject( ContinuumProject project )
         throws ContinuumStoreException
     {
-        return ( (ContinuumProject) addObject( project ) ).getId();
+        return (ContinuumProject) addObject( project, PROJECT_DETAIL_FG );
     }
 
     public void removeProject( String projectId )
@@ -112,7 +131,7 @@
                 {
                     ContinuumSchedule schedule = (ContinuumSchedule) i.next();
 
-                    boolean r = schedule.getProjects().remove( project );
+                    schedule.getProjects().remove( project );
                 }
             }
 
@@ -145,7 +164,7 @@
         }
     }
 
-    public void updateProject( ContinuumProject project )
+    public ContinuumProject updateProject( ContinuumProject project )
         throws ContinuumStoreException
     {
         PersistenceManager pm = pmf.getPersistenceManager();
@@ -174,6 +193,10 @@
             pm.attachCopy( project, true );
 
             commit( tx );
+
+            return (ContinuumProject) getDetailedObject( ContinuumProject.class,
+                                                         project.getId(),
+                                                         PROJECT_DETAIL_FG );
         }
         finally
         {
@@ -236,6 +259,8 @@
 
             query.setFilter( "this.name == name" );
 
+            query.getFetchPlan().addGroup( PROJECT_DETAIL_FG );
+
             Collection result = (Collection) query.execute( name );
 
             if ( result.size() == 0 )
@@ -276,6 +301,8 @@
 
             query.setFilter( "this.scmUrl == scmUrl" );
 
+            query.getFetchPlan().addGroup( PROJECT_DETAIL_FG );
+
             Collection result = (Collection) query.execute( scmUrl );
 
             if ( result.size() == 0 )
@@ -391,10 +418,10 @@
     // Schedules
     // ----------------------------------------------------------------------
 
-    public String addSchedule( ContinuumSchedule schedule )
+    public ContinuumSchedule addSchedule( ContinuumSchedule schedule )
         throws ContinuumStoreException
     {
-        return ( (ContinuumSchedule) addObject( schedule ) ).getId();
+        return (ContinuumSchedule) addObject( schedule, SCHEDULE_DETAIL_FG );
     }
 
     public ContinuumSchedule getSchedule( String projectId )
@@ -457,10 +484,10 @@
         }
     }
 
-    public void updateSchedule( ContinuumSchedule schedule )
+    public ContinuumSchedule updateSchedule( ContinuumSchedule schedule )
         throws ContinuumStoreException
     {
-        updateObject( schedule );
+        return (ContinuumSchedule) updateObject( schedule, SCHEDULE_DETAIL_FG );
     }
 
     public void removeSchedule( String scheduleId )
@@ -512,7 +539,7 @@
     // Builds
     // ----------------------------------------------------------------------
 
-    public String addBuild( String projectId, ContinuumBuild build )
+    public ContinuumBuild addBuild( String projectId, ContinuumBuild build )
         throws ContinuumStoreException
     {
         PersistenceManager pm = pmf.getPersistenceManager();
@@ -537,7 +564,7 @@
 
             commit( tx );
 
-            return build.getId();
+            return (ContinuumBuild) getDetailedObject( ContinuumBuild.class, build.getId(), BUILD_DETAIL_FG );
         }
         finally
         {
@@ -545,39 +572,16 @@
         }
     }
 
-    public void updateBuild( ContinuumBuild build )
+    public ContinuumBuild updateBuild( ContinuumBuild build )
         throws ContinuumStoreException
     {
-        updateObject( build );
+        return (ContinuumBuild) updateObject( build, BUILD_DETAIL_FG );
     }
 
     public ContinuumBuild getBuild( String buildId )
         throws ContinuumStoreException
     {
-        PersistenceManager pm = pmf.getPersistenceManager();
-
-        Transaction tx = pm.currentTransaction();
-
-        try
-        {
-            tx.begin();
-
-            ContinuumBuild build = getContinuumBuild( pm, buildId );
-
-            build = (ContinuumBuild) pm.detachCopy( build );
-
-            commit( tx );
-
-            return build;
-        }
-        catch ( JDOObjectNotFoundException e )
-        {
-            throw new ContinuumObjectNotFoundException( ContinuumBuild.class.getName(), buildId );
-        }
-        finally
-        {
-            rollback( tx );
-        }
+        return (ContinuumBuild) getDetailedObject( ContinuumBuild.class, buildId, BUILD_DETAIL_FG );
     }
 
     public ContinuumBuild getLatestBuildForProject( String projectId )
@@ -687,32 +691,32 @@
         }
     }
 
-    public void removeNotifier( Object notifier )
+    public void removeNotifier( ContinuumNotifier notifier )
         throws ContinuumStoreException
     {
         attachAndDelete( notifier );
     }
 
-    public void storeNotifier( Object notifier )
+    public ContinuumNotifier storeNotifier( ContinuumNotifier notifier )
         throws ContinuumStoreException
     {
-        updateObject( notifier );
+        return (ContinuumNotifier) updateObject( notifier, NOTIFIER_DETAIL_FG );
     }
 
     // ----------------------------------------------------------------------
     // Project Groups
     // ----------------------------------------------------------------------
 
-    public String addProjectGroup( ContinuumProjectGroup projectGroup )
+    public ContinuumProjectGroup addProjectGroup( ContinuumProjectGroup projectGroup )
         throws ContinuumStoreException
     {
-        return ( (ContinuumProjectGroup) addObject( projectGroup ) ).getId();
+        return (ContinuumProjectGroup) addObject( projectGroup, PROJECT_GROUP_DETAIL_FG );
     }
 
-    public void updateProjectGroup( ContinuumProjectGroup projectGroup )
+    public ContinuumProjectGroup updateProjectGroup( ContinuumProjectGroup projectGroup )
         throws ContinuumStoreException
     {
-        updateObject( projectGroup );
+        return (ContinuumProjectGroup) updateObject( projectGroup, PROJECT_GROUP_DETAIL_FG );
     }
 
     public Collection getProjectGroups()
@@ -798,7 +802,7 @@
     {
         return (ContinuumProjectGroup) getDetailedObject( ContinuumProjectGroup.class,
                                                           projectGroupId,
-                                                          "project-group-detail" );
+                                                          PROJECT_GROUP_DETAIL_FG );
     }
 
     public ContinuumProjectGroup getProjectGroupByName( String name )
@@ -845,16 +849,16 @@
     // Build Group
     // ----------------------------------------------------------------------
 
-    public String addBuildGroup( ContinuumBuildGroup buildGroup )
+    public ContinuumBuildGroup addBuildGroup( ContinuumBuildGroup buildGroup )
         throws ContinuumStoreException
     {
-        return ( (ContinuumBuildGroup) addObject( buildGroup ) ).getId();
+        return (ContinuumBuildGroup) addObject( buildGroup, BUILD_GROUP_DETAIL_FG );
     }
 
-    public void updateBuildGroup( ContinuumBuildGroup schedule )
+    public ContinuumBuildGroup updateBuildGroup( ContinuumBuildGroup schedule )
         throws ContinuumStoreException
     {
-        updateObject( schedule );
+        return (ContinuumBuildGroup) updateObject( schedule, BUILD_GROUP_DETAIL_FG );
     }
 
     public void removeBuildGroup( String buildGroupId )
@@ -946,16 +950,16 @@
     // Build Settings
     // ----------------------------------------------------------------------
 
-    public String addBuildSettings( ContinuumBuildSettings buildSettings )
+    public ContinuumBuildSettings addBuildSettings( ContinuumBuildSettings buildSettings )
         throws ContinuumStoreException
     {
-        return ( (ContinuumBuildSettings) addObject( buildSettings ) ).getId();
+        return (ContinuumBuildSettings) addObject( buildSettings, BUILD_SETTINGS_DETAIL_FG );
     }
 
-    public void updateBuildSettings( ContinuumBuildSettings buildSettings )
+    public ContinuumBuildSettings updateBuildSettings( ContinuumBuildSettings buildSettings )
         throws ContinuumStoreException
     {
-        updateObject( buildSettings );
+        return (ContinuumBuildSettings) updateObject( buildSettings, BUILD_SETTINGS_DETAIL_FG );
     }
 
     public void removeBuildSettings( String buildSettingsId )
@@ -1115,21 +1119,19 @@
     {
         if ( details )
         {
-            pm.getFetchPlan().addGroup( "project-group-detail" );
+            pm.getFetchPlan().addGroup( PROJECT_GROUP_DETAIL_FG );
         }
 
         Object id = pm.newObjectIdInstance( ContinuumProjectGroup.class, projectGroupId );
 
-        ContinuumProjectGroup projectGroup = (ContinuumProjectGroup) pm.getObjectById( id );
-
-        return projectGroup;
+        return (ContinuumProjectGroup) pm.getObjectById( id );
     }
 
     // ----------------------------------------------------------------------
     //
     // ----------------------------------------------------------------------
 
-    private Object addObject( Object object )
+    private Object addObject( Object object, String detailedFetchGroup )
     {
         PersistenceManager pm = pmf.getPersistenceManager();
 
@@ -1143,6 +1145,8 @@
 
             Object id = pm.getObjectId( object );
 
+            pm.getFetchPlan().addGroup( detailedFetchGroup );
+
             Object addedObject = pm.getObjectById( id );
 
             addedObject = pm.detachCopy( addedObject );
@@ -1228,7 +1232,7 @@
         }
     }
 
-    private void deletePersistentById( Class clazz, Object identifier )
+    private Object updateObject( Object object, String detailedFetchGroup )
     {
         PersistenceManager pm = pmf.getPersistenceManager();
 
@@ -1238,33 +1242,25 @@
         {
             tx.begin();
 
-            Object id = pm.newObjectIdInstance( clazz, identifier );
+            pm.attachCopy( object, true );
 
-            Object object = pm.getObjectById( id );
+            commit( tx );
 
-            pm.deletePersistent( object );
+            tx.begin();
 
-            commit( tx );
-        }
-        finally
-        {
-            rollback( tx );
-        }
-    }
+            tx = pm.currentTransaction();
 
-    private void updateObject( Object object )
-    {
-        PersistenceManager pm = pmf.getPersistenceManager();
+            Object id = pm.getObjectId( object );
 
-        Transaction tx = pm.currentTransaction();
+            pm.getFetchPlan().addGroup( detailedFetchGroup );
 
-        try
-        {
-            tx.begin();
+            object = pm.getObjectById( id, true );
 
-            pm.attachCopy( object, true );
+            object = pm.detachCopy( object );
 
             commit( tx );
+
+            return object;
         }
         finally
         {

Modified: maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/buildqueue/BuildQueueTest.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/buildqueue/BuildQueueTest.java?rev=220230&r1=220229&r2=220230&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/buildqueue/BuildQueueTest.java (original)
+++ maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/buildqueue/BuildQueueTest.java Thu Jul 21 19:49:22 2005
@@ -17,6 +17,7 @@
  */
 
 import org.apache.maven.continuum.AbstractContinuumTest;
+import org.apache.maven.continuum.project.ContinuumProject;
 
 import org.codehaus.plexus.taskqueue.Task;
 import org.codehaus.plexus.taskqueue.TaskQueue;
@@ -41,7 +42,9 @@
     public void testTestTheQueueWithASingleProject()
         throws Exception
     {
-        String projectId = AbstractContinuumTest.addMavenTwoProject( getStore(), "Build Queue Project 1", "1" );
+        ContinuumProject project = addMavenTwoProject( getStore(), "Build Queue Project 1", "1" );
+
+        String projectId = project.getId();
 
         buildProject( projectId, false );
 
@@ -64,9 +67,9 @@
     public void testTheQueueWithMultipleProjects()
         throws Exception
     {
-        String projectId1 = AbstractContinuumTest.addMavenTwoProject( getStore(), "Build Queue Project 2", "foo" );
+        String projectId1 = addMavenTwoProject( getStore(), "Build Queue Project 2", "foo" ).getId();
 
-        String projectId2 = AbstractContinuumTest.addMavenTwoProject( getStore(), "Build Queue Project 3", "bar" );
+        String projectId2 = addMavenTwoProject( getStore(), "Build Queue Project 3", "bar" ).getId();
 
         buildProject( projectId1, false );
 
@@ -102,7 +105,7 @@
     {
         String name = "Build Queue Project 4";
 
-        String projectId = AbstractContinuumTest.addMavenTwoProject( getStore(), name, "4" );
+        String projectId = addMavenTwoProject( getStore(), name, "4" ).getId();
 
         buildProject( projectId, true );
 

Modified: maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/notification/ContinuumNotificationDispatcherTest.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/notification/ContinuumNotificationDispatcherTest.java?rev=220230&r1=220229&r2=220230&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/notification/ContinuumNotificationDispatcherTest.java (original)
+++ maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/notification/ContinuumNotificationDispatcherTest.java Thu Jul 21 19:49:22 2005
@@ -19,6 +19,7 @@
 import org.apache.maven.continuum.store.ContinuumStore;
 import org.apache.maven.continuum.project.ContinuumBuild;
 import org.apache.maven.continuum.project.ContinuumProjectState;
+import org.apache.maven.continuum.project.ContinuumProject;
 import org.apache.maven.continuum.AbstractContinuumTest;
 
 /**
@@ -36,17 +37,17 @@
 
         ContinuumStore store = getStore();
 
-        String projectId = AbstractContinuumTest.addMavenTwoProject( store,
-                                                                     "Notification Dispatcher Test Project",
-                                                                     "scm:notification/dispatcher" );
+        ContinuumProject project = AbstractContinuumTest.addMavenTwoProject( store,
+                                                                             "Notification Dispatcher Test Project",
+                                                                             "scm:notification/dispatcher" );
 
         ContinuumBuild build = new ContinuumBuild();
         build.setStartTime( System.currentTimeMillis() );
         build.setState( ContinuumProjectState.BUILDING );
         build.setForced( false );
-        String buildId = store.addBuild( projectId, build );
 
-        notificationDispatcher.buildComplete( store.getProject( projectId ),
-                                              store.getBuild( buildId ) );
+        build = store.addBuild( project.getId(), build );
+
+        notificationDispatcher.buildComplete( project, build );
     }
 }

Modified: maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/store/AbstractContinuumStoreTest.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/store/AbstractContinuumStoreTest.java?rev=220230&r1=220229&r2=220230&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/store/AbstractContinuumStoreTest.java (original)
+++ maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/store/AbstractContinuumStoreTest.java Thu Jul 21 19:49:22 2005
@@ -32,11 +32,11 @@
 public class AbstractContinuumStoreTest
     extends AbstractContinuumTest
 {
-    protected ContinuumStore store;
+    private ContinuumStore store;
 
-    protected String roleHint;
+    private String roleHint;
 
-    protected Class implementationClass;
+    private Class implementationClass;
 
     public AbstractContinuumStoreTest( String roleHint, Class implementationClass )
     {
@@ -73,23 +73,21 @@
 
         configuration.setProperty( "foo", "bar" );
 
-        String projectId = store.addProject( makeMavenTwoProject( "Test Project",
-                                                                  "scm:local:src/test/repo",
-                                                                  "foo@bar.com",
-                                                                  "1.0",
-                                                                  "a b",
-                                                                  "/tmp" ) );
-
-        assertNotNull( "The project id is null.", projectId );
-
-        ContinuumProject actual = store.getProject( projectId );
-
-        assertProjectEquals( projectId, makeMavenTwoProject( "Test Project",
-                                                             "scm:local:src/test/repo",
-                                                             "foo@bar.com",
-                                                             "1.0",
-                                                             "a b",
-                                                             "/tmp" ), actual );
+        ContinuumProject actual = store.addProject( makeMavenTwoProject( "Test Project",
+                                                                         "scm:local:src/test/repo",
+                                                                         "foo@bar.com",
+                                                                         "1.0",
+                                                                         "a b",
+                                                                         "/tmp" ) );
+
+        assertNotNull( "The project id is null.", actual.getId() );
+
+        assertProjectEquals( makeMavenTwoProject( "Test Project",
+                                                  "scm:local:src/test/repo",
+                                                  "foo@bar.com",
+                                                  "1.0",
+                                                  "a b",
+                                                  "/tmp" ), actual );
     }
 
     public void testGetNonExistingProject()
@@ -122,25 +120,23 @@
         String commandLineArguments = "";
         String workingDirectory = "/tmp";
 
-        ContinuumProject project = makeMavenTwoProject( name,
-                                                        scmUrl,
-                                                        nagEmailAddress,
-                                                        version,
-                                                        commandLineArguments,
-                                                        workingDirectory );
+        ContinuumProject expected = makeMavenTwoProject( name,
+                                                         scmUrl,
+                                                         nagEmailAddress,
+                                                         version,
+                                                         commandLineArguments,
+                                                         workingDirectory );
 
-        String projectId = store.addProject( project );
+        ContinuumProject project = store.addProject( expected );
+
+        String projectId = project.getId();
 
         // ----------------------------------------------------------------------
         //
         // ----------------------------------------------------------------------
 
-        project = store.getProject( projectId );
-
         assertNotNull( project );
 
-        assertEquals( projectId, project.getId() );
-
         // ----------------------------------------------------------------------
         //
         // ----------------------------------------------------------------------
@@ -169,18 +165,18 @@
 
         scmResult.setSuccess( true );
 
-        setCheckoutDone( store, projectId, scmResult, null, null );
-
-        project = store.getProject( projectId );
+        project = setCheckoutDone( store, store.getProject( projectId ), scmResult, null, null );
 
         assertNotNull( project );
 
+        assertNotNull( project.getScmResult() );
+
+        assertTrue( project.getScmResult().isSuccess() );
+
         // ----------------------------------------------------------------------
         //
         // ----------------------------------------------------------------------
 
-        project = store.getProject( projectId );
-
         String name2 = "name 2";
         String scmUrl2 = "scm url 2";
         String emailAddress2 = "2@bar";
@@ -192,7 +188,7 @@
 
         assertNotNull( project.getNotifiers() );
         assertEquals( 1, project.getNotifiers().size() );
-        ContinuumNotifier notifier = ((ContinuumNotifier) project.getNotifiers().get( 0 ));
+        ContinuumNotifier notifier = (ContinuumNotifier) project.getNotifiers().get( 0 );
         notifier.setType( "kewk" );
         notifier.getConfiguration().put( "address", emailAddress2 );
         notifier.getConfiguration().put( "name", "tryg" );
@@ -210,8 +206,7 @@
         List notifiers = new ArrayList();
         notifiers.add( notifier );
 
-        assertProjectEquals( projectId,
-                             name2,
+        assertProjectEquals( name2,
                              scmUrl2,
                              notifiers,
                              version2,
@@ -257,13 +252,13 @@
         String commandLineArguments1 = "";
         String workingDirectory1 = "/tmp";
 
-        String id1 = addMavenTwoProject( store,
-                                         name1,
-                                         scmUrl1,
-                                         nagEmailAddress1,
-                                         version1,
-                                         commandLineArguments1,
-                                         workingDirectory1 );
+        ContinuumProject project1 = addMavenTwoProject( store,
+                                                        name1,
+                                                        scmUrl1,
+                                                        nagEmailAddress1,
+                                                        version1,
+                                                        commandLineArguments1,
+                                                        workingDirectory1 );
 
         String name2 = "Test All Projects 2";
         String scmUrl2 = "scm:local:src/test/repo/bar";
@@ -272,13 +267,13 @@
         String commandLineArguments2 = "";
         String workingDirectory2 = "/tmp";
 
-        String id2 = addMavenTwoProject( store,
-                                         name2,
-                                         scmUrl2,
-                                         nagEmailAddress2,
-                                         version2,
-                                         commandLineArguments2,
-                                         workingDirectory2 );
+        ContinuumProject project2 = addMavenTwoProject( store,
+                                                        name2,
+                                                        scmUrl2,
+                                                        nagEmailAddress2,
+                                                        version2,
+                                                        commandLineArguments2,
+                                                        workingDirectory2 );
 
         Map projects = new HashMap();
 
@@ -297,10 +292,7 @@
             projects.put( project.getName(), project );
         }
 
-        ContinuumProject project1 = (ContinuumProject) projects.get( name1 );
-
-        assertProjectEquals( id1,
-                             name1,
+        assertProjectEquals( name1,
                              scmUrl1,
                              (String)null,
                              version1,
@@ -309,10 +301,7 @@
                              workingDirectory1,
                              project1 );
 
-        ContinuumProject project2 = (ContinuumProject) projects.get( name2 );
-
-        assertProjectEquals( id2,
-                             name2,
+        assertProjectEquals( name2,
                              scmUrl2,
                              (String)null,
                              version2,
@@ -325,9 +314,9 @@
     public void testRemoveProject()
         throws Exception
     {
-        String projectId = addMavenTwoProject( "Remove Test Project", "scm:remove-project" );
+        ContinuumProject project = addMavenTwoProject( store, "Remove Test Project", "scm:remove-project" );
 
-        String buildId = createBuild( store, projectId, false );
+        ContinuumBuild build = createBuild( store, project.getId(), false );
 
         ScmResult scmResult = new ScmResult();
 
@@ -338,13 +327,13 @@
         scmResult.addFile( file );
 
         setBuildResult( store,
-                        buildId,
+                        build,
                         ContinuumProjectState.OK,
                         makeContinuumBuildExecutionResult( "", 0 ),
                         scmResult,
                         null );
 
-        store.removeProject( projectId );
+        store.removeProject( project.getId() );
     }
 
     private ContinuumBuildExecutionResult makeContinuumBuildExecutionResult( String output,
@@ -358,7 +347,7 @@
         throws Exception
     {
         String projectId = addMavenTwoProject( store,
-                                               makeStubMavenTwoProject( "Last project", "scm:foo" ) );
+                                               makeStubMavenTwoProject( "Last project", "scm:foo" ) ).getId();
 
         assertNull( store.getLatestBuildForProject( projectId ) );
 
@@ -366,7 +355,7 @@
 
         for ( int i = 0; i < 10; i++ )
         {
-            expectedBuilds.add( createBuild( store, projectId, false ) );
+            expectedBuilds.add( createBuild( store, projectId, false ).getId() );
         }
 
         assertEquals( expectedBuilds.get( expectedBuilds.size() - 1 ),
@@ -380,7 +369,7 @@
     public void testUpdateMavenTwoProject()
         throws Exception
     {
-        String projectId = addMavenTwoProject( "Maven Two Project", "scm:foo" );
+        String projectId = addMavenTwoProject( store, "Maven Two Project", "scm:foo" ).getId();
 
         MavenTwoProject project = (MavenTwoProject) store.getProject( projectId );
 
@@ -441,13 +430,15 @@
     {
         lookup( JdoFactory.ROLE );
 
-        String projectId = addMavenTwoProject( "Build Test Project", "scm:build" );
+        String projectId = addMavenTwoProject( store, "Build Test Project", "scm:build" ).getId();
 
         // ----------------------------------------------------------------------
         // Construct a build object
         // ----------------------------------------------------------------------
 
-        String buildId = createBuild( store, projectId, false );
+        ContinuumBuild build = createBuild( store, projectId, false );
+
+        String buildId = build.getId();
 
         ScmResult scmResult = new ScmResult();
 
@@ -464,7 +455,7 @@
         scmResult.getFiles().add( scmFile );
 
         setBuildComplete( store,
-                          buildId,
+                          build,
                           scmResult,
                           makeContinuumBuildExecutionResult( "output", 10 ) );
 
@@ -478,7 +469,7 @@
 
         assertEquals( "Expected the build set to contain a single build.", 1, builds.size() );
 
-        ContinuumBuild build = (ContinuumBuild) builds.iterator().next();
+        build = (ContinuumBuild) builds.iterator().next();
 
         assertNotNull( build );
 
@@ -486,18 +477,16 @@
     }
 
     private void setBuildComplete( ContinuumStore store,
-                                   String buildId,
+                                   ContinuumBuild build,
                                    ScmResult scmResult,
                                    ContinuumBuildExecutionResult result )
         throws ContinuumStoreException
     {
-        ContinuumBuild build = store.getBuild( buildId );
-
         build.setScmResult( scmResult );
 
         build.setExitCode( result.getExitCode() );
 
-        store.setBuildOutput( buildId, "output" );
+        store.setBuildOutput( build.getId(), "output" );
 
         store.updateBuild( build );
     }
@@ -511,11 +500,11 @@
         // Set up projects
         // ----------------------------------------------------------------------
 
-        String projectId = addMavenTwoProject( "Association Test Project", "scm:association" );
+        String projectId = addMavenTwoProject( store, "Association Test Project", "scm:association" ).getId();
 
-        String projectIdFoo = addMavenTwoProject( "Foo Project", "scm:association-foo" );
+        String projectIdFoo = addMavenTwoProject( store, "Foo Project", "scm:association-foo" ).getId();
 
-        String projectIdBar = addMavenTwoProject( "Bar Project", "scm:association-bar" );
+        String projectIdBar = addMavenTwoProject( store, "Bar Project", "scm:association-bar" ).getId();
 
         // ----------------------------------------------------------------------
         //
@@ -525,7 +514,7 @@
 
         for ( int i = 0; i < 10; i++ )
         {
-            expectedBuilds.add( createBuild( store, projectId, false ) );
+            expectedBuilds.add( createBuild( store, projectId, false ).getId() );
 
             createBuild( store, projectIdFoo, false );
 
@@ -567,7 +556,7 @@
     public void testGetLatestBuild()
         throws Exception
     {
-        String projectId = addMavenTwoProject( "Association Test Project", "scm:association" );
+        String projectId = addMavenTwoProject( store, "Association Test Project", "scm:association" ).getId();
 
         int size = 10;
 
@@ -575,7 +564,7 @@
 
         for ( int i = 0; i < size; i++ )
         {
-            expectedBuilds.add( createBuild( store, projectId, false ) );
+            expectedBuilds.add( createBuild( store, projectId, false ).getId() );
         }
 
         // ----------------------------------------------------------------------
@@ -604,18 +593,16 @@
         //
         // ----------------------------------------------------------------------
 
-        String projectId = addMavenTwoProject( "Build Result Project", "scm:build/result" );
+        String projectId = addMavenTwoProject( store, "Build Result Project", "scm:build/result" ).getId();
 
         long now = System.currentTimeMillis();
 
-        String buildId = createBuild( store, projectId, false );
-
-        assertNotNull( buildId );
-
-        ContinuumBuild build = store.getBuild( buildId );
+        ContinuumBuild build = createBuild( store, projectId, false );
 
         assertNotNull( build );
 
+        assertNotNull( build.getId() );
+
         assertEquals( now / 10000, build.getStartTime() / 10000 );
 
         assertEquals( 0, build.getEndTime() );
@@ -631,7 +618,7 @@
         ScmResult scmResult = new ScmResult();
 
         setBuildResult( store,
-                        buildId,
+                        build,
                         ContinuumProjectState.OK,
                         makeContinuumBuildExecutionResult(  "output", 1 ),
                         scmResult,
@@ -641,22 +628,11 @@
         //
         // ----------------------------------------------------------------------
 
-        build = store.getBuild( buildId );
+        build = store.getBuild( build.getId() );
 
         assertEquals( 1, build.getExitCode() );
 
-        assertEquals( "output", store.getBuildOutput( buildId ) );
-    }
-
-    // ----------------------------------------------------------------------
-    // Private utility methods
-    // ----------------------------------------------------------------------
-
-    protected String addMavenTwoProject( String name, String scmUrl )
-        throws Exception
-    {
-        return addMavenTwoProject( store,
-                                   makeStubMavenTwoProject( name, scmUrl ) );
+        assertEquals( "output", store.getBuildOutput( build.getId() ) );
     }
 
     // ----------------------------------------------------------------------
@@ -684,9 +660,7 @@
 
         project.setNotifiers( notifiers );
 
-        String id = getStore().addProject( project );
-
-        project = getStore().getProject( id );
+        project = getStore().addProject( project );
 
         notifiers = project.getNotifiers();
 
@@ -709,18 +683,16 @@
         throws Exception
     {
         // create project
-        String projectId = addMavenTwoProject( "Project Scheduling", "scm:scheduling" );
+        ContinuumProject project = addMavenTwoProject( store, "Project Scheduling", "scm:scheduling" );
 
-        ContinuumProject project = store.getProject( projectId );
+        String projectId = project.getId();
 
         // add schedule
         //project.addSchedule( createStubSchedule( "schedule1" ) );
 
         ContinuumSchedule s = createStubSchedule( "schedule1" );
 
-        String sid = store.addSchedule( s );
-
-        s = store.getSchedule( sid );
+        s = store.addSchedule( s );
 
         project.addSchedule( s );
 
@@ -790,22 +762,15 @@
         // create schedule
         ContinuumSchedule schedule = createStubSchedule( "schedule2" );
 
-        String scheduleId = store.addSchedule( schedule );
-
-        schedule = store.getSchedule( scheduleId );
+        schedule = store.addSchedule( schedule );
 
-        String projectId = addMavenTwoProject( "Project", "scm:scheduling" );
-
-        ContinuumProject project = store.getProject( projectId );
+        ContinuumProject project = addMavenTwoProject( store, "Project", "scm:scheduling" );
 
         // add project
         schedule.addProject( project );
 
         // update schedule
-        store.updateSchedule( schedule );
-
-        // retrieve schedule
-        schedule = store.getSchedule( scheduleId );
+        schedule = store.updateSchedule( schedule );
 
         assertNotNull( schedule );
 
@@ -825,7 +790,7 @@
         // present within the project.
         // ----------------------------------------------------------------------
 
-        project = store.getProject( projectId );
+        project = store.getProject( project.getId() );
 
         assertNotNull( project );
 
@@ -838,11 +803,11 @@
         // still remains in the store.
         // ----------------------------------------------------------------------
 
-        schedule = store.getSchedule( scheduleId );
+        schedule = store.getSchedule( schedule.getId() );
 
         store.removeSchedule( schedule.getId() );
 
-        project = store.getProject( projectId );
+        project = store.getProject( project.getId() );
 
         assertNotNull( project );
     }

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=220230&r1=220229&r2=220230&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 Thu Jul 21 19:49:22 2005
@@ -1,11 +1,5 @@
 package org.apache.maven.continuum.store;
 
-import org.apache.maven.continuum.AbstractContinuumTest;
-import org.apache.maven.continuum.project.ContinuumProject;
-import org.apache.maven.continuum.project.ContinuumProjectGroup;
-import org.apache.maven.continuum.initialization.ContinuumInitializer;
-import org.apache.maven.continuum.initialization.DefaultContinuumInitializer;
-
 /*
  * Copyright 2004-2005 The Apache Software Foundation.
  *
@@ -22,6 +16,13 @@
  * limitations under the License.
  */
 
+import org.apache.maven.continuum.AbstractContinuumTest;
+import org.apache.maven.continuum.project.ContinuumProject;
+import org.apache.maven.continuum.project.ContinuumProjectGroup;
+import org.apache.maven.continuum.project.MavenTwoProject;
+import org.apache.maven.continuum.initialization.ContinuumInitializer;
+import org.apache.maven.continuum.initialization.DefaultContinuumInitializer;
+
 /**
  * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
  * @version $Id:$
@@ -70,11 +71,9 @@
         // At this point we can now accept new projects into the system
         // ----------------------------------------------------------------------
 
-        ContinuumProject project = makeStubMavenTwoProject( "test1", "scm:url" );
-
-        String projectId = addMavenTwoProject( getStore(), project );
+        MavenTwoProject project = makeStubMavenTwoProject( "test1", "scm:url" );
 
-        project = getStore().getProject( projectId );
+        project = addMavenTwoProject( getStore(), project );
 
         // ----------------------------------------------------------------------
         // Now that we have a project we want to add it to the default project group
@@ -84,10 +83,10 @@
 
         getStore().updateProjectGroup( defaultProjectGroup );
 
-        assertEquals( DefaultContinuumInitializer.DEFAULT_PROJECT_GROUP_NAME,   project.getProjectGroup().getName() );
+        assertEquals( DefaultContinuumInitializer.DEFAULT_PROJECT_GROUP_NAME, project.getProjectGroup().getName() );
 
-        assertEquals( DefaultContinuumInitializer.DEFAULT_PROJECT_GROUP_DESCRIPTION,   project.getProjectGroup().getDescription() );
+        assertEquals( DefaultContinuumInitializer.DEFAULT_PROJECT_GROUP_DESCRIPTION, project.getProjectGroup().getDescription() );
 
-        assertEquals( DefaultContinuumInitializer.DEFAULT_PROJECT_GROUP_ID,   project.getProjectGroup().getGroupId() );
+        assertEquals( DefaultContinuumInitializer.DEFAULT_PROJECT_GROUP_ID, project.getProjectGroup().getGroupId() );
     }
 }

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=220230&r1=220229&r2=220230&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 Thu Jul 21 19:49:22 2005
@@ -21,6 +21,7 @@
 import org.apache.maven.continuum.project.ContinuumProject;
 import org.apache.maven.continuum.project.ContinuumProjectGroup;
 import org.apache.maven.continuum.project.ContinuumBuildSettings;
+import org.apache.maven.continuum.project.MavenTwoProject;
 
 import java.util.Collection;
 import java.util.Set;
@@ -35,23 +36,19 @@
     public void testAddingBuildGroupToProjectAndUpdatingProject()
         throws Exception
     {
-        String projectId = addMavenTwoProject( getStore(), "Project Scheduling", "scm:scheduling" );
-
-        ContinuumProject project = getStore().getProject( projectId );
+        ContinuumProject project = addMavenTwoProject( getStore(), "Project Scheduling", "scm:scheduling" );
 
         ContinuumBuildGroup buildGroup = createStubBuildGroup( "Plexus", "Description" );
 
-        String buildGroupId = getStore().addBuildGroup( buildGroup );
-
-        buildGroup = getStore().getBuildGroup( buildGroupId );
+        buildGroup = getStore().addBuildGroup( buildGroup );
 
         project.addBuildGroup( buildGroup );
 
-        getStore().updateProject( project );
+        project = getStore().updateProject( project );
 
         assertEquals( 1, getStore().getBuildGroups().size() );
 
-        project = getStore().getProject( projectId );
+        project = getStore().getProject( project.getId() );
 
         assertEquals( 1, project.getBuildGroups().size() );
     }
@@ -62,22 +59,15 @@
         // create buildGroup
         ContinuumBuildGroup buildGroup = createStubBuildGroup( "buildGroup1", "buildGroup1" );
 
-        String buildGroupId = getStore().addBuildGroup( buildGroup );
+        buildGroup = getStore().addBuildGroup( buildGroup );
 
-        buildGroup = getStore().getBuildGroup( buildGroupId );
-
-        String projectId = addMavenTwoProject( getStore(), "project1", "scm:scheduling" );
-
-        ContinuumProject project = getStore().getProject( projectId );
+        ContinuumProject project = addMavenTwoProject( getStore(), "project1", "scm:scheduling" );
 
         // add project
         buildGroup.addProject( project );
 
         // update buildGroup
-        getStore().updateBuildGroup( buildGroup );
-
-        // retrieve buildGroup
-        buildGroup = getStore().getBuildGroup( buildGroupId );
+        buildGroup = getStore().updateBuildGroup( buildGroup );
 
         assertNotNull( buildGroup );
 
@@ -97,7 +87,7 @@
         // present within the project.
         // ----------------------------------------------------------------------
 
-        project = getStore().getProject( projectId );
+        project = getStore().getProject( project.getId() );
 
         assertNotNull( project );
 
@@ -110,11 +100,11 @@
         // still remains in the getStore().
         // ----------------------------------------------------------------------
 
-        buildGroup = getStore().getBuildGroup( buildGroupId );
+        buildGroup = getStore().getBuildGroup( buildGroup.getId() );
 
         getStore().removeBuildGroup( buildGroup.getId() );
 
-        project = getStore().getProject( projectId );
+        project = getStore().getProject( project.getId() );
 
         assertNotNull( project );
     }
@@ -125,22 +115,15 @@
         // create projectGroup
         ContinuumProjectGroup projectGroup = createStubProjectGroup( "projectGroup1", "projectGroup1" );
 
-        String projectGroupId = getStore().addProjectGroup( projectGroup );
-
-        projectGroup = getStore().getProjectGroup( projectGroupId );
+        projectGroup = getStore().addProjectGroup( projectGroup );
 
-        String projectId = addMavenTwoProject( getStore(), "project2", "scm:scheduling" );
-
-        ContinuumProject project = getStore().getProject( projectId );
+        ContinuumProject project = addMavenTwoProject( getStore(), "project2", "scm:scheduling" );
 
         // add project
         projectGroup.addProject( project );
 
         // update projectGroup
-        getStore().updateProjectGroup( projectGroup );
-
-        // retrieve projectGroup
-        projectGroup = getStore().getProjectGroup( projectGroupId );
+        projectGroup = getStore().updateProjectGroup( projectGroup );
 
         assertNotNull( projectGroup );
 
@@ -160,7 +143,7 @@
         // present within the project.
         // ----------------------------------------------------------------------
 
-        project = getStore().getProject( projectId );
+        project = getStore().getProject( project.getId() );
 
         assertNotNull( project );
 
@@ -173,11 +156,11 @@
         // still remains in the getStore().
         // ----------------------------------------------------------------------
 
-        projectGroup = getStore().getProjectGroup( projectGroupId );
+        projectGroup = getStore().getProjectGroup( projectGroup.getId() );
 
         getStore().removeProjectGroup( projectGroup.getId() );
 
-        project = getStore().getProject( projectId );
+        project = getStore().getProject( project.getId() );
 
         assertNotNull( project );
     }
@@ -188,25 +171,18 @@
         // create buildSettings
         ContinuumBuildSettings buildSettings = createStubBuildSettings( "buildSettings1", "1.3" );
 
-        String buildSettingsId = getStore().addBuildSettings( buildSettings );
-
-        buildSettings = getStore().getBuildSettings( buildSettingsId );
+        buildSettings = getStore().addBuildSettings( buildSettings );
 
         // create buildGroup
         ContinuumBuildGroup buildGroup = createStubBuildGroup( "buildGroup1", "buildGroup1" );
 
-        String buildGroupId = getStore().addBuildGroup( buildGroup );
-
-        buildGroup = getStore().getBuildGroup( buildGroupId );
+        buildGroup = getStore().addBuildGroup( buildGroup );
 
         // add build group
         buildSettings.addBuildGroup( buildGroup );
 
         // update buildSettings
-        getStore().updateBuildSettings( buildSettings );
-
-        // retrieve buildSettings
-        buildSettings = getStore().getBuildSettings( buildSettingsId );
+        buildSettings = getStore().updateBuildSettings( buildSettings );
 
         assertNotNull( buildSettings );
 
@@ -226,7 +202,7 @@
         // present within the build build gropu.
         // ----------------------------------------------------------------------
 
-        buildGroup = getStore().getBuildGroup( buildGroupId );
+        buildGroup = getStore().getBuildGroup( buildGroup.getId() );
 
         assertNotNull( buildGroup );
 
@@ -239,11 +215,11 @@
         // still remains in the getStore().
         // ----------------------------------------------------------------------
 
-        buildSettings = getStore().getBuildSettings( buildSettingsId );
+        buildSettings = getStore().getBuildSettings( buildSettings.getId() );
 
         getStore().removeBuildSettings( buildSettings.getId() );
 
-        buildGroup = getStore().getBuildGroup( buildGroupId );
+        buildGroup = getStore().getBuildGroup( buildGroup.getId() );
 
         assertNotNull( buildGroup );
     }
@@ -254,25 +230,18 @@
         // create buildSettings
         ContinuumBuildSettings buildSettings = createStubBuildSettings( "buildSettings1", "1.3" );
 
-        String buildSettingsId = getStore().addBuildSettings( buildSettings );
-
-        buildSettings = getStore().getBuildSettings( buildSettingsId );
+        buildSettings = getStore().addBuildSettings( buildSettings );
 
         // create projectGroup
         ContinuumProjectGroup projectGroup = createStubProjectGroup( "projectGroup1", "projectGroup1" );
 
-        String projectGroupId = getStore().addProjectGroup( projectGroup );
-
-        projectGroup = getStore().getProjectGroup( projectGroupId );
+        projectGroup = getStore().addProjectGroup( projectGroup );
 
         // add build group
         buildSettings.addProjectGroup( projectGroup );
 
         // update buildSettings
-        getStore().updateBuildSettings( buildSettings );
-
-        // retrieve buildSettings
-        buildSettings = getStore().getBuildSettings( buildSettingsId );
+        buildSettings = getStore().updateBuildSettings( buildSettings );
 
         assertNotNull( buildSettings );
 
@@ -292,7 +261,7 @@
         // present within the build build gropu.
         // ----------------------------------------------------------------------
 
-        projectGroup = getStore().getProjectGroup( projectGroupId );
+        projectGroup = getStore().getProjectGroup( projectGroup.getId() );
 
         assertNotNull( projectGroup );
 
@@ -305,11 +274,11 @@
         // still remains in the getStore().
         // ----------------------------------------------------------------------
 
-        buildSettings = getStore().getBuildSettings( buildSettingsId );
+        buildSettings = getStore().getBuildSettings( buildSettings.getId() );
 
         getStore().removeBuildSettings( buildSettings.getId() );
 
-        projectGroup = getStore().getProjectGroup( projectGroupId );
+        projectGroup = getStore().getProjectGroup( projectGroup.getId() );
 
         assertNotNull( projectGroup );
     }
@@ -331,49 +300,43 @@
 
         plexusGroup.setName( "Plexus" );
 
-        String plexusGroupId = getStore().addProjectGroup( plexusGroup );
-
-        plexusGroup = getStore().getProjectGroup( plexusGroupId );
+        plexusGroup = getStore().addProjectGroup( plexusGroup );
 
         // ----------------------------------------------------------------------
         // Add projects from URL metadata
         // ----------------------------------------------------------------------
 
-        ContinuumProject componentA = makeStubMavenTwoProject( "component a", "a" );
+        MavenTwoProject componentA = makeStubMavenTwoProject( "component a", "a" );
 
         componentA.setProjectGroup( plexusGroup );
 
-        String projectIdA = addMavenTwoProject( getStore(),
-                                                componentA );
+        componentA = addMavenTwoProject( getStore(), componentA );
 
-        ContinuumProject componentB = makeStubMavenTwoProject( "component b", "b" );
+        MavenTwoProject componentB = makeStubMavenTwoProject( "component b", "b" );
 
         componentB.setProjectGroup( plexusGroup );
 
-        String projectIdB = addMavenTwoProject( getStore(),
-                                                componentB );
+        componentB = addMavenTwoProject( getStore(), componentB );
 
         // ----------------------------------------------------------------------
         //
         // ----------------------------------------------------------------------
 
-        plexusGroup = getStore().getProjectGroup( plexusGroupId );
-
         assertNotNull( plexusGroup.getProjects() );
 
         assertEquals( 2, plexusGroup.getProjects().size() );
 
-        ContinuumProject plexusComponentA = getStore().getProject( projectIdA );
+        componentA = (MavenTwoProject) getStore().getProject( componentA.getId() );
 
-        ContinuumProject plexusComponentB = getStore().getProject( projectIdB );
+        componentB = (MavenTwoProject) getStore().getProject( componentB.getId() );
 
-        assertNotNull( "componentA.projectGroup == null", plexusComponentA.getProjectGroup() );
+        assertNotNull( "componentA.projectGroup == null", componentA.getProjectGroup() );
 
-        assertNotNull( "componentB.projectGroup == null", plexusComponentB.getProjectGroup() );
+        assertNotNull( "componentB.projectGroup == null", componentB.getProjectGroup() );
 
-        assertEquals( "projectGroup.id != componentA.projectGroup.id", plexusGroup.getId(), plexusComponentA.getProjectGroup().getId() );
+        assertEquals( "projectGroup.id != componentA.projectGroup.id", plexusGroup.getId(), componentA.getProjectGroup().getId() );
 
-        assertEquals( "projectGroup.id != componentA.projectGroup.id", plexusGroup.getId(), plexusComponentB.getProjectGroup().getId() );
+        assertEquals( "projectGroup.id != componentA.projectGroup.id", plexusGroup.getId(), componentB.getProjectGroup().getId() );
 
         // ----------------------------------------------------------------------
         //
@@ -401,22 +364,17 @@
 
         getStore().updateProject( componentA );
 
-        System.out.println( "componentA.getBuildGroups().size() = " + componentA.getBuildGroups().size() );
-
         buildGroup = (ContinuumBuildGroup) componentA.getBuildGroups().iterator().next();
 
         String buildGroupId = buildGroup.getId();
 
         assertNotNull( buildGroup );
 
-        //String buildGroupId = getStore().getBuildGroup;
-
-
         // ----------------------------------------------------------------------
         // Assert that the project has a build group
         // ----------------------------------------------------------------------
 
-        componentA = getStore().getProject( componentA.getId() );
+        componentA = (MavenTwoProject) getStore().getProject( componentA.getId() );
 
         assertNotNull( componentA.getBuildGroups() );
 
@@ -436,7 +394,7 @@
 
         assertEquals( "buildGroup.projects.size", 1, buildGroup.getProjects().size() );
 
-        assertEquals( projectIdA, ( (ContinuumProject) buildGroup.getProjects().iterator().next() ).getId() );
+        assertEquals( componentA.getId(), ( (ContinuumProject) buildGroup.getProjects().iterator().next() ).getId() );
 
         // ----------------------------------------------------------------------
         //
@@ -456,7 +414,7 @@
 
         assertEquals( 0, buildGroup.getProjects().size() );
 
-        plexusGroup = getStore().getProjectGroup( plexusGroupId );
+        plexusGroup = getStore().getProjectGroup( plexusGroup.getId() );
 
         assertNotNull( plexusGroup );
 

Modified: maven/continuum/trunk/continuum-model/pom.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-model/pom.xml?rev=220230&r1=220229&r2=220230&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-model/pom.xml (original)
+++ maven/continuum/trunk/continuum-model/pom.xml Thu Jul 21 19:49:22 2005
@@ -32,7 +32,7 @@
       <plugin>
         <groupId>org.codehaus.modello</groupId>
         <artifactId>modello-maven-plugin</artifactId>
-        <version>1.0-alpha-3</version>
+        <version>1.0-alpha-4-SNAPSHOT</version>
         <configuration>
           <version>1.0.0</version>
           <packageWithVersion>false</packageWithVersion>

Modified: maven/continuum/trunk/continuum-model/src/main/resources/META-INF/package.jdo
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-model/src/main/resources/META-INF/package.jdo?rev=220230&r1=220229&r2=220230&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-model/src/main/resources/META-INF/package.jdo (original)
+++ maven/continuum/trunk/continuum-model/src/main/resources/META-INF/package.jdo Thu Jul 21 19:49:22 2005
@@ -185,7 +185,7 @@
       <fetch-group name="build-settings-detail">
         <field name="buildGroups"/>
         <field name="projectGroups"/>
-      </fetch-group>      
+      </fetch-group>
     </class>
 
   </package>

Modified: maven/continuum/trunk/continuum-model/src/main/resources/continuum.mdo
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-model/src/main/resources/continuum.mdo?rev=220230&r1=220229&r2=220230&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-model/src/main/resources/continuum.mdo (original)
+++ maven/continuum/trunk/continuum-model/src/main/resources/continuum.mdo Thu Jul 21 19:49:22 2005
@@ -401,9 +401,9 @@
         </field>
         <field>
           <name>id</name>
-          <identifier>true</identifier>
           <version>1.0.0</version>
           <type>String</type>
+          <identifier>true</identifier>
         </field>
         <field>
           <name>state</name>



Mime
View raw message