maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rfscho...@apache.org
Subject [maven-release] 07/21: Read with ReleaseDescriptorBuilder
Date Sat, 10 Feb 2018 16:02:55 GMT
This is an automated email from the ASF dual-hosted git repository.

rfscholte pushed a commit to branch MRELEASE-998
in repository https://gitbox.apache.org/repos/asf/maven-release.git

commit 9161581807215b7593595986df656111fa3865fc
Author: rfscholte <rfscholte@apache.org>
AuthorDate: Sat Jan 27 20:44:17 2018 +0100

    Read with ReleaseDescriptorBuilder
---
 .../maven/shared/release/DefaultReleaseManager.java  | 15 ++++++++-------
 .../config/PropertiesReleaseDescriptorStore.java     |  8 ++++----
 .../release/config/ReleaseDescriptorStore.java       |  2 +-
 .../shared/release/DefaultReleaseManagerTest.java    |  8 ++++----
 .../config/PropertiesReleaseDescriptorStoreTest.java | 20 ++++++++++----------
 .../release/config/ReleaseDescriptorStoreStub.java   |  4 ++--
 6 files changed, 29 insertions(+), 28 deletions(-)

diff --git a/maven-release-manager/src/main/java/org/apache/maven/shared/release/DefaultReleaseManager.java
b/maven-release-manager/src/main/java/org/apache/maven/shared/release/DefaultReleaseManager.java
index 622e336..4b00c75 100644
--- a/maven-release-manager/src/main/java/org/apache/maven/shared/release/DefaultReleaseManager.java
+++ b/maven-release-manager/src/main/java/org/apache/maven/shared/release/DefaultReleaseManager.java
@@ -28,6 +28,7 @@ import java.util.Set;
 
 import org.apache.commons.lang3.BooleanUtils;
 import org.apache.maven.shared.release.config.ReleaseDescriptor;
+import org.apache.maven.shared.release.config.ReleaseDescriptorBuilder;
 import org.apache.maven.shared.release.config.ReleaseDescriptorStore;
 import org.apache.maven.shared.release.config.ReleaseDescriptorStoreException;
 import org.apache.maven.shared.release.phase.ReleasePhase;
