[MNG-6401] Cannot interpolate property in proxy port of settings.xml
This closes #31
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 9dcef0b..8e9f24c 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 @@
// -------------------------------------------------------------------------------------------------------------
// suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137
+ suite.addTestSuite( MavenITmng6401InterpolateSettingsXmlTest.class);
suite.addTestSuite( MavenITmng6386BaseUriPropertyTest.class );
suite.addTestSuite( MavenITmng6330RelativePath.class );
suite.addTestSuite( MavenITmng6240PluginExtensionAetherProvider.class );
diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6401InterpolateSettingsXmlTest.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6401InterpolateSettingsXmlTest.java
new file mode 100644
index 0000000..4307216
--- /dev/null
+++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6401InterpolateSettingsXmlTest.java
@@ -0,0 +1,43 @@
+package org.apache.maven.it;
+
+import java.io.File;
+import java.util.Properties;
+
+import org.apache.maven.it.util.ResourceExtractor;
+
+/**
+ * This is a test set for <a href="https://issues.apache.org/jira/browse/MNG-6401">MNG-6401</a>:
+ * check interpolation for various types fields in settings.xml.
+ */
+public class MavenITmng6401InterpolateSettingsXmlTest
+ extends AbstractMavenIntegrationTestCase
+{
+
+ public MavenITmng6401InterpolateSettingsXmlTest()
+ {
+ super( "[3.5.4,)" );
+ }
+
+ public void testInterpolateSettingsXml()
+ throws Exception
+ {
+ File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-6401" );
+
+ Verifier verifier = newVerifier( testDir.getAbsolutePath() );
+ verifier.addCliOption( "--settings" );
+ verifier.addCliOption( "settings.xml" );
+ verifier.setEnvironmentVariable("MAVEN_PROXY_ACTIVE_BOOLEAN", "true");
+ verifier.setEnvironmentVariable("MAVEN_PROXY_HOST_STRING", "myproxy.host.net");
+ verifier.setEnvironmentVariable("MAVEN_PROXY_PORT_INT", "18080");
+ verifier.executeGoal( "validate" );
+
+ verifier.verifyErrorFreeLog();
+ verifier.resetStreams();
+
+ Properties props = verifier.loadProperties( "target/settings.properties" );
+ assertEquals( "true", props.getProperty( "settings.proxies.0.active" ) );
+ assertEquals( "myproxy.host.net", props.getProperty( "settings.proxies.0.host" ) );
+ assertEquals( "18080", props.getProperty( "settings.proxies.0.port" ) );
+ }
+}
+
diff --git a/core-it-suite/src/test/resources/mng-6401/pom.xml b/core-it-suite/src/test/resources/mng-6401/pom.xml
new file mode 100644
index 0000000..76358d7
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-6401/pom.xml
@@ -0,0 +1,55 @@
+<?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>
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.maven.its.mng6401</groupId>
+ <artifactId>test</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.its.plugins</groupId>
+ <artifactId>maven-it-plugin-expression</artifactId>
+ <version>2.1-SNAPSHOT</version>
+ <configuration>
+ <outputFile>target/settings.properties</outputFile>
+ <expressions>
+ <expression>settings/proxies/0/active</expression>
+ <expression>settings/proxies/0/host</expression>
+ <expression>settings/proxies/0/port</expression>
+ </expressions>
+ </configuration>
+ <executions>
+ <execution>
+ <id>test</id>
+ <phase>validate</phase>
+ <goals>
+ <goal>eval</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/core-it-suite/src/test/resources/mng-6401/settings.xml b/core-it-suite/src/test/resources/mng-6401/settings.xml
new file mode 100644
index 0000000..b0a01e4
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-6401/settings.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<settings>
+ <proxies>
+ <proxy>
+ <id>my_proxy</id>
+ <active>${env.MAVEN_PROXY_ACTIVE_BOOLEAN}</active>
+ <protocol>http</protocol>
+ <host>${env.MAVEN_PROXY_HOST_STRING}</host>
+ <port>${env.MAVEN_PROXY_PORT_INT}</port>
+ <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
+ </proxy>
+ </proxies>
+</settings>