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

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


The following commit(s) were added to refs/heads/SUREFIRE-1796 by this push:
     new 8409875  changes after Michael's review
8409875 is described below

commit 84098759e23e6c8dab0ed47de88349b24722ad84
Author: tibordigana <[email protected]>
AuthorDate: Wed Jun 10 00:48:16 2020 +0200

    changes after Michael's review
---
 .../maven/plugin/surefire/extensions/SurefireForkChannel.java       | 6 +++---
 .../java/org/apache/maven/plugin/surefire/extensions/E2ETest.java   | 4 ++--
 .../apache/maven/surefire/api/util/internal/AsyncSocketTest.java    | 3 +--
 .../booter/spi/SurefireMasterProcessChannelProcessorFactory.java    | 4 ++--
 .../java/org/apache/maven/surefire/booter/ForkedBooterMockTest.java | 4 ++--
 5 files changed, 10 insertions(+), 11 deletions(-)

diff --git 
a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/extensions/SurefireForkChannel.java
 
b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/extensions/SurefireForkChannel.java
index 8d3a54b..092c5f9 100644
--- 
a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/extensions/SurefireForkChannel.java
+++ 
b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/extensions/SurefireForkChannel.java
@@ -105,7 +105,7 @@ final class SurefireForkChannel extends ForkChannel
         try
         {
             worker = server.accept().get();
-            authenticate();
+            verifySessionId();
         }
         catch ( InterruptedException e )
         {
@@ -117,7 +117,7 @@ final class SurefireForkChannel extends ForkChannel
         }
     }
 
-    private void authenticate() throws InterruptedException, 
ExecutionException, IOException
+    private void verifySessionId() throws InterruptedException, 
ExecutionException, IOException
     {
         ByteBuffer buffer = ByteBuffer.allocate( sessionId.length() );
         int read;
@@ -127,7 +127,7 @@ final class SurefireForkChannel extends ForkChannel
         } while ( read != -1 && buffer.hasRemaining() );
         if ( read == -1 )
         {
-            throw new IOException( "Channel closed while authenticating the 
client." );
+            throw new IOException( "Channel closed while verifying the 
client." );
         }
         buffer.flip();
         String clientSessionId = new String( buffer.array(), US_ASCII );
diff --git 
a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/extensions/E2ETest.java
 
b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/extensions/E2ETest.java
index 3c5e1b8..8bdce47 100644
--- 
a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/extensions/E2ETest.java
+++ 
b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/extensions/E2ETest.java
@@ -241,8 +241,8 @@ public class E2ETest
                 @Override
                 public String call() throws Exception
                 {
-                    URI connectionString = new URI( 
server.getForkNodeConnectionString() );
-                    client.connect( "tcp://" + connectionString.getHost() + 
":" + connectionString.getPort()
+                    URI connectionUri = new URI( 
server.getForkNodeConnectionString() );
+                    client.connect( "tcp://" + connectionUri.getHost() + ":" + 
connectionUri.getPort()
                         + "?sessionId=6ba7b812-9dad-11d1-80b4-00c04fd430c8" );
                     return "client connected";
                 }
diff --git 
a/surefire-api/src/test/java/org/apache/maven/surefire/api/util/internal/AsyncSocketTest.java
 
b/surefire-api/src/test/java/org/apache/maven/surefire/api/util/internal/AsyncSocketTest.java
index 162f38f..f4cb773 100644
--- 
a/surefire-api/src/test/java/org/apache/maven/surefire/api/util/internal/AsyncSocketTest.java
+++ 
b/surefire-api/src/test/java/org/apache/maven/surefire/api/util/internal/AsyncSocketTest.java
@@ -26,7 +26,6 @@ import java.io.BufferedOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
-import java.net.Inet4Address;
 import java.net.InetAddress;
 import java.net.InetSocketAddress;
 import java.net.SocketOption;
@@ -81,7 +80,7 @@ public class AsyncSocketTest
         AsynchronousChannelGroup group = 
AsynchronousChannelGroup.withThreadPool( executorService );
         AsynchronousServerSocketChannel server = 
AsynchronousServerSocketChannel.open( group );
         setTrueOptions( server, SO_REUSEADDR, TCP_NODELAY, SO_KEEPALIVE );
-        InetAddress ip = Inet4Address.getLocalHost();
+        InetAddress ip = InetAddress.getLocalHost();
         server.bind( new InetSocketAddress( ip, 0 ), 1 );
         address = (InetSocketAddress) server.getLocalAddress();
 
diff --git 
a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/spi/SurefireMasterProcessChannelProcessorFactory.java
 
b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/spi/SurefireMasterProcessChannelProcessorFactory.java
index bfe0157..9efff25 100644
--- 
a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/spi/SurefireMasterProcessChannelProcessorFactory.java
+++ 
b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/spi/SurefireMasterProcessChannelProcessorFactory.java
@@ -78,7 +78,7 @@ public class SurefireMasterProcessChannelProcessorFactory
             clientSocketChannel = open( withFixedThreadPool( 2, 
newDaemonThreadFactory() ) );
             setTrueOptions( SO_REUSEADDR, TCP_NODELAY, SO_KEEPALIVE );
             clientSocketChannel.connect( hostAddress ).get();
-            String sessionId = parseSessionId( uri );
+            String sessionId = extractSessionId( uri );
             if ( sessionId != null )
             {
                 ByteBuffer buff = ByteBuffer.wrap( sessionId.getBytes( 
US_ASCII ) );
@@ -129,7 +129,7 @@ public class SurefireMasterProcessChannelProcessorFactory
         }
     }
 
-    private static String parseSessionId( URI uri )
+    private static String extractSessionId( URI uri )
     {
         String query = uri.getQuery();
         if ( query == null )
diff --git 
a/surefire-booter/src/test/java/org/apache/maven/surefire/booter/ForkedBooterMockTest.java
 
b/surefire-booter/src/test/java/org/apache/maven/surefire/booter/ForkedBooterMockTest.java
index 6220bca..1982f7e 100644
--- 
a/surefire-booter/src/test/java/org/apache/maven/surefire/booter/ForkedBooterMockTest.java
+++ 
b/surefire-booter/src/test/java/org/apache/maven/surefire/booter/ForkedBooterMockTest.java
@@ -443,7 +443,7 @@ public class ForkedBooterMockTest
     {
         UUID uuid = UUID.randomUUID();
         URI uri = new URI( "tcp://localhost:12345?sessionId=" + uuid );
-        String parsed = invokeMethod( 
SurefireMasterProcessChannelProcessorFactory.class, "parseSessionId", uri );
+        String parsed = invokeMethod( 
SurefireMasterProcessChannelProcessorFactory.class, "extractSessionId", uri );
         assertThat( parsed )
             .isEqualTo( uuid.toString() );
     }
@@ -453,7 +453,7 @@ public class ForkedBooterMockTest
     {
         UUID uuid = UUID.randomUUID();
         URI uri = new URI( "tcp://localhost:12345?xxx=" + uuid );
-        String parsed = invokeMethod( 
SurefireMasterProcessChannelProcessorFactory.class, "parseSessionId", uri );
+        String parsed = invokeMethod( 
SurefireMasterProcessChannelProcessorFactory.class, "extractSessionId", uri );
         assertThat( parsed )
             .isNull();
     }

Reply via email to