You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by br...@apache.org on 2006/04/28 05:23:41 UTC

svn commit: r397750 - in /maven/plugins/trunk/maven-release-plugin/src: main/java/org/apache/maven/plugins/release/phase/RewritePomsForReleasePhase.java test/java/org/apache/maven/plugins/release/phase/RewritePomsForReleasePhaseTest.java

Author: brett
Date: Thu Apr 27 20:23:39 2006
New Revision: 397750

URL: http://svn.apache.org/viewcvs?rev=397750&view=rev
Log:
[MRELEASE-98] reduce duplicates

Modified:
    maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/phase/RewritePomsForReleasePhase.java
    maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/phase/RewritePomsForReleasePhaseTest.java

Modified: maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/phase/RewritePomsForReleasePhase.java
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/phase/RewritePomsForReleasePhase.java?rev=397750&r1=397749&r2=397750&view=diff
==============================================================================
--- maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/phase/RewritePomsForReleasePhase.java (original)
+++ maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/phase/RewritePomsForReleasePhase.java Thu Apr 27 20:23:39 2006
@@ -247,41 +247,8 @@
             {
                 Dependency dep = (Dependency) i.next();
 
-                String key = ArtifactUtils.versionlessKey( dep.getGroupId(), dep.getArtifactId() );
-                String version = (String) mappedVersions.get( key );
-
-                if ( version != null && dep.getVersion().equals( originalVersions.get( key ) ) )
-                {
-                    getLogger().debug( "Updating " + dep.getArtifactId() + " to " + version );
-
-                    try
-                    {
-                        XPath xpath = XPath.newInstance( "./dependencies/dependency[groupId='" + dep.getGroupId() +
-                            "' and artifactId='" + dep.getArtifactId() + "']" );
-
-                        Element dependency = (Element) xpath.selectSingleNode( dependencyRoot );
-                        Element versionElement = dependency.getChild( "version" );
-
-                        // avoid if in dependency management
-                        if ( versionElement != null )
-                        {
-                            versionElement.setText( version );
-                        }
-                    }
-                    catch ( JDOMException e )
-                    {
-                        throw new ReleaseExecutionException( "Unable to locate dependency to process in document", e );
-                    }
-                }
-                else
-                {
-                    // We can ignore dependencies we don't know of, unless they are snapshots
-                    if ( ArtifactUtils.isSnapshot( dep.getVersion() ) )
-                    {
-                        throw new ReleaseExecutionException(
-                            "Version '" + dep.getVersion() + "' for dependency '" + key + "' was not mapped" );
-                    }
-                }
+                updateDomVersion( dep.getGroupId(), dep.getArtifactId(), mappedVersions, dep.getVersion(),
+                                  originalVersions, "dependencies", "dependency", dependencyRoot );
             }
         }
     }
@@ -298,47 +265,14 @@
                 // We can ignore plugins whose version is assumed, they are only written into the release pom
                 if ( plugin.getVersion() != null )
                 {
-                    String key = ArtifactUtils.versionlessKey( plugin.getGroupId(), plugin.getArtifactId() );
-                    String version = (String) mappedVersions.get( key );
-
-                    if ( version != null && plugin.getVersion().equals( originalVersions.get( key ) ) )
-                    {
-                        getLogger().debug( "Updating " + plugin.getArtifactId() + " to " + version );
-
-                        try
-                        {
-                            XPath xpath = XPath.newInstance( "./plugins/plugin[groupId='" + plugin.getGroupId() +
-                                "' and artifactId='" + plugin.getArtifactId() + "']" );
-
-                            Element dependency = (Element) xpath.selectSingleNode( pluginRoot );
-                            Element versionElement = dependency.getChild( "version" );
-
-                            // avoid if in plugin management
-                            if ( versionElement != null )
-                            {
-                                versionElement.setText( version );
-                            }
-                        }
-                        catch ( JDOMException e )
-                        {
-                            throw new ReleaseExecutionException( "Unable to locate plugin to process in document", e );
-                        }
-                    }
-                    else
-                    {
-                        // We can ignore plugins we don't know of, unless they are snapshots
-                        if ( ArtifactUtils.isSnapshot( plugin.getVersion() ) )
-                        {
-                            throw new ReleaseExecutionException(
-                                "Version '" + plugin.getVersion() + "' for plugin '" + key + "' was not mapped" );
-                        }
-                    }
+                    updateDomVersion( plugin.getGroupId(), plugin.getArtifactId(), mappedVersions, plugin.getVersion(),
+                                      originalVersions, "plugins", "plugin", pluginRoot );
                 }
             }
         }
     }
 
