You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by ja...@apache.org on 2018/08/16 12:18:25 UTC

[1/2] ant git commit: move the junitlauncher jupiter sample test to the org/example directory, just like the vintage engine ones

Repository: ant
Updated Branches:
  refs/heads/master e648224f5 -> ffb80b688


move the junitlauncher jupiter sample test to the org/example directory, just like the vintage engine ones


Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/0ed31483
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/0ed31483
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/0ed31483

Branch: refs/heads/master
Commit: 0ed314833651436d7662858d070e5d71d81bb0c3
Parents: e648224
Author: Jaikiran Pai <ja...@apache.org>
Authored: Wed Aug 15 10:26:29 2018 +0530
Committer: Jaikiran Pai <ja...@apache.org>
Committed: Wed Aug 15 10:26:29 2018 +0530

----------------------------------------------------------------------
 build.xml                                       | 14 ++--
 .../taskdefs/optional/junitlauncher.xml         |  3 -
 .../example/jupiter/JupiterSampleTest.java      | 67 --------------------
 .../jupiter/JupiterSampleTest.java              | 67 ++++++++++++++++++++
 4 files changed, 77 insertions(+), 74 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant/blob/0ed31483/build.xml
----------------------------------------------------------------------
diff --git a/build.xml b/build.xml
index c148105..9945d71 100644
--- a/build.xml
+++ b/build.xml
@@ -213,13 +213,19 @@
   </selector>
 
   <selector id="needs.junit.engine.vintage">
-    <!-- we need JUnit vintage engine only in tests where we test the junitlauncher task -->
-    <filename name="${src.junit}/org/apache/tools/ant/taskdefs/optional/junitlauncher/**/*"/>
+    <or>
+      <!-- we need JUnit vintage engine only in tests where we test the junitlauncher task -->
+      <filename name="${optional.package}/junitlauncher/**/*"/>
+      <filename name="org/example/junitlauncher/vintage/**/*"/>
+    </or>
   </selector>
 
   <selector id="needs.junit.engine.jupiter">
-    <!-- we need JUnit jupiter engine only in tests where we test the junitlauncher task -->
-    <filename name="${src.junit}/org/apache/tools/ant/taskdefs/optional/junitlauncher/**/*"/>
+    <or>
+      <!-- we need JUnit jupiter engine only in tests where we test the junitlauncher task -->
+      <filename name="${optional.package}/junitlauncher/**/*"/>
+      <filename name="org/example/junitlauncher/jupiter/**/*"/>
+    </or>
   </selector>
 
   <selector id="needs.apache-regexp">

http://git-wip-us.apache.org/repos/asf/ant/blob/0ed31483/src/etc/testcases/taskdefs/optional/junitlauncher.xml
----------------------------------------------------------------------
diff --git a/src/etc/testcases/taskdefs/optional/junitlauncher.xml b/src/etc/testcases/taskdefs/optional/junitlauncher.xml
index 81861a7..0facadd 100644
--- a/src/etc/testcases/taskdefs/optional/junitlauncher.xml
+++ b/src/etc/testcases/taskdefs/optional/junitlauncher.xml
@@ -103,9 +103,6 @@
                 <fileset dir="${build.classes.dir}">
                     <include name="org/example/**/junitlauncher/**/"/>
                 </fileset>
-                <fileset dir="${build.classes.dir}">
-                    <include name="org/apache/tools/ant/taskdefs/optional/junitlauncher/example/**/"/>
-                </fileset>
                 <listener type="legacy-brief" sendSysOut="true"/>
                 <listener type="legacy-xml" sendSysErr="true" sendSysOut="true"/>
             </testclasses>

