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/03/25 20:49:45 UTC

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

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

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

commit 0e2fd4f06e08f08af82764fb09702906096e667f
Author: Andreas Veithen <ve...@apache.org>
AuthorDate: Sun Mar 24 13:06:56 2019 +0000

    [MNG-6506] Add regression test
---
 .../it/MavenITmng6506PackageAnnotationTest.java    | 57 ++++++++++++++++++++++
 .../mng-6506-package-annotation/plugin/pom.xml     | 48 ++++++++++++++++++
 .../src/main/java/testmojo/TestAnnotation.java     | 30 ++++++++++++
 .../plugin/src/main/java/testmojo/TestMojo.java    | 42 ++++++++++++++++
 .../src/main/java/testmojo/package-info.java       | 21 ++++++++
 .../mng-6506-package-annotation/project/pom.xml    | 47 ++++++++++++++++++
 6 files changed, 245 insertions(+)

diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6506PackageAnnotationTest.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6506PackageAnnotationTest.java
new file mode 100644
index 0000000..911f8c9
--- /dev/null
+++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6506PackageAnnotationTest.java
@@ -0,0 +1,57 @@
+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;
+
+public class MavenITmng6506PackageAnnotationTest
+    extends AbstractMavenIntegrationTestCase
+{
+
+    public MavenITmng6506PackageAnnotationTest()
+    {
+        super( "[3.6.1-SNAPSHOT,)" );
+    }
+
+    public void testGetPackageAnnotation()
+            throws Exception
+    {
+        File testDir =
+                ResourceExtractor.simpleExtractResources( getClass(),
+                                                          "/mng-6506-package-annotation" );
+        File pluginDir = new File( testDir, "plugin" );
+        File projectDir = new File( testDir, "project" );
+
+        Verifier verifier;
+
+        verifier = newVerifier( pluginDir.getAbsolutePath(), "remote" );
+        verifier.executeGoal( "install" );
+        verifier.resetStreams();
+        verifier.verifyErrorFreeLog();
+
+        verifier = newVerifier( projectDir.getAbsolutePath(), "remote" );
+        verifier.executeGoal( "verify" );
+        verifier.resetStreams();
+        verifier.verifyErrorFreeLog();
+        verifier.verifyTextInLog( "MNG-6506 check succeeded" );
+    }
+}
diff --git a/core-it-suite/src/test/resources/mng-6506-package-annotation/plugin/pom.xml b/core-it-suite/src/test/resources/mng-6506-package-annotation/plugin/pom.xml
new file mode 100644
index 0000000..47533fc
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-6506-package-annotation/plugin/pom.xml
@@ -0,0 +1,48 @@
+<?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/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>mng-6506</groupId>
+  <artifactId>mng-6506-plugin</artifactId>
+  <version>0.1</version>
+  <packaging>maven-plugin</packaging>
+
+  <properties>
+    <maven-version>3.6.0</maven-version>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven.plugin-tools</groupId>
+      <artifactId>maven-plugin-annotations</artifactId>
+      <version>${maven-version}</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-plugin-api</artifactId>
+      <version>${maven-version}</version>
+      <scope>provided</scope>
+    </dependency>
+  </dependencies>
+</project>
\ No newline at end of file
diff --git a/core-it-suite/src/test/resources/mng-6506-package-annotation/plugin/src/main/java/testmojo/TestAnnotation.java b/core-it-suite/src/test/resources/mng-6506-package-annotation/plugin/src/main/java/testmojo/TestAnnotation.java
new file mode 100644
index 0000000..cd0ef05
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-6506-package-annotation/plugin/src/main/java/testmojo/TestAnnotation.java
@@ -0,0 +1,30 @@
+package testmojo;
+
+/*
+ * 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 static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+
+@Retention( RUNTIME )
+public @interface TestAnnotation
+{
+
+}
diff --git a/core-it-suite/src/test/resources/mng-6506-package-annotation/plugin/src/main/java/testmojo/TestMojo.java b/core-it-suite/src/test/resources/mng-6506-package-annotation/plugin/src/main/java/testmojo/TestMojo.java
new file mode 100644
index 0000000..d9aaa95
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-6506-package-annotation/plugin/src/main/java/testmojo/TestMojo.java
@@ -0,0 +1,42 @@
+package testmojo;
+
+/*
+ * 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.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugins.annotations.Mojo;
+
+@Mojo( name = "test" )
+public class TestMojo extends AbstractMojo
+{
+    public void execute() throws MojoExecutionException, MojoFailureException
+    {
+        TestAnnotation ann = TestMojo.class.getPackage().getAnnotation( TestAnnotation.class );
+        if ( ann == null )
+        {
+            throw new MojoFailureException( "Failed to retrieve package annotation" );
+        }
+        else
+        {
+            getLog().info( "MNG-6506 check succeeded" );
+        }
+    }
+}
diff --git a/core-it-suite/src/test/resources/mng-6506-package-annotation/plugin/src/main/java/testmojo/package-info.java b/core-it-suite/src/test/resources/mng-6506-package-annotation/plugin/src/main/java/testmojo/package-info.java
new file mode 100644
index 0000000..72ce6c6
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-6506-package-annotation/plugin/src/main/java/testmojo/package-info.java
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+
+@testmojo.TestAnnotation
+package testmojo;
\ No newline at end of file
diff --git a/core-it-suite/src/test/resources/mng-6506-package-annotation/project/pom.xml b/core-it-suite/src/test/resources/mng-6506-package-annotation/project/pom.xml
new file mode 100644
index 0000000..73d73c8
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-6506-package-annotation/project/pom.xml
@@ -0,0 +1,47 @@
+<?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/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>mng-6506</groupId>
+  <artifactId>mng-6506-project</artifactId>
+  <version>0.1</version>
+  <packaging>pom</packaging>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>mng-6506</groupId>
+        <artifactId>mng-6506-plugin</artifactId>
+        <version>0.1</version>
+        <executions>
+          <execution>
+            <phase>test</phase>
+            <goals>
+              <goal>test</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>