-    private void rewriteExtensions( List extensions, Element pluginRoot, Map mappedVersions, Map originalVersions )
+    private void rewriteExtensions( List extensions, Element extensionRoot, Map mappedVersions, Map originalVersions )
         throws ReleaseExecutionException
     {
         if ( extensions != null )
@@ -347,37 +281,8 @@
             {
                 Extension extension = (Extension) i.next();
 
-                String key = ArtifactUtils.versionlessKey( extension.getGroupId(), extension.getArtifactId() );
-                String version = (String) mappedVersions.get( key );
-
-                if ( version != null && extension.getVersion().equals( originalVersions.get( key ) ) )
-                {
-                    getLogger().debug( "Updating " + extension.getArtifactId() + " to " + version );
-
-                    try
-                    {
-                        XPath xpath = XPath.newInstance( "./extensions/extension[groupId='" + extension.getGroupId() +
-                            "' and artifactId='" + extension.getArtifactId() + "']" );
-
-                        Element dependency = (Element) xpath.selectSingleNode( pluginRoot );
-                        Element versionElement = dependency.getChild( "version" );
-
-                        versionElement.setText( version );
-                    }
-                    catch ( JDOMException e )
-                    {
-                        throw new ReleaseExecutionException( "Unable to locate extension to process in document", e );
-                    }
-                }
-                else
-                {
-                    // We can ignore extensions we don't know of, unless they are snapshots
-                    if ( ArtifactUtils.isSnapshot( extension.getVersion() ) )
-                    {
-                        throw new ReleaseExecutionException(
-                            "Version '" + extension.getVersion() + "' for extension '" + key + "' was not mapped" );
-                    }
-                }
+                updateDomVersion( extension.getGroupId(), extension.getArtifactId(), mappedVersions,
+                                  extension.getVersion(), originalVersions, "extensions", "extension", extensionRoot );
             }
         }
     }