http://git-wip-us.apache.org/repos/asf/ant/blob/0ed31483/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junitlauncher/example/jupiter/JupiterSampleTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junitlauncher/example/jupiter/JupiterSampleTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junitlauncher/example/jupiter/JupiterSampleTest.java
deleted file mode 100644
index 07b0a0f..0000000
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junitlauncher/example/jupiter/JupiterSampleTest.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- *  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.tools.ant.taskdefs.optional.junitlauncher.example.jupiter;
-
-import org.junit.jupiter.api.AfterAll;
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Disabled;
-import org.junit.jupiter.api.Test;
-
-import static org.junit.jupiter.api.Assertions.fail;
-
-/**
- *
- */
-public class JupiterSampleTest {
-
-    private static final String message = "The quick brown fox jumps over the lazy dog";
-
-    @BeforeAll
-    static void beforeAll() {
-    }
-
-    @BeforeEach
-    void beforeEach() {
-    }
-
-    @Test
-    void testSucceeds() {
-        System.out.println(message);
-        System.out.print("<some-other-message>Hello world! <!-- some comment --></some-other-message>");
-    }
-
-    @Test
-    void testFails() {
-        fail("intentionally failing");
-    }
-
-    @Test
-    @Disabled("intentionally skipped")
-    void testSkipped() {
-    }
-
-    @AfterEach
-    void afterEach() {
-    }
-
-    @AfterAll
-    static void afterAll() {
-    }
-}

http://git-wip-us.apache.org/repos/asf/ant/blob/0ed31483/src/tests/junit/org/example/junitlauncher/jupiter/JupiterSampleTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/example/junitlauncher/jupiter/JupiterSampleTest.java b/src/tests/junit/org/example/junitlauncher/jupiter/JupiterSampleTest.java
new file mode 100644
index 0000000..b11286b
--- /dev/null
+++ b/src/tests/junit/org/example/junitlauncher/jupiter/JupiterSampleTest.java
@@ -0,0 +1,67 @@
+/*
+ *  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.example.junitlauncher.jupiter;
+
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.fail;
+
+/**
+ *
+ */
+public class JupiterSampleTest {
+
+    private static final String message = "The quick brown fox jumps over the lazy dog";
+
+    @BeforeAll
+    static void beforeAll() {
+    }
+
+    @BeforeEach
+    void beforeEach() {
+    }
+
+    @Test
+    void testSucceeds() {
+        System.out.println(message);
+        System.out.print("<some-other-message>Hello world! <!-- some comment --></some-other-message>");
+    }
+
+    @Test
+    void testFails() {
+        fail("intentionally failing");
+    }
+
+    @Test
+    @Disabled("intentionally skipped")
+    void testSkipped() {
+    }
+
+    @AfterEach
+    void afterEach() {
+    }
+
+    @AfterAll
+    static void afterAll() {
+    }
+}


[2/2] ant git commit: Initial updates to the junitlauncher task manual to explain the fork support

Posted by ja...@apache.org.
Initial updates to the junitlauncher task manual to explain the fork support


Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/ffb80b68
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/ffb80b68
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/ffb80b68

Branch: refs/heads/master
Commit: ffb80b688a12d4e60ab4be466ec0b3e396bb0078
Parents: 0ed3148
Author: Jaikiran Pai <ja...@apache.org>
Authored: Thu Aug 16 17:47:31 2018 +0530
Committer: Jaikiran Pai <ja...@apache.org>
Committed: Thu Aug 16 17:47:31 2018 +0530

----------------------------------------------------------------------
 manual/Tasks/junitlauncher.html | 114 +++++++++++++++++++++++++++++++++++
 1 file changed, 114 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant/blob/ffb80b68/manual/Tasks/junitlauncher.html
----------------------------------------------------------------------
diff --git a/manual/Tasks/junitlauncher.html b/manual/Tasks/junitlauncher.html
index c818f79..8cf4a22 100644
--- a/manual/Tasks/junitlauncher.html
+++ b/manual/Tasks/junitlauncher.html
@@ -438,6 +438,11 @@
     Tests can define their own listeners via nested <code>listener</code> elements.
 </p>
 
