continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tryg...@apache.org
Subject svn commit: r219612 - in /maven/continuum/trunk: ./ continuum-api/src/main/java/org/apache/maven/continuum/configuration/ continuum-api/src/main/java/org/apache/maven/continuum/utils/ continuum-core-it/src/test/java/org/apache/maven/continuum/it/ conti...
Date Tue, 19 Jul 2005 03:44:21 GMT
Author: trygvis
Date: Mon Jul 18 20:44:01 2005
New Revision: 219612

URL: http://svn.apache.org/viewcvs?rev=219612&view=rev
Log:
o Creating continuum-test to be able to reuse common stuff for testing.
 - Moving ContinuumUtils and ConfigurationService to continuum-api
o Attempting to move the build output directories under target/ instead of
  under the current working directory.

Added:
    maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/configuration/
    maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/configuration/ConfigurationLoadingException.java
  (with props)
    maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/configuration/ConfigurationService.java
  (with props)
    maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/configuration/ConfigurationStoringException.java
  (with props)
    maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/utils/
    maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/utils/ContinuumUtils.java
  (with props)
    maven/continuum/trunk/continuum-test/
    maven/continuum/trunk/continuum-test/src/
    maven/continuum/trunk/continuum-test/src/main/
    maven/continuum/trunk/continuum-test/src/main/java/
    maven/continuum/trunk/continuum-test/src/main/java/org/
    maven/continuum/trunk/continuum-test/src/main/java/org/apache/
    maven/continuum/trunk/continuum-test/src/main/java/org/apache/maven/
    maven/continuum/trunk/continuum-test/src/main/java/org/apache/maven/continuum/
    maven/continuum/trunk/continuum-test/src/main/java/org/apache/maven/continuum/AbstractContinuumTest.java
  (with props)
Removed:
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/configuration/ConfigurationLoadingException.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/configuration/ConfigurationService.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/configuration/ConfigurationStoringException.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/utils/ContinuumUtils.java
    maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/AbstractContinuumTest.java
Modified:
    maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/AbstractIntegrationTest.java
    maven/continuum/trunk/continuum-core/pom.xml
    maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/execution/shell/ShellBuildExecutorTest.java
    maven/continuum/trunk/pom.xml

Added: maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/configuration/ConfigurationLoadingException.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/configuration/ConfigurationLoadingException.java?rev=219612&view=auto
==============================================================================
--- maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/configuration/ConfigurationLoadingException.java
(added)
+++ maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/configuration/ConfigurationLoadingException.java
Mon Jul 18 20:44:01 2005
@@ -0,0 +1,24 @@
+package org.apache.maven.continuum.configuration;
+
+/**
+ * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
+ * @version $Id:$
+ */
+public class ConfigurationLoadingException
+    extends Exception
+{
+    public ConfigurationLoadingException( String message )
+    {
+        super( message );
+    }
+
+    public ConfigurationLoadingException( Throwable cause )
+    {
+        super( cause );
+    }
+
+    public ConfigurationLoadingException( String message, Throwable cause )
+    {
+        super( message, cause );
+    }
+}

Propchange: maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/configuration/ConfigurationLoadingException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/configuration/ConfigurationLoadingException.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/configuration/ConfigurationService.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/configuration/ConfigurationService.java?rev=219612&view=auto
==============================================================================
--- maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/configuration/ConfigurationService.java
(added)
+++ maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/configuration/ConfigurationService.java
Mon Jul 18 20:44:01 2005
@@ -0,0 +1,58 @@
+package org.apache.maven.continuum.configuration;
+
+/*
+ * Copyright 2004-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.File;
+
+/**
+ * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
+ * @version $Id:$
+ */
+public interface ConfigurationService
+{
+    String ROLE = ConfigurationService.class.getName();
+
+    // ----------------------------------------------------------------------
+    //
+    // ----------------------------------------------------------------------
+
+    public static final String CONFIGURATION_URL = "url";
+
+    public static final String CONFIGURATION_BUILD_OUTPUT_DIRECTORY = "build-output-directory";
+
+    // ----------------------------------------------------------------------
+    //
+    // ----------------------------------------------------------------------
+
+    String getUrl();
+
+    void setUrl( String url );
+
+    File getBuildOutputDirectory();
+
+    void setBuildOutputDirectory( File buildOutputDirectory );
+
+    // ----------------------------------------------------------------------
+    //
+    // ----------------------------------------------------------------------
+
+    void load()
+        throws ConfigurationLoadingException;
+
+    void store()
+        throws ConfigurationStoringException;
+}

