Tibor17 commented on a change in pull request #300:
URL: https://github.com/apache/maven-surefire/pull/300#discussion_r436306303



##########
File path: 
maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/extensions/E2ETest.java
##########
@@ -184,4 +192,74 @@ public void close()
             .isPositive()
             .isLessThanOrEqualTo( 6_000L );
     }
+
+    @Test( timeout = 10_000L )
+    public void shouldAuthenticateClient() throws Exception
+    {
+        ForkNodeArguments forkNodeArguments = mock( ForkNodeArguments.class );
+        when( forkNodeArguments.getSessionId() ).thenReturn( UUID.randomUUID() 
);
+
+        try ( SurefireForkChannel server = new SurefireForkChannel( 
forkNodeArguments ) )
+        {
+            Thread t = new Thread()
+            {
+                @Override
+                public void run()
+                {
+                    SurefireMasterProcessChannelProcessorFactory client
+                        = new SurefireMasterProcessChannelProcessorFactory();
+                    try
+                    {
+                        client.connect( server.getForkNodeConnectionString() );
+                    }
+                    catch ( IOException e )
+                    {
+                        e.printStackTrace();
+                        throw new RuntimeException( e );
+                    }
+                }
+            };
+            t.setDaemon( true );
+            t.start();
+            server.connectToClient();
+        }
+    }
+
+    @Test( timeout = 10_000L )
+    public void shouldNotAuthenticateClient() throws Exception
+    {
+        ForkNodeArguments forkNodeArguments = mock( ForkNodeArguments.class );
+        when( forkNodeArguments.getSessionId() ).thenReturn( UUID.randomUUID() 
);
+
+        try ( SurefireForkChannel server = new SurefireForkChannel( 
forkNodeArguments ) )
+        {
+            Thread t = new Thread()
+            {
+                @Override
+                public void run()
+                {
+                    SurefireMasterProcessChannelProcessorFactory client
+                        = new SurefireMasterProcessChannelProcessorFactory();
+                    try
+                    {
+                        URI connectionString = new URI( 
server.getForkNodeConnectionString() );
+                        client.connect( "tcp://127.0.0.1:" + 
connectionString.getPort()

Review comment:
       @michael-o Well, for me the naming conventions are always the dilema of 
domain - who is watching.
   
   The `ForkStarter` creates this string passing it to the abstraction.
   If it is the class `ForkStarter`, it is the lifetime of JVM which is 
everything it understands - it does not know authentication in e.g. process 
pipes.
   Maybe some constraints are missing writen, e.g. in Javadoc.
   
   The domain of forked JVM operates with TCP authentication but only in one 
implementation, i.e. `SurefireMasterProcessChannelProcessorFactory`. The 
abstraction `MasterProcessChannelProcessorFactory` again has no notion.
   
   I am not against your opinion. Feel free to tell me your ideas.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to