-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1151 from jedla97/enable-tod-app
Enable TODO app
- Loading branch information
Showing
4 changed files
with
53 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 0 additions & 4 deletions
4
examples/external-applications/src/test/java/io/quarkus/qe/OpenShiftTodoDemoIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 47 additions & 11 deletions
58
examples/external-applications/src/test/java/io/quarkus/qe/TodoDemoIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,84 @@ | ||
package io.quarkus.qe; | ||
|
||
import static org.hamcrest.Matchers.is; | ||
|
||
import org.apache.http.HttpStatus; | ||
import org.junit.jupiter.api.Disabled; | ||
import org.junit.jupiter.api.MethodOrderer; | ||
import org.junit.jupiter.api.Order; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.TestMethodOrder; | ||
|
||
import io.quarkus.test.bootstrap.PostgresqlService; | ||
import io.quarkus.test.bootstrap.RestService; | ||
import io.quarkus.test.scenarios.QuarkusScenario; | ||
import io.quarkus.test.scenarios.annotations.DisabledOnNative; | ||
import io.quarkus.test.services.Container; | ||
import io.quarkus.test.services.GitRepositoryQuarkusApplication; | ||
import io.restassured.http.ContentType; | ||
|
||
// TODO: enable when Quarkus QuickStarts migrates to Quarkus 3 | ||
@Disabled("Disabled until Quarkus 3 is released and TODO application migrates to it") | ||
@DisabledOnNative(reason = "This scenario is using uber-jar, so it's incompatible with Native") | ||
@QuarkusScenario | ||
@TestMethodOrder(MethodOrderer.OrderAnnotation.class) | ||
public class TodoDemoIT { | ||
private static final String REPO = "https://github.com/quarkusio/todo-demo-app.git"; | ||
private static final String DEFAULT_ARGS = "-DskipTests=true -Dquarkus.platform.group-id=${QUARKUS_PLATFORM_GROUP-ID} -Dquarkus.platform.version=${QUARKUS_PLATFORM_VERSION} "; | ||
private static final String UBER = "-Dquarkus.package.jar.type=uber-jar "; | ||
private static final String NO_SUFFIX = "-Dquarkus.package.jar.add-runner-suffix=false"; | ||
|
||
@Container(image = "${postgresql.image}", port = 5432, expectedLog = "is ready") | ||
static PostgresqlService database = new PostgresqlService() | ||
// store data in /tmp/psql as in OpenShift we don't have permissions to /var/lib/postgresql/data | ||
.withProperty("PGDATA", "/tmp/psql"); | ||
|
||
@GitRepositoryQuarkusApplication(repo = REPO, mavenArgs = DEFAULT_ARGS + UBER) | ||
static final RestService app = new RestService(); | ||
static final RestService app = new RestService() | ||
.withProperty("quarkus.datasource.username", database.getUser()) | ||
.withProperty("quarkus.datasource.password", database.getPassword()) | ||
.withProperty("quarkus.datasource.jdbc.url", database::getJdbcUrl); | ||
|
||
@GitRepositoryQuarkusApplication(repo = REPO, artifact = "todo-backend-1.0-SNAPSHOT-runner.jar", mavenArgs = DEFAULT_ARGS | ||
+ UBER) | ||
static final RestService explicit = new RestService(); | ||
|
||
private static final String NO_SUFFIX = "-Dquarkus.package.add-runner-suffix=false"; | ||
static final RestService explicit = new RestService() | ||
.withProperty("quarkus.datasource.username", database.getUser()) | ||
.withProperty("quarkus.datasource.password", database.getPassword()) | ||
.withProperty("quarkus.datasource.jdbc.url", database::getJdbcUrl); | ||
|
||
@GitRepositoryQuarkusApplication(repo = REPO, artifact = "todo-backend-1.0-SNAPSHOT.jar", mavenArgs = DEFAULT_ARGS + UBER | ||
+ NO_SUFFIX) | ||
static final RestService unsuffixed = new RestService(); | ||
static final RestService unsuffixed = new RestService() | ||
.withProperty("quarkus.datasource.username", database.getUser()) | ||
.withProperty("quarkus.datasource.password", database.getPassword()) | ||
.withProperty("quarkus.datasource.jdbc.url", database::getJdbcUrl); | ||
|
||
@Test | ||
@Order(1) | ||
public void verify() { | ||
app.given().get().then().statusCode(HttpStatus.SC_OK); | ||
app.given() | ||
.contentType(ContentType.JSON) | ||
.body("{\"title\": \"Use Quarkus\", \"order\": 1, \"url\": \"https://quarkus.io\"}") | ||
.post("/api") | ||
.then() | ||
.statusCode(HttpStatus.SC_CREATED); | ||
} | ||
|
||
@Test | ||
@Order(2) | ||
public void verifyExplicitArtifact() { | ||
explicit.given().get().then().statusCode(HttpStatus.SC_OK); | ||
explicit.given() | ||
.accept(ContentType.JSON) | ||
.get("/api/1") | ||
.then() | ||
.statusCode(HttpStatus.SC_OK) | ||
.body("title", is("Use Quarkus")); | ||
} | ||
|
||
@Test | ||
@Order(3) | ||
public void verifyNoSuffix() { | ||
unsuffixed.given().get().then().statusCode(HttpStatus.SC_OK); | ||
unsuffixed.given() | ||
.pathParam("id", 1) | ||
.delete("/api/{id}") | ||
.then() | ||
.statusCode(HttpStatus.SC_NO_CONTENT); | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
examples/external-applications/src/test/resources/test.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
ts.appuberjar.openshift.template=/uber-jar-quarkus-s2i-source-build-template.yml | ||
ts.database.openshift.use-internal-service-as-url=true |