continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tryg...@apache.org
Subject svn commit: r219428 - in /maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum: AbstractContinuumTest.java buildqueue/BuildQueueTest.java notification/ContinuumNotificationDispatcherTest.java store/AbstractContinuumStoreTest.java
Date Mon, 18 Jul 2005 00:00:17 GMT
Author: trygvis
Date: Sun Jul 17 17:00:10 2005
New Revision: 219428

URL: http://svn.apache.org/viewcvs?rev=219428&view=rev
Log:
o Moving useful stuff from AbstractContinuumStoreTest to AbstractContinuumTest.

Modified:
    maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/AbstractContinuumTest.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

Modified: maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/AbstractContinuumTest.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/AbstractContinuumTest.java?rev=219428&r1=219427&r2=219428&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/AbstractContinuumTest.java
(original)
+++ maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/AbstractContinuumTest.java
Sun Jul 17 17:00:10 2005
@@ -19,15 +19,23 @@
 import java.util.List;
 import java.util.Properties;
 import java.util.ArrayList;
+import java.util.Date;
 
 import org.apache.maven.continuum.execution.ContinuumBuildExecutor;
+import org.apache.maven.continuum.execution.ContinuumBuildExecutionResult;
 import org.apache.maven.continuum.execution.shell.ShellBuildExecutor;
 import org.apache.maven.continuum.execution.maven.m2.MavenTwoBuildExecutor;
 import org.apache.maven.continuum.project.MavenTwoProject;
 import org.apache.maven.continuum.project.ContinuumNotifier;
 import org.apache.maven.continuum.project.ContinuumProject;
 import org.apache.maven.continuum.project.ShellProject;
+import org.apache.maven.continuum.project.ContinuumBuild;
+import org.apache.maven.continuum.project.ContinuumProjectState;
 import org.apache.maven.continuum.store.ContinuumStore;
+import org.apache.maven.continuum.store.ContinuumStoreException;
+import org.apache.maven.continuum.scm.ScmResult;
+import org.apache.maven.continuum.scm.ScmFile;
+import org.apache.maven.continuum.utils.ContinuumUtils;
 
 import org.codehaus.plexus.PlexusTestCase;
 
@@ -163,4 +171,223 @@
 
         return notifiers;
     }