@@ -394,43 +299,50 @@
                 // We can ignore plugins whose version is assumed, they are only written into the release pom
                 if ( plugin.getVersion() != null )
                 {
-                    String key = ArtifactUtils.versionlessKey( plugin.getGroupId(), plugin.getArtifactId() );
-                    String version = (String) mappedVersions.get( key );
+                    updateDomVersion( plugin.getGroupId(), plugin.getArtifactId(), mappedVersions, plugin.getVersion(),
+                                      originalVersions, "plugins", "plugin", pluginRoot );
+                }
+            }
+        }
+    }
+
+    private void updateDomVersion( String groupId, String artifactId, Map mappedVersions, String version,
+                                   Map originalVersions, String groupTagName, String tagName, Element dependencyRoot )
+        throws ReleaseExecutionException
+    {
+        String key = ArtifactUtils.versionlessKey( groupId, artifactId );
+        String mappedVersion = (String) mappedVersions.get( key );
+
+        if ( mappedVersion != null && version.equals( originalVersions.get( key ) ) )
+        {
+            getLogger().debug( "Updating " + artifactId + " to " + mappedVersion );
+
+            try
+            {
+                XPath xpath = XPath.newInstance( "./" + groupTagName + "/" + tagName + "[groupId='" + groupId +
+                    "' and artifactId='" + artifactId + "']" );
 
-                    if ( version != null && plugin.getVersion().equals( originalVersions.get( key ) ) )
-                    {
-                        getLogger().debug( "Updating " + plugin.getArtifactId() + " to " + version );
-
-                        try
-                        {
-                            XPath xpath = XPath.newInstance( "./plugins/plugin[groupId='" + plugin.getGroupId() +
-                                "' and artifactId='" + plugin.getArtifactId() + "']" );
-
-                            Element dependency = (Element) xpath.selectSingleNode( pluginRoot );
-                            Element versionElement = dependency.getChild( "version" );
-
-                            // avoid if in plugin management
-                            if ( versionElement != null )
-                            {
-                                versionElement.setText( version );
-                            }
-                        }
-                        catch ( JDOMException e )
-                        {
-                            throw new ReleaseExecutionException(
-                                "Unable to locate report plugin to process in document", e );
-                        }
-                    }
-                    else
-                    {
-                        // We can ignore plugins we don't know of, unless they are snapshots
-                        if ( ArtifactUtils.isSnapshot( plugin.getVersion() ) )
-                        {
-                            throw new ReleaseExecutionException( "Version '" + plugin.getVersion() +
-                                "' for report plugin '" + key + "' was not mapped" );
-                        }
-                    }
+                Element dependency = (Element) xpath.selectSingleNode( dependencyRoot );
+                Element versionElement = dependency.getChild( "version" );
+
+                // avoid if in management
+                if ( versionElement != null )
+                {
+                    versionElement.setText( mappedVersion );
                 }
+            }
+            catch ( JDOMException e )
+            {
+                throw new ReleaseExecutionException( "Unable to locate " + tagName + " to process in document", e );
+            }
+        }
+        else
+        {
+            // We can ignore those we don't know of, unless they are snapshots
+            if ( ArtifactUtils.isSnapshot( version ) )
+            {
+                throw new ReleaseExecutionException(
+                    "Version '" + version + "' for " + tagName + " '" + key + "' was not mapped" );
             }
         }
     }

