You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by rf...@apache.org on 2020/03/28 20:46:36 UTC

[maven-integration-testing] 01/18: Add integration test to show that --resume-from works

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

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

commit 8cfa7f566b5fec4ff09b5f7a5d9bb5c550281152
Author: Maarten Mulders <ma...@infosupport.com>
AuthorDate: Wed Jan 29 11:20:35 2020 +0100

    Add integration test to show that --resume-from works
---
 .../org/apache/maven/it/IntegrationTestSuite.java  |  1 +
 .../maven/it/MavenITmng4660ResumeFromTest.java     | 74 ++++++++++++++++++++++
 .../mng-4660-resume-from/module-a/pom.xml          | 36 +++++++++++
 .../mng-4660-resume-from/module-b/pom.xml          | 44 +++++++++++++
 .../test/java/org/apache/maven/it/TestCase.java    | 33 ++++++++++
 .../test/resources/mng-4660-resume-from/pom.xml    | 62 ++++++++++++++++++
 6 files changed, 250 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 87b948e..d54ba20 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
@@ -232,6 +232,7 @@ public class IntegrationTestSuite
         suite.addTestSuite( MavenITmng4679SnapshotUpdateInPluginTest.class );
         suite.addTestSuite( MavenITmng4677DisabledPluginConfigInheritanceTest.class );
         suite.addTestSuite( MavenITmng4666CoreRealmImportTest.class );
+        suite.addTestSuite( MavenITmng4660ResumeFromTest.class );
         suite.addTestSuite( MavenITmng4654ArtifactHandlerForMainArtifactTest.class );
         suite.addTestSuite( MavenITmng4644StrictPomParsingRejectsMisplacedTextTest.class );
         // suite.addTestSuite( MavenITmng4633DualCompilerExecutionsWeaveModeTest.class );
diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4660ResumeFromTest.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4660ResumeFromTest.java
new file mode 100644
index 0000000..c1cbf66
--- /dev/null
+++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4660ResumeFromTest.java
@@ -0,0 +1,74 @@
+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 org.apache.maven.it.util.ResourceExtractor;
+
+import java.io.File;
+
+/**
+ * This is a test case for <a href="https://issues.apache.org/jira/browse/MNG-4660">MNG-4660</a>.
+ *
+ * @author Maarten Mulders
+ * @author Martin Kanters
+ */
+public class MavenITmng4660ResumeFromTest extends AbstractMavenIntegrationTestCase {
+    public MavenITmng4660ResumeFromTest()
+    {
+        // TODO Update version range once bug has been fixed!
+        super( "[3.6.3,)" );
+    }
+
+    /**
+     * Test that the --resume-from flag resolves dependencies inside the same Maven project
+     * without having them installed first.
+     */
+    public void testIt() throws Exception
+    {
+        final File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4660-resume-from" );
+
+        final Verifier verifier1 = newVerifier( testDir.getAbsolutePath() );
+        verifier1.deleteDirectory( "target" );
+        verifier1.deleteArtifacts( "org.apache.maven.its.mng4660" );
+
+        try
+        {
+            verifier1.executeGoal("verify");
+            fail( "Expected this invocation to fail" ); // See TestCase.java
+        }
+        catch ( final VerificationException ve )
+        {
+            verifier1.verifyTextInLog( "Deliberately fail test case" );
+        }
+        finally
+        {
+            verifier1.resetStreams();
+        }
+
+        final Verifier verifier2 = newVerifier( testDir.getAbsolutePath() );
+        verifier2.setAutoclean( false );
+        verifier2.addCliOption( "--resume-from" );
+        verifier2.addCliOption( ":module-b" );
+        verifier2.executeGoal( "compile" ); // to prevent the unit test from failing (again)
+
+        verifier2.verifyErrorFreeLog();
+        verifier2.resetStreams();
+    }
+}
diff --git a/core-it-suite/src/test/resources/mng-4660-resume-from/module-a/pom.xml b/core-it-suite/src/test/resources/mng-4660-resume-from/module-a/pom.xml
new file mode 100644
index 0000000..f6e2caa
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-4660-resume-from/module-a/pom.xml
@@ -0,0 +1,36 @@
+<?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 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>
+
+    <artifactId>module-a</artifactId>
+
+    <parent>
+        <groupId>org.apache.maven.its.mng4660</groupId>
+        <artifactId>parent</artifactId>
+        <version>1.0</version>
+    </parent>
+
+</project>
diff --git a/core-it-suite/src/test/resources/mng-4660-resume-from/module-b/pom.xml b/core-it-suite/src/test/resources/mng-4660-resume-from/module-b/pom.xml
new file mode 100644
index 0000000..e00e63b
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-4660-resume-from/module-b/pom.xml
@@ -0,0 +1,44 @@
+<?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 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>
+
+    <artifactId>module-b</artifactId>
+
+    <parent>
+        <groupId>org.apache.maven.its.mng4660</groupId>
+        <artifactId>parent</artifactId>
+        <version>1.0</version>
+    </parent>
+
+    <dependencies>
+      <dependency>
+          <groupId>org.apache.maven.its.mng4660</groupId>
+          <artifactId>module-a</artifactId>
+          <version>1.0</version>
+      </dependency>
+    </dependencies>
+
+</project>
diff --git a/core-it-suite/src/test/resources/mng-4660-resume-from/module-b/src/test/java/org/apache/maven/it/TestCase.java b/core-it-suite/src/test/resources/mng-4660-resume-from/module-b/src/test/java/org/apache/maven/it/TestCase.java
new file mode 100644
index 0000000..0fe241b
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-4660-resume-from/module-b/src/test/java/org/apache/maven/it/TestCase.java
@@ -0,0 +1,33 @@
+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 org.junit.Test;
+
+import static org.junit.Assert.fail;
+
+public class TestCase
+{
+    @Test
+    public void testCase()
+    {
+        fail( "Deliberately fail test case" );
+    }
+}
\ No newline at end of file
diff --git a/core-it-suite/src/test/resources/mng-4660-resume-from/pom.xml b/core-it-suite/src/test/resources/mng-4660-resume-from/pom.xml
new file mode 100644
index 0000000..5fa0e49
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-4660-resume-from/pom.xml
@@ -0,0 +1,62 @@
+<?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 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>org.apache.maven.its.mng4660</groupId>
+    <artifactId>parent</artifactId>
+    <version>1.0</version>
+
+    <packaging>pom</packaging>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <maven.compiler.source>1.8</maven.compiler.source>
+        <maven.compiler.target>1.8</maven.compiler.target>
+    </properties>
+
+    <modules>
+        <module>module-a</module>
+        <module>module-b</module>
+    </modules>
+
+    <dependencies>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.4</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <version>3.8.1</version>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>