From 27b855bc181b60b2dee8702867b42c36fdb4c9b0 Mon Sep 17 00:00:00 2001 From: pablo gonzalez granados Date: Fri, 17 Jun 2022 13:44:33 +0200 Subject: [PATCH] Add oracle example --- examples/database-oracle/pom.xml | 89 ++++++++ .../oracle/ApplicationExceptionMapper.java | 28 +++ .../io/quarkus/qe/database/oracle/Book.java | 17 ++ .../qe/database/oracle/BookResource.java | 78 +++++++ .../oracle/NotFoundExceptionMapper.java | 14 ++ .../oracle/ValidationExceptionMapper.java | 36 ++++ .../src/main/resources/application.properties | 3 + .../src/main/resources/import.sql | 7 + .../oracle/AbstractSqlDatabaseIT.java | 197 ++++++++++++++++++ .../oracle/DevModeOracleDatabaseIT.java | 41 ++++ .../DevModeOracleDevServiceDatabaseIT.java | 29 +++ .../oracle/OpenShiftOracleDatabaseIT.java | 7 + .../qe/database/oracle/OracleDatabaseIT.java | 27 +++ .../src/test/resources/import-in-test.sql | 7 + .../src/test/resources/test.properties | 3 + pom.xml | 1 + 16 files changed, 584 insertions(+) create mode 100644 examples/database-oracle/pom.xml create mode 100644 examples/database-oracle/src/main/java/io/quarkus/qe/database/oracle/ApplicationExceptionMapper.java create mode 100644 examples/database-oracle/src/main/java/io/quarkus/qe/database/oracle/Book.java create mode 100644 examples/database-oracle/src/main/java/io/quarkus/qe/database/oracle/BookResource.java create mode 100644 examples/database-oracle/src/main/java/io/quarkus/qe/database/oracle/NotFoundExceptionMapper.java create mode 100644 examples/database-oracle/src/main/java/io/quarkus/qe/database/oracle/ValidationExceptionMapper.java create mode 100644 examples/database-oracle/src/main/resources/application.properties create mode 100644 examples/database-oracle/src/main/resources/import.sql create mode 100644 examples/database-oracle/src/test/java/io/quarkus/qe/database/oracle/AbstractSqlDatabaseIT.java create mode 100644 examples/database-oracle/src/test/java/io/quarkus/qe/database/oracle/DevModeOracleDatabaseIT.java create mode 100644 examples/database-oracle/src/test/java/io/quarkus/qe/database/oracle/DevModeOracleDevServiceDatabaseIT.java create mode 100644 examples/database-oracle/src/test/java/io/quarkus/qe/database/oracle/OpenShiftOracleDatabaseIT.java create mode 100644 examples/database-oracle/src/test/java/io/quarkus/qe/database/oracle/OracleDatabaseIT.java create mode 100644 examples/database-oracle/src/test/resources/import-in-test.sql create mode 100644 examples/database-oracle/src/test/resources/test.properties diff --git a/examples/database-oracle/pom.xml b/examples/database-oracle/pom.xml new file mode 100644 index 000000000..ee8014672 --- /dev/null +++ b/examples/database-oracle/pom.xml @@ -0,0 +1,89 @@ + + + 4.0.0 + + io.quarkus.qe + quarkus-test-parent + 1.2.1.Beta1-SNAPSHOT + ../../ + + examples-database-oracle + jar + Quarkus - Test Framework - Examples - Database - Oracle + + + io.quarkus + quarkus-hibernate-orm-panache + + + io.quarkus + quarkus-hibernate-validator + + + io.quarkus + quarkus-resteasy-jackson + + + io.quarkus + quarkus-jdbc-oracle + + + io.quarkus.qe + quarkus-test-containers + test + + + io.quarkus.qe + quarkus-test-service-database + test + + + io.quarkus.qe + quarkus-test-openshift + test + + + + + + ${quarkus.platform.group-id} + quarkus-maven-plugin + ${quarkus.platform.version} + + + + build + + + + + + + + + + skip-tests-on-windows + + + windows + + + + + + maven-surefire-plugin + + true + + + + maven-failsafe-plugin + + true + + + + + + + diff --git a/examples/database-oracle/src/main/java/io/quarkus/qe/database/oracle/ApplicationExceptionMapper.java b/examples/database-oracle/src/main/java/io/quarkus/qe/database/oracle/ApplicationExceptionMapper.java new file mode 100644 index 000000000..1b291f865 --- /dev/null +++ b/examples/database-oracle/src/main/java/io/quarkus/qe/database/oracle/ApplicationExceptionMapper.java @@ -0,0 +1,28 @@ +package io.quarkus.qe.database.oracle; + +import javax.ws.rs.WebApplicationException; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import javax.ws.rs.ext.ExceptionMapper; +import javax.ws.rs.ext.Provider; + +import com.fasterxml.jackson.databind.ObjectMapper; + +@Provider +public class ApplicationExceptionMapper implements ExceptionMapper { + @Override + public Response toResponse(Exception exception) { + int code = Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(); + if (exception instanceof WebApplicationException) { + code = ((WebApplicationException) exception).getResponse().getStatus(); + } + + return Response.status(code) + .type(MediaType.APPLICATION_JSON) + .entity(new ObjectMapper().createObjectNode() + .put("code", code) + .put("error", exception.getMessage()) + .toString()) + .build(); + } +} diff --git a/examples/database-oracle/src/main/java/io/quarkus/qe/database/oracle/Book.java b/examples/database-oracle/src/main/java/io/quarkus/qe/database/oracle/Book.java new file mode 100644 index 000000000..d39f6a5d4 --- /dev/null +++ b/examples/database-oracle/src/main/java/io/quarkus/qe/database/oracle/Book.java @@ -0,0 +1,17 @@ +package io.quarkus.qe.database.oracle; + +import javax.persistence.Entity; +import javax.persistence.Table; +import javax.validation.constraints.NotBlank; + +import io.quarkus.hibernate.orm.panache.PanacheEntity; + +@Entity +@Table(name = "book") +public class Book extends PanacheEntity { + @NotBlank(message = "book title must be set") + public String title; + + @NotBlank(message = "book author must be set") + public String author; +} diff --git a/examples/database-oracle/src/main/java/io/quarkus/qe/database/oracle/BookResource.java b/examples/database-oracle/src/main/java/io/quarkus/qe/database/oracle/BookResource.java new file mode 100644 index 000000000..a7553090d --- /dev/null +++ b/examples/database-oracle/src/main/java/io/quarkus/qe/database/oracle/BookResource.java @@ -0,0 +1,78 @@ +package io.quarkus.qe.database.oracle; + +import java.util.List; + +import javax.transaction.Transactional; +import javax.validation.Valid; +import javax.ws.rs.ClientErrorException; +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.NotFoundException; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + +import io.quarkus.panache.common.Sort; + +@Path("/book") +@Produces(MediaType.APPLICATION_JSON) +@Consumes(MediaType.APPLICATION_JSON) +public class BookResource { + + @GET + public List getAll() { + return Book.listAll(Sort.by("title")); + } + + @GET + @Path("/{id}") + public Book get(@PathParam("id") Long id) { + Book book = Book.findById(id); + if (book == null) { + throw new NotFoundException("book '" + id + "' not found"); + } + return book; + } + + @POST + @Transactional + public Response create(@Valid Book book) { + if (book.id != null) { + throw new ClientErrorException("unexpected ID in request", ValidationExceptionMapper.UNPROCESSABLE_ENTITY); + } + + book.persist(); + return Response.ok(book).status(Response.Status.CREATED).build(); + } + + @PUT + @Path("/{id}") + @Transactional + public Book update(@PathParam("id") Long id, @Valid Book newBook) { + Book book = Book.findById(id); + if (book == null) { + throw new NotFoundException("book '" + id + "' not found"); + } + + book.title = newBook.title; + book.author = newBook.author; + return book; + } + + @DELETE + @Path("/{id}") + @Transactional + public Response delete(@PathParam("id") Long id) { + Book book = Book.findById(id); + if (book == null) { + throw new NotFoundException("book '" + id + "' not found"); + } + book.delete(); + return Response.noContent().build(); + } +} diff --git a/examples/database-oracle/src/main/java/io/quarkus/qe/database/oracle/NotFoundExceptionMapper.java b/examples/database-oracle/src/main/java/io/quarkus/qe/database/oracle/NotFoundExceptionMapper.java new file mode 100644 index 000000000..83e6cc615 --- /dev/null +++ b/examples/database-oracle/src/main/java/io/quarkus/qe/database/oracle/NotFoundExceptionMapper.java @@ -0,0 +1,14 @@ +package io.quarkus.qe.database.oracle; + +import javax.ws.rs.NotFoundException; +import javax.ws.rs.core.Response; +import javax.ws.rs.ext.ExceptionMapper; +import javax.ws.rs.ext.Provider; + +@Provider +public class NotFoundExceptionMapper implements ExceptionMapper { + @Override + public Response toResponse(NotFoundException exception) { + return new ApplicationExceptionMapper().toResponse(exception); + } +} diff --git a/examples/database-oracle/src/main/java/io/quarkus/qe/database/oracle/ValidationExceptionMapper.java b/examples/database-oracle/src/main/java/io/quarkus/qe/database/oracle/ValidationExceptionMapper.java new file mode 100644 index 000000000..a1f13799c --- /dev/null +++ b/examples/database-oracle/src/main/java/io/quarkus/qe/database/oracle/ValidationExceptionMapper.java @@ -0,0 +1,36 @@ +package io.quarkus.qe.database.oracle; + +import javax.validation.ConstraintViolation; +import javax.validation.ConstraintViolationException; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import javax.ws.rs.ext.ExceptionMapper; +import javax.ws.rs.ext.Provider; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.node.ArrayNode; + +@Provider +public class ValidationExceptionMapper implements ExceptionMapper { + + public static final int UNPROCESSABLE_ENTITY = 422; + + @Override + public Response toResponse(ConstraintViolationException exception) { + ObjectMapper mapper = new ObjectMapper(); + ArrayNode errors = mapper.createArrayNode(); + + for (ConstraintViolation constraintViolation : exception.getConstraintViolations()) { + errors.addObject() + .put("path", constraintViolation.getPropertyPath().toString()) + .put("message", constraintViolation.getMessage()); + } + + return Response.status(UNPROCESSABLE_ENTITY) + .type(MediaType.APPLICATION_JSON) + .entity(mapper.createObjectNode() + .put("code", UNPROCESSABLE_ENTITY) + .set("error", errors)) + .build(); + } +} diff --git a/examples/database-oracle/src/main/resources/application.properties b/examples/database-oracle/src/main/resources/application.properties new file mode 100644 index 000000000..9c6704ed1 --- /dev/null +++ b/examples/database-oracle/src/main/resources/application.properties @@ -0,0 +1,3 @@ +quarkus.datasource.db-kind=oracle +quarkus.hibernate-orm.sql-load-script=import.sql +quarkus.hibernate-orm.database.generation=drop-and-create diff --git a/examples/database-oracle/src/main/resources/import.sql b/examples/database-oracle/src/main/resources/import.sql new file mode 100644 index 000000000..3e89f794e --- /dev/null +++ b/examples/database-oracle/src/main/resources/import.sql @@ -0,0 +1,7 @@ +INSERT INTO book (id, title, author) VALUES (hibernate_sequence.NEXTVAL, 'Foundation', 'Isaac Asimov'); +INSERT INTO book (id, title, author) VALUES (hibernate_sequence.NEXTVAL, '2001: A Space Odyssey', 'Arthur C. Clarke'); +INSERT INTO book (id, title, author) VALUES (hibernate_sequence.NEXTVAL, 'Stranger in a Strange Land', 'Robert A. Heinlein'); +INSERT INTO book (id, title, author) VALUES (hibernate_sequence.NEXTVAL, 'Ender''s Game', 'Orson Scott Card'); +INSERT INTO book (id, title, author) VALUES (hibernate_sequence.NEXTVAL, 'Hyperion', 'Dan Simmons'); +INSERT INTO book (id, title, author) VALUES (hibernate_sequence.NEXTVAL, 'Anathem', 'Neal Stephenson'); +INSERT INTO book (id, title, author) VALUES (hibernate_sequence.NEXTVAL, 'Perdido Street Station', 'China Miéville'); diff --git a/examples/database-oracle/src/test/java/io/quarkus/qe/database/oracle/AbstractSqlDatabaseIT.java b/examples/database-oracle/src/test/java/io/quarkus/qe/database/oracle/AbstractSqlDatabaseIT.java new file mode 100644 index 000000000..526b32a77 --- /dev/null +++ b/examples/database-oracle/src/test/java/io/quarkus/qe/database/oracle/AbstractSqlDatabaseIT.java @@ -0,0 +1,197 @@ +package io.quarkus.qe.database.oracle; + +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.Matchers.containsInAnyOrder; +import static org.hamcrest.Matchers.hasSize; + +import org.apache.http.HttpStatus; +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.RestService; +import io.restassured.http.ContentType; + +@TestMethodOrder(MethodOrderer.OrderAnnotation.class) +public abstract class AbstractSqlDatabaseIT { + + private static final int VALID_ID = 8; + private static final int INVALID_ID = 999; + + @Test + @Order(1) + public void getAll() { + getApp().given() + .get("/book") + .then() + .statusCode(HttpStatus.SC_OK) + .body("", hasSize(7)); + } + + @Test + @Order(2) + public void get() { + getApp().given() + .get("/book/7") + .then() + .statusCode(HttpStatus.SC_OK) + .body("title", equalTo("Perdido Street Station")) + .body("author", equalTo("China Miéville")); + } + + @Test + @Order(3) + public void create() { + Book book = new Book(); + book.title = "Neuromancer"; + book.author = "William Gibson"; + + getApp().given() + .contentType(ContentType.JSON) + .body(book) + .post("/book") + .then() + .statusCode(HttpStatus.SC_CREATED) + .body("id", equalTo(VALID_ID)) + .body("title", equalTo("Neuromancer")) + .body("author", equalTo("William Gibson")); + + getApp().given() + .get("/book/8") + .then() + .statusCode(HttpStatus.SC_OK) + .body("title", equalTo("Neuromancer")) + .body("author", equalTo("William Gibson")); + } + + @Test + @Order(4) + public void createInvalidPayload() { + getApp().given() + .contentType(ContentType.TEXT) + .body("") + .post("/book") + .then() + .statusCode(HttpStatus.SC_UNSUPPORTED_MEDIA_TYPE) + .body("code", equalTo(HttpStatus.SC_UNSUPPORTED_MEDIA_TYPE)); + } + + @Test + @Order(5) + public void createBadPayload() { + Book book = new Book(); + book.id = Long.valueOf(INVALID_ID); + book.title = "foo"; + book.author = "bar"; + + getApp().given() + .contentType(ContentType.JSON) + .body(book) + .post("/book") + .then() + .statusCode(HttpStatus.SC_UNPROCESSABLE_ENTITY) + .body("code", equalTo(HttpStatus.SC_UNPROCESSABLE_ENTITY)) + .body("error", equalTo("unexpected ID in request")); + } + + @Test + @Order(6) + public void update() { + Book book = new Book(); + book.id = Long.valueOf(VALID_ID); + book.title = "Schismatrix"; + book.author = "Bruce Sterling"; + + getApp().given() + .contentType(ContentType.JSON) + .body(book) + .put("/book/8") + .then() + .statusCode(HttpStatus.SC_OK) + .body("id", equalTo(VALID_ID)) + .body("title", equalTo("Schismatrix")) + .body("author", equalTo("Bruce Sterling")); + + getApp().given() + .get("/book/" + VALID_ID) + .then() + .statusCode(HttpStatus.SC_OK) + .body("title", equalTo("Schismatrix")) + .body("author", equalTo("Bruce Sterling")); + } + + @Test + @Order(7) + public void updateWithUnknownId() { + Book book = new Book(); + book.id = Long.valueOf(INVALID_ID); + book.title = "foo"; + book.author = "bar"; + + getApp().given() + .contentType(ContentType.JSON) + .body(book) + .put("/book/999") + .then() + .statusCode(HttpStatus.SC_NOT_FOUND) + .body("code", equalTo(HttpStatus.SC_NOT_FOUND)) + .body("error", equalTo("book '999' not found")); + } + + @Test + @Order(8) + public void updateInvalidPayload() { + getApp().given() + .contentType(ContentType.TEXT) + .body("") + .put("/book/8") + .then() + .statusCode(HttpStatus.SC_UNSUPPORTED_MEDIA_TYPE) + .body("code", equalTo(HttpStatus.SC_UNSUPPORTED_MEDIA_TYPE)); + } + + @Test + @Order(9) + public void updateBadPayload() { + Book book = new Book(); + + getApp().given() + .contentType(ContentType.JSON) + .body(book) + .put("/book/8") + .then() + .statusCode(HttpStatus.SC_UNPROCESSABLE_ENTITY) + .body("code", equalTo(HttpStatus.SC_UNPROCESSABLE_ENTITY)) + .body("error.message", containsInAnyOrder("book title must be set", "book author must be set")); + } + + @Test + @Order(10) + public void delete() { + getApp().given() + .delete("/book/8") + .then() + .statusCode(HttpStatus.SC_NO_CONTENT); + + getApp().given() + .get("/book/8") + .then() + .statusCode(HttpStatus.SC_NOT_FOUND) + .body("code", equalTo(HttpStatus.SC_NOT_FOUND)) + .body("error", equalTo("book '8' not found")); + } + + @Test + @Order(11) + public void deleteWithUnknownId() { + getApp().given() + .delete("/book/999") + .then() + .statusCode(HttpStatus.SC_NOT_FOUND) + .body("code", equalTo(HttpStatus.SC_NOT_FOUND)) + .body("error", equalTo("book '999' not found")); + } + + protected abstract RestService getApp(); +} diff --git a/examples/database-oracle/src/test/java/io/quarkus/qe/database/oracle/DevModeOracleDatabaseIT.java b/examples/database-oracle/src/test/java/io/quarkus/qe/database/oracle/DevModeOracleDatabaseIT.java new file mode 100644 index 000000000..14014955e --- /dev/null +++ b/examples/database-oracle/src/test/java/io/quarkus/qe/database/oracle/DevModeOracleDatabaseIT.java @@ -0,0 +1,41 @@ +package io.quarkus.qe.database.oracle; + +import io.quarkus.test.bootstrap.DefaultService; +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.DevModeQuarkusApplication; + +/** + * This test verifies that resources in test can be used in DevMode. + */ +@DisabledOnNative +@QuarkusScenario +public class DevModeOracleDatabaseIT extends AbstractSqlDatabaseIT { + + static final String ORACLE_USER = "myuser"; + static final String ORACLE_PASSWORD = "user"; + static final String ORACLE_DATABASE = "mydb"; + static final int ORACLE_PORT = 1521; + + @Container(image = "docker.io/gvenzl/oracle-xe:21-slim", port = ORACLE_PORT, expectedLog = "DATABASE IS READY TO USE!") + static DefaultService database = new DefaultService() + .withProperty("APP_USER", ORACLE_USER) + .withProperty("APP_USER_PASSWORD", ORACLE_PASSWORD) + .withProperty("ORACLE_PASSWORD", ORACLE_PASSWORD) + .withProperty("ORACLE_DATABASE", ORACLE_DATABASE); + + @DevModeQuarkusApplication + static RestService app = new RestService() + .withProperty("quarkus.hibernate-orm.sql-load-script", "import-in-test.sql") + .withProperty("quarkus.datasource.username", ORACLE_USER) + .withProperty("quarkus.datasource.password", ORACLE_PASSWORD) + .withProperty("quarkus.datasource.jdbc.url", + () -> "jdbc:oracle:thin:@:" + database.getPort() + "/" + ORACLE_DATABASE); + + @Override + protected RestService getApp() { + return app; + } +} diff --git a/examples/database-oracle/src/test/java/io/quarkus/qe/database/oracle/DevModeOracleDevServiceDatabaseIT.java b/examples/database-oracle/src/test/java/io/quarkus/qe/database/oracle/DevModeOracleDevServiceDatabaseIT.java new file mode 100644 index 000000000..1e65ba802 --- /dev/null +++ b/examples/database-oracle/src/test/java/io/quarkus/qe/database/oracle/DevModeOracleDevServiceDatabaseIT.java @@ -0,0 +1,29 @@ +package io.quarkus.qe.database.oracle; + +import org.junit.jupiter.api.Test; + +import io.quarkus.test.bootstrap.RestService; +import io.quarkus.test.scenarios.QuarkusScenario; +import io.quarkus.test.scenarios.annotations.DisabledOnNative; +import io.quarkus.test.services.DevModeQuarkusApplication; + +/** + * Running Quarkus on DEV mode will spin up a Database instance automatically. + */ +@DisabledOnNative +@QuarkusScenario +public class DevModeOracleDevServiceDatabaseIT extends AbstractSqlDatabaseIT { + + @DevModeQuarkusApplication + static RestService app = new RestService(); + + @Override + protected RestService getApp() { + return app; + } + + @Test + public void verifyLogsToAssertDevMode() { + app.logs().assertContains("Profile DevModeOracleDevServiceDatabaseIT activated. Live Coding activated"); + } +} diff --git a/examples/database-oracle/src/test/java/io/quarkus/qe/database/oracle/OpenShiftOracleDatabaseIT.java b/examples/database-oracle/src/test/java/io/quarkus/qe/database/oracle/OpenShiftOracleDatabaseIT.java new file mode 100644 index 000000000..354e57723 --- /dev/null +++ b/examples/database-oracle/src/test/java/io/quarkus/qe/database/oracle/OpenShiftOracleDatabaseIT.java @@ -0,0 +1,7 @@ +package io.quarkus.qe.database.oracle; + +import io.quarkus.test.scenarios.OpenShiftScenario; + +@OpenShiftScenario +public class OpenShiftOracleDatabaseIT extends OracleDatabaseIT { +} diff --git a/examples/database-oracle/src/test/java/io/quarkus/qe/database/oracle/OracleDatabaseIT.java b/examples/database-oracle/src/test/java/io/quarkus/qe/database/oracle/OracleDatabaseIT.java new file mode 100644 index 000000000..d4b67b566 --- /dev/null +++ b/examples/database-oracle/src/test/java/io/quarkus/qe/database/oracle/OracleDatabaseIT.java @@ -0,0 +1,27 @@ +package io.quarkus.qe.database.oracle; + +import static io.quarkus.qe.database.oracle.DevModeOracleDatabaseIT.ORACLE_PORT; + +import io.quarkus.test.bootstrap.OracleService; +import io.quarkus.test.bootstrap.RestService; +import io.quarkus.test.scenarios.QuarkusScenario; +import io.quarkus.test.services.Container; +import io.quarkus.test.services.QuarkusApplication; + +@QuarkusScenario +public class OracleDatabaseIT extends AbstractSqlDatabaseIT { + + @Container(image = "docker.io/gvenzl/oracle-xe:21-slim", port = ORACLE_PORT, expectedLog = "DATABASE IS READY TO USE!") + static OracleService database = new OracleService(); + + @QuarkusApplication + static RestService app = new RestService() + .withProperty("quarkus.datasource.username", database.getUser()) + .withProperty("quarkus.datasource.password", database.getPassword()) + .withProperty("quarkus.datasource.jdbc.url", database::getJdbcUrl); + + @Override + protected RestService getApp() { + return app; + } +} diff --git a/examples/database-oracle/src/test/resources/import-in-test.sql b/examples/database-oracle/src/test/resources/import-in-test.sql new file mode 100644 index 000000000..3e89f794e --- /dev/null +++ b/examples/database-oracle/src/test/resources/import-in-test.sql @@ -0,0 +1,7 @@ +INSERT INTO book (id, title, author) VALUES (hibernate_sequence.NEXTVAL, 'Foundation', 'Isaac Asimov'); +INSERT INTO book (id, title, author) VALUES (hibernate_sequence.NEXTVAL, '2001: A Space Odyssey', 'Arthur C. Clarke'); +INSERT INTO book (id, title, author) VALUES (hibernate_sequence.NEXTVAL, 'Stranger in a Strange Land', 'Robert A. Heinlein'); +INSERT INTO book (id, title, author) VALUES (hibernate_sequence.NEXTVAL, 'Ender''s Game', 'Orson Scott Card'); +INSERT INTO book (id, title, author) VALUES (hibernate_sequence.NEXTVAL, 'Hyperion', 'Dan Simmons'); +INSERT INTO book (id, title, author) VALUES (hibernate_sequence.NEXTVAL, 'Anathem', 'Neal Stephenson'); +INSERT INTO book (id, title, author) VALUES (hibernate_sequence.NEXTVAL, 'Perdido Street Station', 'China Miéville'); diff --git a/examples/database-oracle/src/test/resources/test.properties b/examples/database-oracle/src/test/resources/test.properties new file mode 100644 index 000000000..0b033fb40 --- /dev/null +++ b/examples/database-oracle/src/test/resources/test.properties @@ -0,0 +1,3 @@ +ts.app.log.enable=true +ts.database.log.enable=true +ts.database.openshift.use-internal-service-as-url=true diff --git a/pom.xml b/pom.xml index 400650e14..002555f0a 100644 --- a/pom.xml +++ b/pom.xml @@ -370,6 +370,7 @@ examples/jaeger examples/database-mysql examples/database-postgresql + examples/database-oracle examples/external-applications