continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tryg...@apache.org
Subject svn commit: r219354 - in /maven/continuum/trunk/continuum-core-it: ./ src/main/java/ src/test/java/org/ src/test/java/org/apache/ src/test/java/org/apache/maven/ src/test/java/org/apache/maven/continuum/ src/test/java/org/apache/maven/continuum/it/
Date Sat, 16 Jul 2005 23:12:03 GMT
Author: trygvis
Date: Sat Jul 16 16:12:01 2005
New Revision: 219354

URL: http://svn.apache.org/viewcvs?rev=219354&view=rev
Log:
o Rewritten the integration tests to Java.

Added:
    maven/continuum/trunk/continuum-core-it/pom.xml   (with props)
    maven/continuum/trunk/continuum-core-it/src/test/java/org/
    maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/
    maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/
    maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/
    maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/
    maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/AbstractIntegrationTest.java   (with props)
    maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/AntIntegrationTest.java   (with props)
    maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/ContinuumIt.java   (with props)
    maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/ContinuumXmlRpcClient.java   (with props)
    maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/MavenOneIntegrationTest.java   (with props)
    maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/MavenTwoIntegrationTest.java   (with props)
    maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/ShellIntegrationTest.java   (with props)
Removed:
    maven/continuum/trunk/continuum-core-it/src/main/java/

Added: maven/continuum/trunk/continuum-core-it/pom.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core-it/pom.xml?rev=219354&view=auto
==============================================================================
--- maven/continuum/trunk/continuum-core-it/pom.xml (added)
+++ maven/continuum/trunk/continuum-core-it/pom.xml Sat Jul 16 16:12:01 2005
@@ -0,0 +1,36 @@
+<project>
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <artifactId>continuum-parent</artifactId>
+    <groupId>org.apache.maven.continuum</groupId>
+    <version>1.0-beta-1-SNAPSHOT</version>
+  </parent>
+  <artifactId>continuum-core-it</artifactId>
+  <name>Continuum Core Integration Test</name>
+  <version>1.0-beta-1-SNAPSHOT</version>
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven.continuum</groupId>
+      <artifactId>continuum-plexus-application</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.continuum</groupId>
+      <artifactId>continuum-xmlrpc</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>plexus</groupId>
+      <artifactId>plexus-log4j-logging</artifactId>
+      <version>1.0</version>
+    </dependency>
+    <dependency>
+      <groupId>xmlrpc</groupId>
+      <artifactId>xmlrpc</artifactId>
+      <version>1.2</version>
+    </dependency>
+    <dependency>
+      <groupId>hsqldb</groupId>
+      <artifactId>hsqldb</artifactId>
+      <version>1.7.3.3</version>
+    </dependency>
+  </dependencies>
+</project>

Propchange: maven/continuum/trunk/continuum-core-it/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/continuum/trunk/continuum-core-it/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Id

