[MNG-7740] Remove old temporary consumer*pom files from buildDir (#263)

Co-authored-by: Giovanni van der Schelde <Giovanni.vanderSchelde@infosupport.com>
Co-authored-by: Giovanni van der Schelde <gvdschelde@gmail.com>
This commit is contained in:
Guillaume Nodet 2023-06-05 16:24:36 +02:00 committed by GitHub
parent 74c1775d05
commit 81abb5870c
3 changed files with 85 additions and 0 deletions

View File

@ -0,0 +1,76 @@
/*
* 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.
*/
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 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;
import org.apache.maven.shared.verifier.Verifier;
import org.apache.maven.shared.verifier.util.ResourceExtractor;
import org.junit.jupiter.api.Test;
class MavenITmng7740ConsumerBuildShouldCleanUpOldFilesTest extends AbstractMavenIntegrationTestCase {
protected MavenITmng7740ConsumerBuildShouldCleanUpOldFilesTest() {
super("[4.0.0-alpha-6,)");
}
@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.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 no consumer pom file.", consumerFiles.size() == 0);
}
}
}

View File

@ -120,6 +120,7 @@ public class TestSuiteOrdering implements ClassOrderer {
* the tests are to finishing. Newer tests are also more likely to fail, so this is
* a fail fast technique as well.
*/
suite.addTestSuite(MavenITmng7740ConsumerBuildShouldCleanUpOldFilesTest.class);
suite.addTestSuite(MavenITmng7587Jsr330.class);
suite.addTestSuite(MavenITmng7038RootdirTest.class);
suite.addTestSuite(MavenITmng7697PomWithEmojiTest.class);

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.maven.its.mng7740</groupId>
<artifactId>test</artifactId>
<version>1.0-SNAPSHOT</version>
</project>