changeset 757:bc789d180439

Added authentication information to all requests.
author Raimund Renkert <raimund.renkert@intevation.de>
date Tue, 03 Nov 2015 09:21:34 +0100
parents d4d765729a04
children 57d9b125a7c5
files src/test/java/de/intevation/lada/BaseTest.java src/test/java/de/intevation/lada/test/land/KommentarM.java src/test/java/de/intevation/lada/test/land/KommentarP.java src/test/java/de/intevation/lada/test/land/Messprogramm.java src/test/java/de/intevation/lada/test/land/Messung.java src/test/java/de/intevation/lada/test/land/Messwert.java src/test/java/de/intevation/lada/test/land/Ort.java src/test/java/de/intevation/lada/test/land/Probe.java src/test/java/de/intevation/lada/test/land/Query.java src/test/java/de/intevation/lada/test/land/Zusatzwert.java src/test/java/de/intevation/lada/test/stamm/Stammdaten.java
diffstat 11 files changed, 254 insertions(+), 78 deletions(-) [+]
line wrap: on
line diff
--- a/src/test/java/de/intevation/lada/BaseTest.java	Tue Nov 03 09:15:59 2015 +0100
+++ b/src/test/java/de/intevation/lada/BaseTest.java	Tue Nov 03 09:21:34 2015 +0100
@@ -26,6 +26,10 @@
 
     private static String ARCHIVE_NAME = "lada-basis-test.war";
 
+    public static String TEST_USER = "testeins";
+
+    public static String TEST_ROLES = "cn=Imis-World, cn=mst_06010, cn=mst_11010";
+
     private static Logger logger = Logger.getLogger(BaseTest.class);
 
     protected static List<Protocol> testProtocol;
@@ -40,6 +44,7 @@
         WebArchive archive = ShrinkWrap.create(WebArchive.class, ARCHIVE_NAME)
             .addPackages(true, Package.getPackage("de.intevation.lada"))
             .addAsResource("log4j.properties", "log4j.properties")
+            .addAsResource("shibboleth.properties", "shibboleth.properties")
             .addAsResource("probequery.json", "probequery.json")
             .addAsResource("messprogrammquery.json", "messprogrammquery.json")
             .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
--- a/src/test/java/de/intevation/lada/test/land/KommentarM.java	Tue Nov 03 09:15:59 2015 +0100
+++ b/src/test/java/de/intevation/lada/test/land/KommentarM.java	Tue Nov 03 09:21:34 2015 +0100
@@ -24,6 +24,7 @@
 
 import org.junit.Assert;
 
+import de.intevation.lada.BaseTest;
 import de.intevation.lada.Protocol;
 
 
@@ -37,7 +38,7 @@
     private static final String COMPARE_KOMMENTARM =
         "{\"messungsId\":5,\"datum\":1336627500000,\"erzeuger\":\"12010\"," +
         "\"id\":478,\"text\":\"Hofladen Lenzen geschlossen\",\"owner\":false," +
-        "\"readonly\":false}";
+        "\"readonly\":true}";
 
     private static final String CREATE_KOMMENTARM =
         "{\"messungsId\":\"MID\",\"erzeuger\":\"06010\",\"text\":" +
@@ -78,7 +79,10 @@
         Client client = ClientBuilder.newClient();
         WebTarget target = client.target(baseUrl + "mkommentar");
         /* Request all objects*/
