You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "mthmulders (via GitHub)" <gi...@apache.org> on 2023/05/23 08:53:20 UTC

[GitHub] [maven-integration-testing] mthmulders commented on a diff in pull request #260: [MNG-7740] Add test for target directory being flooded with consumer*pom files

mthmulders commented on code in PR #260:
URL: https://github.com/apache/maven-integration-testing/pull/260#discussion_r1201840115


##########
core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7740ConsumerBuildShouldCleanUpOldFilesTest.java:
##########
@@ -0,0 +1,63 @@
+package org.apache.maven.it;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.shared.verifier.Verifier;
+import org.apache.maven.shared.verifier.util.ResourceExtractor;
+import org.junit.jupiter.api.Test;
+
+import java.io.File;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+class MavenITmng7740ConsumerBuildShouldCleanUpOldFilesTest
+        extends AbstractMavenIntegrationTestCase
+{
+
+    protected MavenITmng7740ConsumerBuildShouldCleanUpOldFilesTest()
+    {
+        super( "[4.0.0-alpha-5,)" );
+    }
+
+    @Test
+    void testConsumerBuildShouldCleanUpOldConsumerFiles()
+            throws Exception
+    {
+        File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-7740-consumer-files" );
+
+        Verifier verifier = newVerifier( testDir.getAbsolutePath() );
+        verifier.addCliArgument( "validate" );
+
+        verifier.execute();
+        verifier.execute();
+
+        verifier.verifyErrorFreeLog();
+
+        try(Stream<Path> stream = Files.walk(testDir.toPath())) {
+            final List<Path> consumerFiles = stream.filter( path -> path.getFileName().toString().contains("consumer")
+                            && path.getFileName().toString().contains( "pom" ))
+                    .collect( Collectors.toList());
+            assertTrue("Expected only 1 consumer pom file.", consumerFiles.size() == 1);

Review Comment:
   If we end up with the solution that cleans files on Maven exit (https://github.com/apache/maven/pull/1117) this should check for 0 rather than 1.



##########
core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7740ConsumerBuildShouldCleanUpOldFilesTest.java:
##########
@@ -0,0 +1,63 @@
+package org.apache.maven.it;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.shared.verifier.Verifier;
+import org.apache.maven.shared.verifier.util.ResourceExtractor;
+import org.junit.jupiter.api.Test;
+
+import java.io.File;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+class MavenITmng7740ConsumerBuildShouldCleanUpOldFilesTest
+        extends AbstractMavenIntegrationTestCase
+{
+
+    protected MavenITmng7740ConsumerBuildShouldCleanUpOldFilesTest()
+    {
+        super( "[4.0.0-alpha-5,)" );

Review Comment:
   I think by now this should be alpha-6.



-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

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