continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r812976 - in /continuum/branches/continuum-1.3.x/continuum-release/src: main/java/org/apache/continuum/release/config/ test/java/org/apache/maven/continuum/release/executors/
Date Wed, 09 Sep 2009 14:35:37 GMT
Author: ctan
Date: Wed Sep  9 14:35:37 2009
New Revision: 812976

URL: http://svn.apache.org/viewvc?rev=812976&view=rev
Log:
[CONTINUUM-2357] read/write executable in release.properties

Modified:
    continuum/branches/continuum-1.3.x/continuum-release/src/main/java/org/apache/continuum/release/config/ContinuumPropertiesReleaseDescriptorStore.java
    continuum/branches/continuum-1.3.x/continuum-release/src/test/java/org/apache/maven/continuum/release/executors/ReleaseTaskExecutorTest.java

Modified: continuum/branches/continuum-1.3.x/continuum-release/src/main/java/org/apache/continuum/release/config/ContinuumPropertiesReleaseDescriptorStore.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-release/src/main/java/org/apache/continuum/release/config/ContinuumPropertiesReleaseDescriptorStore.java?rev=812976&r1=812975&r2=812976&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-release/src/main/java/org/apache/continuum/release/config/ContinuumPropertiesReleaseDescriptorStore.java
(original)
+++ continuum/branches/continuum-1.3.x/continuum-release/src/main/java/org/apache/continuum/release/config/ContinuumPropertiesReleaseDescriptorStore.java
Wed Sep  9 14:35:37 2009
@@ -82,6 +82,7 @@
         releaseDescriptor.setAdditionalArguments( properties.getProperty( "exec.additionalArguments"
) );
         releaseDescriptor.setPomFileName( properties.getProperty( "exec.pomFileName" ) );
         releaseDescriptor.setPreparationGoals( properties.getProperty( "preparationGoals"
) );
+        releaseDescriptor.setExecutable( properties.getProperty( "build.executable" ) );
 
         loadResolvedDependencies( properties, releaseDescriptor );
 
@@ -247,6 +248,12 @@
             processResolvedDependencies( properties, config.getResolvedSnapshotDependencies()
);
         }
 
+        // executables
+        if ( config.getExecutable() != null )
+        {
+            properties.setProperty( "build.executable", config.getExecutable() );
+        }
+
         OutputStream outStream = null;
         //noinspection OverlyBroadCatchBlock
         try

Modified: continuum/branches/continuum-1.3.x/continuum-release/src/test/java/org/apache/maven/continuum/release/executors/ReleaseTaskExecutorTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-release/src/test/java/org/apache/maven/continuum/release/executors/ReleaseTaskExecutorTest.java?rev=812976&r1=812975&r2=812976&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-release/src/test/java/org/apache/maven/continuum/release/executors/ReleaseTaskExecutorTest.java
(original)
+++ continuum/branches/continuum-1.3.x/continuum-release/src/test/java/org/apache/maven/continuum/release/executors/ReleaseTaskExecutorTest.java
Wed Sep  9 14:35:37 2009
@@ -32,13 +32,22 @@
 import org.apache.maven.scm.repository.ScmRepositoryException;
 import org.apache.maven.shared.release.ReleaseResult;
 import org.apache.maven.shared.release.config.ReleaseDescriptor;
+import org.apache.maven.shared.release.config.ReleaseDescriptorStoreException;
 import org.codehaus.plexus.spring.PlexusInSpringTestCase;
 import org.codehaus.plexus.taskqueue.Task;
 import org.codehaus.plexus.taskqueue.execution.TaskExecutionException;
 import org.codehaus.plexus.taskqueue.execution.TaskExecutor;
 import org.codehaus.plexus.util.FileUtils;
+import org.codehaus.plexus.util.IOUtil;
 
 import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.Properties;
 
 /**
  * @author Edwin Punzalan
@@ -130,6 +139,7 @@
         releaseSimpleProject();
         releaseAndRollbackProject();
         releaseSimpleProjectWithNextVersion();
+        releasePerformWithExecutableInDescriptor();
     }
 
     public void releaseSimpleProjectWithNextVersion()
@@ -222,6 +232,75 @@
         //@todo when implemented already, check if tag was also removed
     }
 
+    public void releasePerformWithExecutableInDescriptor()
+        throws Exception
+    {
+        String scmPath = new File( getBasedir(), "target/scm-test" ).getAbsolutePath().replace(
'\\', '/' );
+        File workDir = new File( getBasedir(), "target/test-classes/work-dir" );
+        FileUtils.deleteDirectory( workDir );
+        File testDir = new File( getBasedir(), "target/test-classes/test-dir" );
+        FileUtils.deleteDirectory( testDir );
+
+        ContinuumReleaseDescriptor descriptor = new ContinuumReleaseDescriptor();
+        descriptor.setInteractive( false );
+        descriptor.setScmSourceUrl( "scm:svn:file://localhost/" + scmPath + "/trunk" );
+        descriptor.setWorkingDirectory( workDir.getAbsolutePath() );
+
+        ScmRepository repository = getScmRepositorty( descriptor.getScmSourceUrl() );
+        ScmFileSet fileSet = new ScmFileSet( workDir );
+        scmManager.getProviderByRepository( repository ).checkOut( repository, fileSet, (ScmVersion)
null );
+
+        String pom = FileUtils.fileRead( new File( workDir, "pom.xml" ) );
+        assertTrue( "Test dev version", pom.indexOf( "<version>2.1-SNAPSHOT</version>"
) > 0 );
+
+        doPrepareWithNoError( descriptor );
+
+        pom = FileUtils.fileRead( new File( workDir, "pom.xml" ) );
+        assertTrue( "Test version increment", pom.indexOf( "<version>2.2-SNAPSHOT</version>"
) > 0 );
+
+        repository = getScmRepositorty( "scm:svn:file://localhost/" + scmPath + "/tags/test-artifact-2.1"
);
+        fileSet = new ScmFileSet( testDir );
+        scmManager.getProviderByRepository( repository ).checkOut( repository, fileSet, (ScmVersion)
null );
+
+        pom = FileUtils.fileRead( new File( testDir, "pom.xml" ) );
+        assertTrue( "Test released version", pom.indexOf( "<version>2.1</version>"
) > 0 );
+
+        File file = new File( descriptor.getWorkingDirectory(), "release.properties" );
+        assertTrue( "release.properties file does not exist", file.exists() );
+
+        Properties properties = new Properties();
+
+        InputStream inStream = null;
+        OutputStream outStream = null;
+        
+        try
+        {
+            inStream = new FileInputStream( file );
+
+            properties.load( inStream );
+
+            properties.setProperty( "build.executable", "test/executable/mvn" );
+
+            outStream = new FileOutputStream( file );
+
+            properties.store( outStream, "release configuration" );
+        }
+        finally
+        {
+            IOUtil.close( inStream );
+        }
+
+        performExec.executeTask(
+            getPerformTask( "testRelease", descriptor, new File( getBasedir(), "target/test-classes/build-dir"
) ) );
+
+        ReleaseResult result = (ReleaseResult) releaseManager.getReleaseResults().get( "testRelease"
);
+
+        if ( !result.getOutput().contains( "test/executable/mvn" ) )
+        {
+            fail( "Error in release:perform. Missing executable" );
+        }
+    }
+
     private void doPrepareWithNoError( ReleaseDescriptor descriptor )
         throws TaskExecutionException
     {



Mime
View raw message