[Surefire1881IT] added unit test by PR #355
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1881IT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1881IT.java
index e239796..2b5ab80 100644
--- a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1881IT.java
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1881IT.java
@@ -29,11 +29,12 @@
public class Surefire1881IT extends SurefireJUnit4IntegrationTestCase
{
- @Test( timeout = 30_000L )
+ @Test( timeout = 60_000L )
public void test() throws Exception
{
unpack( "/surefire-1881" )
.executeVerify()
+ .assertTestSuiteResults( 1, 0, 0, 0 )
.assertIntegrationTestSuiteResults( 1, 0, 0, 0 );
}
}
diff --git a/surefire-its/src/test/resources/surefire-1881/pom.xml b/surefire-its/src/test/resources/surefire-1881/pom.xml
index c44fca6..7f7720a 100644
--- a/surefire-its/src/test/resources/surefire-1881/pom.xml
+++ b/surefire-its/src/test/resources/surefire-1881/pom.xml
@@ -41,7 +41,49 @@
</archive>
</configuration>
</plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>${surefire.version}</version>
+ <configuration>
+ <!-- JVM prints nothing, no unexpected output on console -->
+ <!--<argLine></argLine>-->
+ <!-- JVM prints nothing, start forked booter in debug mode -->
+ <!--<argLine>-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=localhost:34567</argLine>-->
+ <!-- JVM prints loaded classes -->
+ <argLine>-verbose:class</argLine>
+ <!-- JVM prints loaded classes, start forked booter in debug mode -->
+ <!--<argLine>-verbose:class -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=localhost:34567</argLine>-->
+ <!-- Fix for "[WARNING] Corrupted STDOUT by directly writing to native stream in forked JVM" -->
+ <!-- FIXME:
+ Using this option is meant to fix "[WARNING] Corrupted STDOUT by directly writing to native stream in
+ forked JVM" and creation of "*-jvmRun1.dumpstream" files. Unfortunately, it makes Surefire/Failsafe
+ freeze if a either the JVM prints something to stdOut or stdErr. This happens both in M5 and in
+ M6-SNAPSHOT after both SUREFIRE-1788 and SUREFIRE-1809 have been merged in already.
+ FIXME:
+ *Not* using this option leads to garbled log output when the JVM writes to both stdOut and stdErr
+ before/during tests.
+ TODO:
+ If the garbled output would also appear with this option activated, cannot be tested at present due to
+ the Surefire/Failsafe freeze -> re-test after the freeze has been fixed.
+ -->
+ <forkNode implementation="org.apache.maven.plugin.surefire.extensions.SurefireForkNodeFactory"/>
+
+ <!-- TODO:
+ We have to use this until SUREFIRE-1809 is fixed in M6, otherwise there are JPMS problems with
+ libraries added to the boot class path. -> re-test, then remove this option
+ -->
+ <useModulePath>false</useModulePath>
+
+ <!--
+ <consoleOutputReporter implementation="org.apache.maven.plugin.surefire.extensions.SurefireConsoleOutputReporter">
+ <!– Suppress Surefire/Failsafe output in favour of test output only –>
+ <disable>true</disable>
+ <encoding>UTF-8</encoding>
+ </consoleOutputReporter>
+ -->
+ </configuration>
+ </plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${surefire.version}</version>
diff --git a/surefire-its/src/test/resources/surefire-1881/src/main/java/de/scrum_master/dummy/Agent.java b/surefire-its/src/test/resources/surefire-1881/src/main/java/de/scrum_master/dummy/Agent.java
index 3a0c68d..857358d 100644
--- a/surefire-its/src/test/resources/surefire-1881/src/main/java/de/scrum_master/dummy/Agent.java
+++ b/surefire-its/src/test/resources/surefire-1881/src/main/java/de/scrum_master/dummy/Agent.java
@@ -6,7 +6,7 @@
public class Agent
{
- public static Instrumentation INSTRUMENTATION;
+ public static volatile Instrumentation INSTRUMENTATION;
public static void premain( String commandLineOptions, Instrumentation instrumentation )
{
diff --git a/surefire-its/src/test/resources/surefire-1881/src/test/java/de/scrum_master/dummy/AgentTest.java b/surefire-its/src/test/resources/surefire-1881/src/test/java/de/scrum_master/dummy/AgentTest.java
new file mode 100644
index 0000000..87ec180
--- /dev/null
+++ b/surefire-its/src/test/resources/surefire-1881/src/test/java/de/scrum_master/dummy/AgentTest.java
@@ -0,0 +1,19 @@
+package de.scrum_master.dummy;
+
+import org.junit.Test;
+
+import java.io.PrintStream;
+import java.net.URL;
+
+public class AgentTest
+{
+ @Test
+ public void test()
+ {
+ for ( int i = 0; i < 5000; i++ )
+ {
+ System.out.println( "[Test OUT] Hello Maven!" );
+ System.err.println( "[Test ERR] Hello Maven!" );
+ }
+ }
+}