continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tryg...@apache.org
Subject svn commit: r190663 - /maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/store /maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action /maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/store /maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/store
Date Tue, 14 Jun 2005 22:31:22 GMT
Author: trygvis
Date: Tue Jun 14 15:31:19 2005
New Revision: 190663

URL: http://svn.apache.org/viewcvs?rev=190663&view=rev
Log: (empty)

Modified:
    maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.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/store/ModelloJPoxContinuumStore.java
    maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/store/ModelloJPoxContinuumStoreTest.java

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=190663&r1=190662&r2=190663&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
Tue Jun 14 15:31:19 2005
@@ -34,7 +34,7 @@
     String ROLE = ContinuumStore.class.getName();
 
     // ----------------------------------------------------------------------
-    // ContinuumProject
+    // ContinuumProject Mutators
     // ----------------------------------------------------------------------
 
     String addProject( ContinuumProject project )
@@ -46,6 +46,9 @@
     void setWorkingDirectory( String projectId, String workingDirectory )
         throws ContinuumStoreException;
 
+    void updateProject( ContinuumProject project )
+        throws ContinuumStoreException;
+
     void updateProject( String projectId,
                         String name,
                         String scmUrl,
@@ -53,6 +56,10 @@
                         String version,
                         String commandLineArguments )
         throws ContinuumStoreException;
+
+    // ----------------------------------------------------------------------
+    // ContinuumProject Queries
+    // ----------------------------------------------------------------------
 
     Collection getAllProjects()
         throws ContinuumStoreException;

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=190663&r1=190662&r2=190663&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
Tue Jun 14 15:31:19 2005
@@ -30,7 +30,7 @@
         String projectId = getStore().addProject( project );
 
         /*
-        String projectId = getStore().addMavenTwoProject( project.getName(),
+        String projectId = getStore().addProject( project.getName(),
                                                   project.getScmUrl(),
                                                   project.getNagEmailAddress(),
                                                   project.getVersion(),

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/store/ModelloJPoxContinuumStore.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/store/ModelloJPoxContinuumStore.java?rev=190663&r1=190662&r2=190663&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/store/ModelloJPoxContinuumStore.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/store/ModelloJPoxContinuumStore.java
Tue Jun 14 15:31:19 2005
@@ -170,6 +170,19 @@
         }
     }
 
+    public void updateProject( ContinuumProject project )
+        throws ContinuumStoreException
+    {
+        try
+        {
+            store.storeContinuumProject( project );
+        }
+        catch ( Exception e )
+        {
+            throw new ContinuumStoreException( "Error while setting the working directory.",
e );
+        }
+    }
+
     public void updateProject( String projectId,
                                String name,
                                String scmUrl,
@@ -266,9 +279,7 @@
     {
         try
         {
-            ContinuumProject project = store.getContinuumProject( projectId, true );
-
-            return project;
+            return store.getContinuumProject( projectId, true );
         }
         catch ( Exception e )
         {

Modified: maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/store/ModelloJPoxContinuumStoreTest.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/store/ModelloJPoxContinuumStoreTest.java?rev=190663&r1=190662&r2=190663&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/store/ModelloJPoxContinuumStoreTest.java
(original)
+++ maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/store/ModelloJPoxContinuumStoreTest.java
Tue Jun 14 15:31:19 2005
@@ -171,20 +171,20 @@
         configuration.setProperty( "foo", "bar" );
 
         ContinuumProject expected = makeMavenTwoProject( "Test Project",
-                                                 "scm:local:src/test/repo",
-                                                 "foo@bar.com",
-                                                 "1.0",
-                                                 "a b",
-                                                 "maven2",
-                                                 "/tmp" );
+                                                         "scm:local:src/test/repo",
+                                                         "foo@bar.com",
+                                                         "1.0",
+                                                         "a b",
+                                                         "maven2",
+                                                         "/tmp" );
 
         String projectId = store.addProject( makeMavenTwoProject( "Test Project",
-                                                          "scm:local:src/test/repo",
-                                                          "foo@bar.com",
-                                                          "1.0",
-                                                          "a b",
-                                                          "maven2",
-                                                          "/tmp" ) );
+                                                                  "scm:local:src/test/repo",
+                                                                  "foo@bar.com",
+                                                                  "1.0",
+                                                                  "a b",
+                                                                  "maven2",
+                                                                  "/tmp" ) );
 
         assertNotNull( "The project id is null.", projectId );
 
@@ -193,6 +193,7 @@
         assertProjectEquals( projectId, expected, actual );
     }
 
+
     public void testGetNonExistingProject()
         throws Exception
     {
@@ -224,12 +225,12 @@
         String workingDirectory = "/tmp";
 
         String projectId = store.addProject( makeMavenTwoProject( name,
-                                                          scmUrl,
-                                                          nagEmailAddress,
-                                                          version,
-                                                          commandLineArguments,
-                                                          builderId,
-                                                          workingDirectory ) );
+                                                                  scmUrl,
+                                                                  nagEmailAddress,
+                                                                  version,
+                                                                  commandLineArguments,
+                                                                  builderId,
+                                                                  workingDirectory ) );
 
         // ----------------------------------------------------------------------
         //
@@ -418,10 +419,62 @@
     // ----------------------------------------------------------------------
 
     public void testUpdateMavenTwoProject()
+        throws Exception
     {
+        ContinuumStore store = (ContinuumStore) lookup( ContinuumStore.ROLE );
+
+        String projectId = addMavenTwoProject( "Maven Two Project", "scm:foo" );
+
+        MavenTwoProject project = (MavenTwoProject) store.getProject( projectId );
+
+        project.setName( "New name" );
+        project.setGoals( "clean test" );
+
+        store.updateProject( project );
+
+        project = (MavenTwoProject) store.getProject( projectId );
 
+        assertEquals( "New name", project.getName() );
+        assertEquals( "clean test", project.getGoals() );
     }
+/*
+    public void testUpdateMavenTwoProjectWithANonJdoObject()
+        throws Exception
+    {
+        ContinuumStore store = (ContinuumStore) lookup( ContinuumStore.ROLE );
+
+        // ----------------------------------------------------------------------
+        // Make a project in the store
+        // ----------------------------------------------------------------------
+
+        String projectId = addMavenTwoProject( "Maven Two Project", "scm:foo" );
 
+        // ----------------------------------------------------------------------
+        // This is a object constructed from outside Continuum, typically
+        // something that comes in over the wire.
+        // ----------------------------------------------------------------------
+
+        MavenTwoProject external = makeStubMavenTwoProject( "Maven Two Project", "scm:foo"
);
+
+        external.setId( projectId );
+
+        external.setName( "New name" );
+
+        MavenTwoProject p = (MavenTwoProject) store.getProject( projectId );
+
+        assertEquals( "Maven Two Project", p.getName() );
+
+        store.updateProject( external );
+
+        // ----------------------------------------------------------------------
+        //
+        // ----------------------------------------------------------------------
+
+        MavenTwoProject actual = (MavenTwoProject) store.getProject( projectId );
+
+        assertEquals( "New name", actual.getName() );
+    }
+*/
     // ----------------------------------------------------------------------
     // Build
     // ----------------------------------------------------------------------