Added: 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=219354&view=auto
==============================================================================
--- maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/AbstractIntegrationTest.java (added)
+++ maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/AbstractIntegrationTest.java Sat Jul 16 16:12:01 2005
@@ -0,0 +1,755 @@
+package org.apache.maven.continuum.it;
+
+/*
+ * 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;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.FileWriter;
+import java.io.InputStream;
+import java.io.FileInputStream;
+import java.io.Reader;
+import java.io.FileReader;
+import java.io.ByteArrayInputStream;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Properties;
+import java.util.List;
+
+import org.apache.maven.continuum.xmlrpc.XmlRpcHelper;
+import org.apache.maven.continuum.Continuum;
+import org.apache.maven.continuum.scm.ScmResult;
+import org.apache.maven.continuum.scm.ScmFile;
+import org.apache.maven.continuum.project.ContinuumProject;
+import org.apache.maven.continuum.project.ContinuumBuild;
+import org.apache.maven.continuum.project.ContinuumProjectState;
+import org.apache.maven.continuum.project.builder.ContinuumProjectBuildingResult;
+
+import org.codehaus.plexus.PlexusTestCase;
+import org.codehaus.plexus.context.Context;
+import org.codehaus.plexus.util.FileUtils;
+import org.codehaus.plexus.util.InterpolationFilterReader;
+import org.codehaus.plexus.util.IOUtil;
+import org.codehaus.plexus.util.cli.CommandLineException;
+import org.codehaus.plexus.util.cli.CommandLineUtils;
+import org.codehaus.plexus.util.cli.Commandline;
+
+/**
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
+ * @version $Id$
+ */
+public abstract class AbstractIntegrationTest
+    extends PlexusTestCase
+{
+    private final static DateFormat progressDateFormat = new SimpleDateFormat( "yyyy.MM.dd HH:mm:ss" );
+
+    private Date startTime;
+
+    private Date endTime;
+
+    private File rootDirectory;
+
+    private File cvsRoot;
+
+    private File svnRoot;
+
+    private File tempCoDir;
+
+    private String remotingMethod;
+
+    public final String REMOTING_METHOD_JVM = "jvm";
+
+    public final String REMOTING_METHOD_XMLRPC = "xmlrpc";
+
+    public final String REMOTING_METHOD_XFIRE = "xfire";
+
+    // ----------------------------------------------------------------------
+    //
+    // ----------------------------------------------------------------------
+
+    protected InputStream getConfiguration()
+        throws Exception
+    {
+        Reader reader = new FileReader( getTestFile( "../continuum-plexus-application/src/conf/application.xml" ) );
+
+        Properties properties = new Properties();
+
+        properties.load( new FileInputStream( getTestFile( "../continuum-plexus-application/app.properties" ) ) );
+
+        String s = IOUtil.toString( new InterpolationFilterReader( reader, properties, "@", "@" ) );
+
+        return new ByteArrayInputStream( s.getBytes() );
+    }
+
+    protected void customizeContext( Context context )
+        throws Exception
+    {
+        File plexusHome = getTestFile( "target/lets/do/some" );
+
+        if ( !plexusHome.isDirectory() )
+        {
+            assertTrue( plexusHome.mkdirs() );
+        }
+
+        context.put( "plexus.home", plexusHome.getAbsolutePath() );
+    }
+
+    public final void setUp()
+        throws Exception
+    {
+        startTime = new Date();
+
+        super.setUp();
+
+        // TODO: get this from System.getProperty()
+
+        remotingMethod = REMOTING_METHOD_JVM;
+
+        rootDirectory = getTestFile( "target/it" );
+
+        cvsRoot = getItFile( "cvs-root" );
+
+        svnRoot = getItFile( "svn-root" );
+
+        tempCoDir = getItFile( "temp-co" );
+
+        line();
+        print( "Integration test settings" );
+        line();
+        print( "IT root: " + rootDirectory.getAbsolutePath() );
+        print( "Remoting method: " + remotingMethod );
+        line();
+
+        deleteAndCreateDirectory( rootDirectory );
+
+        progress( "Connecting to Continuum" );
+        Continuum continuum = getContinuum();
+
+        progress( "Removing all existing projects from Continuum." );
+
+        Collection collection = continuum.getAllProjects( 0, 0 );
+
+        for ( Iterator it = collection.iterator(); it.hasNext(); )
+        {
+            ContinuumProject project = (ContinuumProject) it.next();
+
+            continuum.removeProject( project.getId() );
+        }
+    }
+
+    public final void tearDown()
+        throws Exception
+    {
+        endTime = new Date();
+
+        super.tearDown();
+
+        long diff = endTime.getTime() - startTime.getTime();
+
+        System.err.println( "Used " + diff + "ms" );
+    }
+
+    protected XmlRpcHelper getXmlRpcHelper()
+        throws Exception
+    {
+        return (XmlRpcHelper) lookup( XmlRpcHelper.ROLE );
+    }
+
+    protected Continuum getContinuum()
+        throws Exception
+    {
+        if ( remotingMethod.equals( REMOTING_METHOD_JVM ) )
+        {
+            return (Continuum) lookup( Continuum.ROLE );
+        }
+        else if ( remotingMethod.equals( REMOTING_METHOD_XMLRPC ) )
+        {
+            return new ContinuumXmlRpcClient( getHost(), getPort(), getXmlRpcHelper() );
+        }
+
+        fail( "Unsupported remoting method '" + remotingMethod + "'." );
+
+        return null;
+    }
+
+    // ----------------------------------------------------------------------
+    // Configuration. This should be read from a configuration file
+    // ----------------------------------------------------------------------
+
+    protected String getHost()
+    {
+        return "localhost";
+    }
+
+    protected int getPort()
+    {
+        return 8000;
+    }
+
+    protected String getEmail()
+    {
+        return "trygvis@codehaus.org";
+    }
+
+    // ----------------------------------------------------------------------
+    // Paths
+    // ----------------------------------------------------------------------
+
+    protected File getCvsRoot()
+    {
+        return cvsRoot;
+    }
+
+    protected File getSvnRoot()
+    {
+        return svnRoot;
+    }
+
+    protected File getTempCoDir()
+    {
+        return tempCoDir;
+    }
+
+    protected File getItFile( String dir )
+    {
+        return new File( rootDirectory, dir );
+    }
+
+    // ----------------------------------------------------------------------
+    // Utilities
+    // ----------------------------------------------------------------------
+
+    protected void system( File workingDirectory, String cmd, String arguments )
+        throws CommandLineException
+    {
+        system( workingDirectory, cmd, new String[] { arguments } );
+    }
+
+    protected void system( File workingDirectory, String cmd, String[] arguments )
+        throws CommandLineException
+    {
+        Commandline commandline = new Commandline();
+
+        commandline.setExecutable( cmd );
+
+        commandline.setWorkingDirectory( workingDirectory.getAbsolutePath() );
+
+        for ( int i = 0; i < arguments.length; i++ )
+        {
+            String argument = arguments[ i ];
+
+            commandline.createArgument().setLine( argument );
+        }
+
+        CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
+
+        CommandLineUtils.StringStreamConsumer stdout = new CommandLineUtils.StringStreamConsumer();
+
+        int exitCode = CommandLineUtils.executeCommandLine( commandline, stdout, stderr );
+
+        if ( exitCode != 0 )
+        {
+            System.err.println( "Error while executing command: " + cmd );
+            System.err.println( "Exit code: " + exitCode );
+
+            System.err.println( "Standard output:" );
+            line();
+            System.err.println( stdout.getOutput() );
+            line();
+            System.err.println( "Standard Error:" );
+            line();
+            System.err.println( stderr.getOutput() );
+            line();
+
+            fail( "The command failed." );
+        }
+    }
+
+    private void line()
+    {
+        System.err.println( "-------------------------------------------------------------------------------" );
+    }
+
+    // ----------------------------------------------------------------------
+    //
+    // ----------------------------------------------------------------------
+
+    public static void deleteAndCreateDirectory( File directory )
+        throws IOException
+    {
+        if ( directory.isDirectory() )
+        {
+            FileUtils.deleteDirectory( directory );
+        }
+
+        assertTrue( "Could not make directory " + directory, directory.mkdirs() );
+    }
+
+    public static void cleanDirectory( String directory )
+        throws IOException
+    {
+        cleanDirectory( new File( directory ) );
+    }
+
+    public static void cleanDirectory( File directory )
+        throws IOException
+    {
+        if ( !directory.isDirectory() )
+        {
+            return;
+        }
+
+        FileUtils.cleanDirectory( directory );
+    }
+
+    // ----------------------------------------------------------------------
+    //
+    // ----------------------------------------------------------------------
+
+    protected String getProjectId( ContinuumProjectBuildingResult buildingResult )
+    {
+        List warnings = buildingResult.getWarnings();
+
+        if ( warnings.size() > 0 )
+        {
+            print( "Project building warnings: " );
+
+            for ( Iterator it = warnings.iterator(); it.hasNext(); )
+            {
+                String warning = (String) it.next();
+
+                print( warning );
+            }
+
+            fail( "There was warnings while building the project." );
+        }
+
+        List projects = buildingResult.getProjects();
+
+        if ( projects.size() == 0 )
+        {
+            fail( "When adding a project a single project was expected to be added, no projects added." );
+        }
+        else if ( projects.size() > 1 )
+        {
+            String ids = "[" + ( (ContinuumProject) projects.get( 0 ) ).getId();
+
+            for ( Iterator it = projects.iterator(); it.hasNext(); )
+            {
+                ContinuumProject project = (ContinuumProject) it.next();
+
+                ids += ", " + project.getId();
+            }
+
+            ids += "]";
+
+            fail( "When adding a project only a single project was expected to be added, project ids: " + ids );
+        }
+
+        return ( (ContinuumProject) projects.get( 0 ) ).getId();
+    }
+
+    public ContinuumBuild buildProject( String projectId, boolean force )
+        throws Exception
+    {
+        int count = 600;
+
+        int originalSize = getContinuum().getBuildsForProject( projectId ).size();
+
+        getContinuum().buildProject( projectId, force );
+
+        while( true )
+        {
+            Collection builds = getContinuum().getBuildsForProject( projectId );
+
+            if ( count == 0 )
+            {
+                fail( "Timeout while waiting for build. Project id: " + projectId );
+            }
+
+            if ( builds.size() != originalSize )
+            {
+                return (ContinuumBuild) builds.iterator().next();
+            }
+
+            count--;
+
+            Thread.sleep( 100 );
+        }
+    }
+
+    public void removeProject( String projectId )
+        throws Exception
+    {
+        getContinuum().removeProject( projectId );
+
+        try
+        {
+            getContinuum().getProject( projectId );
+
+            fail( "Expected exception after removing project '" + projectId + "'." );
+        }
+        catch ( Exception e )
+        {
+            // expected
+        }
+    }
+
+    public ContinuumProject waitForCheckout( String projectId )
+        throws Exception
+    {
+        long timeout = 60 * 1000;
+
+        long sleepInterval = 100;
+
+        ContinuumProject project = getContinuum().getProject( projectId );
+
+        while( project.getScmResult() == null &&
+               project.getCheckOutErrorMessage() == null &
+               project.getCheckOutErrorException() == null )
+        {
+            Thread.sleep( sleepInterval );
+
+            timeout -= sleepInterval;
+
+            if ( timeout <= 0 )
+            {
+                fail( "Timeout while waiting for project '" + project.getName() + "' to be checked out." );
+            }
+
+            project = getContinuum().getProject( projectId );
+        }
+
+        return project;
+    }
+
+    public void waitForSuccessfulCheckout( String projectId )
+        throws Exception
+    {
+        ContinuumProject project = waitForCheckout( projectId );
+
+        String message = "The check out was not successful for project #" + project.getId() + ": ";
+
+        if ( project.getScmResult() == null )
+        {
+            print( "check out error message: " + project.getCheckOutErrorMessage() );
+            print( "check out error exception: " );
+            print( project.getCheckOutErrorException() );
+
+            fail( "project.scmResult == null" );
+        }
+
+        assertEquals( message + "Checkout error message != null", null, project.getCheckOutErrorMessage() );
+        assertEquals( message + "Checkout error exception != null", null, project.getCheckOutErrorException() );
+        assertTrue( message + "scmResult.success != true", project.getScmResult().isSuccess() );
+    }
+
+    public ContinuumBuild waitForBuild( String buildId )
+        throws Exception
+    {
+        int timeout = 120 * 1000;
+        int sleepInterval = 100;
+
+        ContinuumBuild build = getContinuum().getBuild( buildId );
+
+        while( build.getState() == ContinuumProjectState.UPDATING ||
+               build.getState() == ContinuumProjectState.BUILDING )
+        {
+            if ( timeout <= 0 )
+            {
+                fail( "Timeout while waiting for build #" + buildId + " to complete." );
+            }
+
+            Thread.sleep( sleepInterval );
+
+            timeout -= sleepInterval;
+
+            build = getContinuum().getBuild( buildId );
+        }
+
+        return build;
+    }
+
+    // ----------------------------------------------------------------------
+    // Assertions
+    // ----------------------------------------------------------------------
+
+    public void assertProject( String projectId,
+                               String name,
+                               String version,
+                               String commandLineArguments,
+                               String executorId,
+                               ContinuumProject project )
+    {
+        assertEquals( "project.id", projectId, project.getId() );
+        assertEquals( "project.name", name, project.getName() );
+        assertEquals( "project.version", version, project.getVersion() );
+        assertEquals( "project.commandLineArguments", commandLineArguments, project.getCommandLineArguments() );
+        assertEquals( "project.executorId", executorId, project.getExecutorId() );
+    }
+
+    public void assertCheckedOutFiles( ContinuumProject project,
+                                       String[] expectedCheckedOutFiles )
+    {
+        assertNotNull( "project.scmResult", project.getScmResult() );
+
+        ScmResult scmResult = project.getScmResult();
+
+        List actualCheckedOutFiles = scmResult.getFiles();
+
+        if ( expectedCheckedOutFiles.length != actualCheckedOutFiles.size() )
+        {
+            print( "Expected files: " );
+
+            for ( int i = 0; i < expectedCheckedOutFiles.length; i++ )
+            {
+                String checkedOutFile = expectedCheckedOutFiles[ i ];
+
+                print( " " + checkedOutFile );
+            }
+
+            print( "Actual files: " );
+
+            for ( Iterator it = actualCheckedOutFiles.iterator(); it.hasNext(); )
+            {
+                ScmFile scmFile = (ScmFile) it.next();
+
+                print( " " + scmFile.getPath() );
+            }
+
+            assertEquals( "The expected and actual lists of checked out actualCheckedOutFiles doesn't have the same length.",
+                          expectedCheckedOutFiles.length,
+                          actualCheckedOutFiles.size() );
+        }
+
+        for ( int i = 0; i < expectedCheckedOutFiles.length; i++ )
+        {
+            String expectedCheckedOutFile = expectedCheckedOutFiles[ i ];
+
+            ScmFile actualCheckedOutFile = (ScmFile) actualCheckedOutFiles.get( i );
+
+            assertEquals( "File #" + i + " doesn't match the expected path.",
+                          expectedCheckedOutFile,
+                          actualCheckedOutFile.getPath() );
+        }
+    }
+    public ContinuumBuild assertSuccessfulNoBuildPerformed( String buildId )
+        throws Exception
+    {
+        ContinuumBuild build = waitForBuild( buildId );
+
+        assertEquals( "The build wasn't successful.", ContinuumProjectState.OK, build.getState() );
+
+        assertTrue( "The build wasn't successful", build.isSuccess() );
+
+        return build;
+    }
+
+    public ContinuumBuild assertSuccessfulBuild( String buildId )
+        throws Exception
+    {
+        ContinuumBuild build = waitForBuild( buildId );
+
+        if ( build.getState() != ContinuumProjectState.OK || !build.isSuccess() )
+        {
+            print( "Build state: " + build.getState() );
+
+            line();
+            print( "Standard output" );
+            line();
+            print( build.getStandardOutput() );
+            line();
+
+            line();
+            print( "Standard error" );
+            line();
+            print( build.getStandardError() );
+            line();
+
+            fail( "The build was not successful" );
+        }
+
+        return build;
+    }
+
+    public ContinuumBuild assertSuccessfulMaven1Build( String buildId )
+        throws Exception
+    {
+        ContinuumBuild build = assertSuccessfulBuild( buildId );
+
+        assertTrue( "Standard output didn't contain the 'BUILD SUCCESSFUL' message.",
+                    build.getStandardOutput().indexOf( "BUILD SUCCESSFUL" ) != -1 );
+        assertEquals( "Standard error wasn't empty.", 0, build.getStandardError().length() );
+
+        return build;
+    }
+
+    public ContinuumBuild assertSuccessfulMaven2Build( String buildId )
+        throws Exception
+    {
+        ContinuumBuild build = assertSuccessfulBuild( buildId );
+
+        assertTrue( "Standard output didn't contain the 'BUILD SUCCESSFUL' message.",
+                    build.getStandardOutput().indexOf( "BUILD SUCCESSFUL" ) != -1 );
+        assertEquals( "Standard error wasn't empty.", 0, build.getStandardError().length() );
+
+        return build;
+    }
+
+    public ContinuumBuild assertSuccessfulAntBuild( String buildId )
+        throws Exception
+    {
+        ContinuumBuild build = assertSuccessfulBuild( buildId );
+
+        assertTrue( "Standard output didn't contain the 'BUILD SUCCESSFUL' message.",
+                    build.getStandardOutput().indexOf( "BUILD SUCCESSFUL" ) != -1 );
+        assertEquals( "Standard error wasn't empty.", 0, build.getStandardError().length() );
+
+        return build;
+    }
+
+    public ContinuumBuild assertSuccessfulShellBuild( String buildId, String expectedStandardOutput )
+        throws Exception
+    {
+        ContinuumBuild build = assertSuccessfulBuild( buildId );
+
+        assertEquals( "Standard output didn't contain the expected output.", expectedStandardOutput,
+                      build.getStandardOutput() );
+        assertEquals( "Standard error wasn't empty.", 0, build.getStandardError().length() );
+
+        return build;
+    }
+
+    // ----------------------------------------------------------------------
+    // Scm Operations
+    // ----------------------------------------------------------------------
+
+    protected void initializeCvsRoot()
+        throws IOException, CommandLineException
+    {
+        File cvsRoot = getCvsRoot();
+
+        deleteAndCreateDirectory( cvsRoot );
+
+        system( cvsRoot, "cvs", " -d " + cvsRoot.getAbsolutePath() + " init" );
+    }
+
+    protected void scmImport( File root, String artifactId, String scm, File scmRoot )
+        throws CommandLineException
+    {
+        if ( scm.equals( "cvs" ) )
+        {
+            cvsImport( root, artifactId, scmRoot );
+        }
+        else
+        {
+            fail( "Unknown scm '" + scm + "'." );
+        }
+    }
+
+    protected void cvsImport( File root, String artifactId, File scmRoot )
+        throws CommandLineException
+    {
+        system( root, "cvs", "-d " + scmRoot.getAbsolutePath() + " import -m yo_yo " + artifactId + " continuum_test start" );
+    }
+
+    protected void svnImport( File root, String artifactId, File svnRoot )
+        throws CommandLineException
+    {
+        system( root, "svn", "import -m - . file://" + svnRoot.getAbsolutePath() + "/" + artifactId );
+    }
+
+    protected void cvsCheckout( File cvsRoot, String module, File coDir )
+        throws CommandLineException
+    {
+        system( cvsRoot, "cvs", "-d " + cvsRoot.getAbsolutePath() + " checkout -d " + coDir.getAbsolutePath() + " " + module );
+    }
+
+    protected void cvsCommit( File coDir )
+        throws CommandLineException
+    {
+        system( coDir, "cvs", new String[] { "commit -m ", "-" } );
+    }
+
+    protected void initializeSvnRoot()
+        throws CommandLineException, IOException
+    {
+        File svnRoot = getSvnRoot();
+
+        deleteAndCreateDirectory( svnRoot );
+
+        system( svnRoot, "svnadmin", "create " + svnRoot.getAbsolutePath() );
+    }
+
+    // ----------------------------------------------------------------------
+    // Maven 1
+    // ----------------------------------------------------------------------
+
+    protected String makeScmUrl( String scm, File scmRoot, String artifactId )
+    {
+        if ( scm.equals( "cvs" ) )
+        {
+            return "scm:cvs:local:" + scmRoot.getAbsolutePath() + ":" + artifactId;
+        }
+        else if ( scm.equals( "svn" ) )
+        {
+            return "scm:svn:file:" + scmRoot.getAbsolutePath() + "/" + artifactId;
+        }
+
+        throw new RuntimeException( "Unknown SCM type '" + scm + "'" );
+    }
+
+    protected void writeMavenOnePom( File file,
+                                     String artifactId,
+                                     String scmUrl,
+                                     String email )
+        throws IOException
+    {
+        PrintWriter writer = new PrintWriter( new FileWriter( file ) );
+
+        writer.println( "<project>" );
+        writer.println( "  <pomVersion>3</pomVersion>" );
+        writer.println( "  <groupId>continuum</groupId>" );
+        writer.println( "  <artifactId>" + artifactId + "</artifactId>" );
+        writer.println( "  <currentVersion>1.0</currentVersion>" );
+        writer.println( "  <name>Maven 1 Project</name>" );
+        writer.println( "  <repository>" );
+        writer.println( "    <connection>" + scmUrl + "</connection>" );
+        writer.println( "  </repository>" );
+        writer.println( "  <build>" );
+        writer.println( "    <nagEmailAddress>" + email + "</nagEmailAddress>" );
+        writer.println( "  </build>" );
+        writer.println( "</project>" );
+        writer.close();
+    }
+    // ----------------------------------------------------------------------
+    // Logging
+    // ----------------------------------------------------------------------
+
+    public static void progress( String message )
+    {
+        System.out.println( "[" + progressDateFormat.format( new Date() ) + "] " + message );
+    }
+
+    public static void print( String message )
+    {
+        System.out.println( "[" + progressDateFormat.format( new Date() ) + "] " + message );
+    }
+}

