You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sl...@apache.org on 2019/01/08 22:18:32 UTC

[maven-integration-testing] 01/01: MNG-6265 Add integration test

This is an automated email from the ASF dual-hosted git repository.

slachiewicz pushed a commit to branch MNG-6256
in repository https://gitbox.apache.org/repos/asf/maven-integration-testing.git

commit 0aad02b4ef5e17a21e74a19934974744ea06b415
Author: Christoph Etzel <ch...@informatik.uni-augsburg.de>
AuthorDate: Fri Jul 14 10:43:58 2017 +0200

    MNG-6265 Add integration test
---
 .../org/apache/maven/it/IntegrationTestSuite.java  |  1 +
 ...nITmng6256SpecialCharsAlternatePOMLocation.java | 92 ++++++++++++++++++++++
 .../folder-with- -space/pom.xml                    |  8 ++
 .../folder-with-)-closing-bracket/pom.xml          |  8 ++
 4 files changed, 109 insertions(+)

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 324bcf5..6ca0637 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( MavenITmng6256SpecialCharsAlternatePOMLocation.class );
         suite.addTestSuite( MavenITmng6386BaseUriPropertyTest.class );
         suite.addTestSuite( MavenITmng6330RelativePath.class );
         suite.addTestSuite( MavenITmng5965ParallelBuildMultipliesWorkTest.class );
diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6256SpecialCharsAlternatePOMLocation.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6256SpecialCharsAlternatePOMLocation.java
new file mode 100644
index 0000000..de79610
--- /dev/null
+++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6256SpecialCharsAlternatePOMLocation.java
@@ -0,0 +1,92 @@
+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 org.apache.maven.it.util.ResourceExtractor;
+
+/**
+ * This is a test set for <a href="https://issues.apache.org/jira/browse/MNG-6256">MNG-6256</a>: check that directories
+ * passed via <code>-f/--file</code> containing special characters do not break the script. E.g
+ * <code>-f "folderWithClosing)Bracket/pom.xml"</code>.
+ */
+public class MavenITmng6256SpecialCharsAlternatePOMLocation
+    extends AbstractMavenIntegrationTestCase
+{
+    public MavenITmng6256SpecialCharsAlternatePOMLocation()
+    {
+        super( "[3.6.1-SNAPSHOT,)" );
+    }
+
+    protected MavenITmng6256SpecialCharsAlternatePOMLocation( String constraint )
+    {
+        super( constraint );
+    }
+
+    /**
+     * check script is working when path to POM is set to <code>folder-with- -space</code>
+     */
+    public void testFolderWithSpace()
+        throws Exception
+    {
+        runWithMvnFileLongOption( "folder-with- -space" );
+        runWithMvnFileShortOption( "folder-with- -space" );
+    }
+
+    /**
+     * check script is working when path to POM is set to <code>folder-with-)-closing-bracket</code>
+     */
+    public void testFolderWithClosingBracket()
+        throws Exception
+    {
+        runWithMvnFileLongOption( "folder-with-)-closing-bracket" );
+        runWithMvnFileShortOption( "folder-with-)-closing-bracket" );
+    }
+
+    private void runWithMvnFileLongOption( String subDir )
+        throws Exception
+    {
+        runCoreExtensionWithOption( "--file", subDir );
+    }
+
+    private void runWithMvnFileShortOption( String subDir )
+        throws Exception
+    {
+        runCoreExtensionWithOption( "-f", subDir );
+    }
+
+    private void runCoreExtensionWithOption( String option, String subDir )
+        throws Exception
+    {
+        File resourceDir =
+            ResourceExtractor.simpleExtractResources( getClass(), "/mng-6256-special-chars-alternate-pom-location" );
+
+        File testDir = new File( resourceDir, "../mng-6256-" + subDir );
+        testDir.mkdir();
+
+        Verifier verifier = newVerifier( testDir.getAbsolutePath() );
+        verifier.getCliOptions().add( option ); // -f/--file
+        verifier.getCliOptions().add( "\"" + new File( resourceDir, subDir ).getAbsolutePath() + "\"" ); // "<path>"
+        verifier.executeGoal( "validate" );
+        verifier.verifyErrorFreeLog();
+        verifier.resetStreams();
+    }
+}
diff --git a/core-it-suite/src/test/resources/mng-6256-special-chars-alternate-pom-location/folder-with- -space/pom.xml b/core-it-suite/src/test/resources/mng-6256-special-chars-alternate-pom-location/folder-with- -space/pom.xml
new file mode 100644
index 0000000..1faf517
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-6256-special-chars-alternate-pom-location/folder-with- -space/pom.xml	
@@ -0,0 +1,8 @@
+<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/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>scratch</groupId>
+  <artifactId>scratch</artifactId>
+  <version>0.0.1-SNAPSHOT</version>
+  <build>
+  </build>
+</project>
diff --git a/core-it-suite/src/test/resources/mng-6256-special-chars-alternate-pom-location/folder-with-)-closing-bracket/pom.xml b/core-it-suite/src/test/resources/mng-6256-special-chars-alternate-pom-location/folder-with-)-closing-bracket/pom.xml
new file mode 100644
index 0000000..1faf517
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-6256-special-chars-alternate-pom-location/folder-with-)-closing-bracket/pom.xml
@@ -0,0 +1,8 @@
+<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/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>scratch</groupId>
+  <artifactId>scratch</artifactId>
+  <version>0.0.1-SNAPSHOT</version>
+  <build>
+  </build>
+</project>