Propchange: maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/configuration/ConfigurationService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/configuration/ConfigurationService.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/configuration/ConfigurationStoringException.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/configuration/ConfigurationStoringException.java?rev=219612&view=auto
==============================================================================
--- maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/configuration/ConfigurationStoringException.java
(added)
+++ maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/configuration/ConfigurationStoringException.java
Mon Jul 18 20:44:01 2005
@@ -0,0 +1,24 @@
+package org.apache.maven.continuum.configuration;
+
+/**
+ * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
+ * @version $Id:$
+ */
+public class ConfigurationStoringException
+    extends Exception
+{
+    public ConfigurationStoringException( String message )
+    {
+        super( message );
+    }
+
+    public ConfigurationStoringException( Throwable cause )
+    {
+        super( cause );
+    }
+
+    public ConfigurationStoringException( String message, Throwable cause )
+    {
+        super( message, cause );
+    }
+}

Propchange: maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/configuration/ConfigurationStoringException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/configuration/ConfigurationStoringException.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/utils/ContinuumUtils.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/utils/ContinuumUtils.java?rev=219612&view=auto
==============================================================================
--- maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/utils/ContinuumUtils.java
(added)
+++ maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/utils/ContinuumUtils.java
Mon Jul 18 20:44:01 2005
@@ -0,0 +1,45 @@
+package org.apache.maven.continuum.utils;
+
+/*
+ * Copyright 2004-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.StringWriter;
+import java.io.PrintWriter;
+
+/**
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
+ * @version $Id$
+ */
+public class ContinuumUtils
+{
+    public static String throwableToString( Throwable error )
+    {
+        if ( error == null )
+        {
+            return "";
+        }
+
+        StringWriter writer = new StringWriter();
+
+        PrintWriter printer = new PrintWriter( writer );
+
+        error.printStackTrace( printer );
+
+        printer.flush();
+
+        return writer.getBuffer().toString();
+    }
+}

Propchange: maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/utils/ContinuumUtils.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/utils/ContinuumUtils.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/AbstractIntegrationTest.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/AbstractIntegrationTest.java?rev=219612&r1=219611&r2=219612&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/AbstractIntegrationTest.java
(original)
+++ maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/AbstractIntegrationTest.java
Mon Jul 18 20:44:01 2005
@@ -35,6 +35,7 @@
 
 import org.apache.maven.continuum.xmlrpc.XmlRpcHelper;
 import org.apache.maven.continuum.Continuum;
+import org.apache.maven.continuum.AbstractContinuumTest;
 import org.apache.maven.continuum.store.ContinuumStore;
 import org.apache.maven.continuum.scm.ScmResult;
 import org.apache.maven.continuum.scm.ScmFile;
@@ -109,19 +110,7 @@
 
         context.put( "plexus.home", plexusHome.getAbsolutePath() );
 
-        // TODO: Replace with AbstractContinuumTest.makeConfiguration( plexusHome.getAbsolutePath()
);
-        File configFile = new File( plexusHome.getAbsolutePath(), "conf/configuration.xml"
);
-
-        if ( !configFile.getParentFile().exists() &&
-             !configFile.getParentFile().mkdirs() )
-        {
-            throw new IOException( "Could not make directory: '" + configFile.getParentFile()
+ "'." );
-        }
-
-        FileUtils.fileWrite( configFile.getAbsolutePath(),
-                             "<configuration>" +
-                             "<build-output-directory>target/build-output</build-output-directory>"
+
-                             "</configuration>");
+        AbstractContinuumTest.makeConfiguration( plexusHome.getAbsolutePath() );
     }
 
     public final void setUp()

Modified: maven/continuum/trunk/continuum-core/pom.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/pom.xml?rev=219612&r1=219611&r2=219612&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/pom.xml (original)
+++ maven/continuum/trunk/continuum-core/pom.xml Mon Jul 18 20:44:01 2005
@@ -11,7 +11,7 @@
   <dependencies>
     <!--
      |
-     | Continuum 
+     | Continuum
      |
      -->
     <dependency>
@@ -19,6 +19,10 @@
       <artifactId>continuum-api</artifactId>
     </dependency>
     <dependency>
+      <groupId>org.apache.maven.continuum</groupId>
+      <artifactId>continuum-test</artifactId>
+    </dependency>
+    <dependency>
       <groupId>jpox</groupId>
       <artifactId>jpox</artifactId>
     </dependency>