Propchange: maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/AbstractIntegrationTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/AbstractIntegrationTest.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/AntIntegrationTest.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/AntIntegrationTest.java?rev=219354&view=auto
==============================================================================
--- maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/AntIntegrationTest.java (added)
+++ maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/AntIntegrationTest.java Sat Jul 16 16:12:01 2005
@@ -0,0 +1,160 @@
+package org.apache.maven.continuum.it;
+
+/*
+ * 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;
+import java.io.IOException;
+import java.util.Properties;
+
+import org.apache.maven.continuum.project.AntProject;
+import org.apache.maven.continuum.project.ContinuumProject;
+import org.apache.maven.continuum.project.ContinuumNotifier;
+import org.apache.maven.continuum.Continuum;
+import org.apache.maven.continuum.execution.ant.AntBuildExecutor;
+
+import org.codehaus.plexus.util.FileUtils;
+
+/**
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
+ * @version $Id$
+ */
+public class AntIntegrationTest
+    extends AbstractIntegrationTest
+{
+    public void testAntSvn()
+        throws Exception
+    {
+        Continuum continuum = getContinuum();
+
+        initializeSvnRoot();
+
+        progress( "Initializing Ant SVN project" );
+
+        File root = getItFile( "ant-svn" );
+
+        initAntProject( root );
+
+        svnImport( root, "ant-svn", getSvnRoot() );
+
+        progress( "Adding Ant SVN project" );
+
+        AntProject p = new AntProject();
+        p.setScmUrl( "scm:svn:file://" + getSvnRoot() + "/ant-svn" );
+        p.setName( "Ant SVN Project" );
+//        p.getNotifiers().add( makeMailNotifier( email ) );
+        p.setVersion( "3.0" );
+        p.setCommandLineArguments( "-v" );
+        p.setExecutable( "ant" );
+        p.setTargets( "clean build" );
+
+        String projectId = continuum.addAntProject( p );
+
+        waitForSuccessfulCheckout( projectId );
+
+        ContinuumProject project = continuum.getProject( projectId );
+
+        assertProject( projectId, "Ant SVN Project", "3.0", "-v", "ant", project );
+
+        progress( "Building SVN Ant project" );
+
+        String buildId = buildProject( project.getId(), false ).getId();
+
+        assertSuccessfulAntBuild( buildId );
+
+        removeProject( projectId );
+    }
+
+    public void testAntCvs()
+        throws Exception
+    {
+        Continuum continuum = getContinuum();
+
+        initializeCvsRoot();
+
+        progress( "Initializing Ant CVS project" );
+
+        File root = getItFile( "ant-cvs" );
+
+        initAntProject( root );
+
+        cvsImport( root, "ant-cvs", getCvsRoot() );
+
+        AntProject p = new AntProject();
+        p.setScmUrl( "scm:cvs:local:" + getCvsRoot().getAbsolutePath() + ":ant-cvs" );
+        p.setName( "Ant CVS Project" );
+//        p.getNotifiers().add( makeMailNotifier( email ) );
+        p.setVersion( "3.0" );
+        p.setCommandLineArguments( "-d" );
+        p.setExecutable( "ant" );
+        p.setTargets( "clean build" );
+
+        String projectId = continuum.addAntProject( p );
+
+        waitForSuccessfulCheckout( projectId );
+
+        ContinuumProject project = continuum.getProject( projectId );
+        assertProject( projectId, "Ant CVS Project", "3.0", "-d", AntBuildExecutor.ID, project );
+
+        progress( "Building CVS Ant project" );
+
+        String buildId = buildProject( projectId, false ).getId();
+
+        assertSuccessfulAntBuild( buildId );
+
+        removeProject( projectId );
+    }
+
+    private ContinuumNotifier makeMailNotifier( String address )
+    {
+        ContinuumNotifier notifier = new ContinuumNotifier();
+
+        notifier.setType( "mail" );
+
+        Properties configuration = new Properties();
+
+        configuration.setProperty( "address", address );
+
+        notifier.setConfiguration( configuration );
+
+        return notifier;
+    }
+
+    private void initAntProject( File root )
+        throws IOException
+    {
+        deleteAndCreateDirectory( root );
+
+        File buildXml = new File( root, "build.xml" );
+
+        FileUtils.fileWrite( buildXml.getAbsolutePath(),
+            "<project>\n" +
+            "  <target name=\"build\">\n" +
+            "    <property name=\"classes\" value=\"target/classes\"/>\n" +
+            "    <mkdir dir=\"${classes}\"/>\n" +
+            "    <javac srcdir=\"src/main/java\" destdir=\"${classes}\"/>\n" +
+            "  </target>\n" +
+            "  <target name=\"clean\">\n" +
+            "    <delete dir=\"${classes}\"/>\n" +
+            "  </target>\n" +
+            "</project>" );
+
+        assertTrue( new File( root, "src/main/java" ).mkdirs() );
+
+        FileUtils.fileWrite( new File( root, "src/main/java/Foo.java" ).getAbsolutePath(),
+                             "class Foo { }" );
+    }
+}

