You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2020/06/14 11:41:34 UTC

[GitHub] [maven-integration-testing] rfscholte opened a new pull request #66: [MNG-6656] Introduce base for build/consumer process

rfscholte opened a new pull request #66:
URL: https://github.com/apache/maven-integration-testing/pull/66


   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [maven-integration-testing] michael-o commented on a change in pull request #66: [MNG-6656] Introduce base for build/consumer process

Posted by GitBox <gi...@apache.org>.
michael-o commented on a change in pull request #66:
URL: https://github.com/apache/maven-integration-testing/pull/66#discussion_r439849717



##########
File path: core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5669ReadPomsOnce.java
##########
@@ -96,4 +97,58 @@ public void testit()
         }
         assertEquals( uniqueBuildingSources.size(), 167 /* is 168 minus superpom */ );
     }
+    
+    public void testWithBuildConsumer()
+                    throws Exception
+    {
+        // prepare JavaAgent
+        File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5669-read-poms-once" );
+        Verifier verifier = newVerifier( testDir.getAbsolutePath(), false );
+        Map<String, String> filterProperties =
+            Collections.singletonMap( "${javaAgentJar}",
+                                      verifier.getArtifactPath( "mng-coreit", "javaagent", "1.0-SNAPSHOT", "jar" ) );
+        verifier.filterFile( ".mvn/jvm.config", ".mvn/jvm.config", null, filterProperties );
+
+        verifier.setForkJvm( true ); // pick up agent
+        verifier.setMavenDebug( false );
+        verifier.setAutoclean( false );
+        verifier.addCliOption( "-q" );
+        verifier.addCliOption( "-U" );
+        verifier.addCliOption( "-Dmaven.experimental.buildconsumer=true" );
+        verifier.executeGoals( Arrays.asList( "verify" ) );
+        verifier.resetStreams();
+        
+        List<String> logTxt = verifier.loadLines( "log.txt", "utf-8" );
+        for ( String line : logTxt ) 
+        {
+            if ( line.startsWith( "Picked up JAVA_TOOL_OPTIONS:" ) )
+            {
+                logTxt.remove( line );
+                break;
+            }
+        }
+        assertEquals( logTxt.toString(), 168 + 4 /* reactor poms are read twice: file + raw (=XMLFilters) */, logTxt.size() );
+        
+        // analyze lines. It is a Hashmap, so we can't rely on the order
+        Set<String> uniqueBuildingSources = new HashSet<>( 168 );
+        final String buildSourceKey = "org.apache.maven.model.building.source=";
+        final int keyLength = buildSourceKey.length();
+        for( String line : logTxt )
+        {
+            int start = line.indexOf( buildSourceKey );
+            if ( start < 0 )
+            {
+                continue;
+            }
+            
+            int end = line.indexOf(", ", start);
+            if ( end < 0) 

Review comment:
       Whitespace missing

##########
File path: core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5669ReadPomsOnce.java
##########
@@ -96,4 +97,58 @@ public void testit()
         }
         assertEquals( uniqueBuildingSources.size(), 167 /* is 168 minus superpom */ );
     }
+    
+    public void testWithBuildConsumer()
+                    throws Exception
+    {
+        // prepare JavaAgent
+        File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5669-read-poms-once" );
+        Verifier verifier = newVerifier( testDir.getAbsolutePath(), false );
+        Map<String, String> filterProperties =
+            Collections.singletonMap( "${javaAgentJar}",
+                                      verifier.getArtifactPath( "mng-coreit", "javaagent", "1.0-SNAPSHOT", "jar" ) );
+        verifier.filterFile( ".mvn/jvm.config", ".mvn/jvm.config", null, filterProperties );
+
+        verifier.setForkJvm( true ); // pick up agent
+        verifier.setMavenDebug( false );
+        verifier.setAutoclean( false );
+        verifier.addCliOption( "-q" );
+        verifier.addCliOption( "-U" );
+        verifier.addCliOption( "-Dmaven.experimental.buildconsumer=true" );
+        verifier.executeGoals( Arrays.asList( "verify" ) );
+        verifier.resetStreams();
+        
+        List<String> logTxt = verifier.loadLines( "log.txt", "utf-8" );
+        for ( String line : logTxt ) 
+        {
+            if ( line.startsWith( "Picked up JAVA_TOOL_OPTIONS:" ) )
+            {
+                logTxt.remove( line );
+                break;
+            }
+        }
+        assertEquals( logTxt.toString(), 168 + 4 /* reactor poms are read twice: file + raw (=XMLFilters) */, logTxt.size() );
+        
+        // analyze lines. It is a Hashmap, so we can't rely on the order
+        Set<String> uniqueBuildingSources = new HashSet<>( 168 );
+        final String buildSourceKey = "org.apache.maven.model.building.source=";
+        final int keyLength = buildSourceKey.length();
+        for( String line : logTxt )
+        {
+            int start = line.indexOf( buildSourceKey );
+            if ( start < 0 )
+            {
+                continue;
+            }
+            
+            int end = line.indexOf(", ", start);

Review comment:
       Whitespace missing




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [maven-integration-testing] rfscholte commented on pull request #66: [MNG-6656] Introduce base for build/consumer process

Posted by GitBox <gi...@apache.org>.
rfscholte commented on pull request #66:
URL: https://github.com/apache/maven-integration-testing/pull/66#issuecomment-647775741


   Fixed in https://github.com/apache/maven-integration-testing/commit/79ed965031c27e8715c25ede79c7eb977ee26ed1


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [maven-integration-testing] rfscholte closed pull request #66: [MNG-6656] Introduce base for build/consumer process

Posted by GitBox <gi...@apache.org>.
rfscholte closed pull request #66:
URL: https://github.com/apache/maven-integration-testing/pull/66


   


----------------------------------------------------------------
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:
users@infra.apache.org