You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ti...@apache.org on 2022/03/27 13:19:50 UTC

[maven-surefire] branch SUREFIRE-2046 updated (d4f7cb3 -> c741006)

This is an automated email from the ASF dual-hosted git repository.

tibordigana pushed a change to branch SUREFIRE-2046
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git.


    omit d4f7cb3  [SUREFIRE-2046] Resolved TODOs. Updated callbacks ForkedProcessPropertyEventListener and ForkedProcessStandardOutErrEventListener.
     new c741006  [SUREFIRE-2046] Resolved TODOs. Updated callbacks ForkedProcessPropertyEventListener and ForkedProcessStandardOutErrEventListener.

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (d4f7cb3)
            \
             N -- N -- N   refs/heads/SUREFIRE-2046 (c741006)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../apache/maven/plugin/surefire/booterclient/output/ForkClient.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

[maven-surefire] 01/01: [SUREFIRE-2046] Resolved TODOs. Updated callbacks ForkedProcessPropertyEventListener and ForkedProcessStandardOutErrEventListener.

Posted by ti...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

tibordigana pushed a commit to branch SUREFIRE-2046
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git

commit c74100604c3559dbe17eabaf51cf235d999be41f
Author: tibordigana <ti...@apache.org>
AuthorDate: Sat Mar 26 21:27:03 2022 +0100

    [SUREFIRE-2046] Resolved TODOs. Updated callbacks ForkedProcessPropertyEventListener and ForkedProcessStandardOutErrEventListener.
---
 .../surefire/booterclient/output/ForkClient.java   | 14 ++++++-------
 .../output/ForkedProcessEventNotifier.java         |  6 ++++--
 .../output/ForkedProcessPropertyEventListener.java |  2 +-
 .../ForkedProcessStandardOutErrEventListener.java  |  2 +-
 .../extensions/ForkedProcessEventNotifierTest.java | 24 ++++++++++++++--------
 5 files changed, 28 insertions(+), 20 deletions(-)

diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/ForkClient.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/ForkClient.java
index f89209b..fe5b9cf 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/ForkClient.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/ForkClient.java
@@ -211,7 +211,7 @@ public final class ForkClient
     private final class SystemPropertiesListener implements ForkedProcessPropertyEventListener
     {
         @Override
-        public void handle( RunMode runMode, String key, String value )
+        public void handle( String key, String value, RunMode runMode, Long testRunId )
         {
             testVmSystemProperties.put( key, value );
         }
@@ -220,18 +220,18 @@ public final class ForkClient
     private final class StdOutListener implements ForkedProcessStandardOutErrEventListener
     {
         @Override
-        public void handle( RunMode runMode, String output, boolean newLine )
+        public void handle( String output, boolean newLine, RunMode runMode, Long testRunId )
         {
-            writeTestOutput( output, newLine, true );
+            writeTestOutput( output, true, newLine, runMode, testRunId );
         }
     }
 
     private final class StdErrListener implements ForkedProcessStandardOutErrEventListener
     {
         @Override
-        public void handle( RunMode runMode, String output, boolean newLine )
+        public void handle( String output, boolean newLine, RunMode runMode, Long testRunId )
         {
-            writeTestOutput( output, newLine, false );
+            writeTestOutput( output, false, newLine, runMode, testRunId );
         }
     }
 
@@ -393,10 +393,10 @@ public final class ForkClient
         util.dumpStreamText( msg, reportsDir, forkNumber );
     }
 
-    private void writeTestOutput( String output, boolean newLine, boolean isStdout )
+    private void writeTestOutput( String output, boolean isStdout, boolean newLine, RunMode runMode, Long testRunId )
     {
         getConsoleOutputReceiver()
-                .writeTestOutput( new TestOutputReportEntry( output, isStdout, newLine, /*todo*/ null, null ) );
+                .writeTestOutput( new TestOutputReportEntry( output, isStdout, newLine, runMode, testRunId ) );
     }
 
     public Map<String, String> getTestVmSystemProperties()
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/ForkedProcessEventNotifier.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/ForkedProcessEventNotifier.java
index 2e2a174..8effa98 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/ForkedProcessEventNotifier.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/ForkedProcessEventNotifier.java
@@ -207,18 +207,20 @@ public final class ForkedProcessEventNotifier
             ForkedProcessStandardOutErrEventListener listener = stdOutErrEventListeners.get( eventType );
             if ( listener != null )
             {
-                listener.handle( standardStreamEvent.getRunMode(), standardStreamEvent.getMessage(), newLine );
+                listener.handle( standardStreamEvent.getMessage(), newLine,
+                    standardStreamEvent.getRunMode(), standardStreamEvent.getTestRunId() );
             }
         }
         else if ( event.isSysPropCategory() )
         {
             SystemPropertyEvent systemPropertyEvent = (SystemPropertyEvent) event;
             RunMode runMode = systemPropertyEvent.getRunMode();
+            Long testRunId = systemPropertyEvent.getTestRunId();
             String key = systemPropertyEvent.getKey();
             String value = systemPropertyEvent.getValue();
             if ( propertyEventListener != null )
             {
-                propertyEventListener.handle( runMode, key, value );
+                propertyEventListener.handle( key, value, runMode, testRunId );
             }
         }
         else if ( event.isTestCategory() )
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/ForkedProcessPropertyEventListener.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/ForkedProcessPropertyEventListener.java
index 98cf092..271f367 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/ForkedProcessPropertyEventListener.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/ForkedProcessPropertyEventListener.java
@@ -27,5 +27,5 @@ import org.apache.maven.surefire.api.report.RunMode;
  */
 public interface ForkedProcessPropertyEventListener
 {
-    void handle( RunMode runMode, String key, String value );
+    void handle( String key, String value, RunMode runMode, Long testRunId );
 }
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/ForkedProcessStandardOutErrEventListener.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/ForkedProcessStandardOutErrEventListener.java
index 86b7bb9..be8b566 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/ForkedProcessStandardOutErrEventListener.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/ForkedProcessStandardOutErrEventListener.java
@@ -27,5 +27,5 @@ import org.apache.maven.surefire.api.report.RunMode;
  */
 public interface ForkedProcessStandardOutErrEventListener
 {
-    void handle( RunMode runMode, String output, boolean newLine );
+    void handle( String output, boolean newLine, RunMode runMode, Long testRunId );
 }