+<p>
+    The <a href="#fork">fork</a> nested element can be used to run the test in a newly forked
+    JVM.
+</p>
+
 <h4>testclasses</h4>
 
 <p>Define a number of tests based on pattern matching.</p>
@@ -514,6 +519,115 @@
     elements.
 </p>
 
+<p>
+    The <a href="#fork">fork</a> nested element can be used to run the tests in a newly forked
+    JVM. All tests that are part of this <code>testclasses</code> element will run in one single
+    instance of the newly forked JVM.
+</p>
+
+<h4 id="fork">fork</h4>
+
+<p><em>Since Ant 1.10.6</em></p>
+
+Tests launched using the <code>junitlauncher</code> task, by default, run in the same JVM that
+initiates the task. This behaviour can be changed using the <code>fork</code> element.
+The <code>fork</code> element and its attributes define the characteristics of
+the new JVM instance that will be created to launch the tests.
+
+<table class="attr">
+    <tr>
+        <th scope="col">Attribute</th>
+        <th scope="col">Description</th>
+        <th scope="col">Required</th>
+    </tr>
+    <tr>
+        <td>dir</td>
+        <td>The user working directory that will be used for the forked JVM</td>
+        <td>No</td>
+    </tr>
+    <tr>
+        <td>timeout</td>
+        <td>A value in milliseconds, specifying a maximum duration, the test
+            running in this forked JVM is allowed to run. If the test runs longer
+            than this configured value, then the JVM is killed</td>
+        <td>No</td>
+    </tr>
+</table>
+
+The <code>fork</code> element allows the following nested elements:
+
+<h5>jvmarg</h5>
+<p>
+    Additional JVM arguments may be passed to the forked JVM via the <code>jvmarg</code> elements.
+    For example:
+    <pre>
+    &lt;fork ...&gt;
+      &lt;jvmarg value="-Djava.compiler=NONE"/&gt;
+      ...
+    &lt;/fork&gt;
+    </pre>
+</p>
+
+<p>
+    <code>jvmarg</code> allows all attributes described in <a href="../using.html#arg">Command-line Arguments</a>
+</p>
+
+<h5>sysproperty</h5>
+<p>
+    The <code>sysproperty</code> elements allow passing Java system properties to the forked JVM:
+    <pre>
+    &lt;fork&gt;
+        &lt;sysproperty key="greeting" value="hello world"/&gt;
+    ...
+    &lt;/fork&gt;
+    </pre>
+</p>
+<p>
+    The attributes for this element are the same as for <a href="../Tasks/exec.html#env">environment variables</a>
+</p>
+
+<h5>syspropertyset</h5>
+
+<p>
+    You can specify a set of properties to be used as system properties with
+    <a href="../Types/propertyset.html">syspropertyset</a>(s)
+</p>
+
+
+<h5>env</h5>
+
+<p>
+    It is possible to specify environment variables to pass to the forked JVM via
+    nested <code>env</code> elements. For a description of the <code>env</code>
+    element's attributes, see the description in the <a href="../Tasks/exec.html#env">exec</a> task.
+</p>
+
+<h5>modulepath</h5>
+
+<p>
+    The location of Java modules can be specified using the <code>modulepath</code> element,
+    which is a <a href="../using.html#path">path-like structure</a>.
+</p>
+For example:
+<pre>
+&lt;fork&gt;
+  &lt;modulepath&gt;
+    &lt;pathelement location="lib"/&gt;
+    &lt;pathelement location="dist/test.jar"/&gt;
+  &lt;/modulepath&gt;
+  ...
+&lt;/fork&gt;
+</pre>
+
+<h5>upgrademodulepath</h5>
+
+<p>
+    The location of Java modules, that replace upgradeable modules in the runtime, can be specified
+    using the <code>upgrademodulepath</code> element, which is a <a href="../using.html#path">path-like
+    structure</a>.
+</p>
+
+
 <h3>Examples</h3>
 
 <p>