diff --git a/pom.xml b/pom.xml
index 3c64547..ef9ef09 100644
--- a/pom.xml
+++ b/pom.xml
@@ -36,7 +36,7 @@
1.0.2.Final
- 7.0.1.GA
+ 7.1.5.GA
2.19.1
2.1.1
@@ -94,6 +94,13 @@
pom
import
+
+ org.testcontainers
+ testcontainers-bom
+ 1.19.8
+ pom
+ import
+
@@ -134,6 +141,7 @@
junit
junit
+ 4.13.2
test
@@ -157,6 +165,23 @@
resteasy-multipart-provider
test
+
+ org.testcontainers
+ testcontainers
+ test
+
+
+ ch.qos.logback
+ logback-classic
+ 1.2.7
+ test
+
+
+ io.rest-assured
+ rest-assured
+ 5.4.0
+ test
+
-
- BASIC
- RealmUsersRoles
-
+
+
+
+
-
- resteasy.role.based.security
- true
-
+
+
+
+
-
-
- Tasks
- /ws/tasks/*
-
-
- Users
- /ws/users/*
-
+
+
+
+
+
+
+
+
+
-
- guest
-
-
+
+
+
+
-
- guest
-
+
+
+
diff --git a/src/test/java/org/jboss/as/quickstarts/tasksrs/DefaultDeployment.java b/src/test/java/org/jboss/as/quickstarts/tasksrs/DefaultDeployment.java
index 8e05bcc..3e450d9 100644
--- a/src/test/java/org/jboss/as/quickstarts/tasksrs/DefaultDeployment.java
+++ b/src/test/java/org/jboss/as/quickstarts/tasksrs/DefaultDeployment.java
@@ -44,6 +44,13 @@ public DefaultDeployment withPersistence() {
return this;
}
+ public DefaultDeployment withOriginalPersistence() {
+ webArchive = webArchive.addAsResource("META-INF/persistence.xml", "META-INF/persistence.xml")
+ .addAsWebInfResource(new File(WEBAPP_SRC, "WEB-INF/tasks-rs-ds.xml"))
+ .addAsWebInfResource(new File(WEBAPP_SRC, "WEB-INF/web.xml"));
+ return this;
+ }
+
public DefaultDeployment withImportedData() {
webArchive = webArchive.addAsResource("import.sql");
return this;
diff --git a/src/test/java/org/jboss/as/quickstarts/tasksrs/service/UserResourceIntegrationTest.java b/src/test/java/org/jboss/as/quickstarts/tasksrs/service/UserResourceIntegrationTest.java
new file mode 100644
index 0000000..79ecbcf
--- /dev/null
+++ b/src/test/java/org/jboss/as/quickstarts/tasksrs/service/UserResourceIntegrationTest.java
@@ -0,0 +1,66 @@
+package org.jboss.as.quickstarts.tasksrs.service;
+
+import com.openshift.service.DemoResource;
+import io.restassured.RestAssured;
+import io.restassured.http.ContentType;
+import io.restassured.specification.RequestSpecification;
+import org.jboss.as.quickstarts.tasksrs.DefaultDeployment;
+import org.jboss.as.quickstarts.tasksrs.model.Resources;
+import org.jboss.as.quickstarts.tasksrs.model.Task;
+import org.jboss.as.quickstarts.tasksrs.model.TaskDao;
+import org.jboss.as.quickstarts.tasksrs.model.TaskDaoImpl;
+import org.jboss.as.quickstarts.tasksrs.model.User;
+import org.jboss.as.quickstarts.tasksrs.model.UserDao;
+import org.jboss.as.quickstarts.tasksrs.model.UserDaoImpl;
+import org.jboss.shrinkwrap.api.exporter.ZipExporter;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.testcontainers.containers.GenericContainer;
+import org.testcontainers.images.builder.Transferable;
+
+import java.io.ByteArrayOutputStream;
+
+import static org.hamcrest.Matchers.equalTo;
+import static org.hamcrest.Matchers.hasSize;
+
+public class UserResourceIntegrationTest {
+
+ public static byte[] deployment() throws IllegalArgumentException {
+ WebArchive webArchive = new DefaultDeployment().withOriginalPersistence().withImportedData().getArchive()
+ .addClasses(Resources.class, User.class, UserDao.class, Task.class, TaskDao.class, TaskDaoImpl.class, UserDaoImpl.class, TaskResource.class, UserResource.class, DemoResource.class);
+ ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+ webArchive.as(ZipExporter.class).exportTo(outputStream);
+ return outputStream.toByteArray();
+ }
+
+ @ClassRule
+ public static final GenericContainer> wildfly
+ = new GenericContainer<>("jboss/wildfly:21.0.2.Final")
+ .withExposedPorts(8080, 9990)
+ .withCopyToContainer(
+ Transferable.of(deployment()),
+ "/opt/jboss/wildfly/standalone/deployments/test.war");
+
+ @Test
+ public void test() {
+ RequestSpecification requestSpecification = RestAssured.given()
+ .baseUri("http://" + wildfly.getHost() + ":" + wildfly.getMappedPort(8080) + "/test");
+ requestSpecification
+ .get("/ws/demo/healthcheck")
+ .andReturn()
+ .then()
+ .statusCode(200)
+ .body("health", equalTo(1))
+ .body("response", equalTo("Health Status: 1"));
+
+ requestSpecification
+ .accept(ContentType.JSON)
+ .get("/ws/users")
+ .andReturn()
+ .then()
+ .statusCode(200)
+ .body(".", hasSize(2));
+ }
+
+}
diff --git a/src/test/resources/logback-test.xml b/src/test/resources/logback-test.xml
new file mode 100644
index 0000000..5370155
--- /dev/null
+++ b/src/test/resources/logback-test.xml
@@ -0,0 +1,17 @@
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n
+
+
+
+
+
+
+
+
+
+
+
+
+