@@ -704,26 +757,26 @@
     // Public utility methods
     // ----------------------------------------------------------------------
 
-    public static ContinuumProject makeStubMavenTwoProject( String name, String scmUrl )
+    public static MavenTwoProject makeStubMavenTwoProject( String name, String scmUrl )
     {
         return makeMavenTwoProject( name,
-                            scmUrl,
-                            "foo@bar.com",
-                            "1.0",
-                            "",
-                            ContinuumBuildExecutor.MAVEN_TWO_EXECUTOR_ID,
-                            "/tmp" );
-    }
-
-    public static ContinuumProject makeMavenTwoProject( String name,
-                                                String scmUrl,
-                                                String nagEmailAddress,
-                                                String version,
-                                                String commandLineArguments,
-                                                String executorId,
-                                                String workingDirectory )
+                                    scmUrl,
+                                    "foo@bar.com",
+                                    "1.0",
+                                    "",
+                                    ContinuumBuildExecutor.MAVEN_TWO_EXECUTOR_ID,
+                                    "/tmp" );
+    }
+
+    public static MavenTwoProject makeMavenTwoProject( String name,
+                                                       String scmUrl,
+                                                       String nagEmailAddress,
+                                                       String version,
+                                                       String commandLineArguments,
+                                                       String executorId,
+                                                       String workingDirectory )
     {
-        ContinuumProject project = new MavenTwoProject();
+        MavenTwoProject project = new MavenTwoProject();
 
         project.setName( name );
         project.setScmUrl( scmUrl );
@@ -783,12 +836,12 @@
         throws Exception
     {
         String projectId = store.addProject( makeMavenTwoProject( name,
-                                                          scmUrl,
-                                                          nagEmailAddress,
-                                                          version,
-                                                          commandLineArguments,
-                                                          executorId,
-                                                          workingDirectory ) );
+                                                                  scmUrl,
+                                                                  nagEmailAddress,
+                                                                  version,
+                                                                  commandLineArguments,
+                                                                  executorId,
+                                                                  workingDirectory ) );
 
         CheckOutScmResult checkOutScmResult = new CheckOutScmResult();
 



Mime
View raw message