@@ -66,7 +70,7 @@
       <groupId>quartz</groupId>
       <artifactId>quartz</artifactId>
       <version>1.4.5</version>
-    </dependency>    
+    </dependency>
     <!--
      |
      | Maven Dependencies

Modified: maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/execution/shell/ShellBuildExecutorTest.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/execution/shell/ShellBuildExecutorTest.java?rev=219612&r1=219611&r2=219612&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/execution/shell/ShellBuildExecutorTest.java
(original)
+++ maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/execution/shell/ShellBuildExecutorTest.java
Mon Jul 18 20:44:01 2005
@@ -30,7 +30,7 @@
     public void testNonAbsolutePath()
         throws Exception
     {
-        ShellBuildExecutor buildExecutor = getShellBuildExecutor();
+        ShellBuildExecutor buildExecutor = (ShellBuildExecutor) getBuildExecutor( ShellBuildExecutor.ID
);
 
         ShellProject project = makeStubShellProject( "Shell project", "scm:foo" );
 
@@ -48,9 +48,11 @@
 
         project.setExecutable( getTestFile( "foo.sh" ).getAbsolutePath() );
 
+        ShellBuildExecutor buildExecutor = (ShellBuildExecutor) getBuildExecutor( ShellBuildExecutor.ID
);
+
         try
         {
-            getShellBuildExecutor().updateProjectFromCheckOut( null, project );
+            buildExecutor.updateProjectFromCheckOut( null, project );
 
             fail( "Expected ContinuumBuildExecutorException" );
         }

Added: maven/continuum/trunk/continuum-test/src/main/java/org/apache/maven/continuum/AbstractContinuumTest.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-test/src/main/java/org/apache/maven/continuum/AbstractContinuumTest.java?rev=219612&view=auto
==============================================================================
--- maven/continuum/trunk/continuum-test/src/main/java/org/apache/maven/continuum/AbstractContinuumTest.java
(added)
+++ maven/continuum/trunk/continuum-test/src/main/java/org/apache/maven/continuum/AbstractContinuumTest.java
Mon Jul 18 20:44:01 2005
@@ -0,0 +1,412 @@
+package org.apache.maven.continuum;
+
+/*
+ * Copyright 2004-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Properties;
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.maven.continuum.execution.ContinuumBuildExecutionResult;
+import org.apache.maven.continuum.execution.ContinuumBuildExecutor;
+import org.apache.maven.continuum.project.ContinuumBuild;
+import org.apache.maven.continuum.project.ContinuumNotifier;
+import org.apache.maven.continuum.project.ContinuumProject;
+import org.apache.maven.continuum.project.ContinuumProjectState;
+import org.apache.maven.continuum.project.MavenTwoProject;
+import org.apache.maven.continuum.project.ShellProject;
+import org.apache.maven.continuum.scm.ScmFile;
+import org.apache.maven.continuum.scm.ScmResult;
+import org.apache.maven.continuum.store.ContinuumStore;
+import org.apache.maven.continuum.store.ContinuumStoreException;
+import org.apache.maven.continuum.utils.ContinuumUtils;
+import org.apache.maven.continuum.configuration.ConfigurationService;
+
+import org.codehaus.plexus.PlexusTestCase;
+import org.codehaus.plexus.util.FileUtils;
+import org.codehaus.plexus.context.Context;
+
+/**
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
+ * @version $Id$
+ */
+public abstract class AbstractContinuumTest
+    extends PlexusTestCase
+{
+    // ----------------------------------------------------------------------
+    //
+    // ----------------------------------------------------------------------
+
+    protected void setUp()
+        throws Exception
+    {
+        super.setUp();
+
+        Context context = getContainer().getContext();
+
+        ConfigurationService configurationService = (ConfigurationService) lookup( ConfigurationService.ROLE
);
+
+        configurationService.setBuildOutputDirectory( getTestFile( "target/build-output"
) );
+    }
+
+    // ----------------------------------------------------------------------
+    // Store
+    // ----------------------------------------------------------------------
+
+    protected ContinuumStore getStore()
+        throws Exception
+    {
+        return (ContinuumStore) lookup( ContinuumStore.ROLE );
+    }
+
+    // ----------------------------------------------------------------------
+    // Build Executor
+    // ----------------------------------------------------------------------
+
+    protected ContinuumBuildExecutor getBuildExecutor( String id )
+        throws Exception
+    {
+        ContinuumBuildExecutor buildExecutor = (ContinuumBuildExecutor) lookup( ContinuumBuildExecutor.ROLE,
id );
+
+        assertNotNull( "Could not look up build executor '" + id + "'", buildExecutor );
+
+        return buildExecutor;
+    }
+
+    // ----------------------------------------------------------------------
+    // Maven 2 Project Generators
+    // ----------------------------------------------------------------------
+
+    public static MavenTwoProject makeStubMavenTwoProject( String name, String scmUrl )
+    {
+        return makeMavenTwoProject( name,
+                                    scmUrl,
+                                    "foo@bar.com",
+                                    "1.0",
+                                    "",
+                                    PlexusTestCase.getTestFile( "plexus-temp" ).getAbsolutePath()
);
+    }
+
+    public static MavenTwoProject makeMavenTwoProject( String name,
+                                                       String scmUrl,
+                                                       String emailAddress,
+                                                       String version,
+                                                       String commandLineArguments,
+                                                       String workingDirectory )
+    {
+        MavenTwoProject project = new MavenTwoProject();
+
+        makeProject( project,
+                     name,
+                     scmUrl,
+                     version,
+                     commandLineArguments,
+                     workingDirectory,
+                     "maven2" );
+
+        List notifiers = createMailNotifierList( emailAddress );
+
+        project.setNotifiers( notifiers );
+
+        return project;
+    }
+
+    // ----------------------------------------------------------------------
+    // Shell Project Generators
+    // ----------------------------------------------------------------------
+
+    public static ShellProject makeStubShellProject( String name, String scmUrl )
+    {
+        ShellProject project = new ShellProject();
+
+        makeProject( project,
+                     name,
+                     scmUrl,
+                     "1.0",
+                     "",
+                     PlexusTestCase.getTestFile( "plexus-temp" ).getAbsolutePath(),
+                     "shell" );
+
+        project.setExecutable( "script.sh" );
+
+        return project;
+    }
+
+    public static ContinuumProject makeProject( ContinuumProject project,
+                                                String name,
+                                                String scmUrl,
+                                                String version,
+                                                String commandLineArguments,
+                                                String workingDirectory,
+                                                String executorId )
+    {
+        project.setName( name );
+        project.setScmUrl( scmUrl );
+        project.setVersion( version );
+        project.setCommandLineArguments( commandLineArguments );
+        project.setWorkingDirectory( workingDirectory );
+        project.setExecutorId( executorId );
+
+        return project;
+    }
+
+    protected static List createMailNotifierList( String emailAddress )
+    {
+        if ( emailAddress == null )
+        {
+            return null;
+        }
+
+        ContinuumNotifier notifier = new ContinuumNotifier();
+
+        notifier.setType( "mail" );
+
+        Properties props = new Properties();
+
+        props.put( "address", emailAddress );
+
+        notifier.setConfiguration( props );
+
+        List notifiers = new ArrayList();
+
+        notifiers.add( notifier );
+
+        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.setExitCode( result.getExitCode() );
+
+        store.setBuildOutput( build.getId(), result.getOutput() );
+
+        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() );
+
+        if ( notifiers != null )
+        {
+            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()
);
+    }
+}