Propchange: maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/AntIntegrationTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/AntIntegrationTest.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/ContinuumIt.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/ContinuumIt.java?rev=219354&view=auto
==============================================================================
--- maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/ContinuumIt.java (added)
+++ maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/ContinuumIt.java Sat Jul 16 16:12:01 2005
@@ -0,0 +1,69 @@
+package org.apache.maven.continuum.it;
+
+/*
+ * 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.
+ */
+
+/**
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
+ * @version $Id$
+ */
+public class ContinuumIt
+{
+    public static void main( String[] args )
+        throws Exception
+    {
+        AbstractIntegrationTest.progress( "############################################################" );
+        AbstractIntegrationTest.progress( "Running integration tests" );
+        AbstractIntegrationTest.progress( "" );
+        AbstractIntegrationTest.progress( "NOTE:" );
+        AbstractIntegrationTest.progress( "When running these integration tests you will get some" );
+        AbstractIntegrationTest.progress( "stacktraces. This is normal and expected." );
+        AbstractIntegrationTest.progress( "############################################################" );
+/*
+        // ----------------------------------------------------------------------
+        // Set up the enviroment
+        // ----------------------------------------------------------------------
+
+        File basedir = new File( new File( "" ).getAbsolutePath() );
+
+        File plexusHome = new File( basedir, "../continuum-plexus-application/target/plexus-test-runtime" );
+
+        System.setProperty( "plexus.home", plexusHome.getAbsolutePath() );
+
+        // ----------------------------------------------------------------------
+        // Start the application host
+        // ----------------------------------------------------------------------
+
+        PlexusApplicationHost applicationHost = new PlexusApplicationHost();
+
+        ClassWorld classWorld = new ClassWorld();
+
+//        String configurationResource = new File( basedir, "../continuum-plexus-application/src/conf/application.xml" ).getAbsolutePath();
+
+        String configurationResource = new File( basedir, "src/main/resources/server.xml" ).getAbsolutePath();
+
+        applicationHost.start( classWorld, configurationResource );
+
+        ApplicationServer server = applicationHost.getApplicationServer();
+
+        ApplicationRuntimeProfile profile = server.getApplicationRuntimeProfile( "continuum" );
+
+        PlexusContainer container = profile.getContainer();
+
+        applicationHost.shutdown();
+*/
+    }
+}

