Skip to content

Commit

Permalink
Fix codestarts compatibility with older CLI
Browse files Browse the repository at this point in the history
(cherry picked from commit 5bc19c0)
  • Loading branch information
ia3andy authored and gsmet committed Mar 19, 2024
1 parent 4cd8024 commit 34ef25e
Show file tree
Hide file tree
Showing 12 changed files with 144 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{#include readme-header /}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{#include index-entry path=resource.path/}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# We need this for compat with older CLI versions
name: resteasy-reactive-codestart
ref: resteasy-reactive
type: code
tags: extension-codestart
metadata:
title: REST
description: Easily start your REST Web Services
related-guide-section: https://quarkus.io/guides/getting-started-reactive#reactive-jax-rs-resources
language:
base:
data:
resource:
class-name: GreetingResource
path: "/hello"
response: "Hello from Quarkus REST"
dependencies:
- io.quarkus:quarkus-rest
test-dependencies:
- io.rest-assured:rest-assured
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package org.acme;

import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;

@Path("{resource.path}")
public class {resource.class-name} {

@GET
@Produces(MediaType.TEXT_PLAIN)
public String hello() {
return "{resource.response}";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package org.acme;

import io.quarkus.test.junit.QuarkusIntegrationTest;

@QuarkusIntegrationTest
class {resource.class-name}IT extends {resource.class-name}Test {
// Execute the same tests but in packaged mode.
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package org.acme;

import io.quarkus.test.junit.QuarkusTest;
import org.junit.jupiter.api.Test;

import static io.restassured.RestAssured.given;
import static org.hamcrest.CoreMatchers.is;

@QuarkusTest
class {resource.class-name}Test {
@Test
void testHelloEndpoint() {
given()
.when().get("{resource.path}")
.then()
.statusCode(200)
.body(is("{resource.response}"));
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package org.acme

import jakarta.ws.rs.GET
import jakarta.ws.rs.Path
import jakarta.ws.rs.Produces
import jakarta.ws.rs.core.MediaType

@Path("{resource.path}")
class {resource.class-name} {

@GET
@Produces(MediaType.TEXT_PLAIN)
fun hello() = "{resource.response}"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package org.acme

import io.quarkus.test.junit.QuarkusIntegrationTest

@QuarkusIntegrationTest
class {resource.class-name}IT : {resource.class-name}Test()
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package org.acme

import io.quarkus.test.junit.QuarkusTest
import io.restassured.RestAssured.given
import org.hamcrest.CoreMatchers.`is`
import org.junit.jupiter.api.Test

@QuarkusTest
class {resource.class-name}Test {

@Test
fun testHelloEndpoint() {
given()
.`when`().get("{resource.path}")
.then()
.statusCode(200)
.body(`is`("{resource.response}"))
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package org.acme

import jakarta.ws.rs.\{GET, Path, Produces}
import jakarta.ws.rs.core.MediaType

@Path("{resource.path}")
class {resource.class-name} {

@GET
@Produces(Array[String](MediaType.TEXT_PLAIN))
def hello() = "{resource.response}"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package org.acme

import io.quarkus.test.junit.QuarkusIntegrationTest

@QuarkusIntegrationTest
class {resource.class-name}IT extends {resource.class-name}Test
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package org.acme

import io.quarkus.test.junit.QuarkusTest
import io.restassured.RestAssured.given
import org.hamcrest.CoreMatchers.`is`
import org.junit.jupiter.api.Test

@QuarkusTest
class {resource.class-name}Test {

@Test
def testHelloEndpoint() = {
given()
.`when`().get("{resource.path}")
.then()
.statusCode(200)
.body(`is`("{resource.response}"))
}

}

0 comments on commit 34ef25e

Please sign in to comment.