You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by gb...@apache.org on 2017/07/19 19:22:22 UTC
maven-integration-testing git commit: [MNG-6255] Maven script cannot
parse jvm.config with CRLF
Repository: maven-integration-testing
Updated Branches:
refs/heads/MNG-6255 [created] 7b7d7b5bb
[MNG-6255] Maven script cannot parse jvm.config with CRLF
Both \r and \n should also be replaced with a space to deal with CRLF line endings properly
Project: http://git-wip-us.apache.org/repos/asf/maven-integration-testing/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-integration-testing/commit/7b7d7b5b
Tree: http://git-wip-us.apache.org/repos/asf/maven-integration-testing/tree/7b7d7b5b
Diff: http://git-wip-us.apache.org/repos/asf/maven-integration-testing/diff/7b7d7b5b
Branch: refs/heads/MNG-6255
Commit: 7b7d7b5bbe9a86a2969f985190ae6bf289561742
Parents: a162291
Author: Andrew Donald Kennedy <an...@cloudsoftcorp.com>
Authored: Tue Jul 18 18:21:43 2017 +0100
Committer: Guillaume Boué <gb...@apache.org>
Committed: Wed Jul 19 21:11:13 2017 +0200
----------------------------------------------------------------------
.../apache/maven/it/IntegrationTestSuite.java | 1 +
.../maven/it/MavenITmng6255FixConcatLines.java | 104 +++++++++++++++++++
.../src/test/resources/mng-6255/.mvn/jvm.config | 0
.../src/test/resources/mng-6255/pom.xml | 67 ++++++++++++
4 files changed, 172 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/7b7d7b5b/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
----------------------------------------------------------------------
diff --git a/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java b/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
index 026b4b0..e8ce666 100644
--- a/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
+++ b/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
@@ -106,6 +106,7 @@ public class IntegrationTestSuite
// -------------------------------------------------------------------------------------------------------------
// suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137
+ suite.addTestSuite( MavenITmng6255FixConcatLines.class );
suite.addTestSuite( MavenITmng6240PluginExtensionAetherProvider.class );
suite.addTestSuite( MavenITmng6223FindBasedir.class );
suite.addTestSuite( MavenITmng6189SiteReportPluginsWarningTest.class );
http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/7b7d7b5b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6255FixConcatLines.java
----------------------------------------------------------------------
diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6255FixConcatLines.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6255FixConcatLines.java
new file mode 100644
index 0000000..4bd53ae
--- /dev/null
+++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6255FixConcatLines.java
@@ -0,0 +1,104 @@
+package org.apache.maven.it;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+
+import java.io.File;
+import java.util.Properties;
+
+import org.apache.maven.it.util.ResourceExtractor;
+
+import com.google.common.base.Charsets;
+import com.google.common.base.Joiner;
+import com.google.common.io.Files;
+
+/**
+ * This is a test set for <a href="https://issues.apache.org/jira/browse/MNG-6255">MNG-6255</a>:
+ * Check that the <code>.mvn/jvm.config</code> file contents are concatenated properly, no matter
+ * what line endings are used.
+ */
+public class MavenITmng6255FixConcatLines
+ extends AbstractMavenIntegrationTestCase
+{
+ public MavenITmng6255FixConcatLines()
+ {
+ super( "[3.5.1,)" );
+ }
+
+ protected MavenITmng6255FixConcatLines( String constraint )
+ {
+ super( constraint );
+ }
+
+ /**
+ * Check that <code>CR</code> line endings work.
+ * <p>
+ * Currently disabled.
+ */
+ public void disabledJvmConfigFileCR()
+ throws Exception
+ {
+ runWithLineEndings( "\r" );
+ }
+
+ /**
+ * Check that <code>LF</code> line endings work.
+ */
+ public void testJvmConfigFileLF()
+ throws Exception
+ {
+ runWithLineEndings( "\n" );
+ }
+
+ /**
+ * Check that <code>CRLF</code> line endings work.
+ */
+ public void testJvmConfigFileCRLF()
+ throws Exception
+ {
+ runWithLineEndings( "\r\n" );
+ }
+
+ protected void runWithLineEndings( String lineEndings )
+ throws Exception
+ {
+ File baseDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-6255" );
+ File mvnDir = new File( baseDir, ".mvn" );
+
+ File jvmConfig = new File( mvnDir, "jvm.config" );
+ createJvmConfigFile( jvmConfig, lineEndings, "-Djvm.config=ok", "-Xms256m", "-Xmx512m" );
+
+ Verifier verifier = newVerifier( baseDir.getAbsolutePath() );
+ verifier.getCliOptions().add( "-Dexpression.outputFile=" + new File( baseDir, "expression.properties" ).getAbsolutePath() );
+ verifier.setForkJvm( true );
+ verifier.executeGoal( "validate" );
+ verifier.verifyErrorFreeLog();
+ verifier.resetStreams();
+
+ Properties props = verifier.loadProperties( "expression.properties" );
+ assertEquals( "ok", props.getProperty( "project.properties.jvm-config" ) );
+ }
+
+ protected void createJvmConfigFile( File jvmConfig, String lineEndings, String...lines )
+ throws Exception
+ {
+ String content = Joiner.on(lineEndings).join(lines);
+ Files.write( content, jvmConfig, Charsets.UTF_8 );
+ }
+}
http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/7b7d7b5b/core-it-suite/src/test/resources/mng-6255/.mvn/jvm.config
----------------------------------------------------------------------
diff --git a/core-it-suite/src/test/resources/mng-6255/.mvn/jvm.config b/core-it-suite/src/test/resources/mng-6255/.mvn/jvm.config
new file mode 100644
index 0000000..e69de29
http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/7b7d7b5b/core-it-suite/src/test/resources/mng-6255/pom.xml
----------------------------------------------------------------------
diff --git a/core-it-suite/src/test/resources/mng-6255/pom.xml b/core-it-suite/src/test/resources/mng-6255/pom.xml
new file mode 100644
index 0000000..90fe9e1
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-6255/pom.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you 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>org.apache.maven.its.mng6255</groupId>
+ <artifactId>test</artifactId>
+ <version>1</version>
+ <packaging>pom</packaging>
+
+ <name>Maven Integration Test :: MNG-6255</name>
+ <description>
+ Verify that .mvn/jvm.config file is parsed correctly with different line endings
+ </description>
+
+ <properties>
+ <jvm-config>${jvm.config}</jvm-config>
+ <user-dir>${user.dir}</user-dir>
+ <maven-multiModuleProjectDirectory>${maven.multiModuleProjectDirectory}</maven-multiModuleProjectDirectory>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.its.plugins</groupId>
+ <artifactId>maven-it-plugin-expression</artifactId>
+ <version>2.1-SNAPSHOT</version>
+ <configuration>
+ <expressions>
+ <expression>project/properties/jvm-config</expression>
+ <expression>project/properties/user-dir</expression>
+ <expression>project/properties/maven-multiModuleProjectDirectory</expression>
+ <expression>project/basedir</expression>
+ </expressions>
+ </configuration>
+ <executions>
+ <execution>
+ <id>test</id>
+ <phase>validate</phase>
+ <goals>
+ <goal>eval</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>