Propchange: maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/ContinuumIt.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/ContinuumIt.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: 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=219354&view=auto
==============================================================================
--- maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/ContinuumXmlRpcClient.java (added)
+++ maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/ContinuumXmlRpcClient.java Sat Jul 16 16:12:01 2005
@@ -0,0 +1,428 @@
+package org.apache.maven.continuum.it;
+
+/*
+ * 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.Collection;
+import java.util.Map;
+import java.util.Vector;
+import java.util.Hashtable;
+import java.util.List;
+import java.net.MalformedURLException;
+import java.io.IOException;
+import java.beans.IntrospectionException;
+import java.lang.reflect.InvocationTargetException;
+
+import org.apache.maven.continuum.Continuum;
+import org.apache.maven.continuum.ContinuumException;
+import org.apache.maven.continuum.scm.ScmResult;
+import org.apache.maven.continuum.xmlrpc.XmlRpcHelper;
+import org.apache.maven.continuum.project.ContinuumProject;
+import org.apache.maven.continuum.project.ContinuumBuild;
+import org.apache.maven.continuum.project.MavenTwoProject;
+import org.apache.maven.continuum.project.MavenOneProject;
+import org.apache.maven.continuum.project.AntProject;
+import org.apache.maven.continuum.project.ShellProject;
+import org.apache.maven.continuum.project.ContinuumNotifier;
+import org.apache.maven.continuum.project.builder.ContinuumProjectBuildingResult;
+import org.apache.xmlrpc.XmlRpcClientLite;
+import org.apache.xmlrpc.XmlRpcClient;
+import org.apache.xmlrpc.XmlRpcException;
+
+import org.codehaus.plexus.util.StringUtils;
+import org.codehaus.plexus.util.dag.CycleDetectedException;
+
+/**
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
+ * @version $Id$
+ */
+public class ContinuumXmlRpcClient
+    implements Continuum
+{
+    // ----------------------------------------------------------------------
+    // Configuration
+    // ----------------------------------------------------------------------
+
+    private String host;
+
+    private int port;
+
+    private XmlRpcHelper helper;
+
+    // ----------------------------------------------------------------------
+    //
+    // ----------------------------------------------------------------------
+
+    private XmlRpcClient client;
+
+    private static final String EOL = System.getProperty( "line.separator" );
+
+    public ContinuumXmlRpcClient( String host, int port, XmlRpcHelper helper )
+        throws MalformedURLException
+    {
+        this.host = host;
+
+        this.port = port;
+
+        this.helper = helper;
+
+        client = new XmlRpcClientLite( host, port );
+    }
+
+    // ----------------------------------------------------------------------
+    // Project
+    // ----------------------------------------------------------------------
+
+    public void removeProject( String projectId )
+        throws ContinuumException
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    public void checkoutProject( String projectId )
+        throws ContinuumException
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    public ContinuumProject getProject( String projectId )
+        throws ContinuumException
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    public Collection getAllProjects( int start, int end )
+        throws ContinuumException
+    {
+        return (Collection) invoke( "getProjects",
+                                    new Object[]{},
+                                    ContinuumProject.class );
+    }
+
+    public List getProjectsInBuildOrder()
+        throws CycleDetectedException, ContinuumException
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    public ScmResult getScmResultForProject( String projectId )
+        throws ContinuumException
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    public ScmResult getCheckOutScmResultForProject( String projectId )
+        throws ContinuumException
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    public Collection getProjects()
+        throws ContinuumException
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    public ContinuumBuild getLatestBuildForProject( String projectId )
+        throws ContinuumException
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    // ----------------------------------------------------------------------
+    // Queues
+    // ----------------------------------------------------------------------
+
+    public boolean isInBuildingQueue( String projectId )
+        throws ContinuumException
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    // ----------------------------------------------------------------------
+    // Building
+    // ----------------------------------------------------------------------
+
+    public void buildProjects()
+        throws ContinuumException
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    public void buildProjects( boolean force )
+        throws ContinuumException
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    public void buildProject( String projectId )
+        throws ContinuumException
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    public void buildProject( String projectId, boolean force )
+        throws ContinuumException
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    // ----------------------------------------------------------------------
+    // Build information
+    // ----------------------------------------------------------------------
+
+    public ContinuumBuild getBuild( String buildId )
+        throws ContinuumException
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    public Collection getBuildsForProject( String projectId )
+        throws ContinuumException
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    public Collection getChangedFilesForBuild( String buildId )
+        throws ContinuumException
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    // ----------------------------------------------------------------------
+    // Maven 2.x projects.
+    // ----------------------------------------------------------------------
+
+    public ContinuumProjectBuildingResult addMavenTwoProject( String metadataUrl )
+        throws ContinuumException
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    public String addMavenTwoProject( MavenTwoProject mavenTwoProject )
+        throws ContinuumException
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    public MavenTwoProject getMavenTwoProject( String projectId )
+        throws ContinuumException
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    public void updateMavenTwoProject( MavenTwoProject mavenTwoProject )
+        throws ContinuumException
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    // ----------------------------------------------------------------------
+    // Maven 1.x projects
+    // ----------------------------------------------------------------------
+
+    public ContinuumProjectBuildingResult addMavenOneProject( String metadataUrl )
+        throws ContinuumException
+    {
+        return (ContinuumProjectBuildingResult)
+            invoke( "addMavenOneProject",
+                    new Object[]{ metadataUrl, },
+                    ContinuumProjectBuildingResult.class );
+    }
+
+    public String addMavenOneProject( MavenOneProject mavenOneProject )
+        throws ContinuumException
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    public MavenOneProject getMavenOneProject( String s )
+        throws ContinuumException
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    public void updateMavenOneProject( MavenOneProject mavenOneProject )
+        throws ContinuumException
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    // ----------------------------------------------------------------------
+    // Ant Projects
+    // ----------------------------------------------------------------------
+
+    public String addAntProject( AntProject antProject )
+        throws ContinuumException
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    public AntProject getAntProject( String s )
+        throws ContinuumException
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    public void updateAntProject( AntProject antProject )
+        throws ContinuumException
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    // ----------------------------------------------------------------------
+    // Shell projects
+    // ----------------------------------------------------------------------
+
+    public String addShellProject( ShellProject shellProject )
+        throws ContinuumException
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    public ShellProject getShellProject( String s )
+        throws ContinuumException
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    public void updateShellProject( ShellProject shellProject )
+        throws ContinuumException
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    // ----------------------------------------------------------------------
+    // Notification
+    // ----------------------------------------------------------------------
+
+    public ContinuumNotifier getNotifier( String projectId, String notifierType )
+        throws ContinuumException
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    public void updateNotifier( String projectId, String notifierType, Map configuration )
+        throws ContinuumException
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    public void addNotifier( String projectId, String notifierType, Map configuration )
+        throws ContinuumException
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    public void removeNotifier( String projectId, String notifierType )
+        throws ContinuumException
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    // ----------------------------------------------------------------------
+    //
+    // ----------------------------------------------------------------------
+
+    private Object invoke( String method, Object[] arguments, Class returnType )
+        throws ContinuumException
+    {
+        Vector vector = new Vector( arguments.length );
+
+        for ( int i = 0; i < arguments.length; i++ )
+        {
+            Object argument = arguments[ i ];
+
+            vector.add( argument );
+        }
+
+        Hashtable returnValue;
+
+        try
+        {
+            returnValue = (Hashtable) client.execute( "continuum." + method, vector );
+        }
+        catch ( XmlRpcException e )
+        {
+            throw new ContinuumException( "Error while invoking method '" + method + "'.", e );
+        }
+        catch ( IOException e )
+        {
+            throw new ContinuumException( "Error while invoking method '" + method + "'.", e );
+        }
+
+        String result = (String) returnValue.get( "result" );
+
+        if ( StringUtils.isEmpty( result ) || !result.equals( "ok" ) )
+        {
+            String remoteMethod = (String) returnValue.get( "method" );
+
+            String message = (String) returnValue.get( "message" );
+
+            String stackTrace = (String) returnValue.get( "stackTrace" );
+
+            throw new ContinuumException( "Error while calling the remote method '" + method + "'. " + EOL +
+                                          "Result code: " + result + EOL +
+                                          "Remote method: " + remoteMethod + EOL +
+                                          "Message: " + message + "." + EOL +
+                                          "Stack trace: " + stackTrace );
+        }
+
+        System.err.println( "return value: " + returnValue );
+
+        Object object;
+
+        try
+        {
+            object = returnType.newInstance();
+        }
+        catch ( InstantiationException e )
+        {
+            throw new ContinuumException( "Could not instantiate the return type '" + returnType.getName() + "'. " +
+                                          "Make sure this type has a empy public constructor.", e );
+        }
+        catch ( IllegalAccessException e )
+        {
+            throw new ContinuumException( "Could not instantiate the return type '" + returnType.getName() + "'. " +
+                                          "Make sure this type has a empy public constructor.", e );
+        }
+
+        try
+        {
+            helper.hashtableToObject( (Hashtable) returnValue, object );
+        }
+        catch ( IntrospectionException e )
+        {
+            throw new ContinuumException( "Error while building the return object. " +
+                                          "XMLRPC return value type: " + returnValue.getClass().getName() + ". " +
+                                          "Method return type: " + returnType.getName() + ".", e );
+        }
+        catch ( IllegalAccessException e )
+        {
+            throw new ContinuumException( "Error while building the return object. " +
+                                          "XMLRPC return value type: " + returnValue.getClass().getName() + ". " +
+                                          "Method return type: " + returnType.getName() + ".", e );
+        }
+        catch ( InvocationTargetException e )
+        {
+            throw new ContinuumException( "Error while building the return object. " +
+                                          "XMLRPC return value type: " + returnValue.getClass().getName() + ". " +
+                                          "Method return type: " + returnType.getName() + ".", e );
+        }
+
+        return object;
+    }
+}

