Return-Path: Delivered-To: apmail-maven-commits-archive@www.apache.org Received: (qmail 43052 invoked from network); 25 Apr 2006 01:35:22 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 25 Apr 2006 01:35:22 -0000 Received: (qmail 90387 invoked by uid 500); 25 Apr 2006 01:35:21 -0000 Delivered-To: apmail-maven-commits-archive@maven.apache.org Received: (qmail 90346 invoked by uid 500); 25 Apr 2006 01:35:21 -0000 Mailing-List: contact commits-help@maven.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@maven.apache.org Delivered-To: mailing list commits@maven.apache.org Received: (qmail 90335 invoked by uid 99); 25 Apr 2006 01:35:20 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 24 Apr 2006 18:35:20 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Mon, 24 Apr 2006 18:35:20 -0700 Received: (qmail 42831 invoked by uid 65534); 25 Apr 2006 01:34:59 -0000 Message-ID: <20060425013459.42830.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@maven.apache.org From: brett@apache.org X-Mailer: svnmailer-1.0.8 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N 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 Brett Porter */ @@ -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 Brett Porter + */ +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