maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r396755 - in /maven/plugins/trunk/maven-release-plugin/src: main/java/org/apache/maven/plugins/release/ main/java/org/apache/maven/plugins/release/phase/ test/java/org/apache/maven/plugins/release/phase/
Date Tue, 25 Apr 2006 01:34:59 GMT
Author: brett
Date: Mon Apr 24 18:34:57 2006
New Revision: 396755

URL: http://svn.apache.org/viewcvs?rev=396755&view=rev
Log:
[MRELEASE-98] setup initial check-poms phase

Added:
    maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/phase/CheckPomPhaseTest.java
  (with props)
Modified:
    maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/DefaultReleaseManager.java
    maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/phase/CheckPomPhase.java

Modified: maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/DefaultReleaseManager.java
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/DefaultReleaseManager.java?rev=396755&r1=396754&r2=396755&view=diff
==============================================================================
--- maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/DefaultReleaseManager.java
(original)
+++ maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/DefaultReleaseManager.java
Mon Apr 24 18:34:57 2006
@@ -60,7 +60,6 @@
     private ReleaseConfigurationStore configStore;
 
     // TODO: config - release pom generation, interactive, tag, use edit mode
-    // TODO: SCM URL is coming from the store but it probably needs to be read from every
project instead
 
     public void prepare( ReleaseConfiguration releaseConfiguration )
         throws ReleaseExecutionException

Modified: maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/phase/CheckPomPhase.java
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/phase/CheckPomPhase.java?rev=396755&r1=396754&r2=396755&view=diff
==============================================================================
--- maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/phase/CheckPomPhase.java
(original)
+++ maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/phase/CheckPomPhase.java
Mon Apr 24 18:34:57 2006
@@ -16,10 +16,12 @@
  * limitations under the License.
  */
 
+import org.apache.maven.plugins.release.ReleaseExecutionException;
 import org.apache.maven.plugins.release.config.ReleaseConfiguration;
+import org.codehaus.plexus.util.StringUtils;
 
 /**
- * TODO: Description.
+ * Phase that checks the validity of the POM before release.
  *
  * @author <a href="mailto:brett@apache.org">Brett Porter</a>
  */
@@ -27,14 +29,21 @@
     implements ReleasePhase
 {
     public void execute( ReleaseConfiguration releaseConfiguration )
+        throws ReleaseExecutionException
     {
-        // TODO: implement
-
+        // TODO: SCM URL is coming from the store but it probably needs to be read from every
project instead
+        // TODO: prepare release mojo needs to set this correct to either connection or developerConnection
as appropriate - new version doesn't handle it
+        if ( StringUtils.isEmpty( releaseConfiguration.getUrl() ) )
+        {
+            throw new ReleaseExecutionException(
+                "Missing required setting: scm connection or developerConnection must be
specified." );
+        }
     }
 
     public void simulate( ReleaseConfiguration releaseConfiguration )
+        throws ReleaseExecutionException
     {
-        // TODO: implement
-
+        // It makes no modifications, so simulate is the same as execute
+        execute( releaseConfiguration );
     }
 }

Added: maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/phase/CheckPomPhaseTest.java
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/phase/CheckPomPhaseTest.java?rev=396755&view=auto
==============================================================================
--- maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/phase/CheckPomPhaseTest.java
(added)
+++ maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/phase/CheckPomPhaseTest.java
Mon Apr 24 18:34:57 2006
@@ -0,0 +1,81 @@
+package org.apache.maven.plugins.release.phase;
+
+/*
+ * Copyright 2005-2006 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 org.apache.maven.plugins.release.ReleaseExecutionException;
+import org.apache.maven.plugins.release.config.ReleaseConfiguration;
+import org.codehaus.plexus.PlexusTestCase;
+
+/**
+ * Test the POM verification check phase.
+ *
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ */
+public class CheckPomPhaseTest
+    extends PlexusTestCase
+{
+    private ReleasePhase phase;
+
+    protected void setUp()
+        throws Exception
+    {
+        super.setUp();
+
+        phase = (ReleasePhase) lookup( ReleasePhase.ROLE, "check-poms" );
+    }
+
+    public void testCorrectlyConfigured()
+        throws Exception
+    {
+        ReleaseConfiguration releaseConfiguration = new ReleaseConfiguration();
+        releaseConfiguration.setUrl( "scm-url" );
+
+        phase.execute( releaseConfiguration );
+
+        phase.simulate( releaseConfiguration );
+
+        // successful execution is verification enough
+        assertTrue( true );
+    }
+
+    public void testMissingUrl()
+        throws Exception
+    {
+        ReleaseConfiguration releaseConfiguration = new ReleaseConfiguration();
+
+        try
+        {
+            phase.execute( releaseConfiguration );
+
+            fail( "Should have failed to execute" );
+        }
+        catch ( ReleaseExecutionException e )
+        {
+            assertNull( "Check no cause", e.getCause() );
+        }
+        try
+        {
+            phase.simulate( releaseConfiguration );
+
+            fail( "Should have failed to simulate" );
+        }
+        catch ( ReleaseExecutionException e )
+        {
+            assertNull( "Check no cause", e.getCause() );
+        }
+    }
+}

Propchange: maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/phase/CheckPomPhaseTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/phase/CheckPomPhaseTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision



Mime
View raw message