Propchange: maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/ContinuumXmlRpcClient.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/ContinuumXmlRpcClient.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/MavenOneIntegrationTest.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/MavenOneIntegrationTest.java?rev=219354&view=auto
==============================================================================
--- maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/MavenOneIntegrationTest.java (added)
+++ maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/MavenOneIntegrationTest.java Sat Jul 16 16:12:01 2005
@@ -0,0 +1,125 @@
+package org.apache.maven.continuum.it;
+
+/*
+ * 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;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+import org.apache.maven.continuum.Continuum;
+import org.apache.maven.continuum.execution.maven.m1.MavenOneBuildExecutor;
+import org.apache.maven.continuum.project.ContinuumProject;
+
+import org.codehaus.plexus.util.FileUtils;
+import org.codehaus.plexus.util.cli.CommandLineException;
+
+/**
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
+ * @version $Id$
+ */
+public class MavenOneIntegrationTest
+    extends AbstractIntegrationTest
+{
+    public void testBasic()
+        throws Exception
+    {
+        Continuum continuum = getContinuum();
+
+        initializeCvsRoot();
+
+        progress( "Initializing Maven 1 CVS project" );
+
+        File root = getItFile( "maven-1" );
+
+        initMaven1Project( root, "maven-1", "cvs", getCvsRoot() );
+
+        progress( "Adding Maven 1 project" );
+
+        String projectId = getProjectId( continuum.addMavenOneProject( "file:" + root + "/project.xml" ) );
+
+        waitForSuccessfulCheckout( projectId );
+
+        ContinuumProject project = continuum.getProject( projectId );
+
+        assertProject( projectId, "Maven 1 Project", "1.0", "", MavenOneBuildExecutor.ID, project );
+
+        assertCheckedOutFiles( project, new String[]{ "/project.xml", "/src/main/java/Foo.java" } );
+
+        // ----------------------------------------------------------------------
+        //
+        // ----------------------------------------------------------------------
+
+        progress( "Building Maven 1 project" );
+
+        String buildId = buildProject( projectId, false ).getId();
+
+        assertSuccessfulMaven1Build( buildId );
+
+        // ----------------------------------------------------------------------
+        //
+        // ----------------------------------------------------------------------
+
+        progress( "Testing that the POM is updated before each build." );
+
+        File coDir = getTempCoDir();
+
+        cleanDirectory( coDir );
+
+        cvsCheckout( getCvsRoot(), "maven-1", coDir );
+
+        File projectXml = new File( coDir, "/project.xml" );
+
+        String pom = FileUtils.fileRead( projectXml );
+
+        pom = pom.replaceAll( "Maven 1 Project", "Maven 1 Project - Changed" );
+
+        pom = pom.replaceAll( "1.0", "1.1" );
+
+        FileUtils.fileWrite( projectXml.getAbsolutePath(), pom );
+
+        cvsCommit( coDir );
+
+//#c.updateProjectFromScm( maven1.id )
+//#maven1 = c.getProject( maven1.id )
+//#assertEquals( "The project name wasn't changed.", "Maven 1 Project - Changed", maven1.name )
+//#assertEquals( "The project version wasn't changed.", "1.1", maven1.version )
+
+        removeProject( project.getId() );
+    }
+
+    private void initMaven1Project( File root,
+                                    String artifactId, String scm,
+                                    File scmRoot )
+        throws IOException, CommandLineException
+    {
+        deleteAndCreateDirectory( root );
+
+        writeMavenOnePom( new File( root, "/project.xml" ),
+                          artifactId,
+                          makeScmUrl( scm, scmRoot, artifactId ),
+                          getEmail() );
+
+        assertTrue( new File( root, "/src/main/java" ).mkdirs() );
+
+        PrintWriter writer = new PrintWriter( new FileWriter( new File( root, "/src/main/java/Foo.java" )  ) );
+        writer.write( "class Foo { }" );
+        writer.close();
+
+        scmImport( root, artifactId, scm, scmRoot );
+    }
+}

