Skip to content

Commit

Permalink
Improve testId in QuarkusCodestartTest and fix QuarkusCodestartBuildIT
Browse files Browse the repository at this point in the history
  • Loading branch information
ia3andy committed Nov 25, 2021
1 parent c64c335 commit 4bae693
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,18 @@
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;
import java.util.List;
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;
Expand Down Expand Up @@ -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.<String> 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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,11 @@ class QuarkusCodestartBuildIT extends PlatformAwareTestBase {

private static final Path testDirPath = Paths.get("target/quarkus-codestart-build-test");

private static final Set<String> EXCLUDED = Sets.newHashSet("spring-web-codestart", "picocli-codestart",
"hibernate-orm-codestart", "reactive-messaging");
private static final Set<String> EXCLUDED = Sets.newHashSet(
"spring-web-codestart",
"picocli-codestart",
"hibernate-orm-codestart",
"reactive-messaging-codestart");

@BeforeAll
static void setUp() throws IOException {
Expand Down Expand Up @@ -135,7 +138,7 @@ private String genName(String buildtool, String language, List<String> codestart
if (codestarts.isEmpty()) {
name += "-default";
} else if (codestarts.size() > 2) {
name += "-" + UUID.randomUUID().toString();
name += "-" + UUID.randomUUID();
} else {
name += "-" + String.join("-", codestarts);
}
Expand Down

0 comments on commit 4bae693

Please sign in to comment.