Propchange: maven/continuum/trunk/continuum-test/src/main/java/org/apache/maven/continuum/AbstractContinuumTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/continuum/trunk/continuum-test/src/main/java/org/apache/maven/continuum/AbstractContinuumTest.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: maven/continuum/trunk/pom.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/pom.xml?rev=219612&r1=219611&r2=219612&view=diff
==============================================================================
--- maven/continuum/trunk/pom.xml (original)
+++ maven/continuum/trunk/pom.xml Mon Jul 18 20:44:01 2005
@@ -85,6 +85,11 @@
       </dependency>
       <dependency>
         <groupId>org.apache.maven.continuum</groupId>
+        <artifactId>continuum-test</artifactId>
+        <version>1.0-beta-1-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.maven.continuum</groupId>
         <artifactId>continuum-web</artifactId>
         <version>1.0-beta-1-SNAPSHOT</version>
       </dependency>
@@ -184,10 +189,12 @@
   <modules>
     <module>continuum-api</module>
     <module>continuum-cc</module>
+    <module>continuum-core-ci</module>
     <module>continuum-core</module>
     <module>continuum-model</module>
     <module>continuum-notifiers</module>
     <module>continuum-plexus-application</module>
+    <module>continuum-test</module>
     <module>continuum-web</module>
     <module>continuum-xfire</module>
     <module>continuum-xmlrpc</module>



Mime
View raw message