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 2010/02/10 04:03:51 UTC
svn commit: r908333 - in /maven/release/trunk/maven-release-manager/src:
main/java/org/apache/maven/shared/release/phase/
main/java/org/apache/maven/shared/release/util/
test/java/org/apache/maven/shared/release/phase/
test/resources/projects/rewrite-f...
Author: brett
Date: Wed Feb 10 03:03:50 2010
New Revision: 908333
URL: http://svn.apache.org/viewvc?rev=908333&view=rev
Log:
[MRELEASE-383] alter test so that it is not platform dependant
Modified:
maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/AbstractRewritePomsPhase.java
maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/util/ReleaseUtil.java
maven/release/trunk/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/RewritePomsForReleasePhaseTest.java
maven/release/trunk/maven-release-manager/src/test/resources/projects/rewrite-for-release/cdata-section/expected-pom.xml (contents, props changed)
maven/release/trunk/maven-release-manager/src/test/resources/projects/rewrite-for-release/cdata-section/pom.xml (contents, props changed)
Modified: maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/AbstractRewritePomsPhase.java
URL: http://svn.apache.org/viewvc/maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/AbstractRewritePomsPhase.java?rev=908333&r1=908332&r2=908333&view=diff
==============================================================================
--- maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/AbstractRewritePomsPhase.java (original)
+++ maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/AbstractRewritePomsPhase.java Wed Feb 10 03:03:50 2010
@@ -88,6 +88,13 @@
*/
private String pomSuffix;
+ private String ls = ReleaseUtil.LS;
+
+ public void setLs( String ls )
+ {
+ this.ls = ls;
+ }
+
public ReleaseResult execute( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment,
List reactorProjects )
throws ReleaseExecutionException, ReleaseFailureException
@@ -125,7 +132,7 @@
String outtro = null;
try
{
- String content = ReleaseUtil.readXmlFile( ReleaseUtil.getStandardPom( project ) );
+ String content = ReleaseUtil.readXmlFile( ReleaseUtil.getStandardPom( project ), ls );
// we need to eliminate any extra whitespace inside elements, as JDOM will nuke it
content = content.replaceAll( "<([^!][^>]*?)\\s{2,}([^>]*?)>", "<$1 $2>" );
content = content.replaceAll( "(\\s{2,}|[^\\s])/>", "$1 />" );
@@ -140,7 +147,7 @@
// rewrite DOM as a string to find differences, since text outside the root element is not tracked
StringWriter w = new StringWriter();
Format format = Format.getRawFormat();
- format.setLineSeparator( ReleaseUtil.LS );
+ format.setLineSeparator( ls );
XMLOutputter out = new XMLOutputter( format );
out.output( document.getRootElement(), w );
@@ -227,12 +234,12 @@
for ( Iterator i = document.getDescendants( new ContentFilter( ContentFilter.COMMENT ) ); i.hasNext(); )
{
Comment c = (Comment) i.next();
- c.setText( ReleaseUtil.normalizeLineEndings( c.getText(), ReleaseUtil.LS ) );
+ c.setText( ReleaseUtil.normalizeLineEndings( c.getText(), ls ) );
}
for ( Iterator i = document.getDescendants( new ContentFilter( ContentFilter.CDATA ) ); i.hasNext(); )
{
CDATA c = (CDATA) i.next();
- c.setText( ReleaseUtil.normalizeLineEndings( c.getText(), ReleaseUtil.LS ) );
+ c.setText( ReleaseUtil.normalizeLineEndings( c.getText(), ls ) );
}
}
@@ -752,7 +759,7 @@
}
Format format = Format.getRawFormat();
- format.setLineSeparator( ReleaseUtil.LS );
+ format.setLineSeparator( ls );
XMLOutputter out = new XMLOutputter( format );
out.output( document.getRootElement(), writer );
Modified: maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/util/ReleaseUtil.java
URL: http://svn.apache.org/viewvc/maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/util/ReleaseUtil.java?rev=908333&r1=908332&r2=908333&view=diff
==============================================================================
--- maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/util/ReleaseUtil.java (original)
+++ maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/util/ReleaseUtil.java Wed Feb 10 03:03:50 2010
@@ -122,11 +122,17 @@
public static String readXmlFile( File file )
throws IOException
{
+ return readXmlFile( file, LS );
+ }
+
+ public static String readXmlFile( File file, String ls )
+ throws IOException
+ {
Reader reader = null;
try
{
reader = ReaderFactory.newXmlReader( file );
- return normalizeLineEndings( IOUtil.toString( reader ), LS );
+ return normalizeLineEndings( IOUtil.toString( reader ), ls );
}
finally
{
Modified: maven/release/trunk/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/RewritePomsForReleasePhaseTest.java
URL: http://svn.apache.org/viewvc/maven/release/trunk/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/RewritePomsForReleasePhaseTest.java?rev=908333&r1=908332&r2=908333&view=diff
==============================================================================
--- maven/release/trunk/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/RewritePomsForReleasePhaseTest.java (original)
+++ maven/release/trunk/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/RewritePomsForReleasePhaseTest.java Wed Feb 10 03:03:50 2010
@@ -353,13 +353,15 @@
}
// MRELEASE-383
- public void testRewritePomWithCDATASection()
+ public void testRewritePomWithCDATASectionOnWindows()
throws Exception
{
List reactorProjects = createReactorProjects( "cdata-section" );
ReleaseDescriptor config = createDescriptorFromProjects( reactorProjects );
mapNextVersion( config, "groupId:artifactId" );
+ RewritePomsForReleasePhase phase = (RewritePomsForReleasePhase) this.phase;
+ phase.setLs( "\r\n" );
phase.execute( config, new DefaultReleaseEnvironment(), reactorProjects );
// compare POMS without line ending normalization
Modified: maven/release/trunk/maven-release-manager/src/test/resources/projects/rewrite-for-release/cdata-section/expected-pom.xml
URL: http://svn.apache.org/viewvc/maven/release/trunk/maven-release-manager/src/test/resources/projects/rewrite-for-release/cdata-section/expected-pom.xml?rev=908333&r1=908332&r2=908333&view=diff
==============================================================================
--- maven/release/trunk/maven-release-manager/src/test/resources/projects/rewrite-for-release/cdata-section/expected-pom.xml (original)
+++ maven/release/trunk/maven-release-manager/src/test/resources/projects/rewrite-for-release/cdata-section/expected-pom.xml Wed Feb 10 03:03:50 2010
@@ -1,67 +1,67 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- ~ 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 xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <groupId>groupId</groupId>
- <artifactId>artifactId</artifactId>
- <version>1.0</version>
-
- <prerequisites>
- <maven>2.0.4</maven>
- </prerequisites>
-
- <scm>
- <connection>scm:svn:file://localhost/tmp/scm-repo/tags/release-label</connection>
- <developerConnection>scm:svn:file://localhost/tmp/scm-repo/tags/release-label</developerConnection>
- <url>file://localhost/tmp/scm-repo/tags/release-label</url>
- </scm>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-eclipse-plugin</artifactId>
- <configuration>
- <downloadSources>true</downloadSources>
- <additionalBuildcommands>
- <buildcommand>com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder</buildcommand>
- </additionalBuildcommands>
- <additionalProjectnatures>
- <projectnature>com.atlassw.tools.eclipse.checkstyle.CheckstyleNature</projectnature>
- </additionalProjectnatures>
- <additionalConfig>
- <file>
- <name>.checkstyle</name>
- <content>
- <![CDATA[<?xml version="1.0" encoding="UTF-8"?>
-<fileset-config file-format-version="1.2.0" simple-config="true">
- <fileset name="all" enabled="true" check-config-name="QifCon" local="false">
- <file-match-pattern match-pattern="." include-pattern="true" />
- </fileset>
-</fileset-config>
-]]>
- </content>
- </file>
- </additionalConfig>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
\ No newline at end of file
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ ~ 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 xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>groupId</groupId>
+ <artifactId>artifactId</artifactId>
+ <version>1.0</version>
+
+ <prerequisites>
+ <maven>2.0.4</maven>
+ </prerequisites>
+
+ <scm>
+ <connection>scm:svn:file://localhost/tmp/scm-repo/tags/release-label</connection>
+ <developerConnection>scm:svn:file://localhost/tmp/scm-repo/tags/release-label</developerConnection>
+ <url>file://localhost/tmp/scm-repo/tags/release-label</url>
+ </scm>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-eclipse-plugin</artifactId>
+ <configuration>
+ <downloadSources>true</downloadSources>
+ <additionalBuildcommands>
+ <buildcommand>com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder</buildcommand>
+ </additionalBuildcommands>
+ <additionalProjectnatures>
+ <projectnature>com.atlassw.tools.eclipse.checkstyle.CheckstyleNature</projectnature>
+ </additionalProjectnatures>
+ <additionalConfig>
+ <file>
+ <name>.checkstyle</name>
+ <content>
+ <![CDATA[<?xml version="1.0" encoding="UTF-8"?>
+<fileset-config file-format-version="1.2.0" simple-config="true">
+ <fileset name="all" enabled="true" check-config-name="QifCon" local="false">
+ <file-match-pattern match-pattern="." include-pattern="true" />
+ </fileset>
+</fileset-config>
+]]>
+ </content>
+ </file>
+ </additionalConfig>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
Propchange: maven/release/trunk/maven-release-manager/src/test/resources/projects/rewrite-for-release/cdata-section/expected-pom.xml
------------------------------------------------------------------------------
--- svn:eol-style (original)
+++ svn:eol-style Wed Feb 10 03:03:50 2010
@@ -1 +1 @@
-native
+CRLF
Modified: maven/release/trunk/maven-release-manager/src/test/resources/projects/rewrite-for-release/cdata-section/pom.xml
URL: http://svn.apache.org/viewvc/maven/release/trunk/maven-release-manager/src/test/resources/projects/rewrite-for-release/cdata-section/pom.xml?rev=908333&r1=908332&r2=908333&view=diff
==============================================================================
--- maven/release/trunk/maven-release-manager/src/test/resources/projects/rewrite-for-release/cdata-section/pom.xml (original)
+++ maven/release/trunk/maven-release-manager/src/test/resources/projects/rewrite-for-release/cdata-section/pom.xml Wed Feb 10 03:03:50 2010
@@ -1,67 +1,67 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- ~ 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 xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <groupId>groupId</groupId>
- <artifactId>artifactId</artifactId>
- <version>1.0-SNAPSHOT</version>
-
- <prerequisites>
- <maven>2.0.4</maven>
- </prerequisites>
-
- <scm>
- <connection>scm:svn:file://localhost/tmp/scm-repo/trunk</connection>
- <developerConnection>scm:svn:file://localhost/tmp/scm-repo/trunk</developerConnection>
- <url>file://localhost/tmp/scm-repo/trunk</url>
- </scm>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-eclipse-plugin</artifactId>
- <configuration>
- <downloadSources>true</downloadSources>
- <additionalBuildcommands>
- <buildcommand>com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder</buildcommand>
- </additionalBuildcommands>
- <additionalProjectnatures>
- <projectnature>com.atlassw.tools.eclipse.checkstyle.CheckstyleNature</projectnature>
- </additionalProjectnatures>
- <additionalConfig>
- <file>
- <name>.checkstyle</name>
- <content>
- <![CDATA[<?xml version="1.0" encoding="UTF-8"?>
-<fileset-config file-format-version="1.2.0" simple-config="true">
- <fileset name="all" enabled="true" check-config-name="QifCon" local="false">
- <file-match-pattern match-pattern="." include-pattern="true" />
- </fileset>
-</fileset-config>
-]]>
- </content>
- </file>
- </additionalConfig>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
\ No newline at end of file
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ ~ 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 xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>groupId</groupId>
+ <artifactId>artifactId</artifactId>
+ <version>1.0-SNAPSHOT</version>
+
+ <prerequisites>
+ <maven>2.0.4</maven>
+ </prerequisites>
+
+ <scm>
+ <connection>scm:svn:file://localhost/tmp/scm-repo/trunk</connection>
+ <developerConnection>scm:svn:file://localhost/tmp/scm-repo/trunk</developerConnection>
+ <url>file://localhost/tmp/scm-repo/trunk</url>
+ </scm>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-eclipse-plugin</artifactId>
+ <configuration>
+ <downloadSources>true</downloadSources>
+ <additionalBuildcommands>
+ <buildcommand>com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder</buildcommand>
+ </additionalBuildcommands>
+ <additionalProjectnatures>
+ <projectnature>com.atlassw.tools.eclipse.checkstyle.CheckstyleNature</projectnature>
+ </additionalProjectnatures>
+ <additionalConfig>
+ <file>
+ <name>.checkstyle</name>
+ <content>
+ <![CDATA[<?xml version="1.0" encoding="UTF-8"?>
+<fileset-config file-format-version="1.2.0" simple-config="true">
+ <fileset name="all" enabled="true" check-config-name="QifCon" local="false">
+ <file-match-pattern match-pattern="." include-pattern="true" />
+ </fileset>
+</fileset-config>
+]]>
+ </content>
+ </file>
+ </additionalConfig>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
Propchange: maven/release/trunk/maven-release-manager/src/test/resources/projects/rewrite-for-release/cdata-section/pom.xml
------------------------------------------------------------------------------
--- svn:eol-style (original)
+++ svn:eol-style Wed Feb 10 03:03:50 2010
@@ -1 +1 @@
-native
+CRLF