-}
+
+    // ----------------------------------------------------------------------
+    // Public utility methods
+    // ----------------------------------------------------------------------
+
+    public static String addMavenTwoProject( ContinuumStore store,
+                                             ContinuumProject project )
+        throws Exception
+    {
+        String projectId = store.addProject( project );
+
+        ScmResult scmResult = new ScmResult();
+
+        scmResult.setSuccess( true );
+
+        scmResult.setCommandOutput( "commandOutput" );
+
+        scmResult.setProviderMessage( "providerMessage" );
+
+        ScmFile scmFile = new ScmFile();
+
+        scmFile.setPath( "/foo" );
+
+        scmResult.addFile( scmFile );
+
+        setCheckoutDone( store, projectId, scmResult, null, null );
+
+        project = store.getProject( projectId );
+
+        assertNotNull( project );
+
+        return projectId;
+    }
+
+    public static String addMavenTwoProject( ContinuumStore store,
+                                             String name,
+                                             String scmUrl )
+        throws Exception
+    {
+        return addMavenTwoProject( store, makeStubMavenTwoProject( name, scmUrl ) );
+    }
+
+    public static String addMavenTwoProject( ContinuumStore store,
+                                             String name,
+                                             String scmUrl,
+                                             String nagEmailAddress,
+                                             String version,
+                                             String commandLineArguments,
+                                             String workingDirectory )
+        throws Exception
+    {
+        String projectId = store.addProject( makeMavenTwoProject( name,
+                                                                  scmUrl,
+                                                                  nagEmailAddress,
+                                                                  version,
+                                                                  commandLineArguments,
+                                                                  workingDirectory ) );
+
+        ScmResult scmResult = new ScmResult();
+
+        scmResult.setSuccess( true );
+
+        setCheckoutDone( store, projectId, scmResult, null, null );
+
+        ContinuumProject project = store.getProject( projectId );
+
+        assertNotNull( project );
+
+        return projectId;
+    }
+
+    public static String createBuild( ContinuumStore store,
+                                      String projectId,
+                                      boolean forced )
+        throws ContinuumStoreException
+    {
+        ContinuumBuild build = new ContinuumBuild();
+
+        build.setStartTime( System.currentTimeMillis() );
+
+        build.setState( ContinuumProjectState.BUILDING );
+
+        build.setForced( forced );
+
+        return store.addBuild( projectId, build );
+    }
+
+    public static void setCheckoutDone( ContinuumStore store,
+                                        String projectId,
+                                        ScmResult scmResult,
+                                        String errorMessage,
+                                        Throwable exception )
+        throws ContinuumStoreException
+    {
+        ContinuumProject project = store.getProject( projectId );
+
+        project.setScmResult( scmResult );
+
+        project.setCheckOutErrorMessage( errorMessage );
+
+        project.setCheckOutErrorException( ContinuumUtils.throwableToString( exception )
);
+
+        store.updateProject( project );
+    }
+
+    public static void setBuildResult( ContinuumStore store,
+                                       String buildId,
+                                       int state,
+                                       ContinuumBuildExecutionResult result,
+                                       ScmResult scmResult,
+                                       Throwable error )
+        throws ContinuumStoreException
+    {
+        ContinuumBuild build = store.getBuild( buildId );
+
+        build.setState( state );
+
+        build.setEndTime( new Date().getTime() );
+
+        build.setError( ContinuumUtils.throwableToString( error ) );
+
+        build.setScmResult( scmResult );
+
+        // ----------------------------------------------------------------------
+        // Copy over the build result
+        // ----------------------------------------------------------------------
+
+        build.setSuccess( result.isSuccess() );
+
+        build.setStandardOutput( result.getStandardOutput() );
+
+        build.setStandardError( result.getStandardError() );
+
+        build.setExitCode( result.getExitCode() );
+
+        store.updateBuild( build );
+    }
+
+    // ----------------------------------------------------------------------
+    // Assertions
+    // ----------------------------------------------------------------------
+
+    public void assertProjectEquals( String projectId,
+                                     ContinuumProject expected,
+                                     ContinuumProject actual )
+    {
+        assertProjectEquals( projectId,
+                             expected.getName(),
+                             expected.getScmUrl(),
+                             expected.getNotifiers(),
+                             expected.getVersion(),
+                             expected.getCommandLineArguments(),
+                             expected.getExecutorId(),
+                             expected.getWorkingDirectory(),
+                             actual );
+    }
+
+    public void assertProjectEquals( String projectId,
+                                     String name,
+                                     String scmUrl,
+                                     String emailAddress,
+                                     String version,
+                                     String commandLineArguments,
+                                     String builderId,
+                                     String workingDirectory,
+                                     ContinuumProject actual )
+    {
+        assertProjectEquals( projectId,
+                             name,
+                             scmUrl,
+                             createMailNotifierList( emailAddress ),
+                             version,
+                             commandLineArguments,
+                             builderId,
+                             workingDirectory,
+                             actual );
+    }
+
+    public void assertProjectEquals( String projectId,
+                                     String name,
+                                     String scmUrl,
+                                     List notifiers,
+                                     String version,
+                                     String commandLineArguments,
+                                     String builderId,
+                                     String workingDirectory,
+                                     ContinuumProject actual )
+    {
+        assertEquals( "project.id", projectId, actual.getId() );
+
+        assertEquals( "project.name", name, actual.getName() );
+
+        assertEquals( "project.scmUrl", scmUrl, actual.getScmUrl() );
+
+        assertNotNull( "project.notifiers", actual.getNotifiers() );
+
+        assertEquals( "project.notifiers.size", notifiers.size(), actual.getNotifiers().size()
);
+
+        for ( int i = 0; i < notifiers.size(); i++ )
+        {
+            ContinuumNotifier notifier = (ContinuumNotifier) notifiers.get( i );
+
+            ContinuumNotifier actualNotifier = (ContinuumNotifier) actual.getNotifiers().get(
i );
+
+            assertEquals( "project.notifiers.notifier.type", notifier.getType(), actualNotifier.getType()
);
+
+            assertEquals( "project.notifiers.notifier.configuration.address",
+                          notifier.getConfiguration().get( "address" ),
+                          actualNotifier.getConfiguration().get( "address" ) );
+        }
+
+        assertEquals( "project.version", version, actual.getVersion() );
+
+        assertEquals( "project.commandLineArguments", commandLineArguments, actual.getCommandLineArguments()
);
+
+        assertEquals( "project.executorId", builderId, actual.getExecutorId() );
+
+        assertEquals( "project.workingDirectory", workingDirectory, actual.getWorkingDirectory()
);
+    }
+ }

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=219428&r1=219427&r2=219428&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
Sun Jul 17 17:00:10 2005
@@ -16,11 +16,8 @@
  * limitations under the License.
  */
 
-import org.apache.maven.continuum.store.ContinuumStore;
-import org.apache.maven.continuum.store.ModelloJPoxContinuumStoreTest;
 import org.apache.maven.continuum.AbstractContinuumTest;
 
-import org.codehaus.plexus.PlexusTestCase;
 import org.codehaus.plexus.taskqueue.Task;
 import org.codehaus.plexus.taskqueue.TaskQueue;
 
