From 4bae693ce948e531ad2bbf08d15c13caf717b89b Mon Sep 17 00:00:00 2001 From: Andy Damevin Date: Thu, 25 Nov 2021 17:04:57 +0100 Subject: [PATCH] Improve testId in QuarkusCodestartTest and fix QuarkusCodestartBuildIT --- .../testing/codestarts/QuarkusCodestartTest.java | 14 ++++++++++---- .../quarkus/QuarkusCodestartBuildIT.java | 9 ++++++--- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/independent-projects/tools/devtools-testing/src/main/java/io/quarkus/devtools/testing/codestarts/QuarkusCodestartTest.java b/independent-projects/tools/devtools-testing/src/main/java/io/quarkus/devtools/testing/codestarts/QuarkusCodestartTest.java index f741564f59aa5..e13049c20ada2 100644 --- a/independent-projects/tools/devtools-testing/src/main/java/io/quarkus/devtools/testing/codestarts/QuarkusCodestartTest.java +++ b/independent-projects/tools/devtools-testing/src/main/java/io/quarkus/devtools/testing/codestarts/QuarkusCodestartTest.java @@ -22,7 +22,6 @@ import java.io.IOException; import java.nio.file.Path; import java.nio.file.Paths; -import java.time.Instant; import java.util.Collection; import java.util.Collections; import java.util.HashSet; @@ -30,7 +29,11 @@ import java.util.Map; import java.util.Objects; import java.util.Set; +import java.util.UUID; import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; import org.assertj.core.api.AbstractPathAssert; import org.assertj.core.api.Assertions; import org.assertj.core.api.ListAssert; @@ -280,9 +283,12 @@ private AbstractPathAssert checkGeneratedSource(String sourceDir, Language la } private String getTestId() { - String tool = buildTool != null ? buildTool.getKey() + "-" : ""; - String suffix = codestarts.isEmpty() ? String.valueOf(Instant.now().toEpochMilli()) : String.join("-", codestarts); - return tool + suffix; + final String id = Stream.of( + buildTool != null ? Stream.of(buildTool.getKey()) : Stream. empty(), + this.extensions.stream().map(ArtifactCoords::getArtifactId), + this.codestarts.stream(), + Stream.of(UUID.randomUUID().toString())).flatMap(Function.identity()).collect(Collectors.joining("-")); + return id; } private void generateRealDataProjectIfNeeded(Path path, Language language) throws IOException { diff --git a/integration-tests/devtools/src/test/java/io/quarkus/devtools/codestarts/quarkus/QuarkusCodestartBuildIT.java b/integration-tests/devtools/src/test/java/io/quarkus/devtools/codestarts/quarkus/QuarkusCodestartBuildIT.java index 61b967ffe9ef7..415070a21d879 100644 --- a/integration-tests/devtools/src/test/java/io/quarkus/devtools/codestarts/quarkus/QuarkusCodestartBuildIT.java +++ b/integration-tests/devtools/src/test/java/io/quarkus/devtools/codestarts/quarkus/QuarkusCodestartBuildIT.java @@ -36,8 +36,11 @@ class QuarkusCodestartBuildIT extends PlatformAwareTestBase { private static final Path testDirPath = Paths.get("target/quarkus-codestart-build-test"); - private static final Set EXCLUDED = Sets.newHashSet("spring-web-codestart", "picocli-codestart", - "hibernate-orm-codestart", "reactive-messaging"); + private static final Set EXCLUDED = Sets.newHashSet( + "spring-web-codestart", + "picocli-codestart", + "hibernate-orm-codestart", + "reactive-messaging-codestart"); @BeforeAll static void setUp() throws IOException { @@ -135,7 +138,7 @@ private String genName(String buildtool, String language, List codestart if (codestarts.isEmpty()) { name += "-default"; } else if (codestarts.size() > 2) { - name += "-" + UUID.randomUUID().toString(); + name += "-" + UUID.randomUUID(); } else { name += "-" + String.join("-", codestarts); }