Skip to content

Commit

Permalink
Make RESTEasy Reactive the default codestart
Browse files Browse the repository at this point in the history
Also only add the default codestart if no extensions have been selected.
Quarkus is more than a REST framework and this behavior is annoying for
anything that is not REST and does not have a codestart.
  • Loading branch information
gsmet committed Mar 19, 2022
1 parent 8fa5628 commit 0998cac
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ public void testCreateAppDefaults() throws Exception {
String pomContent = validateBasicIdentifiers(CreateProjectHelper.DEFAULT_GROUP_ID,
CreateProjectHelper.DEFAULT_ARTIFACT_ID,
CreateProjectHelper.DEFAULT_VERSION);
Assertions.assertTrue(pomContent.contains("<artifactId>quarkus-resteasy</artifactId>"),
"pom.xml should contain quarkus-resteasy:\n" + pomContent);
Assertions.assertTrue(pomContent.contains("<artifactId>quarkus-resteasy-reactive</artifactId>"),
"pom.xml should contain quarkus-resteasy-reactive:\n" + pomContent);

CliDriver.valdiateGeneratedSourcePackage(project, "org/acme");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public enum Tooling implements DataKey {

public enum ExtensionCodestart implements DataKey {
RESTEASY,
RESTEAST_REACTIVE,
RESTEASY_REACTIVE,
SPRING_WEB
}

Expand Down Expand Up @@ -127,14 +127,15 @@ protected Collection<Codestart> select(QuarkusCodestartProjectInput projectInput
.filter(c -> !isExample(c) || projectInput.getExample() == null || c.matches(projectInput.getExample()))
.collect(Collectors.toCollection(ArrayList::new));

// include default codestarts if no code selected
// include default codestarts if no code selected and no extensions have been selected
if (projectInput.getAppContent().contains(CODE)
&& projectInput.getExtensions().isEmpty()
&& projectCodestarts.stream()
.noneMatch(c -> c.getType() == CodestartType.CODE && !c.getSpec().isPreselected())) {
final Codestart defaultCodestart = codestarts.stream()
.filter(c -> c.matches(ExtensionCodestart.RESTEASY.key()))
.filter(c -> c.matches(ExtensionCodestart.RESTEASY_REACTIVE.key()))
.findFirst().orElseThrow(() -> new CodestartStructureException(
ExtensionCodestart.RESTEASY.key() + " codestart not found"));
ExtensionCodestart.RESTEASY_REACTIVE.key() + " codestart not found"));
final String languageName = findLanguageName(projectCodestarts);
if (defaultCodestart.implementsLanguage(languageName)) {
projectCodestarts.add(defaultCodestart);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ public class GreetingResource {
@GET
@Produces(MediaType.TEXT_PLAIN)
public String hello() {
return "Hello RESTEasy";
return "Hello from RESTEasy Reactive";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public void testHelloEndpoint() {
.when().get("/hello")
.then()
.statusCode(200)
.body(is("Hello RESTEasy"));
.body(is("Hello from RESTEasy Reactive"));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ runtime/src/
runtime/src/main/
runtime/src/main/resources/
runtime/src/main/resources/META-INF/
runtime/src/main/resources/META-INF/quarkus-extension.yaml
runtime/src/main/resources/META-INF/quarkus-extension.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public void testProjectGenerationFromScratch() throws MavenInvocationException,
&& d.getType().equals("pom"))).isTrue();

assertThat(
model.getDependencies().stream().anyMatch(d -> d.getArtifactId().equalsIgnoreCase("quarkus-resteasy")
model.getDependencies().stream().anyMatch(d -> d.getArtifactId().equalsIgnoreCase("quarkus-resteasy-reactive")
&& d.getVersion() == null)).isTrue();

assertThat(model.getProfiles()).hasSize(1);
Expand Down

0 comments on commit 0998cac

Please sign in to comment.