Integration test for properties replacement.

Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/4683d4d1
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/4683d4d1
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/4683d4d1

Branch: refs/heads/master
Commit: 4683d4d1a208a30ff3beb24c2da93d8b3674da7b
Parents: f0d7ea7
Author: Henning Schmiedehausen <henn...@schmiedehausen.org>
Authored: Wed Dec 18 19:37:27 2013 -0800
Committer: Henning Schmiedehausen <henn...@schmiedehausen.org>
Committed: Wed Dec 18 19:37:27 2013 -0800

----------------------------------------------------------------------
 .../maven/surefire/its/ArgLinePropertiesIT.java | 39 +++++++++
 .../test/resources/argLine-properties/pom.xml   | 84 ++++++++++++++++++++
 .../TestSurefireArgLineProperties.java          | 58 ++++++++++++++
 .../src/test/resources/it.properties            | 19 +++++
 4 files changed, 200 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4683d4d1/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ArgLinePropertiesIT.java
----------------------------------------------------------------------
diff --git 
a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ArgLinePropertiesIT.java
 
b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ArgLinePropertiesIT.java
new file mode 100644
index 0000000..cf1074e
--- /dev/null
+++ 
b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ArgLinePropertiesIT.java
@@ -0,0 +1,39 @@
+package org.apache.maven.surefire.its;
+
+/*
+ * 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.surefire.its.fixture.SurefireJUnit4IntegrationTestCase;
+import org.junit.Test;
+
+/**
+ * Test passing an argLine parameter
+ *
+ * @author <a href="mailto:dfabul...@apache.org";>Dan Fabulich</a>
+ * @author <a href="mailto:krosenv...@apache.org";>Kristian Rosenvold</a>
+ */
+public class ArgLinePropertiesIT
+    extends SurefireJUnit4IntegrationTestCase
+{
+    @Test
+    public void argLine()
+    {
+        unpack( "/argLine-properties" ).executeTest().verifyErrorFree( 4 );
+    }
+}

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4683d4d1/surefire-integration-tests/src/test/resources/argLine-properties/pom.xml
----------------------------------------------------------------------
diff --git 
a/surefire-integration-tests/src/test/resources/argLine-properties/pom.xml 
b/surefire-integration-tests/src/test/resources/argLine-properties/pom.xml
new file mode 100644
index 0000000..e679767
--- /dev/null
+++ b/surefire-integration-tests/src/test/resources/argLine-properties/pom.xml
@@ -0,0 +1,84 @@
+<?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>
+
+  <parent>
+    <groupId>org.apache.maven.surefire</groupId>
+    <artifactId>it-parent</artifactId>
+    <version>1.0</version>
+    <relativePath>../pom.xml</relativePath>
+  </parent>
+
+  <groupId>org.apache.maven.plugins.surefire</groupId>
+  <artifactId>testArgProperties</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <name>Test for late replacement argLine properties.</name>
+
+  <properties>
+    <from.prop>from-prop-value</from.prop>
+    <override.prop>not-override-prop-value</override.prop>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>4.11</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>properties-maven-plugin</artifactId>
+        <version>1.0-alpha-2</version>
+        <executions>
+          <execution>
+            <id>default</id>
+            <phase>validate</phase>
+            <goals>
+              <goal>read-project-properties</goal>
+            </goals>
+            <configuration>
+              <files>
+                
<file>${project.basedir}/src/test/resources/it.properties</file>
+              </files>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <forkMode>once</forkMode>
+          <argLine>-Dp1=@{from.prop} -Dp2=@{override.prop} 
-Dp3=@{undefined.prop} -Dp4=@{generated.prop}</argLine>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4683d4d1/surefire-integration-tests/src/test/resources/argLine-properties/src/test/java/argLine-properties/TestSurefireArgLineProperties.java
----------------------------------------------------------------------
diff --git 
a/surefire-integration-tests/src/test/resources/argLine-properties/src/test/java/argLine-properties/TestSurefireArgLineProperties.java
 
b/surefire-integration-tests/src/test/resources/argLine-properties/src/test/java/argLine-properties/TestSurefireArgLineProperties.java
new file mode 100644
index 0000000..a16fceb
--- /dev/null
+++ 
b/surefire-integration-tests/src/test/resources/argLine-properties/src/test/java/argLine-properties/TestSurefireArgLineProperties.java
@@ -0,0 +1,58 @@
+package argLine;
+
+/*
+ * 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.Assert;
+import org.junit.Test;
+
+public class TestSurefireArgLineProperties
+{
+    @Test
+    public void testFromProp()
+    {
+        String fromProp = System.getProperty("p1");
+        Assert.assertNotNull(fromProp, "incorrect arg line, no p1 present?");
+        Assert.assertEquals("from-prop-value", fromProp);
+    }
+
+    @Test
+    public void testOverrideProp()
+    {
+        String overrideProp = System.getProperty("p2");
+        Assert.assertNotNull(overrideProp, "incorrect arg line, no p2 
present?");
+        Assert.assertEquals("override-prop-value", overrideProp);
+    }
+
+    @Test
+    public void testUndefinedProp()
+    {
+        String undefinedProp = System.getProperty("p3");
+        Assert.assertNotNull(undefinedProp, "incorrect arg line, no p3 
present?");
+        Assert.assertEquals("@{undefined.prop}", undefinedProp);
+    }
+
+    @Test
+    public void testGeneratedProp()
+    {
+        String generatedProp = System.getProperty("p4");
+        Assert.assertNotNull(generatedProp, "incorrect arg line, no p4 
present?");
+        Assert.assertEquals("generated-prop-value", generatedProp);
+    }
+}

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4683d4d1/surefire-integration-tests/src/test/resources/argLine-properties/src/test/resources/it.properties
----------------------------------------------------------------------
diff --git 
a/surefire-integration-tests/src/test/resources/argLine-properties/src/test/resources/it.properties
 
b/surefire-integration-tests/src/test/resources/argLine-properties/src/test/resources/it.properties
new file mode 100644
index 0000000..dd889a2
--- /dev/null
+++ 
b/surefire-integration-tests/src/test/resources/argLine-properties/src/test/resources/it.properties
@@ -0,0 +1,19 @@
+# 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.
+
+override.prop=override-prop-value
+generated.prop=generated-prop-value

Reply via email to