Modified: maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/phase/RewritePomsForReleasePhaseTest.java
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/phase/RewritePomsForReleasePhaseTest.java?rev=397750&r1=397749&r2=397750&view=diff
==============================================================================
--- maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/phase/RewritePomsForReleasePhaseTest.java (original)
+++ maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/phase/RewritePomsForReleasePhaseTest.java Thu Apr 27 20:23:39 2006
@@ -78,10 +78,7 @@
     public void testRewritePomWithParent()
         throws Exception
     {
-        ReleaseConfiguration config = createConfigurationFromProjects( "pom-with-parent" );
-
-        config.mapReleaseVersion( "groupId:artifactId", "1.0" );
-        config.mapReleaseVersion( "groupId:subproject1", "2.0" );
+        ReleaseConfiguration config = createConfigurationForPomWithParent( "pom-with-parent", "2.0" );
 
         phase.execute( config );
 
@@ -126,10 +123,7 @@
     public void testRewritePomWithInheritedVersion()
         throws Exception
     {
-        ReleaseConfiguration config = createConfigurationFromProjects( "pom-with-inherited-version" );
-
-        config.mapReleaseVersion( "groupId:artifactId", "1.0" );
-        config.mapReleaseVersion( "groupId:subproject1", "1.0" );
+        ReleaseConfiguration config = createConfigurationForPomWithParent( "pom-with-inherited-version", "1.0" );
 
         phase.execute( config );
 
@@ -139,10 +133,7 @@
     public void testRewritePomWithChangedInheritedVersion()
         throws Exception
     {
-        ReleaseConfiguration config = createConfigurationFromProjects( "pom-with-inherited-version" );
-
-        config.mapReleaseVersion( "groupId:artifactId", "1.0" );
-        config.mapReleaseVersion( "groupId:subproject1", "2.0" );
+        ReleaseConfiguration config = createConfigurationForPomWithParent( "pom-with-inherited-version", "2.0" );
 
         phase.execute( config );
 
@@ -158,13 +149,7 @@
     public void testRewritePomDependencies()
         throws Exception
     {
-        ReleaseConfiguration config = createConfigurationFromProjects( "internal-snapshot-dependencies" );
-
-        config.mapReleaseVersion( "groupId:subproject1", "1.0" );
-        config.mapReleaseVersion( "groupId:subproject2", "1.0" );
-        config.mapReleaseVersion( "groupId:subproject3", "1.0" );
-        config.mapReleaseVersion( "groupId:subproject4", "1.0" );
-        config.mapReleaseVersion( "groupId:artifactId", "1.0" );
+        ReleaseConfiguration config = createDefaultConfiguration( "internal-snapshot-dependencies" );
 
         phase.execute( config );
 
@@ -174,15 +159,7 @@
     public void testRewritePomUnmappedDependencies()
         throws Exception
     {
-        ReleaseConfiguration config = createConfigurationFromProjects( "internal-snapshot-dependencies" );
-
-        MavenProject project =
-            (MavenProject) getProjectsAsMap( config.getReactorProjects() ).get( "groupId:subproject2" );
-        config.setReactorProjects( Collections.singletonList( project ) );
-
-        config.mapReleaseVersion( "groupId:subproject2", "1.0" );
-        config.mapReleaseVersion( "groupId:subproject3", "1.0" );
-        config.mapReleaseVersion( "groupId:artifactId", "1.0" );
+        ReleaseConfiguration config = createUnmappedConfiguration( "internal-snapshot-dependencies" );
 
         try
         {
@@ -199,11 +176,7 @@
     public void testRewritePomDependenciesDifferentVersion()
         throws Exception
     {
-        ReleaseConfiguration config = createConfigurationFromProjects( "internal-differing-snapshot-dependencies" );
-
-        config.mapReleaseVersion( "groupId:subproject1", "1.0" );
-        config.mapReleaseVersion( "groupId:subproject2", "1.0" );
-        config.mapReleaseVersion( "groupId:artifactId", "1.0" );
+        ReleaseConfiguration config = createDifferingVersionConfiguration( "internal-differing-snapshot-dependencies" );
 
         try
         {
@@ -220,12 +193,7 @@
     public void testRewriteManagedPomDependencies()
         throws Exception
     {
-        ReleaseConfiguration config = createConfigurationFromProjects( "internal-managed-snapshot-dependency" );
-
-        config.mapReleaseVersion( "groupId:subproject1", "1.0" );
-        config.mapReleaseVersion( "groupId:subproject2", "1.0" );
-        config.mapReleaseVersion( "groupId:subproject3", "1.0" );
-        config.mapReleaseVersion( "groupId:artifactId", "1.0" );
+        ReleaseConfiguration config = createMappedConfiguration( "internal-managed-snapshot-dependency" );
 
         phase.execute( config );
 
@@ -235,15 +203,7 @@
     public void testRewriteManagedPomUnmappedDependencies()
         throws Exception
     {
-        ReleaseConfiguration config = createConfigurationFromProjects( "internal-managed-snapshot-dependency" );
-
-        MavenProject project =
-            (MavenProject) getProjectsAsMap( config.getReactorProjects() ).get( "groupId:subproject2" );
-        config.setReactorProjects( Collections.singletonList( project ) );
-
-        config.mapReleaseVersion( "groupId:subproject2", "1.0" );
-        config.mapReleaseVersion( "groupId:subproject3", "1.0" );
-        config.mapReleaseVersion( "groupId:artifactId", "1.0" );
+        ReleaseConfiguration config = createUnmappedConfiguration( "internal-managed-snapshot-dependency" );
 
         try
         {
@@ -260,13 +220,7 @@
     public void testRewritePomPlugins()
         throws Exception
     {
-        ReleaseConfiguration config = createConfigurationFromProjects( "internal-snapshot-plugins" );
-
-        config.mapReleaseVersion( "groupId:subproject1", "1.0" );
-        config.mapReleaseVersion( "groupId:subproject2", "1.0" );
-        config.mapReleaseVersion( "groupId:subproject3", "1.0" );
-        config.mapReleaseVersion( "groupId:subproject4", "1.0" );
-        config.mapReleaseVersion( "groupId:artifactId", "1.0" );
+        ReleaseConfiguration config = createDefaultConfiguration( "internal-snapshot-plugins" );
 
         phase.execute( config );
 
@@ -276,15 +230,7 @@
     public void testRewritePomUnmappedPlugins()
         throws Exception
     {
-        ReleaseConfiguration config = createConfigurationFromProjects( "internal-snapshot-plugins" );
-
-        MavenProject project =
-            (MavenProject) getProjectsAsMap( config.getReactorProjects() ).get( "groupId:subproject2" );
-        config.setReactorProjects( Collections.singletonList( project ) );
-
-        config.mapReleaseVersion( "groupId:subproject2", "1.0" );
-        config.mapReleaseVersion( "groupId:subproject3", "1.0" );
-        config.mapReleaseVersion( "groupId:artifactId", "1.0" );
+        ReleaseConfiguration config = createUnmappedConfiguration( "internal-snapshot-plugins" );
 
         try
         {
@@ -301,11 +247,7 @@
     public void testRewritePomPluginsDifferentVersion()
         throws Exception
     {
-        ReleaseConfiguration config = createConfigurationFromProjects( "internal-differing-snapshot-plugins" );
-
-        config.mapReleaseVersion( "groupId:subproject1", "1.0" );
-        config.mapReleaseVersion( "groupId:subproject2", "1.0" );
-        config.mapReleaseVersion( "groupId:artifactId", "1.0" );
+        ReleaseConfiguration config = createDifferingVersionConfiguration( "internal-differing-snapshot-plugins" );
 
         try
         {
@@ -322,12 +264,7 @@
     public void testRewriteManagedPomPlugins()
         throws Exception
     {
-        ReleaseConfiguration config = createConfigurationFromProjects( "internal-managed-snapshot-plugin" );
-
-        config.mapReleaseVersion( "groupId:subproject1", "1.0" );
-        config.mapReleaseVersion( "groupId:subproject2", "1.0" );
-        config.mapReleaseVersion( "groupId:subproject3", "1.0" );
-        config.mapReleaseVersion( "groupId:artifactId", "1.0" );
+        ReleaseConfiguration config = createMappedConfiguration( "internal-managed-snapshot-plugin" );
 
         phase.execute( config );
 
@@ -337,15 +274,7 @@
     public void testRewriteManagedPomUnmappedPlugins()
         throws Exception
     {
-        ReleaseConfiguration config = createConfigurationFromProjects( "internal-managed-snapshot-plugin" );
-
-        MavenProject project =
-            (MavenProject) getProjectsAsMap( config.getReactorProjects() ).get( "groupId:subproject2" );
-        config.setReactorProjects( Collections.singletonList( project ) );
-
-        config.mapReleaseVersion( "groupId:subproject2", "1.0" );
-        config.mapReleaseVersion( "groupId:subproject3", "1.0" );
-        config.mapReleaseVersion( "groupId:artifactId", "1.0" );
+        ReleaseConfiguration config = createUnmappedConfiguration( "internal-managed-snapshot-plugin" );
 
         try
         {
@@ -362,13 +291,7 @@
     public void testRewritePomReportPlugins()
         throws Exception
     {
-        ReleaseConfiguration config = createConfigurationFromProjects( "internal-snapshot-report-plugins" );
-
-        config.mapReleaseVersion( "groupId:subproject1", "1.0" );
-        config.mapReleaseVersion( "groupId:subproject2", "1.0" );
-        config.mapReleaseVersion( "groupId:subproject3", "1.0" );
-        config.mapReleaseVersion( "groupId:subproject4", "1.0" );
-        config.mapReleaseVersion( "groupId:artifactId", "1.0" );
+        ReleaseConfiguration config = createDefaultConfiguration( "internal-snapshot-report-plugins" );
 
         phase.execute( config );
 
@@ -378,15 +301,7 @@
     public void testRewritePomUnmappedReportPlugins()
         throws Exception
     {
-        ReleaseConfiguration config = createConfigurationFromProjects( "internal-snapshot-report-plugins" );
-
-        MavenProject project =
-            (MavenProject) getProjectsAsMap( config.getReactorProjects() ).get( "groupId:subproject2" );
-        config.setReactorProjects( Collections.singletonList( project ) );
-
-        config.mapReleaseVersion( "groupId:subproject2", "1.0" );
-        config.mapReleaseVersion( "groupId:subproject3", "1.0" );
-        config.mapReleaseVersion( "groupId:artifactId", "1.0" );
+        ReleaseConfiguration config = createUnmappedConfiguration( "internal-snapshot-report-plugins" );
 
         try
         {
@@ -403,11 +318,7 @@
     public void testRewritePomReportPluginsDifferentVersion()
         throws Exception
     {
-        ReleaseConfiguration config = createConfigurationFromProjects( "internal-differing-snapshot-report-plugins" );
-
-        config.mapReleaseVersion( "groupId:subproject1", "1.0" );
-        config.mapReleaseVersion( "groupId:subproject2", "1.0" );
-        config.mapReleaseVersion( "groupId:artifactId", "1.0" );
+        ReleaseConfiguration config = createDifferingVersionConfiguration( "internal-differing-snapshot-report-plugins" );
 
         try
         {
@@ -424,13 +335,7 @@
     public void testRewritePomExtension()
         throws Exception
     {
-        ReleaseConfiguration config = createConfigurationFromProjects( "internal-snapshot-extension" );
-
-        config.mapReleaseVersion( "groupId:subproject1", "1.0" );
-        config.mapReleaseVersion( "groupId:subproject2", "1.0" );
-        config.mapReleaseVersion( "groupId:subproject3", "1.0" );
-        config.mapReleaseVersion( "groupId:subproject4", "1.0" );
-        config.mapReleaseVersion( "groupId:artifactId", "1.0" );
+        ReleaseConfiguration config = createDefaultConfiguration( "internal-snapshot-extension" );
 
         phase.execute( config );
 
@@ -440,15 +345,7 @@
     public void testRewritePomUnmappedExtension()
         throws Exception
     {
-        ReleaseConfiguration config = createConfigurationFromProjects( "internal-snapshot-extension" );
-
-        MavenProject project =
-            (MavenProject) getProjectsAsMap( config.getReactorProjects() ).get( "groupId:subproject2" );
-        config.setReactorProjects( Collections.singletonList( project ) );
-
-        config.mapReleaseVersion( "groupId:subproject2", "1.0" );
-        config.mapReleaseVersion( "groupId:subproject3", "1.0" );
-        config.mapReleaseVersion( "groupId:artifactId", "1.0" );
+        ReleaseConfiguration config = createUnmappedConfiguration( "internal-snapshot-extension" );
 
         try
         {
@@ -465,11 +362,7 @@
     public void testRewritePomExtensionDifferentVersion()
         throws Exception
     {
-        ReleaseConfiguration config = createConfigurationFromProjects( "internal-differing-snapshot-extension" );
-
-        config.mapReleaseVersion( "groupId:subproject1", "1.0" );
-        config.mapReleaseVersion( "groupId:subproject2", "1.0" );
-        config.mapReleaseVersion( "groupId:artifactId", "1.0" );
+        ReleaseConfiguration config = createDifferingVersionConfiguration( "internal-differing-snapshot-extension" );
 
         try
         {
@@ -591,10 +484,7 @@
         scmManagerMock.expects( new InvokeAtLeastOnceMatcher() ).method( "makeScmRepository" ).with(
             new IsEqual( config.getUrl() ) ).will( new ThrowStub( new ScmRepositoryException( "..." ) ) );
 
-        ScmManager scmManager = (ScmManager) scmManagerMock.proxy();
-        DefaultScmRepositoryConfigurator configurator =
-            (DefaultScmRepositoryConfigurator) lookup( ScmRepositoryConfigurator.ROLE );
-        configurator.setScmManager( scmManager );
+        setMockScmManager( scmManagerMock );
 
         try
         {
@@ -619,10 +509,7 @@
         scmManagerMock.expects( new InvokeAtLeastOnceMatcher() ).method( "makeScmRepository" ).with(
             new IsEqual( config.getUrl() ) ).will( new ThrowStub( new NoSuchScmProviderException( "..." ) ) );
 
-        ScmManager scmManager = (ScmManager) scmManagerMock.proxy();
-        DefaultScmRepositoryConfigurator configurator =
-            (DefaultScmRepositoryConfigurator) lookup( ScmRepositoryConfigurator.ROLE );
-        configurator.setScmManager( scmManager );
+        setMockScmManager( scmManagerMock );
 
         try
         {
@@ -679,4 +566,66 @@
         }
         return map;
     }
+
+    private ReleaseConfiguration createUnmappedConfiguration( String path )
+        throws Exception
+    {
+        ReleaseConfiguration config = createConfigurationFromProjects( path );
+
+        MavenProject project =
+            (MavenProject) getProjectsAsMap( config.getReactorProjects() ).get( "groupId:subproject2" );
+        config.setReactorProjects( Collections.singletonList( project ) );
+
+        config.mapReleaseVersion( "groupId:subproject2", "1.0" );
+        config.mapReleaseVersion( "groupId:subproject3", "1.0" );
+        config.mapReleaseVersion( "groupId:artifactId", "1.0" );
+        return config;
+    }
+
+    private ReleaseConfiguration createDefaultConfiguration( String path )
+        throws Exception
+    {
+        ReleaseConfiguration config = createMappedConfiguration( path );
+
+        config.mapReleaseVersion( "groupId:subproject4", "1.0" );
+        return config;
+    }
+
+    private ReleaseConfiguration createMappedConfiguration( String path )
+        throws Exception
+    {
+        ReleaseConfiguration config = createDifferingVersionConfiguration( path );
+
+        config.mapReleaseVersion( "groupId:subproject3", "1.0" );
+        return config;
+    }
+
+    private ReleaseConfiguration createDifferingVersionConfiguration( String path )
+        throws Exception
+    {
+        ReleaseConfiguration config = createConfigurationForPomWithParent( path, "1.0" );
+
+        config.mapReleaseVersion( "groupId:subproject2", "1.0" );
+        return config;
+    }
+
+    private ReleaseConfiguration createConfigurationForPomWithParent( String path, String nextVersion )
+        throws Exception
+    {
+        ReleaseConfiguration config = createConfigurationFromProjects( path );
+
+        config.mapReleaseVersion( "groupId:artifactId", "1.0" );
+        config.mapReleaseVersion( "groupId:subproject1", nextVersion );
+        return config;
+    }
+
+    private void setMockScmManager( Mock scmManagerMock )
+        throws Exception
+    {
+        ScmManager scmManager = (ScmManager) scmManagerMock.proxy();
+        DefaultScmRepositoryConfigurator configurator =
+            (DefaultScmRepositoryConfigurator) lookup( ScmRepositoryConfigurator.ROLE );
+        configurator.setScmManager( scmManager );
+    }
+
 }