From ff1d119179554629b313ea8c1d1ed420837ef9fd Mon Sep 17 00:00:00 2001 From: Guillaume Nodet Date: Wed, 22 May 2024 15:45:02 +0200 Subject: [PATCH] [MNG-8123] IT for build cache extension (#342) --- .../it/MavenITmng8123BuildCacheTest.java | 41 +++++++++++++++ .../apache/maven/it/TestSuiteOrdering.java | 1 + .../src/test/resources-filtered/bootstrap.txt | 1 + .../mng-8123-build-cache/.mvn/extensions.xml | 8 +++ .../resources/mng-8123-build-cache/pom.xml | 52 +++++++++++++++++++ .../src/main/java/groupId/App.java | 29 +++++++++++ 6 files changed, 132 insertions(+) create mode 100644 its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng8123BuildCacheTest.java create mode 100644 its/core-it-suite/src/test/resources/mng-8123-build-cache/.mvn/extensions.xml create mode 100644 its/core-it-suite/src/test/resources/mng-8123-build-cache/pom.xml create mode 100644 its/core-it-suite/src/test/resources/mng-8123-build-cache/src/main/java/groupId/App.java diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng8123BuildCacheTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng8123BuildCacheTest.java new file mode 100644 index 0000000000..dcbaefe548 --- /dev/null +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng8123BuildCacheTest.java @@ -0,0 +1,41 @@ +/* + * 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. + */ +package org.apache.maven.it; + +import java.io.File; + +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; +import org.junit.jupiter.api.Test; + +public class MavenITmng8123BuildCacheTest extends AbstractMavenIntegrationTestCase { + public MavenITmng8123BuildCacheTest() { + super("[3,)"); + } + + @Test + public void testBuildCacheExtension() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-8123-build-cache"); + + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.addCliArgument("install"); + verifier.execute(); + verifier.verifyErrorFreeLog(); + } +} diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/TestSuiteOrdering.java b/its/core-it-suite/src/test/java/org/apache/maven/it/TestSuiteOrdering.java index e9523499c0..45e97d647a 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/TestSuiteOrdering.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/TestSuiteOrdering.java @@ -120,6 +120,7 @@ public class TestSuiteOrdering implements ClassOrderer { * the tests are to finishing. Newer tests are also more likely to fail, so this is * a fail fast technique as well. */ + suite.addTestSuite(MavenITmng8123BuildCacheTest.class); suite.addTestSuite(MavenITmng8106OverlappingDirectoryRolesTest.class); suite.addTestSuite(MavenITmng8005IdeWorkspaceReaderUsedTest.class); suite.addTestSuite(MavenITmng7967ArtifactHandlerLanguageTest.class); diff --git a/its/core-it-suite/src/test/resources-filtered/bootstrap.txt b/its/core-it-suite/src/test/resources-filtered/bootstrap.txt index cc445a699b..164e5c9423 100644 --- a/its/core-it-suite/src/test/resources-filtered/bootstrap.txt +++ b/its/core-it-suite/src/test/resources-filtered/bootstrap.txt @@ -22,6 +22,7 @@ org.apache.groovy:groovy:4.0.15 org.apache.maven:maven-api-spi:4.0.0-alpha-8 org.apache.maven:maven-api-model:mdo:4.0.0-alpha-8 org.apache.maven.extensions:maven-extensions:pom:41 +org.apache.maven.extensions:maven-build-cache-extension:1.2.0 org.apache.maven.its.plugins.class-loader:dep-c:${project.version} org.apache.maven.its.plugins:maven-it-plugin-active-collection:${project.version} org.apache.maven.its.plugins:maven-it-plugin-all:${project.version} diff --git a/its/core-it-suite/src/test/resources/mng-8123-build-cache/.mvn/extensions.xml b/its/core-it-suite/src/test/resources/mng-8123-build-cache/.mvn/extensions.xml new file mode 100644 index 0000000000..97a342cde6 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-8123-build-cache/.mvn/extensions.xml @@ -0,0 +1,8 @@ + + + org.apache.maven.extensions + maven-build-cache-extension + 1.2.0 + + + diff --git a/its/core-it-suite/src/test/resources/mng-8123-build-cache/pom.xml b/its/core-it-suite/src/test/resources/mng-8123-build-cache/pom.xml new file mode 100644 index 0000000000..f0654fd39e --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-8123-build-cache/pom.xml @@ -0,0 +1,52 @@ + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + artifactId + + http://www.example.com + + + UTF-8 + 1.8 + 1.8 + + + + + + + + + maven-clean-plugin + 3.3.2 + + + + maven-resources-plugin + 3.3.0 + + + maven-compiler-plugin + 3.10.1 + + + maven-jar-plugin + 3.3.0 + + + maven-install-plugin + 3.0.1 + + + maven-deploy-plugin + 3.0.0 + + + + + diff --git a/its/core-it-suite/src/test/resources/mng-8123-build-cache/src/main/java/groupId/App.java b/its/core-it-suite/src/test/resources/mng-8123-build-cache/src/main/java/groupId/App.java new file mode 100644 index 0000000000..824b855779 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-8123-build-cache/src/main/java/groupId/App.java @@ -0,0 +1,29 @@ +/* + * 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. + */ +package groupId; + +/** + * Hello world! + * + */ +public class App { + public static void main(String[] args) { + System.out.println("Hello World!"); + } +}