Propchange: maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/MavenOneIntegrationTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/MavenOneIntegrationTest.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/MavenTwoIntegrationTest.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/MavenTwoIntegrationTest.java?rev=219354&view=auto
==============================================================================
--- maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/MavenTwoIntegrationTest.java (added)
+++ maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/MavenTwoIntegrationTest.java Sat Jul 16 16:12:01 2005
@@ -0,0 +1,142 @@
+package org.apache.maven.continuum.it;
+
+/*
+ * 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.IOException;
+import java.io.File;
+import java.util.Map;
+
+import org.apache.maven.continuum.project.ContinuumProject;
+import org.apache.maven.continuum.project.ContinuumBuild;
+import org.apache.maven.continuum.project.ContinuumNotifier;
+import org.apache.maven.continuum.Continuum;
+import org.apache.maven.continuum.execution.maven.m2.MavenTwoBuildExecutor;
+
+import org.codehaus.plexus.util.FileUtils;
+import org.codehaus.plexus.util.cli.CommandLineException;
+
+/**
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
+ * @version $Id$
+ */
+public class MavenTwoIntegrationTest
+    extends AbstractIntegrationTest
+{
+    public void testBasic()
+        throws Exception
+    {
+        Continuum continuum = getContinuum();
+
+        initializeCvsRoot();
+
+        progress( "Initializing Maven 2 CVS project" );
+
+        File root = getItFile( "maven-two" );
+
+        initMaven2Project( root, "maven-two" );
+
+        progress( "Adding Maven 2 project" );
+
+        String projectId = getProjectId( continuum.addMavenTwoProject( "file:" + root.getAbsolutePath() + "/pom.xml" ) );
+
+        waitForSuccessfulCheckout( projectId );
+
+        ContinuumProject project = continuum.getProject( projectId );
+
+        assertProject( projectId,
+                       "Maven 2 Project",
+                       "2.0-SNAPSHOT",
+                       "-N -B",
+                       MavenTwoBuildExecutor.ID,
+                       project );
+
+        assertEquals( "project.notifiers.size", 1, project.getNotifiers().size() );
+
+        Map configuration = ((ContinuumNotifier) project.getNotifiers().get( 0 )).getConfiguration();
+
+        assertEquals( "project.notifiers[1].configuration.size", 1, configuration.size() );
+
+        assertEquals( "project.notifiers[1].configuration['address']", getEmail(), configuration.get( "address" ) );
+
+        progress( "Building Maven 2 project" );
+
+        String buildId = buildProject( projectId, false ).getId();
+
+        assertSuccessfulMaven2Build( buildId );
+
+        progress( "Test that a build without any files changed won't execute the executor" );
+
+        int expectedSize = continuum.getBuildsForProject( projectId ).size();
+
+        continuum.buildProject( projectId, false );
+
+        Thread.sleep( 3000 );
+
+        int actualSize = continuum.getBuildsForProject( projectId ).size();
+
+        assertEquals( "A build has unexpectedly been executed.", expectedSize, actualSize );
+
+        progress( "Test that a forced build without any files changed executes the executor" );
+
+        buildId = buildProject( projectId, true ).getId();
+
+        ContinuumBuild build = assertSuccessfulMaven2Build( buildId );
+
+        assertTrue( "The 'build forced' flag wasn't true", build.isForced() );
+
+        build = continuum.getBuild( buildId );
+
+        removeProject( projectId );
+    }
+
+    private void initMaven2Project( File basedir, String artifactId )
+        throws IOException, CommandLineException
+    {
+        File cvsRoot = getCvsRoot();
+
+        deleteAndCreateDirectory( basedir );
+
+        FileUtils.fileWrite( new File( basedir, "pom.xml" ).getAbsolutePath(),
+            "<project>\n" +
+            "  <modelVersion>4.0.0</modelVersion>\n" +
+            "  <groupId>continuum</groupId>\n" +
+            "  <artifactId>" + artifactId + "</artifactId>\n" +
+            "  <version>2.0-SNAPSHOT</version>\n" +
+            "  <name>Maven 2 Project</name>\n" +
+            "  <ciManagement>\n" +
+            "    <notifiers>\n" +
+            "      <notifier>\n" +
+            "        <type>mail</type>\n" +
+            "        <configuration>\n" +
+            "          <address>" + getEmail() + "</address>\n" +
+            "        </configuration>\n" +
+            "      </notifier>\n" +
+            "    </notifiers>\n" +
+            "  </ciManagement>\n" +
+            "  <scm>\n" +
+            "    <connection>scm:cvs:local:" + cvsRoot.getAbsolutePath() + ":" + artifactId + "</connection>\n" +
+            "  </scm>\n" +
+            "</project>" );
+
+        assertTrue( new File( basedir + "/src/main/java" ).mkdirs() );
+
+        FileUtils.fileWrite( new File( basedir + "/src/main/java/Foo.java" ).getAbsolutePath(),
+                             "class Foo { }" );
+
+        cvsImport( basedir, artifactId, getCvsRoot() );
+    }
+}

