You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2020/03/18 02:54:47 UTC
[maven-integration-testing] 01/01: [MNG-5001] check build failure
on configure read-only plugin parameter
This is an automated email from the ASF dual-hosted git repository.
hboutemy pushed a commit to branch MNG-5001
in repository https://gitbox.apache.org/repos/asf/maven-integration-testing.git
commit b4fae25b7c9bf9cee38c0f743aa2e4ec00314e02
Author: Hervé Boutemy <hb...@apache.org>
AuthorDate: Wed Mar 18 03:54:27 2020 +0100
[MNG-5001] check build failure on configure read-only plugin parameter
---
.../org/apache/maven/it/IntegrationTestSuite.java | 1 +
.../it/MavenITmng5001PluginReadOnlyParameter.java | 64 ++++++++++++++++++++++
.../src/test/resources/mng-5001_readonly/pom.xml | 63 +++++++++++++++++++++
3 files changed, 128 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..9c54f3e 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
@@ -107,6 +107,7 @@ public class IntegrationTestSuite
// -------------------------------------------------------------------------------------------------------------
// suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137
+ suite.addTestSuite( MavenITmng5001PluginReadOnlyParameter.class );
suite.addTestSuite( MavenITmng5669ReadPomsOnce.class );
suite.addTestSuite( MavenITmng6071GetResourceWithCustomPom.class );
suite.addTestSuite( MavenITmng6759TransitiveDependencyRepositoriesTest.class );
diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5001PluginReadOnlyParameter.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5001PluginReadOnlyParameter.java
new file mode 100644
index 0000000..c45bdb0
--- /dev/null
+++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5001PluginReadOnlyParameter.java
@@ -0,0 +1,64 @@
+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.Verifier;
+import org.apache.maven.it.util.ResourceExtractor;
+
+import java.io.File;
+
+/**
+ * This is a test set for <a href="https://issues.apache.org/jira/browse/MNG-5001">MNG-5001</a>:
+ * fail build if a configuring a read-only plugin parameter.
+ */
+public class MavenITmng5001PluginReadOnlyParameter
+ extends AbstractMavenIntegrationTestCase
+{
+
+ public MavenITmng5001PluginReadOnlyParameter()
+ {
+ super( "[2.0.5,3.0-alpha-1),[3.7.0,)" );
+ }
+
+ /**
+ * Verify that a project configuring a read-only plugin parameter just fails at build time.
+ */
+ public void testit()
+ throws Exception
+ {
+ File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5001_readonly" );
+
+ Verifier verifier = newVerifier( testDir.getAbsolutePath() );
+ verifier.setAutoclean( false );
+ verifier.deleteDirectory( "target" );
+ verifier.executeGoal( "validate" );
+ try
+ {
+ verifier.verifyErrorFreeLog();
+ throw new Exception( "configuring a plugin's read-only parameter should fail" );
+ }
+ catch ( VerificationException ve )
+ {
+ // expected failure
+ }
+ verifier.resetStreams();
+ }
+
+}
diff --git a/core-it-suite/src/test/resources/mng-5001_readonly/pom.xml b/core-it-suite/src/test/resources/mng-5001_readonly/pom.xml
new file mode 100644
index 0000000..994ac0e
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-5001_readonly/pom.xml
@@ -0,0 +1,63 @@
+<?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>org.apache.maven.its.mng5001</groupId>
+ <artifactId>readonlytest</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <description>
+ IT for MNG-5001: tries to configure a read-only plugin parameter.
+ This fails with Maven 2 as expected, but is not checked with Maven 3 (up to 3.6.x) then implicitely permitted...
+ </description>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.its.plugins</groupId>
+ <artifactId>maven-it-plugin-configuration</artifactId>
+ <version>2.1-SNAPSHOT</version>
+ <configuration>
+ <propertiesFile>target/config.properties</propertiesFile>
+ <basedir>target</basedir><!-- read-only parameter: configuring should not be permitted -->
+ </configuration>
+ <executions>
+ <execution>
+ <id>test</id>
+ <phase>validate</phase>
+ <goals>
+ <goal>config</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ </project>