maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r399104 - in /maven/plugins/trunk/maven-release-plugin/src: main/java/org/apache/maven/plugins/release/ main/java/org/apache/maven/plugins/release/config/ main/java/org/apache/maven/plugins/release/phase/ test/java/org/apache/maven/plugins/...
Date Wed, 03 May 2006 01:29:38 GMT
Author: brett
Date: Tue May  2 18:29:36 2006
New Revision: 399104

URL: http://svn.apache.org/viewcvs?rev=399104&view=rev
Log:
[MRELEASE-98] clean up release.properties configuration

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/config/PropertiesReleaseConfigurationStore.java
    maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/config/ReleaseConfigurationStore.java
    maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/phase/ScmCheckModificationsPhase.java
    maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/DefaultReleaseManagerTest.java
    maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/config/PropertiesReleaseConfigurationStoreTest.java
    maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/config/ReleaseConfigurationStoreStub.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=399104&r1=399103&r2=399104&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
Tue May  2 18:29:36 2006
@@ -217,7 +217,7 @@
 
     public void clean()
     {
-        // TODO: tag, next poms [!]
+        // TODO: this, tag, next, backup poms [!] -- test backup pom is generated
 /*
         File releaseProperties = new File( basedir, "release.properties" );
 

Modified: maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/config/PropertiesReleaseConfigurationStore.java
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/config/PropertiesReleaseConfigurationStore.java?rev=399104&r1=399103&r2=399104&view=diff
==============================================================================
--- maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/config/PropertiesReleaseConfigurationStore.java
(original)
+++ maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/config/PropertiesReleaseConfigurationStore.java
Tue May  2 18:29:36 2006
@@ -40,18 +40,19 @@
     extends AbstractLogEnabled
     implements ReleaseConfigurationStore
 {
-    /**
-     * The properties file to read and write.
-     */
-    private File propertiesFile;
+    public ReleaseConfiguration read( ReleaseConfiguration mergeConfiguration )
+        throws ReleaseConfigurationStoreException
+    {
+        return read( mergeConfiguration, getDefaultReleasePropertiesFile( mergeConfiguration
) );
+    }
 
-    public PropertiesReleaseConfigurationStore()
+    public ReleaseConfiguration read( File file )
+        throws ReleaseConfigurationStoreException
     {
-        // TODO [!]: set properties file somehow
-        propertiesFile = new File( "release.properties" );
+        return read( null, file );
     }
 
-    public ReleaseConfiguration read( ReleaseConfiguration mergeConfiguration )
+    public ReleaseConfiguration read( ReleaseConfiguration mergeConfiguration, File file
)
         throws ReleaseConfigurationStoreException
     {
         Properties properties = new Properties();
@@ -59,18 +60,18 @@
         InputStream inStream = null;
         try
         {
-            inStream = new FileInputStream( propertiesFile );
+            inStream = new FileInputStream( file );
 
             properties.load( inStream );
         }
         catch ( FileNotFoundException e )
         {
-            getLogger().debug( propertiesFile.getName() + " not found - using empty properties"
);
+            getLogger().debug( file.getName() + " not found - using empty properties" );
         }
         catch ( IOException e )
         {
             throw new ReleaseConfigurationStoreException(
-                "Error reading properties file '" + propertiesFile.getName() + "': " + e.getMessage(),
e );
+                "Error reading properties file '" + file.getName() + "': " + e.getMessage(),
e );
         }
         finally
         {
@@ -138,6 +139,12 @@
     public void write( ReleaseConfiguration config )
         throws ReleaseConfigurationStoreException
     {
+        write( config, getDefaultReleasePropertiesFile( config ) );
+    }
+
+    public void write( ReleaseConfiguration config, File file )
+        throws ReleaseConfigurationStoreException
+    {
         Properties properties = new Properties();
         properties.setProperty( "completedPhase", config.getCompletedPhase() );
         properties.setProperty( "scm.url", config.getUrl() );
@@ -216,14 +223,14 @@
         //noinspection OverlyBroadCatchBlock
         try
         {
-            outStream = new FileOutputStream( propertiesFile );
+            outStream = new FileOutputStream( file );
 
             properties.store( outStream, "release configuration" );
         }
         catch ( IOException e )
         {
             throw new ReleaseConfigurationStoreException(
-                "Error writing properties file '" + propertiesFile.getName() + "': " + e.getMessage(),
e );
+                "Error writing properties file '" + file.getName() + "': " + e.getMessage(),
e );
         }
         finally
         {
@@ -232,14 +239,8 @@
 
     }
 
-    public ReleaseConfiguration read()
-        throws ReleaseConfigurationStoreException
-    {
-        return read( null );
-    }
-
-    public void setPropertiesFile( File propertiesFile )
+    private static File getDefaultReleasePropertiesFile( ReleaseConfiguration mergeConfiguration
)
     {
-        this.propertiesFile = propertiesFile;
+        return new File( mergeConfiguration.getWorkingDirectory(), "release.properties" );
     }
 }

Modified: maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/config/ReleaseConfigurationStore.java
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/config/ReleaseConfigurationStore.java?rev=399104&r1=399103&r2=399104&view=diff
==============================================================================
--- maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/config/ReleaseConfigurationStore.java
(original)
+++ maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/config/ReleaseConfigurationStore.java
Tue May  2 18:29:36 2006
@@ -39,14 +39,6 @@
         throws ReleaseConfigurationStoreException;
 
     /**
-     * Read a configuration.
-     *
-     * @return the configuration
-     */
-    ReleaseConfiguration read()
-        throws ReleaseConfigurationStoreException;
-
-    /**
      * Save a configuration.
      *
      * @param config the configuration

Modified: maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/phase/ScmCheckModificationsPhase.java
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/phase/ScmCheckModificationsPhase.java?rev=399104&r1=399103&r2=399104&view=diff
==============================================================================
--- maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/phase/ScmCheckModificationsPhase.java
(original)
+++ maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/phase/ScmCheckModificationsPhase.java
Tue May  2 18:29:36 2006
@@ -55,7 +55,7 @@
     /**
      * The files to exclude from the status check.
      *
-     * @todo [!] proper construction of filenames, especially release properties
+     * @todo proper construction of filenames, especially release properties
      */
     private Set excludedFiles = new HashSet( Arrays.asList(
         new String[]{"pom.xml", "pom.xml.backup", "pom.xml.tag", "pom.xml.next", "release.properties"}
) );

Modified: maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/DefaultReleaseManagerTest.java
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/DefaultReleaseManagerTest.java?rev=399104&r1=399103&r2=399104&view=diff
==============================================================================
--- maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/DefaultReleaseManagerTest.java
(original)
+++ maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/DefaultReleaseManagerTest.java
Tue May  2 18:29:36 2006
@@ -19,6 +19,7 @@
 import org.apache.maven.plugins.release.config.ReleaseConfiguration;
 import org.apache.maven.plugins.release.config.ReleaseConfigurationStore;
 import org.apache.maven.plugins.release.config.ReleaseConfigurationStoreException;
+import org.apache.maven.plugins.release.config.ReleaseConfigurationStoreStub;
 import org.apache.maven.plugins.release.phase.ReleasePhase;
 import org.apache.maven.plugins.release.phase.ReleasePhaseStub;
 import org.codehaus.plexus.PlexusTestCase;
@@ -38,7 +39,7 @@
 public class DefaultReleaseManagerTest
     extends PlexusTestCase
 {
-    private ReleaseConfigurationStore configStore;
+    private ReleaseConfigurationStoreStub configStore;
 
 
     protected void setUp()
@@ -46,7 +47,7 @@
     {
         super.setUp();
 
-        configStore = (ReleaseConfigurationStore) lookup( ReleaseConfigurationStore.ROLE,
"stub" );
+        configStore = (ReleaseConfigurationStoreStub) lookup( ReleaseConfigurationStore.ROLE,
"stub" );
     }
 
     public void testPrepareNoCompletedPhase()
@@ -54,7 +55,7 @@
     {
         ReleaseManager releaseManager = (ReleaseManager) lookup( ReleaseManager.ROLE, "test"
);
 
-        ReleaseConfiguration releaseConfiguration = configStore.read();
+        ReleaseConfiguration releaseConfiguration = configStore.getReleaseConfiguration();
         releaseConfiguration.setCompletedPhase( null );
 
         releaseManager.prepare( new ReleaseConfiguration() );
@@ -77,7 +78,7 @@
     {
         ReleaseManager releaseManager = (ReleaseManager) lookup( ReleaseManager.ROLE, "test"
);
 
-        ReleaseConfiguration releaseConfiguration = configStore.read();
+        ReleaseConfiguration releaseConfiguration = configStore.getReleaseConfiguration();
         releaseConfiguration.setCompletedPhase( "step1" );
 
         releaseManager.prepare( new ReleaseConfiguration() );
@@ -100,7 +101,7 @@
     {
         ReleaseManager releaseManager = (ReleaseManager) lookup( ReleaseManager.ROLE, "test"
);
 
-        ReleaseConfiguration releaseConfiguration = configStore.read();
+        ReleaseConfiguration releaseConfiguration = configStore.getReleaseConfiguration();
         releaseConfiguration.setCompletedPhase( "step1" );
 
         releaseManager.prepare( new ReleaseConfiguration(), false, false );
@@ -123,7 +124,7 @@
     {
         ReleaseManager releaseManager = (ReleaseManager) lookup( ReleaseManager.ROLE, "test"
);
 
-        ReleaseConfiguration releaseConfiguration = configStore.read();
+        ReleaseConfiguration releaseConfiguration = configStore.getReleaseConfiguration();
         releaseConfiguration.setCompletedPhase( "step3" );
 
         releaseManager.prepare( new ReleaseConfiguration() );
@@ -146,7 +147,7 @@
     {
         ReleaseManager releaseManager = (ReleaseManager) lookup( ReleaseManager.ROLE, "test"
);
 
-        ReleaseConfiguration releaseConfiguration = configStore.read();
+        ReleaseConfiguration releaseConfiguration = configStore.getReleaseConfiguration();
         releaseConfiguration.setCompletedPhase( "foo" );
 
         releaseManager.prepare( new ReleaseConfiguration() );
@@ -169,7 +170,7 @@
     {
         ReleaseManager releaseManager = (ReleaseManager) lookup( ReleaseManager.ROLE, "test"
);
 
-        ReleaseConfiguration releaseConfiguration = configStore.read();
+        ReleaseConfiguration releaseConfiguration = configStore.getReleaseConfiguration();
         releaseConfiguration.setCompletedPhase( null );
 
         releaseManager.prepare( new ReleaseConfiguration(), true, true );
@@ -192,7 +193,7 @@
     {
         ReleaseManager releaseManager = (ReleaseManager) lookup( ReleaseManager.ROLE, "test"
);
 
-        ReleaseConfiguration releaseConfiguration = configStore.read();
+        ReleaseConfiguration releaseConfiguration = configStore.getReleaseConfiguration();
         releaseConfiguration.setCompletedPhase( "step1" );
 
         releaseManager.prepare( new ReleaseConfiguration(), true, true );
@@ -215,7 +216,7 @@
     {
         ReleaseManager releaseManager = (ReleaseManager) lookup( ReleaseManager.ROLE, "test"
);
 
-        ReleaseConfiguration releaseConfiguration = configStore.read();
+        ReleaseConfiguration releaseConfiguration = configStore.getReleaseConfiguration();
         releaseConfiguration.setCompletedPhase( "step3" );
 
         releaseManager.prepare( new ReleaseConfiguration(), true, true );
@@ -238,7 +239,7 @@
     {
         ReleaseManager releaseManager = (ReleaseManager) lookup( ReleaseManager.ROLE, "test"
);
 
-        ReleaseConfiguration releaseConfiguration = configStore.read();
+        ReleaseConfiguration releaseConfiguration = configStore.getReleaseConfiguration();
         releaseConfiguration.setCompletedPhase( "foo" );
 
         releaseManager.prepare( new ReleaseConfiguration(), true, true );

Modified: maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/config/PropertiesReleaseConfigurationStoreTest.java
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/config/PropertiesReleaseConfigurationStoreTest.java?rev=399104&r1=399103&r2=399104&view=diff
==============================================================================
--- maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/config/PropertiesReleaseConfigurationStoreTest.java
(original)
+++ maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/config/PropertiesReleaseConfigurationStoreTest.java
Tue May  2 18:29:36 2006
@@ -43,9 +43,8 @@
         throws ReleaseConfigurationStoreException
     {
         File file = getTestFile( "target/test-classes/release.properties" );
-        store.setPropertiesFile( file );
 
-        ReleaseConfiguration config = store.read();
+        ReleaseConfiguration config = store.read( file );
         assertEquals( "Expected completedPhase of 'step1'", "step1", config.getCompletedPhase()
);
         assertEquals( "Expected url of 'scm-url'", "scm-url", config.getUrl() );
         assertEquals( "Expected username of 'username'", "username", config.getUsername()
);
@@ -100,9 +99,8 @@
         throws ReleaseConfigurationStoreException
     {
         File file = getTestFile( "target/test-classes/empty-release.properties" );
-        store.setPropertiesFile( file );
 
-        ReleaseConfiguration config = store.read();
+        ReleaseConfiguration config = store.read( file );
 
         assertDefaultReleaseConfiguration( config );
     }
@@ -111,9 +109,8 @@
         throws ReleaseConfigurationStoreException
     {
         File file = getTestFile( "target/test-classes/no-release.properties" );
-        store.setPropertiesFile( file );
 
-        ReleaseConfiguration config = store.read();
+        ReleaseConfiguration config = store.read( file );
 
         assertDefaultReleaseConfiguration( config );
     }
@@ -122,10 +119,9 @@
         throws ReleaseConfigurationStoreException
     {
         File file = getTestFile( "target/test-classes/empty-release.properties" );
-        store.setPropertiesFile( file );
 
         ReleaseConfiguration mergeConfiguration = createMergeConfiguration();
-        ReleaseConfiguration config = store.read( mergeConfiguration );
+        ReleaseConfiguration config = store.read( mergeConfiguration, file );
 
         assertEquals( "Check configurations merged", mergeConfiguration, config );
     }
@@ -134,10 +130,9 @@
         throws ReleaseConfigurationStoreException
     {
         File file = getTestFile( "target/test-classes/no-release.properties" );
-        store.setPropertiesFile( file );
 
         ReleaseConfiguration mergeConfiguration = createMergeConfiguration();
-        ReleaseConfiguration config = store.read( mergeConfiguration );
+        ReleaseConfiguration config = store.read( mergeConfiguration, file );
 
         assertEquals( "Check configurations merged", mergeConfiguration, config );
     }
@@ -148,13 +143,12 @@
         File file = getTestFile( "target/test-classes/new-release.properties" );
         file.delete();
         assertFalse( "Check file doesn't exist", file.exists() );
-        store.setPropertiesFile( file );
 
         ReleaseConfiguration config = createReleaseConfigurationForWriting();
 
-        store.write( config );
+        store.write( config, file );
 
-        ReleaseConfiguration rereadConfiguration = store.read();
+        ReleaseConfiguration rereadConfiguration = store.read( file );
 
         assertEquals( "compare configuration", config, rereadConfiguration );
     }
@@ -165,15 +159,14 @@
         File file = getTestFile( "target/test-classes/new-release.properties" );
         file.delete();
         assertFalse( "Check file doesn't exist", file.exists() );
-        store.setPropertiesFile( file );
 
         ReleaseConfiguration config = new ReleaseConfiguration();
         config.setCompletedPhase( "completed-phase-write" );
         config.setUrl( "url-write" );
 
-        store.write( config );
+        store.write( config, file );
 
-        ReleaseConfiguration rereadConfiguration = store.read();
+        ReleaseConfiguration rereadConfiguration = store.read( file );
 
         assertEquals( "compare configuration", config, rereadConfiguration );
     }
@@ -183,13 +176,12 @@
     {
         File file = getTestFile( "target/test-classes/rewrite-release.properties" );
         assertTrue( "Check file already exists", file.exists() );
-        store.setPropertiesFile( file );
 
         ReleaseConfiguration config = createReleaseConfigurationForWriting();
 
-        store.write( config );
+        store.write( config, file );
 
-        ReleaseConfiguration rereadConfiguration = store.read();
+        ReleaseConfiguration rereadConfiguration = store.read( file );
 
         assertEquals( "compare configuration", config, rereadConfiguration );
     }

Modified: maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/config/ReleaseConfigurationStoreStub.java
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/config/ReleaseConfigurationStoreStub.java?rev=399104&r1=399103&r2=399104&view=diff
==============================================================================
--- maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/config/ReleaseConfigurationStoreStub.java
(original)
+++ maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/config/ReleaseConfigurationStoreStub.java
Tue May  2 18:29:36 2006
@@ -35,14 +35,13 @@
         return releaseConfiguration;
     }
 
-    public ReleaseConfiguration read()
-        throws ReleaseConfigurationStoreException
+    public void write( ReleaseConfiguration config )
     {
-        return releaseConfiguration;
+        this.releaseConfiguration = config;
     }
 
-    public void write( ReleaseConfiguration config )
+    public ReleaseConfiguration getReleaseConfiguration()
     {
-        this.releaseConfiguration = config;
+        return releaseConfiguration;
     }
 }



Mime
View raw message