Propchange: maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/MavenTwoIntegrationTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/MavenTwoIntegrationTest.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/ShellIntegrationTest.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/ShellIntegrationTest.java?rev=219354&view=auto
==============================================================================
--- maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/ShellIntegrationTest.java (added)
+++ maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/ShellIntegrationTest.java Sat Jul 16 16:12:01 2005
@@ -0,0 +1,114 @@
+package org.apache.maven.continuum.it;
+
+/*
+ * 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;
+import java.io.IOException;
+
+import org.apache.maven.continuum.project.ShellProject;
+import org.apache.maven.continuum.project.ContinuumProject;
+import org.apache.maven.continuum.Continuum;
+
+import org.codehaus.plexus.util.FileUtils;
+import org.codehaus.plexus.util.cli.CommandLineException;
+
+/**
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
+ * @version $Id$
+ */
+public class ShellIntegrationTest
+    extends AbstractIntegrationTest
+{
+    public final static String EOL = System.getProperty( "line.separator" );
+
+    public void testBasic()
+        throws Exception
+    {
+        Continuum continuum = getContinuum();
+
+        initializeCvsRoot();
+
+        progress( "Initializing Shell CVS project" );
+
+        File root = getItFile( "shell" );
+
+        initShellProject( root );
+
+        cvsImport( root, "shell", getCvsRoot() );
+
+        progress( "Adding CVS Shell project" );
+
+        ShellProject p = new ShellProject();
+        p.setScmUrl( "scm:cvs:local:" + getCvsRoot() + ":shell" );
+        p.setName( "Shell Project" );
+//        p.getNotifiers().add( makeMailNotifier( email ) );
+        p.setVersion( "3.0" );
+        p.setCommandLineArguments( "" );
+        p.setExecutable( "script.sh" );
+        String projectId = continuum.addShellProject( p );
+        waitForSuccessfulCheckout( projectId );
+
+        ContinuumProject project = continuum.getProject( projectId );
+        assertProject( projectId, "Shell Project", "3.0", "", "shell", project );
+        progress( "Building Shell project" );
+        String buildId = buildProject( projectId, false ).getId();
+        assertSuccessfulShellBuild( buildId, "" );
+
+        // Test project reconfiguration
+        // Test that a project will be built after a changed file is committed
+        progress( "Building Shell project with alternative configuration" );
+
+        File coDir = getTempCoDir();
+
+        cvsCheckout( getCvsRoot(), "shell", coDir );
+
+        File s = new File( coDir, "script.sh" );
+        String script = FileUtils.fileRead( s );
+        FileUtils.fileWrite( s.getAbsolutePath(), script + " # Extra part" );
+        system( root, "chmod", "+x " + s.getAbsolutePath() );
+
+        cvsCommit( coDir );
+
+        ShellProject shellProject = continuum.getShellProject( projectId );
+        shellProject.setCommandLineArguments( "a b" );
+        continuum.updateShellProject( shellProject );
+
+        shellProject = continuum.getShellProject( projectId );
+        assertEquals( "Updated command line arguments doesn't match", "a b", shellProject.getCommandLineArguments() );
+
+        buildId = buildProject( projectId, false ).getId();
+        assertSuccessfulShellBuild( buildId, "a" + EOL +
+                                             "b" + EOL );
+        removeProject( projectId );
+    }
+
+    private void initShellProject( File root )
+        throws IOException, CommandLineException
+    {
+        deleteAndCreateDirectory( root );
+
+        File script = new File( root, "script.sh" );
+
+        FileUtils.fileWrite( script.getAbsolutePath(),
+                             "#!/bin/bash" + EOL +
+                             "for arg in \"$@\"; do" + EOL +
+                             "  echo $arg" + EOL +
+                             "done");
+
+        system( root, "chmod", "+x " + script.getAbsolutePath() );
+    }
+}

Propchange: maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/ShellIntegrationTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/ShellIntegrationTest.java
------------------------------------------------------------------------------
    svn:keywords = Id



Mime
View raw message