continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From epunza...@apache.org
Subject svn commit: r440580 - in /maven/continuum/branches/release-integration/continuum: continuum-api/src/main/java/org/apache/maven/continuum/release/ continuum-release/ continuum-release/src/main/java/org/apache/maven/continuum/release/ continuum-release/s...
Date Wed, 06 Sep 2006 02:47:39 GMT
Author: epunzalan
Date: Tue Sep  5 19:47:38 2006
New Revision: 440580

URL: http://svn.apache.org/viewvc?view=rev&rev=440580
Log:
PR: CONTINUUM-727

adding unit test with pb

Added:
    maven/continuum/branches/release-integration/continuum/continuum-release/src/test/scm/
    maven/continuum/branches/release-integration/continuum/continuum-release/src/test/scm/pom.xml
  (with props)
Modified:
    maven/continuum/branches/release-integration/continuum/continuum-api/src/main/java/org/apache/maven/continuum/release/ContinuumReleaseManager.java
    maven/continuum/branches/release-integration/continuum/continuum-release/pom.xml
    maven/continuum/branches/release-integration/continuum/continuum-release/src/main/java/org/apache/maven/continuum/release/DefaultContinuumReleaseManager.java
    maven/continuum/branches/release-integration/continuum/continuum-release/src/test/java/org/apache/maven/continuum/release/executors/PrepareReleaseTaskExecutorTest.java

Modified: maven/continuum/branches/release-integration/continuum/continuum-api/src/main/java/org/apache/maven/continuum/release/ContinuumReleaseManager.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/release-integration/continuum/continuum-api/src/main/java/org/apache/maven/continuum/release/ContinuumReleaseManager.java?view=diff&rev=440580&r1=440579&r2=440580
==============================================================================
--- maven/continuum/branches/release-integration/continuum/continuum-api/src/main/java/org/apache/maven/continuum/release/ContinuumReleaseManager.java
(original)
+++ maven/continuum/branches/release-integration/continuum/continuum-api/src/main/java/org/apache/maven/continuum/release/ContinuumReleaseManager.java
Tue Sep  5 19:47:38 2006
@@ -20,6 +20,7 @@
 
 import java.io.File;
 import java.util.Map;
+import java.util.Properties;
 
 /**
  * The Continuum Release Manager is responsible for performing releases based on a release
descriptor
@@ -35,9 +36,10 @@
      * Prepare a project for release
      *
      * @param project      project / project group to be released
+     * @param releaseProperties
      * @throws ContinuumReleaseException
      */
-    void prepare( Project project )
+    void prepare( Project project, Properties releaseProperties )
         throws ContinuumReleaseException;
 
     /**

Modified: maven/continuum/branches/release-integration/continuum/continuum-release/pom.xml
URL: http://svn.apache.org/viewvc/maven/continuum/branches/release-integration/continuum/continuum-release/pom.xml?view=diff&rev=440580&r1=440579&r2=440580
==============================================================================
--- maven/continuum/branches/release-integration/continuum/continuum-release/pom.xml (original)
+++ maven/continuum/branches/release-integration/continuum/continuum-release/pom.xml Tue Sep
 5 19:47:38 2006
@@ -34,4 +34,12 @@
       <version>1.0-alpha-3</version>
     </dependency>
   </dependencies>
+  <build>
+    <testResources>
+      <testResource>
+        <directory>src/test/scm</directory>
+        <targetPath>scm-src</targetPath>
+      </testResource>
+    </testResources>
+  </build>
 </project>

Modified: maven/continuum/branches/release-integration/continuum/continuum-release/src/main/java/org/apache/maven/continuum/release/DefaultContinuumReleaseManager.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/release-integration/continuum/continuum-release/src/main/java/org/apache/maven/continuum/release/DefaultContinuumReleaseManager.java?view=diff&rev=440580&r1=440579&r2=440580
==============================================================================
--- maven/continuum/branches/release-integration/continuum/continuum-release/src/main/java/org/apache/maven/continuum/release/DefaultContinuumReleaseManager.java
(original)
+++ maven/continuum/branches/release-integration/continuum/continuum-release/src/main/java/org/apache/maven/continuum/release/DefaultContinuumReleaseManager.java
Tue Sep  5 19:47:38 2006
@@ -29,6 +29,7 @@
 import java.io.FileReader;
 import java.io.IOException;
 import java.util.Map;
+import java.util.Properties;
 
 /**
  * @author Jason van Zyl
@@ -52,14 +53,16 @@
      */
     private Map preparedReleases;
 