diff --git a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/extensions/ForkedProcessEventNotifierTest.java b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/extensions/ForkedProcessEventNotifierTest.java
index f59c235..dc3c6f3 100644
--- a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/extensions/ForkedProcessEventNotifierTest.java
+++ b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/extensions/ForkedProcessEventNotifierTest.java
@@ -540,7 +540,7 @@ public class ForkedProcessEventNotifierTest
 
             ForkedProcessEventNotifier notifier = new ForkedProcessEventNotifier();
             StandardOutErrEventAssertionListener listener =
-                new StandardOutErrEventAssertionListener( NORMAL_RUN, "msg", false );
+                new StandardOutErrEventAssertionListener( NORMAL_RUN, 1L, "msg", false );
             notifier.setStdOutListener( listener );
 
             EH eventHandler = new EH();
@@ -579,7 +579,7 @@ public class ForkedProcessEventNotifierTest
 
             ForkedProcessEventNotifier notifier = new ForkedProcessEventNotifier();
             StandardOutErrEventAssertionListener listener =
-                new StandardOutErrEventAssertionListener( NORMAL_RUN, "", false );
+                new StandardOutErrEventAssertionListener( NORMAL_RUN, 1L, "", false );
             notifier.setStdOutListener( listener );
 
             EH eventHandler = new EH();
@@ -618,7 +618,7 @@ public class ForkedProcessEventNotifierTest
 
             ForkedProcessEventNotifier notifier = new ForkedProcessEventNotifier();
             StandardOutErrEventAssertionListener listener =
-                new StandardOutErrEventAssertionListener( NORMAL_RUN, null, false );
+                new StandardOutErrEventAssertionListener( NORMAL_RUN, 1L, null, false );
             notifier.setStdOutListener( listener );
 
             EH eventHandler = new EH();
@@ -657,7 +657,7 @@ public class ForkedProcessEventNotifierTest
 
             ForkedProcessEventNotifier notifier = new ForkedProcessEventNotifier();
             StandardOutErrEventAssertionListener listener =
-                new StandardOutErrEventAssertionListener( NORMAL_RUN, "", true );
+                new StandardOutErrEventAssertionListener( NORMAL_RUN, 1L, "", true );
             notifier.setStdOutListener( listener );
 
             EH eventHandler = new EH();
@@ -696,7 +696,7 @@ public class ForkedProcessEventNotifierTest
 
             ForkedProcessEventNotifier notifier = new ForkedProcessEventNotifier();
             StandardOutErrEventAssertionListener listener =
-                new StandardOutErrEventAssertionListener( NORMAL_RUN, null, true );
+                new StandardOutErrEventAssertionListener( NORMAL_RUN, 1L, null, true );
             notifier.setStdOutListener( listener );
 
             EH eventHandler = new EH();
@@ -735,7 +735,7 @@ public class ForkedProcessEventNotifierTest
 
             ForkedProcessEventNotifier notifier = new ForkedProcessEventNotifier();
             StandardOutErrEventAssertionListener listener =
-                new StandardOutErrEventAssertionListener( NORMAL_RUN, "msg", false );
+                new StandardOutErrEventAssertionListener( NORMAL_RUN, 1L, "msg", false );
             notifier.setStdErrListener( listener );
 
             EH eventHandler = new EH();
@@ -995,11 +995,12 @@ public class ForkedProcessEventNotifierTest
         private final Map<?, ?> sysProps = System.getProperties();
         private final AtomicInteger counter = new AtomicInteger();
 
-        public void handle( RunMode runMode, String key, String value )
+        public void handle( String key, String value, RunMode runMode, Long testRunId )
         {
             called.set( true );
             counter.incrementAndGet();
             assertThat( runMode ).isEqualTo( NORMAL_RUN );
+            assertThat( testRunId ).isEqualTo( 1L );
             assertTrue( sysProps.containsKey( key ) );
             assertThat( sysProps.get( key ) ).isEqualTo( value );
         }
@@ -1067,23 +1068,28 @@ public class ForkedProcessEventNotifierTest
     {
         final AtomicBoolean called = new AtomicBoolean();
         private final RunMode runMode;
+        private final long testRunId;
         private final String output;
         private final boolean newLine;
 
-        StandardOutErrEventAssertionListener( RunMode runMode, String output, boolean newLine )
+        StandardOutErrEventAssertionListener( RunMode runMode, long testRunId, String output, boolean newLine )
         {
             this.runMode = runMode;
+            this.testRunId = testRunId;
             this.output = output;
             this.newLine = newLine;
         }
 
-        public void handle( RunMode runMode, String output, boolean newLine )
+        public void handle( String output, boolean newLine, RunMode runMode, Long testRunId )
         {
             called.set( true );
 
             assertThat( runMode )
                     .isEqualTo( this.runMode );
 
+            assertThat( testRunId )
+                .isEqualTo( this.testRunId );
+
             assertThat( output )
                     .isEqualTo( this.output );