@@ -33,22 +30,18 @@
 {
     private TaskQueue buildQueue;
 
-    private ContinuumStore store;
-
     public void setUp()
         throws Exception
     {
         super.setUp();
 
         buildQueue = (TaskQueue) lookup( TaskQueue.ROLE, "build-project" );
-
-        store = (ContinuumStore) lookup( ContinuumStore.ROLE );
     }
 
     public void testTestTheQueueWithASingleProject()
         throws Exception
     {
-        String projectId = ModelloJPoxContinuumStoreTest.addMavenTwoProject( store, "Build
Queue Project 1", "1" );
+        String projectId = AbstractContinuumTest.addMavenTwoProject( getStore(), "Build Queue
Project 1", "1" );
 
         buildProject( projectId, false );
 
@@ -71,9 +64,9 @@
     public void testTheQueueWithMultipleProjects()
         throws Exception
     {
-        String projectId1 = ModelloJPoxContinuumStoreTest.addMavenTwoProject( store, "Build
Queue Project 2", "foo" );
+        String projectId1 = AbstractContinuumTest.addMavenTwoProject( getStore(), "Build
Queue Project 2", "foo" );
 
-        String projectId2 = ModelloJPoxContinuumStoreTest.addMavenTwoProject( store, "Build
Queue Project 3", "bar" );
+        String projectId2 = AbstractContinuumTest.addMavenTwoProject( getStore(), "Build
Queue Project 3", "bar" );
 
         buildProject( projectId1, false );
 
@@ -109,7 +102,7 @@
     {
         String name = "Build Queue Project 4";
 
-        String projectId = ModelloJPoxContinuumStoreTest.addMavenTwoProject( store, name,
"4" );
+        String projectId = AbstractContinuumTest.addMavenTwoProject( getStore(), name, "4"
);
 
         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=219428&r1=219427&r2=219428&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
Sun Jul 17 17:00:10 2005
@@ -17,7 +17,6 @@
  */
 
 import org.apache.maven.continuum.store.ContinuumStore;
-import org.apache.maven.continuum.store.ModelloJPoxContinuumStoreTest;
 import org.apache.maven.continuum.project.ContinuumBuild;
 import org.apache.maven.continuum.project.ContinuumProjectState;
 import org.apache.maven.continuum.AbstractContinuumTest;
@@ -37,9 +36,9 @@
 
         ContinuumStore store = getStore();
 
-        String projectId = ModelloJPoxContinuumStoreTest.addMavenTwoProject( store,
-                                                                             "Notification
Dispatcher Test Project",
-                                                                             "scm:notification/dispatcher"
);
+        String projectId = AbstractContinuumTest.addMavenTwoProject( store,
+                                                                     "Notification Dispatcher
Test Project",
+                                                                     "scm:notification/dispatcher"
);
 
         ContinuumBuild build = new ContinuumBuild();
         build.setStartTime( System.currentTimeMillis() );

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=219428&r1=219427&r2=219428&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
Sun Jul 17 17:00:10 2005
@@ -661,221 +661,4 @@
         return addMavenTwoProject( store,
                                    makeStubMavenTwoProject( name, scmUrl ) );
     }
-
-    // ----------------------------------------------------------------------
-    // Public utility methods
-    // ----------------------------------------------------------------------
-
-    public static String addMavenTwoProject( ContinuumStore store,
-                                             ContinuumProject project )
-        throws Exception
-    {
-        String projectId = store.addProject( project );
-
-        ScmResult scmResult = new ScmResult();
-
-        scmResult.setSuccess( true );
-
-        scmResult.setCommandOutput( "commandOutput" );
-
-        scmResult.setProviderMessage( "providerMessage" );
-
-        ScmFile scmFile = new ScmFile();
-
-        scmFile.setPath( "/foo" );
-
-        scmResult.addFile( scmFile );
-
-        setCheckoutDone( store, projectId, scmResult, null, null );
-
-        project = store.getProject( projectId );
-
-        assertNotNull( project );
-
-        return projectId;
-    }
-
-    public static String addMavenTwoProject( ContinuumStore store,
-                                             String name,
-                                             String scmUrl )
-        throws Exception
-    {
-        return addMavenTwoProject( store, makeStubMavenTwoProject( name, scmUrl ) );
-    }
-
-    public static String addMavenTwoProject( ContinuumStore store,
-                                             String name,
-                                             String scmUrl,
-                                             String nagEmailAddress,
-                                             String version,
-                                             String commandLineArguments,
-                                             String workingDirectory )
-        throws Exception
-    {
-        String projectId = store.addProject( makeMavenTwoProject( name,
-                                                                  scmUrl,
-                                                                  nagEmailAddress,
-                                                                  version,
-                                                                  commandLineArguments,
-                                                                  workingDirectory ) );
-
-        ScmResult scmResult = new ScmResult();
-
-        scmResult.setSuccess( true );
-
-        setCheckoutDone( store, projectId, scmResult, null, null );
-
-        ContinuumProject project = store.getProject( projectId );
-
-        assertNotNull( project );
-
-        return projectId;
-    }
-
-    public static String createBuild( ContinuumStore store, String projectId, boolean forced
)
-        throws ContinuumStoreException
-    {
-        ContinuumBuild build = new ContinuumBuild();
-
-        build.setStartTime( System.currentTimeMillis() );
-
-        build.setState( ContinuumProjectState.BUILDING );
-
-        build.setForced( forced );
-
-        return store.addBuild( projectId, build );
-    }
-
-    private static void setCheckoutDone( ContinuumStore store,
-                                  String projectId,
-                                  ScmResult scmResult,
-                                  String errorMessage,
-                                  Throwable exception  )
-        throws ContinuumStoreException
-    {
-        ContinuumProject project = store.getProject( projectId );
-
-        project.setScmResult( scmResult );
-
-        project.setCheckOutErrorMessage( errorMessage );
-
-        project.setCheckOutErrorException( ContinuumUtils.throwableToString( exception )
);
-
-        store.updateProject( project );
-    }
-
-    public static void setBuildResult( ContinuumStore store,
-                                       String buildId,
-                                       int state,
-                                       ContinuumBuildExecutionResult result,
-                                       ScmResult scmResult,
-                                       Throwable error )
-        throws ContinuumStoreException
-    {
-        ContinuumBuild build = store.getBuild( buildId );
-
-        build.setState( state );
-
-        build.setEndTime( new Date().getTime() );
-
-        build.setError( ContinuumUtils.throwableToString( error ) );
-
-        build.setScmResult( scmResult );
-
-        // ----------------------------------------------------------------------
-        // Copy over the build result
-        // ----------------------------------------------------------------------
-
-        build.setSuccess( result.isSuccess() );
-
-        build.setStandardOutput( result.getStandardOutput() );
-
-        build.setStandardError( result.getStandardError() );
-
-        build.setExitCode( result.getExitCode() );
-
-        store.updateBuild( build );
-    }
-
-    // ----------------------------------------------------------------------
-    // Assertions
-    // ----------------------------------------------------------------------
-
-    private void assertProjectEquals( String projectId,
-                                      ContinuumProject expected,
-                                      ContinuumProject actual )
-    {
-        assertProjectEquals( projectId,
-                             expected.getName(),
-                             expected.getScmUrl(),
-                             expected.getNotifiers(),
-                             expected.getVersion(),
-                             expected.getCommandLineArguments(),
-                             expected.getExecutorId(),
-                             expected.getWorkingDirectory(),
-                             actual );
-    }
-
-    private void assertProjectEquals( String projectId,
-                                      String name,
-                                      String scmUrl,
-                                      String emailAddress,
-                                      String version,
-                                      String commandLineArguments,
-                                      String builderId,
-                                      String workingDirectory,
-                                      ContinuumProject actual )
-    {
-        assertProjectEquals( projectId,
-                             name,
-                             scmUrl,
-                             createMailNotifierList( emailAddress),
-                             version,
-                             commandLineArguments,
-                             builderId,
-                             workingDirectory,
-                             actual );
-    }
-
-    private void assertProjectEquals( String projectId,
-                                      String name,
-                                      String scmUrl,
-                                      List notifiers,
-                                      String version,
-                                      String commandLineArguments,
-                                      String builderId,
-                                      String workingDirectory,
-                                      ContinuumProject actual )
-    {
-        assertEquals( "project.id", projectId, actual.getId() );
-
-        assertEquals( "project.name", name, actual.getName() );
-
-        assertEquals( "project.scmUrl", scmUrl, actual.getScmUrl() );
-
-        assertNotNull( "project.notifiers", actual.getNotifiers() );
-
-        assertEquals( "project.notifiers.size", notifiers.size(), actual.getNotifiers().size()
);
-
-        for ( int i = 0; i < notifiers.size(); i++ )
-        {
-            ContinuumNotifier notifier = (ContinuumNotifier) notifiers.get( i );
-
-            ContinuumNotifier actualNotifier = (ContinuumNotifier) actual.getNotifiers().get(
i );
-
-            assertEquals( "project.notifiers.notifier.type", notifier.getType(), actualNotifier.getType()
);
-
-            assertEquals( "project.notifiers.notifier.configuration.address",
-                          notifier.getConfiguration().get( "address" ),
-                          actualNotifier.getConfiguration().get( "address" ) );
-        }
-
-        assertEquals( "project.version", version, actual.getVersion() );
-
-        assertEquals( "project.commandLineArguments", commandLineArguments, actual.getCommandLineArguments()
);
-
-        assertEquals( "project.executorId", builderId, actual.getExecutorId() );
-
-        assertEquals( "project.workingDirectory", workingDirectory, actual.getWorkingDirectory()
);
-    }
 }



Mime
View raw message