Author: brett
Date: Tue May 2 01:41:37 2006
New Revision: 398862
URL: http://svn.apache.org/viewcvs?rev=398862&view=rev
Log:
[MRELEASE-98] test multiple projects in commit phase
Added:
maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/scm-commit/multiple-poms/
maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/scm-commit/multiple-poms/pom.xml
(with props)
maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/scm-commit/multiple-poms/subproject1/
maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/scm-commit/multiple-poms/subproject1/pom.xml
(with props)
maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/scm-commit/multiple-poms/subproject2/
maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/scm-commit/multiple-poms/subproject2/pom.xml
(with props)
Modified:
maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/phase/ScmCommitPhaseTest.java
maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/scm-commit/single-pom/pom.xml
Modified:
maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/phase/ScmCommitPhaseTest.java
URL:
http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/phase/ScmCommitPhaseTest.java?rev=398862&r1=398861&r2=398862&view=diff
==============================================================================
---
maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/phase/ScmCommitPhaseTest.java
(original)
+++
maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/phase/ScmCommitPhaseTest.java
Tue May 2 01:41:37 2006
@@ -37,25 +37,30 @@
import org.jmock.core.constraint.IsAnything;
import org.jmock.core.constraint.IsEqual;
import org.jmock.core.constraint.IsNull;
-import org.jmock.core.matcher.InvokeAtLeastOnceMatcher;
+import org.jmock.core.matcher.InvokeOnceMatcher;
import org.jmock.core.matcher.TestFailureMatcher;
import org.jmock.core.stub.ReturnStub;
import org.jmock.core.stub.ThrowStub;
+import java.io.File;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
/**
* Test the SCM commit phase.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Brett Porter</a>
- * @todo [!] multiple projects
*/
public class ScmCommitPhaseTest
extends AbstractReleaseTestCase
{
private static final String PREFIX = "[maven-release-plugin] prepare
release ";
+ private static final File[] EMPTY_FILE_ARRAY = new File[0];
+
protected void setUp()
throws Exception
{
@@ -78,7 +83,39 @@
Mock scmProviderMock = new Mock( ScmProvider.class );
Constraint[] arguments = new Constraint[]{new IsAnything(), new
IsScmFileSetEquals( fileSet ), new IsNull(),
new IsEqual( PREFIX + "release-label" )};
- scmProviderMock.expects( new InvokeAtLeastOnceMatcher() ).method(
"checkIn" ).with( arguments ).will(
+ scmProviderMock.expects( new InvokeOnceMatcher() ).method( "checkIn"
).with( arguments ).will(
+ new ReturnStub( new CheckInScmResult( "...",
Collections.singletonList( rootProject.getFile() ) ) ) );
+
+ ScmManagerStub stub = (ScmManagerStub) lookup( ScmManager.ROLE );
+ stub.setScmProvider( (ScmProvider) scmProviderMock.proxy() );
+
+ phase.execute( config );
+
+ assertTrue( true );
+ }
+
+ public void testCommitMultiModule()
+ throws Exception
+ {
+ ReleaseConfiguration config = createConfigurationFromProjects(
"scm-commit/", "multiple-poms", true );
+ config.setUrl( "scm-url" );
+ MavenProject rootProject = (MavenProject)
config.getReactorProjects().get( 0 );
+ config.setWorkingDirectory( rootProject.getFile().getParentFile() );
+ config.setReleaseLabel( "release-label" );
+
+ List poms = new ArrayList();
+ for ( Iterator i = config.getReactorProjects().iterator();
i.hasNext(); )
+ {
+ MavenProject project = (MavenProject) i.next();
+ poms.add( project.getFile() );
+ }
+ ScmFileSet fileSet =
+ new ScmFileSet( rootProject.getFile().getParentFile(), (File[])
poms.toArray( EMPTY_FILE_ARRAY ) );
+
+ Mock scmProviderMock = new Mock( ScmProvider.class );
+ Constraint[] arguments = new Constraint[]{new IsAnything(), new
IsScmFileSetEquals( fileSet ), new IsNull(),
+ new IsEqual( PREFIX + "release-label" )};
+ scmProviderMock.expects( new InvokeOnceMatcher() ).method( "checkIn"
).with( arguments ).will(
new ReturnStub( new CheckInScmResult( "...",
Collections.singletonList( rootProject.getFile() ) ) ) );
ScmManagerStub stub = (ScmManagerStub) lookup( ScmManager.ROLE );
@@ -105,7 +142,7 @@
Mock scmProviderMock = new Mock( ScmProvider.class );
Constraint[] arguments = new Constraint[]{new IsAnything(), new
IsScmFileSetEquals( fileSet ), new IsNull(),
new IsEqual( "[maven-release-plugin] prepare for next development
iteration" )};
- scmProviderMock.expects( new InvokeAtLeastOnceMatcher() ).method(
"checkIn" ).with( arguments ).will(
+ scmProviderMock.expects( new InvokeOnceMatcher() ).method( "checkIn"
).with( arguments ).will(
new ReturnStub( new CheckInScmResult( "...",
Collections.singletonList( rootProject.getFile() ) ) ) );
ScmManagerStub stub = (ScmManagerStub) lookup( ScmManager.ROLE );
@@ -174,7 +211,7 @@
ReleaseConfiguration releaseConfiguration =
createReleaseConfiguration();
Mock scmManagerMock = new Mock( ScmManager.class );
- scmManagerMock.expects( new InvokeAtLeastOnceMatcher() ).method(
"makeScmRepository" ).with(
+ scmManagerMock.expects( new InvokeOnceMatcher() ).method(
"makeScmRepository" ).with(
new IsEqual( "scm-url" ) ).will( new ThrowStub( new
NoSuchScmProviderException( "..." ) ) );
ScmManager scmManager = (ScmManager) scmManagerMock.proxy();
@@ -200,7 +237,7 @@
ReleaseConfiguration releaseConfiguration =
createReleaseConfiguration();
Mock scmManagerMock = new Mock( ScmManager.class );
- scmManagerMock.expects( new InvokeAtLeastOnceMatcher() ).method(
"makeScmRepository" ).with(
+ scmManagerMock.expects( new InvokeOnceMatcher() ).method(
"makeScmRepository" ).with(
new IsEqual( "scm-url" ) ).will( new ThrowStub( new
ScmRepositoryException( "..." ) ) );
ScmManager scmManager = (ScmManager) scmManagerMock.proxy();
@@ -226,7 +263,7 @@
ReleaseConfiguration releaseConfiguration =
createReleaseConfiguration();
Mock scmProviderMock = new Mock( ScmProvider.class );
- scmProviderMock.expects( new InvokeAtLeastOnceMatcher() ).method(
"checkIn" ).will(
+ scmProviderMock.expects( new InvokeOnceMatcher() ).method( "checkIn"
).will(
new ThrowStub( new ScmException( "..." ) ) );
ScmManagerStub stub = (ScmManagerStub) lookup( ScmManager.ROLE );
Added:
maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/scm-commit/multiple-poms/pom.xml
URL:
http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/scm-commit/multiple-poms/pom.xml?rev=398862&view=auto
==============================================================================
---
maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/scm-commit/multiple-poms/pom.xml
(added)
+++
maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/scm-commit/multiple-poms/pom.xml
Tue May 2 01:41:37 2006
@@ -0,0 +1,28 @@
+<!--
+ ~ 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.
+ -->
+
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>groupId</groupId>
+ <artifactId>artifactId</artifactId>
+ <version>1.0</version>
+ <packaging>pom</packaging>
+
+ <modules>
+ <module>subproject1</module>
+ <module>subproject2</module>
+ </modules>
+</project>
Propchange:
maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/scm-commit/multiple-poms/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/scm-commit/multiple-poms/pom.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added:
maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/scm-commit/multiple-poms/subproject1/pom.xml
URL:
http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/scm-commit/multiple-poms/subproject1/pom.xml?rev=398862&view=auto
==============================================================================
---
maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/scm-commit/multiple-poms/subproject1/pom.xml
(added)
+++
maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/scm-commit/multiple-poms/subproject1/pom.xml
Tue May 2 01:41:37 2006
@@ -0,0 +1,26 @@
+<!--
+ ~ 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.
+ -->
+
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>groupId</groupId>
+ <artifactId>artifactId</artifactId>
+ <version>1.0</version>
+ </parent>
+
+ <artifactId>subproject1</artifactId>
+</project>
Propchange:
maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/scm-commit/multiple-poms/subproject1/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/scm-commit/multiple-poms/subproject1/pom.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added:
maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/scm-commit/multiple-poms/subproject2/pom.xml
URL:
http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/scm-commit/multiple-poms/subproject2/pom.xml?rev=398862&view=auto
==============================================================================
---
maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/scm-commit/multiple-poms/subproject2/pom.xml
(added)
+++
maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/scm-commit/multiple-poms/subproject2/pom.xml
Tue May 2 01:41:37 2006
@@ -0,0 +1,34 @@
+<!--
+ ~ 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.
+ -->
+
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>groupId</groupId>
+ <artifactId>artifactId</artifactId>
+ <version>1.0</version>
+ </parent>
+
+ <artifactId>subproject2</artifactId>
+
+ <dependencies>
+ <dependency>
+ <groupId>groupId</groupId>
+ <artifactId>subproject1</artifactId>
+ <version>1.0</version>
+ </dependency>
+ </dependencies>
+</project>
Propchange:
maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/scm-commit/multiple-poms/subproject2/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/scm-commit/multiple-poms/subproject2/pom.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified:
maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/scm-commit/single-pom/pom.xml
URL:
http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/scm-commit/single-pom/pom.xml?rev=398862&r1=398861&r2=398862&view=diff
==============================================================================
---
maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/scm-commit/single-pom/pom.xml
(original)
+++
maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/scm-commit/single-pom/pom.xml
Tue May 2 01:41:37 2006
@@ -18,5 +18,5 @@
<modelVersion>4.0.0</modelVersion>
<groupId>groupId</groupId>
<artifactId>artifactId</artifactId>
- <version>1.0-SNAPSHOT</version>
+ <version>1.0</version>
</project>