-        Response response = target.request().get();
+        Response response = target.request()
+            .header("X-SHIB-user", BaseTest.TEST_USER)
+            .header("X-SHIB-roles", BaseTest.TEST_ROLES)
+            .get();
         String entity = response.readEntity(String.class);
         try{
             /* Try to parse the response*/
@@ -122,7 +126,10 @@
             WebTarget target = client.target(baseUrl + "mkommentar/478");
             prot.addInfo("kommentarId", 478);
             /* Request an object by id*/
-            Response response = target.request().get();
+            Response response = target.request()
+                .header("X-SHIB-user", BaseTest.TEST_USER)
+                .header("X-SHIB-roles", BaseTest.TEST_ROLES)
+                .get();
             String entity = response.readEntity(String.class);
             /* Try to parse the response*/
             JsonReader fromServiceReader =
@@ -163,7 +170,10 @@
                 client.target(baseUrl + "mkommentar?messungId=988");
             prot.addInfo("filter", "messungId=988");
             /* Request the objects using the filter*/
-            Response response = target.request().get();
+            Response response = target.request()
+                .header("X-SHIB-user", BaseTest.TEST_USER)
+                .header("X-SHIB-roles", BaseTest.TEST_ROLES)
+                .get();
             String entity = response.readEntity(String.class);
             /* Try to parse the response*/
             JsonReader reader = Json.createReader(new StringReader(entity));
@@ -205,7 +215,10 @@
             WebTarget target = client.target(baseUrl + "mkommentar");
             /* Send a post request containing a new kommentar*/
             String mess = CREATE_KOMMENTARM.replace("MID", messungId.toString());
-            Response response = target.request().post(
+            Response response = target.request()
+                .header("X-SHIB-user", BaseTest.TEST_USER)
+                .header("X-SHIB-roles", BaseTest.TEST_ROLES)
+                .post(
                     Entity.entity(mess, MediaType.APPLICATION_JSON));
             String entity = response.readEntity(String.class);
             /* Try to parse the response*/
@@ -249,7 +262,10 @@
                 client.target(baseUrl + "mkommentar/" + createdKommentarId);
             prot.addInfo("kommentarId", createdKommentarId);
             /* Request a kommentar with the id saved when created a kommentar*/
-            Response response = target.request().get();
+            Response response = target.request()
+                .header("X-SHIB-user", BaseTest.TEST_USER)
+                .header("X-SHIB-roles", BaseTest.TEST_ROLES)
+                .get();
             String entity = response.readEntity(String.class);
             /* Try to parse the response*/
             JsonReader reader = Json.createReader(new StringReader(entity));
@@ -262,8 +278,10 @@
             prot.addInfo("updated to", "neu");
             /* Send the updated kommentar via put reauest*/
             WebTarget putTarget = client.target(baseUrl + "mkommentar/" + createdKommentarId);
-            Response updated = putTarget.request().put(
-                Entity.entity(updatedEntity, MediaType.APPLICATION_JSON));
+            Response updated = putTarget.request()
+                .header("X-SHIB-user", BaseTest.TEST_USER)
+                .header("X-SHIB-roles", BaseTest.TEST_ROLES)
+                .put(Entity.entity(updatedEntity, MediaType.APPLICATION_JSON));
             /* Try to parse the response*/
             JsonReader updatedReader = Json.createReader(
                 new StringReader(updated.readEntity(String.class)));
@@ -302,7 +320,10 @@
                 client.target(baseUrl + "mkommentar/" + createdKommentarId);
             prot.addInfo("kommentarId", createdKommentarId);
             /* Delete a kommentar with the saved id*/
-            Response response = target.request().delete();
+            Response response = target.request()
+                .header("X-SHIB-user", BaseTest.TEST_USER)
+                .header("X-SHIB-roles", BaseTest.TEST_ROLES)
+                .delete();
             String entity = response.readEntity(String.class);
             /* Try to parse the response*/
             JsonReader reader = Json.createReader(new StringReader(entity));
--- a/src/test/java/de/intevation/lada/test/land/KommentarP.java	Tue Nov 03 09:15:59 2015 +0100
+++ b/src/test/java/de/intevation/lada/test/land/KommentarP.java	Tue Nov 03 09:21:34 2015 +0100
@@ -24,6 +24,7 @@
 
 import org.junit.Assert;
 
+import de.intevation.lada.BaseTest;
 import de.intevation.lada.Protocol;
 
 
@@ -37,8 +38,8 @@
     private static final String COMPARE_KOMMENTARP =
         "{\"datum\":1321002077000,\"erzeuger\":\"06010\",\"id\":1,\"text\":" +
         "\"Die Probe wurde in Darmstadt gammaspektrometrisch gemessen und " +
-        "für die Sr-Bestimmung verascht. \",\"probeId\":361,\"owner\":false," +
-        "\"readonly\":false}";
+        "für die Sr-Bestimmung verascht. \",\"probeId\":361,\"owner\":true," +
+        "\"readonly\":true}";
 
     private static final String CREATE_KOMMENTARP =
         "{\"probeId\":\"PID\",\"erzeuger\":\"11010\",\"text\":" +
@@ -79,7 +80,10 @@
         Client client = ClientBuilder.newClient();
         WebTarget target = client.target(baseUrl + "pkommentar");
         /* Request all objects*/
-        Response response = target.request().get();
+        Response response = target.request()
+            .header("X-SHIB-user", BaseTest.TEST_USER)
+            .header("X-SHIB-roles", BaseTest.TEST_ROLES)
+            .get();
         String entity = response.readEntity(String.class);
         try{
             /* Try to parse the response*/
@@ -123,7 +127,10 @@
             WebTarget target = client.target(baseUrl + "pkommentar/1");
             prot.addInfo("kommentarId", 1);
             /* Request an object by id*/
-            Response response = target.request().get();
+            Response response = target.request()
+                .header("X-SHIB-user", BaseTest.TEST_USER)
+                .header("X-SHIB-roles", BaseTest.TEST_ROLES)
+                .get();
             String entity = response.readEntity(String.class);
             /* Try to parse the response*/
             JsonReader fromServiceReader =
@@ -164,7 +171,10 @@
                 client.target(baseUrl + "pkommentar?probeId=400");
             prot.addInfo("filter", "probeId=400");
             /* Request the objects using the filter*/
-            Response response = target.request().get();
+            Response response = target.request()
+                .header("X-SHIB-user", BaseTest.TEST_USER)
+                .header("X-SHIB-roles", BaseTest.TEST_ROLES)
+                .get();
             String entity = response.readEntity(String.class);
             /* Try to parse the response*/
             JsonReader reader = Json.createReader(new StringReader(entity));
@@ -206,8 +216,10 @@
             WebTarget target = client.target(baseUrl + "pkommentar");
             /* Send a post request containing a new kommentar*/
             String mess = CREATE_KOMMENTARP.replace("PID", probeId.toString());
-            Response response = target.request().post(
-                    Entity.entity(mess, MediaType.APPLICATION_JSON));
+            Response response = target.request()
+                .header("X-SHIB-user", BaseTest.TEST_USER)
+                .header("X-SHIB-roles", BaseTest.TEST_ROLES)
+                .post(Entity.entity(mess, MediaType.APPLICATION_JSON));
             String entity = response.readEntity(String.class);
             /* Try to parse the response*/
             JsonReader fromServiceReader =
@@ -250,7 +262,10 @@
                 client.target(baseUrl + "pkommentar/" + createdKommentarId);
             prot.addInfo("kommentarId", createdKommentarId);
             /* Request a kommentar with the id saved when created a kommentar*/
-            Response response = target.request().get();
+            Response response = target.request()
+                .header("X-SHIB-user", BaseTest.TEST_USER)
+                .header("X-SHIB-roles", BaseTest.TEST_ROLES)
+                .get();
             String entity = response.readEntity(String.class);
             /* Try to parse the response*/
             JsonReader reader = Json.createReader(new StringReader(entity));
@@ -263,8 +278,10 @@
             prot.addInfo("updated to", "neu");
             /* Send the updated kommentar via put reauest*/
             WebTarget putTarget = client.target(baseUrl + "pkommentar/" + createdKommentarId);
-            Response updated = putTarget.request().put(
-                Entity.entity(updatedEntity, MediaType.APPLICATION_JSON));
+            Response updated = putTarget.request()
+                .header("X-SHIB-user", BaseTest.TEST_USER)
+                .header("X-SHIB-roles", BaseTest.TEST_ROLES)
+                .put(Entity.entity(updatedEntity, MediaType.APPLICATION_JSON));
             /* Try to parse the response*/
             JsonReader updatedReader = Json.createReader(
                 new StringReader(updated.readEntity(String.class)));
@@ -303,7 +320,10 @@
                 client.target(baseUrl + "pkommentar/" + createdKommentarId);
             prot.addInfo("kommentarId", createdKommentarId);
             /* Delete a kommentar with the saved id*/
-            Response response = target.request().delete();
+            Response response = target.request()
+                .header("X-SHIB-user", BaseTest.TEST_USER)
+                .header("X-SHIB-roles", BaseTest.TEST_ROLES)
+                .delete();
             String entity = response.readEntity(String.class);
             /* Try to parse the response*/
             JsonReader reader = Json.createReader(new StringReader(entity));
--- a/src/test/java/de/intevation/lada/test/land/Messprogramm.java	Tue Nov 03 09:15:59 2015 +0100
+++ b/src/test/java/de/intevation/lada/test/land/Messprogramm.java	Tue Nov 03 09:21:34 2015 +0100
@@ -24,6 +24,7 @@
 
 import org.junit.Assert;
 
+import de.intevation.lada.BaseTest;
 import de.intevation.lada.Protocol;
 
 /**
@@ -84,7 +85,10 @@
         Client client = ClientBuilder.newClient();
         WebTarget target = client.target(baseUrl + "messprogramm");
         /* Request all objects*/
-        Response response = target.request().get();
+        Response response = target.request()
+            .header("X-SHIB-user", BaseTest.TEST_USER)
+            .header("X-SHIB-roles", BaseTest.TEST_ROLES)
+            .get();
         String entity = response.readEntity(String.class);
         try{
             /* Try to parse the response*/
@@ -128,7 +132,10 @@
             WebTarget target = client.target(baseUrl + "messprogramm/1");
             prot.addInfo("messprogrammId", 1);
             /* Request a object by id*/
-            Response response = target.request().get();
+            Response response = target.request()
+                .header("X-SHIB-user", BaseTest.TEST_USER)
+                .header("X-SHIB-roles", BaseTest.TEST_ROLES)
+                .get();
             String entity = response.readEntity(String.class);
             /* Try to parse the response*/
             JsonReader fromServiceReader =
@@ -169,7 +176,10 @@
                 client.target(baseUrl + "messprogramm?qid=1");
             prot.addInfo("filter", "qid=1");
             /* Request the objects using the filter*/
-            Response response = target.request().get();
+            Response response = target.request()
+                .header("X-SHIB-user", BaseTest.TEST_USER)
+                .header("X-SHIB-roles", BaseTest.TEST_ROLES)
+                .get();
             String entity = response.readEntity(String.class);
             /* Try to parse the response*/
             JsonReader reader = Json.createReader(new StringReader(entity));
@@ -209,8 +219,10 @@
             Client client = ClientBuilder.newClient();
             WebTarget target = client.target(baseUrl + "messprogramm");
             /* Send a post request containing a new object*/
-            Response response = target.request().post(
-                    Entity.entity(CREATE, MediaType.APPLICATION_JSON));
+            Response response = target.request()
+                .header("X-SHIB-user", BaseTest.TEST_USER)
+                .header("X-SHIB-roles", BaseTest.TEST_ROLES)
+                .post(Entity.entity(CREATE, MediaType.APPLICATION_JSON));
             String entity = response.readEntity(String.class);
             /* Try to parse the response*/
             JsonReader fromServiceReader =
@@ -253,7 +265,10 @@
                 client.target(baseUrl + "messprogramm/" + createdId);
             prot.addInfo("messprogrammId", createdId);
             /* Request a messprogramm with the saved id*/
-            Response response = target.request().get();
+            Response response = target.request()
+                .header("X-SHIB-user", BaseTest.TEST_USER)
+                .header("X-SHIB-roles", BaseTest.TEST_ROLES)
+                .get();
             String entity = response.readEntity(String.class);
             /* Try to parse the response*/
             JsonReader reader = Json.createReader(new StringReader(entity));
@@ -266,8 +281,10 @@
             prot.addInfo("updated to", "Mess2");
             /* Send the updated messung via put request*/
             WebTarget putTarget = client.target(baseUrl + "messprogramm/" + createdId);
-            Response updated = putTarget.request().put(
-                Entity.entity(updatedEntity, MediaType.APPLICATION_JSON));
+            Response updated = putTarget.request()
+                .header("X-SHIB-user", BaseTest.TEST_USER)
+                .header("X-SHIB-roles", BaseTest.TEST_ROLES)
+                .put(Entity.entity(updatedEntity, MediaType.APPLICATION_JSON));
             /* Try to parse the response*/
             JsonReader updatedReader = Json.createReader(
                 new StringReader(updated.readEntity(String.class)));
@@ -306,7 +323,10 @@
                 client.target(baseUrl + "messprogramm/" + createdId);
             prot.addInfo("messprogrammId", createdId);
             /* Delete a messung with the saved id*/
-            Response response = target.request().delete();
+            Response response = target.request()
+                .header("X-SHIB-user", BaseTest.TEST_USER)
+                .header("X-SHIB-roles", BaseTest.TEST_ROLES)
+                .delete();
             String entity = response.readEntity(String.class);
             /* Try to parse the response*/
             JsonReader reader = Json.createReader(new StringReader(entity));
--- a/src/test/java/de/intevation/lada/test/land/Messung.java	Tue Nov 03 09:15:59 2015 +0100
+++ b/src/test/java/de/intevation/lada/test/land/Messung.java	Tue Nov 03 09:21:34 2015 +0100
@@ -22,9 +22,9 @@
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 
-import org.hamcrest.CoreMatchers;
 import org.junit.Assert;
 
+import de.intevation.lada.BaseTest;
 import de.intevation.lada.Protocol;
 
 /**
@@ -77,7 +77,10 @@
         Client client = ClientBuilder.newClient();
         WebTarget target = client.target(baseUrl + "messung");
         /* Request all objects*/
-        Response response = target.request().get();
+        Response response = target.request()
+            .header("X-SHIB-user", BaseTest.TEST_USER)
+            .header("X-SHIB-roles", BaseTest.TEST_ROLES)
+            .get();
         String entity = response.readEntity(String.class);
         try{
             /* Try to parse the response*/
@@ -117,7 +120,10 @@
             WebTarget target = client.target(baseUrl + "messung/1");
             prot.addInfo("messungId", 1);
             /* Request a object by id*/
-            Response response = target.request().get();
+            Response response = target.request()
+                .header("X-SHIB-user", BaseTest.TEST_USER)
+                .header("X-SHIB-roles", BaseTest.TEST_ROLES)
+                .get();
             String entity = response.readEntity(String.class);
             /* Try to parse the response*/
             JsonReader fromServiceReader =
@@ -157,7 +163,10 @@
                 client.target(baseUrl + "messung?probeId=1");
             prot.addInfo("filter", "probeId=1");
             /* Request the objects using the filter*/
-            Response response = target.request().get();
+            Response response = target.request()
+                .header("X-SHIB-user", BaseTest.TEST_USER)
+                .header("X-SHIB-roles", BaseTest.TEST_ROLES)
+                .get();
             String entity = response.readEntity(String.class);
             /* Try to parse the response*/
             JsonReader reader = Json.createReader(new StringReader(entity));
@@ -199,8 +208,10 @@
             WebTarget target = client.target(baseUrl + "messung");
             /* Send a post request containing a new object*/
             String mess = CREATE_MESSUNG.replace("PID", probeId.toString());
-            Response response = target.request().post(
-                    Entity.entity(mess, MediaType.APPLICATION_JSON));
+            Response response = target.request()
+                .header("X-SHIB-user", BaseTest.TEST_USER)
+                .header("X-SHIB-roles", BaseTest.TEST_ROLES)
+                .post(Entity.entity(mess, MediaType.APPLICATION_JSON));
             String entity = response.readEntity(String.class);
             /* Try to parse the response*/
             JsonReader fromServiceReader =
@@ -243,7 +254,10 @@
                 client.target(baseUrl + "messung/" + createdMessungId);
             prot.addInfo("messungsId", createdMessungId);
             /* Request a messung with the saved id*/
-            Response response = target.request().get();
+            Response response = target.request()
+                .header("X-SHIB-user", BaseTest.TEST_USER)
+                .header("X-SHIB-roles", BaseTest.TEST_ROLES)
+                .get();
             String entity = response.readEntity(String.class);
             /* Try to parse the response*/
             JsonReader reader = Json.createReader(new StringReader(entity));
@@ -256,8 +270,10 @@
             prot.addInfo("updated to", "G1");
             /* Send the updated messung via put request*/
             WebTarget putTarget = client.target(baseUrl + "messung/" + createdMessungId);
-            Response updated = putTarget.request().put(
-                Entity.entity(updatedEntity, MediaType.APPLICATION_JSON));
+            Response updated = putTarget.request()
+                .header("X-SHIB-user", BaseTest.TEST_USER)
+                .header("X-SHIB-roles", BaseTest.TEST_ROLES)
+                .put(Entity.entity(updatedEntity, MediaType.APPLICATION_JSON));
             /* Try to parse the response*/
             JsonReader updatedReader = Json.createReader(
                 new StringReader(updated.readEntity(String.class)));
@@ -296,7 +312,10 @@
                 client.target(baseUrl + "messung/" + createdMessungId);
             prot.addInfo("messungId", createdMessungId);
             /* Delete a messung with the saved id*/
-            Response response = target.request().delete();
+            Response response = target.request()
+                .header("X-SHIB-user", BaseTest.TEST_USER)
+                .header("X-SHIB-roles", BaseTest.TEST_ROLES)
+                .delete();
             String entity = response.readEntity(String.class);
             /* Try to parse the response*/
             JsonReader reader = Json.createReader(new StringReader(entity));
--- a/src/test/java/de/intevation/lada/test/land/Messwert.java	Tue Nov 03 09:15:59 2015 +0100
+++ b/src/test/java/de/intevation/lada/test/land/Messwert.java	Tue Nov 03 09:21:34 2015 +0100
@@ -24,6 +24,7 @@
 
 import org.junit.Assert;
 
+import de.intevation.lada.BaseTest;
 import de.intevation.lada.Protocol;
 
 /**
@@ -78,7 +79,10 @@
         Client client = ClientBuilder.newClient();
         WebTarget target = client.target(baseUrl + "messwert");
         /* Request all objects*/
-        Response response = target.request().get();
+        Response response = target.request()
+            .header("X-SHIB-user", BaseTest.TEST_USER)
+            .header("X-SHIB-roles", BaseTest.TEST_ROLES)
+            .get();
         String entity = response.readEntity(String.class);
         try{
             /* Try to parse the response*/
@@ -118,7 +122,10 @@
             WebTarget target = client.target(baseUrl + "messwert/1");
             prot.addInfo("messwertId", 1);
             /* Request a object by id*/
-            Response response = target.request().get();
+            Response response = target.request()
+                .header("X-SHIB-user", BaseTest.TEST_USER)
+                .header("X-SHIB-roles", BaseTest.TEST_ROLES)
+                .get();
             String entity = response.readEntity(String.class);
             /* Try to parse the response*/
             JsonReader fromServiceReader =
@@ -158,7 +165,10 @@
                 client.target(baseUrl + "messwert?messungId=1");
             prot.addInfo("filter", "messungId=1");
             /* Request the objects using the filter*/
-            Response response = target.request().get();
+            Response response = target.request()
+                .header("X-SHIB-user", BaseTest.TEST_USER)
+                .header("X-SHIB-roles", BaseTest.TEST_ROLES)
+                .get();
             String entity = response.readEntity(String.class);
             /* Try to parse the response*/
             JsonReader reader = Json.createReader(new StringReader(entity));
@@ -200,8 +210,10 @@
             WebTarget target = client.target(baseUrl + "messwert");
             /* Send a post request containing a new object*/
             String mess = CREATE_MESSWERT.replace("MID", messungId.toString());
-            Response response = target.request().post(
-                    Entity.entity(mess, MediaType.APPLICATION_JSON));
+            Response response = target.request()
+                .header("X-SHIB-user", BaseTest.TEST_USER)
+                .header("X-SHIB-roles", BaseTest.TEST_ROLES)
+                .post(Entity.entity(mess, MediaType.APPLICATION_JSON));
             String entity = response.readEntity(String.class);
             /* Try to parse the response*/
             JsonReader fromServiceReader =
@@ -244,7 +256,10 @@
                 client.target(baseUrl + "messwert/" + createdMesswertId);
             prot.addInfo("messwertId", createdMesswertId);
             /* Request a messwert with the saved id*/
-            Response response = target.request().get();
+            Response response = target.request()
+                .header("X-SHIB-user", BaseTest.TEST_USER)
+                .header("X-SHIB-roles", BaseTest.TEST_ROLES)
+                .get();
             String entity = response.readEntity(String.class);
             /* Try to parse the response*/
             JsonReader reader = Json.createReader(new StringReader(entity));
@@ -257,8 +272,10 @@
             prot.addInfo("updated to", "69");
             /* Send the updated messwert via put request*/
             WebTarget putTarget = client.target(baseUrl + "messwert/" + createdMesswertId);
-            Response updated = putTarget.request().put(
-                Entity.entity(updatedEntity, MediaType.APPLICATION_JSON));
+            Response updated = putTarget.request()
+                .header("X-SHIB-user", BaseTest.TEST_USER)
+                .header("X-SHIB-roles", BaseTest.TEST_ROLES)
+                .put(Entity.entity(updatedEntity, MediaType.APPLICATION_JSON));
             /* Try to parse the response*/
             JsonReader updatedReader = Json.createReader(
                 new StringReader(updated.readEntity(String.class)));
@@ -297,7 +314,10 @@
                 client.target(baseUrl + "messwert/" + createdMesswertId);
             prot.addInfo("messwertId", createdMesswertId);
             /* Delete a messwert with the saved id*/
-            Response response = target.request().delete();
+            Response response = target.request()
+                .header("X-SHIB-user", BaseTest.TEST_USER)
+                .header("X-SHIB-roles", BaseTest.TEST_ROLES)
+                .delete();
             String entity = response.readEntity(String.class);
             /* Try to parse the response*/
             JsonReader reader = Json.createReader(new StringReader(entity));
--- a/src/test/java/de/intevation/lada/test/land/Ort.java	Tue Nov 03 09:15:59 2015 +0100
+++ b/src/test/java/de/intevation/lada/test/land/Ort.java	Tue Nov 03 09:21:34 2015 +0100
@@ -24,6 +24,7 @@
 
 import org.junit.Assert;
 
+import de.intevation.lada.BaseTest;
 import de.intevation.lada.Protocol;
 
 /**
@@ -74,7 +75,10 @@
         Client client = ClientBuilder.newClient();
         WebTarget target = client.target(baseUrl + "ort");
         /* Request all objects*/
-        Response response = target.request().get();
+        Response response = target.request()
+            .header("X-SHIB-user", BaseTest.TEST_USER)
+            .header("X-SHIB-roles", BaseTest.TEST_ROLES)
+            .get();
         String entity = response.readEntity(String.class);
         try{
             /* Try to parse the response*/
@@ -114,7 +118,10 @@
             WebTarget target = client.target(baseUrl + "ort/1");
             prot.addInfo("ortId", 1);
             /* Request a object by id*/
-            Response response = target.request().get();
+            Response response = target.request()
+                .header("X-SHIB-user", BaseTest.TEST_USER)
+                .header("X-SHIB-roles", BaseTest.TEST_ROLES)
+                .get();
             String entity = response.readEntity(String.class);
             /* Try to parse the response*/
             JsonReader fromServiceReader =
@@ -154,7 +161,10 @@
                 client.target(baseUrl + "ort?probeId=1");
             prot.addInfo("filter", "probeId=1");
             /* Request the objects using the filter*/
-            Response response = target.request().get();
+            Response response = target.request()
+                .header("X-SHIB-user", BaseTest.TEST_USER)
+                .header("X-SHIB-roles", BaseTest.TEST_ROLES)
+                .get();
             String entity = response.readEntity(String.class);
             /* Try to parse the response*/
             JsonReader reader = Json.createReader(new StringReader(entity));
@@ -196,8 +206,10 @@
             WebTarget target = client.target(baseUrl + "ort");
             /* Send a post request containing a new object*/
             String mess = CREATE.replace("PID", probeId.toString());
-            Response response = target.request().post(
-                    Entity.entity(mess, MediaType.APPLICATION_JSON));
+            Response response = target.request()
+                .header("X-SHIB-user", BaseTest.TEST_USER)
+                .header("X-SHIB-roles", BaseTest.TEST_ROLES)
+                .post(Entity.entity(mess, MediaType.APPLICATION_JSON));
             String entity = response.readEntity(String.class);
             /* Try to parse the response*/
             JsonReader fromServiceReader =
@@ -240,7 +252,10 @@
                 client.target(baseUrl + "ort/" + createdId);
             prot.addInfo("ortId", createdId);
             /* Request an object with the saved id*/
-            Response response = target.request().get();
+            Response response = target.request()
+                .header("X-SHIB-user", BaseTest.TEST_USER)
+                .header("X-SHIB-roles", BaseTest.TEST_ROLES)
+                .get();
             String entity = response.readEntity(String.class);
             /* Try to parse the response*/
             JsonReader reader = Json.createReader(new StringReader(entity));
@@ -253,8 +268,10 @@
             prot.addInfo("updated to", "zusatz");
             /* Send the updated messwert via put request*/
             WebTarget putTarget = client.target(baseUrl + "ort/" + createdId);
-            Response updated = putTarget.request().put(
-                Entity.entity(updatedEntity, MediaType.APPLICATION_JSON));
+            Response updated = putTarget.request()
+                .header("X-SHIB-user", BaseTest.TEST_USER)
+                .header("X-SHIB-roles", BaseTest.TEST_ROLES)
+                .put(Entity.entity(updatedEntity, MediaType.APPLICATION_JSON));
             /* Try to parse the response*/
             JsonReader updatedReader = Json.createReader(
                 new StringReader(updated.readEntity(String.class)));
@@ -293,7 +310,10 @@
                 client.target(baseUrl + "ort/" + createdId);
             prot.addInfo("ortId", createdId);
             /* Delete the object with the saved id*/
-            Response response = target.request().delete();
+            Response response = target.request()
+                .header("X-SHIB-user", BaseTest.TEST_USER)
+                .header("X-SHIB-roles", BaseTest.TEST_ROLES)
+                .delete();
             String entity = response.readEntity(String.class);
             /* Try to parse the response*/
             JsonReader reader = Json.createReader(new StringReader(entity));
--- a/src/test/java/de/intevation/lada/test/land/Probe.java	Tue Nov 03 09:15:59 2015 +0100
+++ b/src/test/java/de/intevation/lada/test/land/Probe.java	Tue Nov 03 09:21:34 2015 +0100
@@ -24,6 +24,7 @@
 
 import org.junit.Assert;
 
+import de.intevation.lada.BaseTest;
 import de.intevation.lada.Protocol;
 
 
@@ -91,7 +92,10 @@
         Client client = ClientBuilder.newClient();
         WebTarget target = client.target(baseUrl + "probe");
         /* Request all objects*/
-        Response response = target.request().get();
+        Response response = target.request()
+            .header("X-SHIB-user", BaseTest.TEST_USER)
+            .header("X-SHIB-roles", BaseTest.TEST_ROLES)
+            .get();
         String entity = response.readEntity(String.class);
         try{
             /* Try to parse the response*/
@@ -131,7 +135,10 @@
             WebTarget target = client.target(baseUrl + "probe/1");
             prot.addInfo("probeId", 1);
             /* Request a object by id*/
-            Response response = target.request().get();
+            Response response = target.request()
+                .header("X-SHIB-user", BaseTest.TEST_USER)
+                .header("X-SHIB-roles", BaseTest.TEST_ROLES)
+                .get();
             String entity = response.readEntity(String.class);
             /* Try to parse the response*/
             JsonReader fromServiceReader =
@@ -171,7 +178,10 @@
                 client.target(baseUrl + "probe?qid=2&mst_id=11010&umw_id=N24");
             prot.addInfo("filter", "qid=2&mst_id=11010&umw_id=N24");
             /* Request the objects using the filter*/
-            Response response = target.request().get();
+            Response response = target.request()
+                .header("X-SHIB-user", BaseTest.TEST_USER)
+                .header("X-SHIB-roles", BaseTest.TEST_ROLES)
+                .get();
             String entity = response.readEntity(String.class);
             /* Try to parse the response*/
             JsonReader reader = Json.createReader(new StringReader(entity));
@@ -209,8 +219,10 @@
             Client client = ClientBuilder.newClient();
             WebTarget target = client.target(baseUrl + "probe");
             /* Send a post request containing a new probe*/
-            Response response = target.request().post(
-                    Entity.entity(CREATE_PROBE, MediaType.APPLICATION_JSON));
+            Response response = target.request()
+                .header("X-SHIB-user", BaseTest.TEST_USER)
+                .header("X-SHIB-roles", BaseTest.TEST_ROLES)
+                .post(Entity.entity(CREATE_PROBE, MediaType.APPLICATION_JSON));
             String entity = response.readEntity(String.class);
             /* Try to parse the response*/
             JsonReader fromServiceReader =
@@ -253,7 +265,10 @@
                 client.target(baseUrl + "probe/" + createdProbeId);
             prot.addInfo("probeId", createdProbeId);
             /* Request a with the saved id*/
-            Response response = target.request().get();
+            Response response = target.request()
+                .header("X-SHIB-user", BaseTest.TEST_USER)
+                .header("X-SHIB-roles", BaseTest.TEST_ROLES)
+                .get();
             String entity = response.readEntity(String.class);
             /* Try to parse the response*/
             JsonReader reader = Json.createReader(new StringReader(entity));
@@ -266,8 +281,10 @@
             prot.addInfo("updated to", "2345678901");
             /* Send the updated probe via put reauest*/
             WebTarget putTarget = client.target(baseUrl + "probe/" + createdProbeId);
-            Response updated = putTarget.request().put(
-                Entity.entity(updatedEntity, MediaType.APPLICATION_JSON));
+            Response updated = putTarget.request()
+                .header("X-SHIB-user", BaseTest.TEST_USER)
+                .header("X-SHIB-roles", BaseTest.TEST_ROLES)
+                .put(Entity.entity(updatedEntity, MediaType.APPLICATION_JSON));
             /* Try to parse the response*/
             JsonReader updatedReader = Json.createReader(
                 new StringReader(updated.readEntity(String.class)));
@@ -306,7 +323,10 @@
                 client.target(baseUrl + "probe/" + createdProbeId);
             prot.addInfo("probeId", createdProbeId);
             /* Delete a probe with the id saved when created a probe*/
-            Response response = target.request().delete();
+            Response response = target.request()
+                .header("X-SHIB-user", BaseTest.TEST_USER)
+                .header("X-SHIB-roles", BaseTest.TEST_ROLES)
+                .delete();
             String entity = response.readEntity(String.class);
             /* Try to parse the response*/
             JsonReader reader = Json.createReader(new StringReader(entity));
--- a/src/test/java/de/intevation/lada/test/land/Query.java	Tue Nov 03 09:15:59 2015 +0100
+++ b/src/test/java/de/intevation/lada/test/land/Query.java	Tue Nov 03 09:21:34 2015 +0100
@@ -22,6 +22,7 @@
 
 import org.junit.Assert;
 
+import de.intevation.lada.BaseTest;
 import de.intevation.lada.Protocol;
 
 
@@ -58,7 +59,10 @@
         Client client = ClientBuilder.newClient();
         WebTarget target = client.target(baseUrl + "query/probe");
         /* Request all queries*/
-        Response response = target.request().get();
+        Response response = target.request()
+            .header("X-SHIB-user", BaseTest.TEST_USER)
+            .header("X-SHIB-roles", BaseTest.TEST_ROLES)
+            .get();
         String entity = response.readEntity(String.class);
         try{
             /* Try to parse the response*/
--- a/src/test/java/de/intevation/lada/test/land/Zusatzwert.java	Tue Nov 03 09:15:59 2015 +0100
+++ b/src/test/java/de/intevation/lada/test/land/Zusatzwert.java	Tue Nov 03 09:21:34 2015 +0100
@@ -24,6 +24,7 @@
 
 import org.junit.Assert;
 
+import de.intevation.lada.BaseTest;
 import de.intevation.lada.Protocol;
 
 /**
@@ -76,7 +77,10 @@
         Client client = ClientBuilder.newClient();
         WebTarget target = client.target(baseUrl + "zusatzwert");
         /* Request all objects*/
-        Response response = target.request().get();
+        Response response = target.request()
+            .header("X-SHIB-user", BaseTest.TEST_USER)
+            .header("X-SHIB-roles", BaseTest.TEST_ROLES)
+            .get();
         String entity = response.readEntity(String.class);
         try{
             /* Try to parse the response*/
@@ -116,7 +120,10 @@
             WebTarget target = client.target(baseUrl + "zusatzwert/1");
             prot.addInfo("zustzwertId", 1);
             /* Request a object by id*/
-            Response response = target.request().get();
+            Response response = target.request()
+                .header("X-SHIB-user", BaseTest.TEST_USER)
+                .header("X-SHIB-roles", BaseTest.TEST_ROLES)
+                .get();
             String entity = response.readEntity(String.class);
             /* Try to parse the response*/
             JsonReader fromServiceReader =
@@ -156,7 +163,10 @@
                 client.target(baseUrl + "zusatzwert?probeIdId=1");
             prot.addInfo("filter", "probeId=1");
             /* Request the objects using the filter*/
-            Response response = target.request().get();
+            Response response = target.request()
+                .header("X-SHIB-user", BaseTest.TEST_USER)
+                .header("X-SHIB-roles", BaseTest.TEST_ROLES)
+                .get();
             String entity = response.readEntity(String.class);
             /* Try to parse the response*/
             JsonReader reader = Json.createReader(new StringReader(entity));
@@ -198,8 +208,10 @@
             WebTarget target = client.target(baseUrl + "zusatzwert");
             /* Send a post request containing a new object*/
             String zus = CREATE.replace("PID", probeId.toString());
-            Response response = target.request().post(
-                    Entity.entity(zus, MediaType.APPLICATION_JSON));
+            Response response = target.request()
+                .header("X-SHIB-user", BaseTest.TEST_USER)
+                .header("X-SHIB-roles", BaseTest.TEST_ROLES)
+                .post(Entity.entity(zus, MediaType.APPLICATION_JSON));
             String entity = response.readEntity(String.class);
             /* Try to parse the response*/
             JsonReader fromServiceReader =
@@ -242,7 +254,10 @@
                 client.target(baseUrl + "zusatzwert/" + createdId);
             prot.addInfo("zusatzwertId", createdId);
             /* Request an object with the saved id*/
-            Response response = target.request().get();
+            Response response = target.request()
+                .header("X-SHIB-user", BaseTest.TEST_USER)
+                .header("X-SHIB-roles", BaseTest.TEST_ROLES)
+                .get();
             String entity = response.readEntity(String.class);
             /* Try to parse the response*/
             JsonReader reader = Json.createReader(new StringReader(entity));
@@ -255,8 +270,10 @@
             prot.addInfo("updated to", "14");
             /* Send the updated messwert via put request*/
             WebTarget putTarget = client.target(baseUrl + "zusatzwert");
-            Response updated = putTarget.request().put(
-                Entity.entity(updatedEntity, MediaType.APPLICATION_JSON));
+            Response updated = putTarget.request()
+                .header("X-SHIB-user", BaseTest.TEST_USER)
+                .header("X-SHIB-roles", BaseTest.TEST_ROLES)
+                .put(Entity.entity(updatedEntity, MediaType.APPLICATION_JSON));
             /* Try to parse the response*/
             JsonReader updatedReader = Json.createReader(
                 new StringReader(updated.readEntity(String.class)));
@@ -295,7 +312,10 @@
                 client.target(baseUrl + "zusatzwert/" + createdId);
             prot.addInfo("zusatzwertId", createdId);
             /* Delete the object with the saved id*/
-            Response response = target.request().delete();
+            Response response = target.request()
+                .header("X-SHIB-user", BaseTest.TEST_USER)
+                .header("X-SHIB-roles", BaseTest.TEST_ROLES)
+                .delete();
             String entity = response.readEntity(String.class);
             /* Try to parse the response*/
             JsonReader reader = Json.createReader(new StringReader(entity));
--- a/src/test/java/de/intevation/lada/test/stamm/Stammdaten.java	Tue Nov 03 09:15:59 2015 +0100
+++ b/src/test/java/de/intevation/lada/test/stamm/Stammdaten.java	Tue Nov 03 09:21:34 2015 +0100
@@ -17,6 +17,7 @@
 
 import org.junit.Assert;
 
+import de.intevation.lada.BaseTest;
 import de.intevation.lada.Protocol;
 
 public class Stammdaten {
@@ -104,7 +105,10 @@
         Client client = ClientBuilder.newClient();
         WebTarget target = client.target(baseUrl + type);
         /* Request all objects*/
-        Response response = target.request().get();
+        Response response = target.request()
+            .header("X-SHIB-user", BaseTest.TEST_USER)
+            .header("X-SHIB-roles", BaseTest.TEST_ROLES)
+            .get();
         String entity = response.readEntity(String.class);
         try{
             /* Try to parse the response*/
@@ -147,7 +151,10 @@
             WebTarget target = client.target(baseUrl + type +"/" + id);
             prot.addInfo(type + "Id", id);
             /* Request an object by id*/
-            Response response = target.request().get();
+            Response response = target.request()
+                .header("X-SHIB-user", BaseTest.TEST_USER)
+                .header("X-SHIB-roles", BaseTest.TEST_ROLES)
+                .get();
             String entity = response.readEntity(String.class);
             /* Try to parse the response*/
             JsonReader fromServiceReader =
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)