diff --git a/testsuite/src/test/java/org/keycloak/testsuite/TestApplication.java b/testsuite/src/test/java/org/keycloak/testsuite/TestApplication.java
index 0b1dcf5df8..6b8b1218ae 100755
--- a/testsuite/src/test/java/org/keycloak/testsuite/TestApplication.java
+++ b/testsuite/src/test/java/org/keycloak/testsuite/TestApplication.java
@@ -25,6 +25,9 @@ import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
+import javax.servlet.ServletContext;
+import javax.ws.rs.core.Context;
+
import org.jboss.resteasy.jwt.JsonSerialization;
import org.keycloak.representations.idm.CredentialRepresentation;
import org.keycloak.representations.idm.RealmRepresentation;
@@ -40,27 +43,8 @@ import org.keycloak.services.resources.SaasService;
*/
public class TestApplication extends KeycloakApplication {
- public static RealmRepresentation loadJson(String path)
- {
- InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(path);
- ByteArrayOutputStream os = new ByteArrayOutputStream();
- int c;
- try {
- while ( (c = is.read()) != -1)
- {
- os.write(c);
- }
- byte[] bytes = os.toByteArray();
- //System.out.println(new String(bytes));
-
- return JsonSerialization.fromBytes(RealmRepresentation.class, bytes);
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
-
- public TestApplication() {
- super();
+ public TestApplication(@Context ServletContext servletContext) {
+ super(servletContext);
KeycloakSession session = factory.createSession();
session.getTransaction().begin();
RealmManager realmManager = new RealmManager(session);
@@ -90,5 +74,21 @@ public class TestApplication extends KeycloakApplication {
}
+ public static RealmRepresentation loadJson(String path) {
+ InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(path);
+ ByteArrayOutputStream os = new ByteArrayOutputStream();
+ int c;
+ try {
+ while ((c = is.read()) != -1) {
+ os.write(c);
+ }
+ byte[] bytes = os.toByteArray();
+ // System.out.println(new String(bytes));
+
+ return JsonSerialization.fromBytes(RealmRepresentation.class, bytes);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
}
diff --git a/testsuite/src/test/resources/web.xml b/testsuite/src/test/resources/web.xml
index 76426e6ccd..243f73a3ed 100755
--- a/testsuite/src/test/resources/web.xml
+++ b/testsuite/src/test/resources/web.xml
@@ -21,6 +21,16 @@
true
+
+ Keycloak Session Management
+ org.keycloak.services.filters.KeycloakSessionServletFilter
+
+
+
+ Keycloak Session Management
+ /rest/*
+
+
Resteasy
/rest/*