@@ -102,7 +103,7 @@ public class DefaultReleaseManager
         ReleaseDescriptor config;
         if ( BooleanUtils.isNotFalse( prepareRequest.getResume() ) )
         {
-            config = loadReleaseDescriptor( prepareRequest.getReleaseDescriptorBuilder().build(),
+            config = loadReleaseDescriptor( prepareRequest.getReleaseDescriptorBuilder(),
                                             prepareRequest.getReleaseManagerListener() );
         }
         else
@@ -199,7 +200,7 @@ public class DefaultReleaseManager
         throws ReleaseExecutionException, ReleaseFailureException
     {
         ReleaseDescriptor releaseDescriptor =
-            loadReleaseDescriptor( rollbackRequest.getReleaseDescriptorBuilder().build(),
null );
+            loadReleaseDescriptor( rollbackRequest.getReleaseDescriptorBuilder(), null );
 
         Strategy releaseStrategy = getStrategy( releaseDescriptor.getReleaseStrategyId()
);
 
@@ -264,7 +265,7 @@ public class DefaultReleaseManager
         throws ReleaseExecutionException, ReleaseFailureException
     {
         ReleaseDescriptor releaseDescriptor =
-            loadReleaseDescriptor( performRequest.getReleaseDescriptorBuilder().build(),
+            loadReleaseDescriptor( performRequest.getReleaseDescriptorBuilder(),
                                    performRequest.getReleaseManagerListener() );
 
         Strategy releaseStrategy = getStrategy( releaseDescriptor.getReleaseStrategyId()
);
@@ -325,7 +326,7 @@ public class DefaultReleaseManager
         throws ReleaseExecutionException, ReleaseFailureException
     {
         ReleaseDescriptor releaseDescriptor =
-            loadReleaseDescriptor( branchRequest.getReleaseDescriptorBuilder().build(),
+            loadReleaseDescriptor( branchRequest.getReleaseDescriptorBuilder(),
                                    branchRequest.getReleaseManagerListener() );
 
         boolean dryRun = BooleanUtils.isTrue( branchRequest.getDryRun() );
@@ -375,7 +376,7 @@ public class DefaultReleaseManager
         throws ReleaseExecutionException, ReleaseFailureException
     {
         ReleaseDescriptor releaseDescriptor =
-            loadReleaseDescriptor( updateVersionsRequest.getReleaseDescriptorBuilder().build(),
+            loadReleaseDescriptor( updateVersionsRequest.getReleaseDescriptorBuilder(),
                                    updateVersionsRequest.getReleaseManagerListener() );
 
         Strategy releaseStrategy = getStrategy( releaseDescriptor.getReleaseStrategyId()
);
@@ -427,14 +428,14 @@ public class DefaultReleaseManager
         }
     }
 
-    private ReleaseDescriptor loadReleaseDescriptor( ReleaseDescriptor releaseDescriptor,
+    private ReleaseDescriptor loadReleaseDescriptor( ReleaseDescriptorBuilder builder,
                                                      ReleaseManagerListener listener )
         throws ReleaseExecutionException
     {
         try
         {
             updateListener( listener, "verify-release-configuration", PHASE_START );
-            ReleaseDescriptor descriptor = configStore.read( releaseDescriptor );
+            ReleaseDescriptor descriptor = configStore.read( builder );
             updateListener( listener, "verify-release-configuration", PHASE_END );
             return descriptor;
         }
diff --git a/maven-release-manager/src/main/java/org/apache/maven/shared/release/config/PropertiesReleaseDescriptorStore.java
b/maven-release-manager/src/main/java/org/apache/maven/shared/release/config/PropertiesReleaseDescriptorStore.java
index 1b6695e..114179c 100644
--- a/maven-release-manager/src/main/java/org/apache/maven/shared/release/config/PropertiesReleaseDescriptorStore.java
+++ b/maven-release-manager/src/main/java/org/apache/maven/shared/release/config/PropertiesReleaseDescriptorStore.java
@@ -61,10 +61,10 @@ public class PropertiesReleaseDescriptorStore
     private DefaultSecDispatcher secDispatcher;
 
     @Override
-    public ReleaseDescriptor read( ReleaseDescriptor mergeDescriptor )
+    public ReleaseDescriptor read( ReleaseDescriptorBuilder mergeDescriptor )
         throws ReleaseDescriptorStoreException
     {
-        return read( mergeDescriptor, getDefaultReleasePropertiesFile( mergeDescriptor )
);
+        return read( mergeDescriptor, getDefaultReleasePropertiesFile( mergeDescriptor.build()
) );
     }
 
     public ReleaseDescriptor read( File file )
@@ -73,7 +73,7 @@ public class PropertiesReleaseDescriptorStore
         return read( null, file );
     }
 
-    public ReleaseDescriptor read( ReleaseDescriptor mergeDescriptor, File file )
+    public ReleaseDescriptor read( ReleaseDescriptorBuilder mergeDescriptor, File file )
         throws ReleaseDescriptorStoreException
     {
         Properties properties = new Properties();
@@ -98,7 +98,7 @@ public class PropertiesReleaseDescriptorStore
         ReleaseDescriptor releaseDescriptor = builder.build();
         if ( mergeDescriptor != null )
         {
-            releaseDescriptor = ReleaseUtils.merge( releaseDescriptor, mergeDescriptor );
+            releaseDescriptor = ReleaseUtils.merge( releaseDescriptor, mergeDescriptor.build()
);
         }
 
         return releaseDescriptor;
diff --git a/maven-release-manager/src/main/java/org/apache/maven/shared/release/config/ReleaseDescriptorStore.java
b/maven-release-manager/src/main/java/org/apache/maven/shared/release/config/ReleaseDescriptorStore.java
index 5b1e8c4..3694744 100644
--- a/maven-release-manager/src/main/java/org/apache/maven/shared/release/config/ReleaseDescriptorStore.java
+++ b/maven-release-manager/src/main/java/org/apache/maven/shared/release/config/ReleaseDescriptorStore.java
@@ -33,7 +33,7 @@ public interface ReleaseDescriptorStore
      *                        while others are used to override
      * @return the configuration
      */
-    ReleaseDescriptor read( ReleaseDescriptor mergeDescriptor )
+    ReleaseDescriptor read( ReleaseDescriptorBuilder mergeDescriptor )
         throws ReleaseDescriptorStoreException;
 
     /**
diff --git a/maven-release-manager/src/test/java/org/apache/maven/shared/release/DefaultReleaseManagerTest.java
b/maven-release-manager/src/test/java/org/apache/maven/shared/release/DefaultReleaseManagerTest.java
index 9ef602e..e7a97c8 100644
--- a/maven-release-manager/src/test/java/org/apache/maven/shared/release/DefaultReleaseManagerTest.java
+++ b/maven-release-manager/src/test/java/org/apache/maven/shared/release/DefaultReleaseManagerTest.java
@@ -343,7 +343,7 @@ public class DefaultReleaseManagerTest
         DefaultReleaseManager releaseManager = (DefaultReleaseManager) lookup( ReleaseManager.class,
"test" );
 
         ReleaseDescriptorStore configStoreMock = mock( ReleaseDescriptorStore.class );
-        when( configStoreMock.read( builder.build() ) ).thenThrow( new ReleaseDescriptorStoreException(
"message", new IOException( "ioExceptionMsg" ) ) );
+        when( configStoreMock.read( builder ) ).thenThrow( new ReleaseDescriptorStoreException(
"message", new IOException( "ioExceptionMsg" ) ) );
 
         releaseManager.setConfigStore( configStoreMock );
         
@@ -364,7 +364,7 @@ public class DefaultReleaseManagerTest
         }
 
         // verify
-        verify( configStoreMock ).read( builder.build() );
+        verify( configStoreMock ).read( builder );
         verifyNoMoreInteractions( configStoreMock );
     }
 
@@ -483,7 +483,7 @@ public class DefaultReleaseManagerTest
         DefaultReleaseManager releaseManager = (DefaultReleaseManager) lookup( ReleaseManager.class,
"test" );
 
         ReleaseDescriptorStore configStoreMock = mock( ReleaseDescriptorStore.class );
-        when( configStoreMock.read( builder.build() ) ).thenThrow( new ReleaseDescriptorStoreException(
"message", new IOException( "ioExceptionMsg" ) ) );
+        when( configStoreMock.read( builder ) ).thenThrow( new ReleaseDescriptorStoreException(
"message", new IOException( "ioExceptionMsg" ) ) );
 
         releaseManager.setConfigStore( configStoreMock );
         
@@ -506,7 +506,7 @@ public class DefaultReleaseManagerTest
         }
 
         // verify
-        verify( configStoreMock ).read( builder.build() );
+        verify( configStoreMock ).read( builder );
         verifyNoMoreInteractions( configStoreMock );
     }
 
diff --git a/maven-release-manager/src/test/java/org/apache/maven/shared/release/config/PropertiesReleaseDescriptorStoreTest.java
b/maven-release-manager/src/test/java/org/apache/maven/shared/release/config/PropertiesReleaseDescriptorStoreTest.java
index 225aa81..124fe6e 100644
--- a/maven-release-manager/src/test/java/org/apache/maven/shared/release/config/PropertiesReleaseDescriptorStoreTest.java
+++ b/maven-release-manager/src/test/java/org/apache/maven/shared/release/config/PropertiesReleaseDescriptorStoreTest.java
@@ -63,12 +63,12 @@ public class PropertiesReleaseDescriptorStoreTest
     public void testReadFromFileUsingWorkingDirectory()
         throws Exception
     {
-        ReleaseDescriptor releaseDescriptor = new ReleaseDescriptor();
-        releaseDescriptor.setWorkingDirectory( AbstractReleaseTestCase.getPath(  getTestFile(
"target/test-classes" ) ) );
-        ReleaseDescriptor config = store.read( releaseDescriptor );
+        ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder();
+        builder.setWorkingDirectory( AbstractReleaseTestCase.getPath(  getTestFile( "target/test-classes"
) ) );
+        ReleaseDescriptor config = store.read( builder );
 
         ReleaseDescriptor expected = createExpectedReleaseConfiguration();
-        expected.setWorkingDirectory( releaseDescriptor.getWorkingDirectory() );
+        expected.setWorkingDirectory( builder.build().getWorkingDirectory() );
 
         assertEquals( "check matches", expected, config );
     }
@@ -98,10 +98,10 @@ public class PropertiesReleaseDescriptorStoreTest
     {
         File file = getTestFile( "target/test-classes/empty-release.properties" );
 
-        ReleaseDescriptor mergeDescriptor = createMergeConfiguration();
+        ReleaseDescriptorBuilder mergeDescriptor = createMergeConfiguration();
         ReleaseDescriptor config = store.read( mergeDescriptor, file );
 
-        assertEquals( "Check configurations merged", mergeDescriptor, config );
+        assertEquals( "Check configurations merged", mergeDescriptor.build(), config );
     }
 
     public void testMergeFromMissingFile()
@@ -109,10 +109,10 @@ public class PropertiesReleaseDescriptorStoreTest
     {
         File file = getTestFile( "target/test-classes/no-release.properties" );
 
-        ReleaseDescriptor mergeDescriptor = createMergeConfiguration();
+        ReleaseDescriptorBuilder mergeDescriptor = createMergeConfiguration();
         ReleaseDescriptor config = store.read( mergeDescriptor, file );
 
-        assertEquals( "Check configurations merged", mergeDescriptor, config );
+        assertEquals( "Check configurations merged", mergeDescriptor.build(), config );
     }
 
     public void testWriteToNewFile()
@@ -346,7 +346,7 @@ public class PropertiesReleaseDescriptorStoreTest
         assertNotNull( "Expected resolved snapshot dependencies map", config.getResolvedSnapshotDependencies()
);
     }
 
-    public ReleaseDescriptor createMergeConfiguration()
+    public ReleaseDescriptorBuilder createMergeConfiguration()
         throws IOException
     {
         ReleaseDescriptorBuilder releaseDescriptor = new ReleaseDescriptorBuilder();
@@ -357,7 +357,7 @@ public class PropertiesReleaseDescriptorStoreTest
         releaseDescriptor.setWorkingDirectory( AbstractReleaseTestCase.getPath( getTestFile(
"target/test-working-directory" ) ) );
         // Not setting non-override setting completedPhase
 
-        return releaseDescriptor.build();
+        return releaseDescriptor;
     }
 
     private void assertAndAdjustScmPassword( ReleaseDescriptor expected, ReleaseDescriptor
original )
diff --git a/maven-release-manager/src/test/java/org/apache/maven/shared/release/config/ReleaseDescriptorStoreStub.java
b/maven-release-manager/src/test/java/org/apache/maven/shared/release/config/ReleaseDescriptorStoreStub.java
index 9d54918..056b48a 100644
--- a/maven-release-manager/src/test/java/org/apache/maven/shared/release/config/ReleaseDescriptorStoreStub.java
+++ b/maven-release-manager/src/test/java/org/apache/maven/shared/release/config/ReleaseDescriptorStoreStub.java
@@ -33,9 +33,9 @@ public class ReleaseDescriptorStoreStub
     private ReleaseDescriptorBuilder releaseDescriptor = new ReleaseDescriptorBuilder();
 
     @Override
-    public ReleaseDescriptor read( ReleaseDescriptor mergeDescriptor )
+    public ReleaseDescriptor read( ReleaseDescriptorBuilder mergeDescriptor )
     {
-        ReleaseUtils.merge( releaseDescriptor.build(), mergeDescriptor );
+        ReleaseUtils.merge( releaseDescriptor.build(), mergeDescriptor.build() );
         return releaseDescriptor.build();
     }
 

-- 
To stop receiving notification emails like this one, please contact
rfscholte@apache.org.

Mime
View raw message