-    public void prepare( Project project )
+    public void prepare( Project project, Properties releaseProperties )
         throws ContinuumReleaseException
     {
         String releaseId = project.getGroupId() + ":" + project.getArtifactId();
 
+        ReleaseDescriptor descriptor = getReleaseDescriptor( project, releaseProperties );
+
         try
         {
-            prepareReleaseQueue.put( new PrepareReleaseProjectTask( releaseId, new ReleaseDescriptor()
) );
+            prepareReleaseQueue.put( new PrepareReleaseProjectTask( releaseId, descriptor
) );
         }
         catch ( TaskQueueException e )
         {
@@ -99,7 +102,7 @@
     }
 
     private void perform( String releaseId, ReleaseDescriptor descriptor, File buildDirectory,
-                         String goals, boolean useReleaseProfile )
+                          String goals, boolean useReleaseProfile )
         throws ContinuumReleaseException
     {
         try
@@ -121,5 +124,25 @@
     public void setPreparedReleases( Map preparedReleases )
     {
         this.preparedReleases = preparedReleases;
+    }
+
+    private ReleaseDescriptor getReleaseDescriptor( Project project, Properties releaseProperties
)
+    {
+        ReleaseDescriptor descriptor = new ReleaseDescriptor();
+
+        //release properties from the project
+        descriptor.setScmUsername( project.getScmUsername() );
+        descriptor.setScmPassword( project.getScmPassword() );
+        descriptor.setWorkingDirectory( project.getWorkingDirectory() );
+        descriptor.setScmSourceUrl( project.getScmUrl() );
+
+        //required properties
+        descriptor.setScmReleaseLabel( releaseProperties.getProperty( "tag" ) );
+        descriptor.setScmTagBase( releaseProperties.getProperty( "tagBase" ) );
+
+        //forced properties
+        descriptor.setInteractive( false );
+
+        return descriptor;
     }
 }

Modified: maven/continuum/branches/release-integration/continuum/continuum-release/src/test/java/org/apache/maven/continuum/release/executors/PrepareReleaseTaskExecutorTest.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/release-integration/continuum/continuum-release/src/test/java/org/apache/maven/continuum/release/executors/PrepareReleaseTaskExecutorTest.java?view=diff&rev=440580&r1=440579&r2=440580
==============================================================================
--- maven/continuum/branches/release-integration/continuum/continuum-release/src/test/java/org/apache/maven/continuum/release/executors/PrepareReleaseTaskExecutorTest.java
(original)
+++ maven/continuum/branches/release-integration/continuum/continuum-release/src/test/java/org/apache/maven/continuum/release/executors/PrepareReleaseTaskExecutorTest.java
Tue Sep  5 19:47:38 2006
@@ -18,16 +18,25 @@
 
 import org.apache.maven.continuum.release.tasks.PrepareReleaseProjectTask;
 import org.apache.maven.plugins.release.config.ReleaseDescriptor;
+import org.apache.maven.scm.manager.NoSuchScmProviderException;
+import org.apache.maven.scm.manager.ScmManager;
+import org.apache.maven.scm.repository.ScmRepository;
+import org.apache.maven.scm.repository.ScmRepositoryException;
+import org.apache.maven.scm.ScmFileSet;
 import org.codehaus.plexus.PlexusTestCase;
 import org.codehaus.plexus.taskqueue.Task;
 import org.codehaus.plexus.taskqueue.execution.TaskExecutor;
 
+import java.io.File;
+
 /**
  * @author Edwin Punzalan
  */
 public class PrepareReleaseTaskExecutorTest
     extends PlexusTestCase
 {
+    private ScmManager scmManager;
+
     private TaskExecutor taskExec;
 
     protected void setUp()
@@ -35,21 +44,45 @@
     {
         super.setUp();
 
+        scmManager = (ScmManager) lookup( "org.apache.maven.scm.manager.ScmManager" );
+
         taskExec = (TaskExecutor) lookup( ReleaseTaskExecutor.ROLE, "prepare-release" );
     }
 
     public void testRelease()
         throws Exception
     {
+        File testProjectDir = new File( getBasedir(), "src/test/scm" );
+        File workDir = new File( getBasedir(), "target/test-classes/work-dir" );
+        workDir.mkdirs();
+
         ReleaseDescriptor descriptor = new ReleaseDescriptor();
+        descriptor.setScmSourceUrl( "scm:svn:file://localhost/" + testProjectDir.getAbsolutePath()
);
+        descriptor.setWorkingDirectory( workDir.getAbsolutePath() );
+
+        ScmRepository repository = getScmRepositorty( descriptor.getScmSourceUrl() );
+        ScmFileSet fileSet = new ScmFileSet( workDir );
+        scmManager.getProviderByRepository( repository ).checkOut( repository, fileSet, null
);
 
-        taskExec.executeTask( getPrepareTask( "testRelease", descriptor ) );
+//        taskExec.executeTask( getPrepareTask( "testRelease", descriptor ) );
     }
 
     protected Task getPrepareTask( String releaseId, ReleaseDescriptor descriptor )
     {
         Task task = new PrepareReleaseProjectTask( releaseId, descriptor );
 
+        
+
         return task;
+    }
+
+    private ScmRepository getScmRepositorty( String scmUrl )
+        throws ScmRepositoryException, NoSuchScmProviderException
+    {
+        ScmRepository repository = scmManager.makeScmRepository( scmUrl.trim() );
+
+        repository.getProviderRepository().setPersistCheckout( true );
+
+        return repository;
     }
 }

Added: maven/continuum/branches/release-integration/continuum/continuum-release/src/test/scm/pom.xml
URL: http://svn.apache.org/viewvc/maven/continuum/branches/release-integration/continuum/continuum-release/src/test/scm/pom.xml?view=auto&rev=440580
==============================================================================
--- maven/continuum/branches/release-integration/continuum/continuum-release/src/test/scm/pom.xml
(added)
+++ maven/continuum/branches/release-integration/continuum/continuum-release/src/test/scm/pom.xml
Tue Sep  5 19:47:38 2006
@@ -0,0 +1,11 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>test-group</groupId>
+  <artifactId>test-artifact</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <name>Simple Project</name>
+  <description>
+    Sample project
+  </description>
+</project>

Propchange: maven/continuum/branches/release-integration/continuum/continuum-release/src/test/scm/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message