changeset 644:47dd9aded7bd

Updated tests to fit the new requirements (authorization).
author Raimund Renkert <raimund.renkert@intevation.de>
date Thu, 30 Apr 2015 16:30:13 +0200
parents 4a9ad99e8e58
children 7088d3c1da29
files src/test/java/de/intevation/lada/LadaStammTest.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/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/Status.java src/test/java/de/intevation/lada/test/land/Zusatzwert.java src/test/java/de/intevation/lada/test/stamm/Stammdaten.java src/test/java/de/intevation/lada/test/validator/Probe.java
diffstat 12 files changed, 63 insertions(+), 57 deletions(-) [+]
line wrap: on
line diff
--- a/src/test/java/de/intevation/lada/LadaStammTest.java	Thu Apr 30 16:27:28 2015 +0200
+++ b/src/test/java/de/intevation/lada/LadaStammTest.java	Thu Apr 30 16:30:13 2015 +0200
@@ -119,7 +119,7 @@
     @Test
     @RunAsClient
     public final void testMessstelleById(@ArquillianResource URL baseUrl) {
-        stammdatenTest.getById(baseUrl, "messstelle", "03151", testProtocol);
+        stammdatenTest.getById(baseUrl, "messstelle", "06010", testProtocol);
     }
 
     @Test
@@ -131,7 +131,7 @@
     @Test
     @RunAsClient
     public final void testNetzbetreiberById(@ArquillianResource URL baseUrl) {
-        stammdatenTest.getById(baseUrl, "netzbetreiber", "PA", testProtocol);
+        stammdatenTest.getById(baseUrl, "netzbetreiber", "06", testProtocol);
     }
 
     @Test
@@ -312,7 +312,7 @@
             prot.addInfo("updated value", "Neuer Ort");
             prot.addInfo("updated to", "Neuerer Ort");
             /* Send the updated kommentar via put reauest*/
-            WebTarget putTarget = client.target(baseUrl + "location");
+            WebTarget putTarget = client.target(baseUrl + "location/" + createdOrtId);
             Response updated = putTarget.request().put(
                 Entity.entity(updatedEntity, MediaType.APPLICATION_JSON));
             /* Try to parse the response*/
--- a/src/test/java/de/intevation/lada/test/land/KommentarM.java	Thu Apr 30 16:27:28 2015 +0200
+++ b/src/test/java/de/intevation/lada/test/land/KommentarM.java	Thu Apr 30 16:30:13 2015 +0200
@@ -35,12 +35,13 @@
 public class KommentarM {
 
     private static final String COMPARE_KOMMENTARM =
-        "{\"messungId\":5,\"datum\":1336627500000,\"erzeuger\":\"12010\"," +
-        "\"id\":478,\"text\":\"Hofladen Lenzen geschlossen\"}";
+        "{\"messungsId\":5,\"datum\":1336627500000,\"erzeuger\":\"12010\"," +
+        "\"id\":478,\"text\":\"Hofladen Lenzen geschlossen\",\"owner\":false," +
+        "\"readonly\":false}";
 
     private static final String CREATE_KOMMENTARM =
-        "{\"messungId\":\"MID\",\"erzeuger\":\"11010\",\"text\":" +
-        "\"test\",\"datum\":\"2015-02-09T10:58:36\"}";
+        "{\"messungsId\":\"MID\",\"erzeuger\":\"06010\",\"text\":" +
+        "\"test\",\"datum\":\"2015-02-09T10:58:36\",\"owner\":false}";
 
     private List<Protocol> protocol;
 
@@ -260,7 +261,7 @@
             prot.addInfo("updated value", "test");
             prot.addInfo("updated to", "neu");
             /* Send the updated kommentar via put reauest*/
-            WebTarget putTarget = client.target(baseUrl + "mkommentar");
+            WebTarget putTarget = client.target(baseUrl + "mkommentar/" + createdKommentarId);
             Response updated = putTarget.request().put(
                 Entity.entity(updatedEntity, MediaType.APPLICATION_JSON));
             /* Try to parse the response*/
--- a/src/test/java/de/intevation/lada/test/land/KommentarP.java	Thu Apr 30 16:27:28 2015 +0200
+++ b/src/test/java/de/intevation/lada/test/land/KommentarP.java	Thu Apr 30 16:30:13 2015 +0200
@@ -37,7 +37,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}";
+        "für die Sr-Bestimmung verascht. \",\"probeId\":361,\"owner\":false," +
+        "\"readonly\":false}";
 
     private static final String CREATE_KOMMENTARP =
         "{\"probeId\":\"PID\",\"erzeuger\":\"11010\",\"text\":" +
@@ -261,7 +262,7 @@
             prot.addInfo("updated value", "test");
             prot.addInfo("updated to", "neu");
             /* Send the updated kommentar via put reauest*/
-            WebTarget putTarget = client.target(baseUrl + "pkommentar");
+            WebTarget putTarget = client.target(baseUrl + "pkommentar/" + createdKommentarId);
             Response updated = putTarget.request().put(
                 Entity.entity(updatedEntity, MediaType.APPLICATION_JSON));
             /* Try to parse the response*/
--- a/src/test/java/de/intevation/lada/test/land/Messung.java	Thu Apr 30 16:27:28 2015 +0200
+++ b/src/test/java/de/intevation/lada/test/land/Messung.java	Thu Apr 30 16:30:13 2015 +0200
@@ -36,8 +36,9 @@
     private static final String COMPARE_MESSUNG =
         "{\"id\":1,\"fertig\":true,\"letzteAenderung\":1331536340000," +
         "\"messdauer\":73929,\"messzeitpunkt\":1329139620000,\"mmtId\":" +
-        "\"G1\",\"probeId\":575,\"nebenprobenNr\":\"01G1\",\"geplant\":true," +
-        "\"messungsIdAlt\":1}";
+        "\"G1\",\"probeId\":575,\"owner\":false,\"readonly\":false," +
+        "\"nebenprobenNr\":\"01G1\",\"geplant\":true," +
+        "\"treeModified\":null,\"parentModified\":null,\"messungsIdAlt\":1}";
 
     private static final String CREATE_MESSUNG =
         "{\"probeId\":\"PID\",\"mmtId\":\"A4\",\"nebenprobenNr\":\"10R1\"," +
@@ -245,7 +246,7 @@
             Client client = ClientBuilder.newClient();
             WebTarget target =
                 client.target(baseUrl + "messung/" + createdMessungId);
-            prot.addInfo("messungId", createdMessungId);
+            prot.addInfo("messungsId", createdMessungId);
             /* Request a messung with the saved id*/
             Response response = target.request().get();
             String entity = response.readEntity(String.class);
@@ -259,7 +260,7 @@
             prot.addInfo("updated value", "A4");
             prot.addInfo("updated to", "G1");
             /* Send the updated messung via put request*/
-            WebTarget putTarget = client.target(baseUrl + "messung");
+            WebTarget putTarget = client.target(baseUrl + "messung/" + createdMessungId);
             Response updated = putTarget.request().put(
                 Entity.entity(updatedEntity, MediaType.APPLICATION_JSON));
             /* Try to parse the response*/
--- a/src/test/java/de/intevation/lada/test/land/Messwert.java	Thu Apr 30 16:27:28 2015 +0200
+++ b/src/test/java/de/intevation/lada/test/land/Messwert.java	Thu Apr 30 16:30:13 2015 +0200
@@ -37,7 +37,8 @@
         "{\"id\":1,\"grenzwertueberschreitung\":null,\"letzteAenderung\":" +
         "1327305368000,\"mehId\":69,\"messfehler\":1.1,\"messgroesseId\":28," +
         "\"messungsId\":749,\"messwert\":97.0,\"messwertNwg\":null," +
-        "\"nwgZuMesswert\":null}";
+        "\"nwgZuMesswert\":null,\"owner\":false,\"readonly\":false," +
+        "\"treeModified\":null,\"parentModified\":null}";
 
     private static final String CREATE_MESSWERT =
         "{\"messungsId\":MID,\"messgroesseId\":242,\"messwert\":1," +
@@ -260,7 +261,7 @@
             prot.addInfo("updated value", "207");
             prot.addInfo("updated to", "69");
             /* Send the updated messwert via put request*/
-            WebTarget putTarget = client.target(baseUrl + "messwert");
+            WebTarget putTarget = client.target(baseUrl + "messwert/" + createdMesswertId);
             Response updated = putTarget.request().put(
                 Entity.entity(updatedEntity, MediaType.APPLICATION_JSON));
             /* Try to parse the response*/
--- a/src/test/java/de/intevation/lada/test/land/Ort.java	Thu Apr 30 16:27:28 2015 +0200
+++ b/src/test/java/de/intevation/lada/test/land/Ort.java	Thu Apr 30 16:30:13 2015 +0200
@@ -35,7 +35,8 @@
 
     private static final String COMPARE =
         "{\"id\":1,\"letzteAenderung\":1376287046510,\"ortsTyp\":\"Z\"," +
-        "\"ortszusatztext\":null,\"probeId\":96,\"ort\":213}";
+        "\"ortszusatztext\":null,\"probeId\":96,\"ort\":213,\"owner\":false," +
+        "\"readonly\":false,\"treeModified\":null,\"parentModified\":null}";
 
     private static final String CREATE =
         "{\"letzteAenderung\":1376287046510,\"ortsTyp\":\"Z\"," +
@@ -256,7 +257,7 @@
             prot.addInfo("updated value", "text");
             prot.addInfo("updated to", "zusatz");
             /* Send the updated messwert via put request*/
-            WebTarget putTarget = client.target(baseUrl + "ort");
+            WebTarget putTarget = client.target(baseUrl + "ort/" + createdId);
             Response updated = putTarget.request().put(
                 Entity.entity(updatedEntity, MediaType.APPLICATION_JSON));
             /* Try to parse the response*/
--- a/src/test/java/de/intevation/lada/test/land/Probe.java	Thu Apr 30 16:27:28 2015 +0200
+++ b/src/test/java/de/intevation/lada/test/land/Probe.java	Thu Apr 30 16:30:13 2015 +0200
@@ -42,14 +42,15 @@
         "null,\"mstId\":\"06010\",\"netzbetreiberId\":\"06\"," +
         "\"probeentnahmeBeginn\":1336467600000,\"probeentnahmeEnde\":" +
         "null,\"probenartId\":1,\"test\":false,\"umwId\":\"N72\"," +
-        "\"erzeugerId\":null,\"mpKat\":\"1\",\"mplId\":null,\"mprId\":3749," +
-        "\"probeNehmerId\":726,\"solldatumBeginn\":1336341600000," +
-        "\"solldatumEnde\":1336939199000,\"probeIdAlt\":\"000007581034X\"," +
-        "\"hauptprobenNr\":\"120510002\"}";
+        "\"hauptprobenNr\":\"120510002\",\"erzeugerId\":null,\"mpKat\":\"1\"," +
+        "\"mplId\":null,\"mprId\":3749,\"probeNehmerId\":726," +
+        "\"solldatumBeginn\":1336341600000,\"solldatumEnde\":1336939199000," +
+        "\"treeModified\":null,\"readonly\":false,\"owner\":false," +
+        "\"probeIdAlt\":\"000007581034X\"}";
 
     private static final String CREATE_PROBE =
         "{\"baId\":\"1\",\"datenbasisId\":2,\"erzeugerId\":\"\"," +
-        "\"hauptprobenNr\":\"1234567890\",\"media\":\"\",\"mediaDesk\":" +
+        "\"hauptprobenNr\":\"4554567890\",\"media\":\"\",\"mediaDesk\":" +
         "\"\",\"mittelungsdauer\":\"\",\"mpKat\":\"\",\"mplId\":\"\"," +
         "\"mprId\":\"\",\"mstId\":\"11010\",\"netzbetreiberId\":\"11\"," +
         "\"probeNehmerId\":3,\"probenartId\":1,\"test\":true,\"umwId\":" +
@@ -264,12 +265,12 @@
             JsonObject oldProbe = reader.readObject().getJsonObject("data");
             /* Change the hauptprobenNr*/
             String updatedEntity =
-                oldProbe.toString().replace("1234567890", "2345678901");
+                oldProbe.toString().replace("4554567890", "2345678901");
             prot.addInfo("updated datafield", "hauptprobenNr");
             prot.addInfo("updated value", "1234567890");
             prot.addInfo("updated to", "2345678901");
             /* Send the updated probe via put reauest*/
-            WebTarget putTarget = client.target(baseUrl + "probe");
+            WebTarget putTarget = client.target(baseUrl + "probe/" + createdProbeId);
             Response updated = putTarget.request().put(
                 Entity.entity(updatedEntity, MediaType.APPLICATION_JSON));
             /* Try to parse the response*/
--- a/src/test/java/de/intevation/lada/test/land/Query.java	Thu Apr 30 16:27:28 2015 +0200
+++ b/src/test/java/de/intevation/lada/test/land/Query.java	Thu Apr 30 16:30:13 2015 +0200
@@ -56,7 +56,7 @@
         protocol.add(prot);
         /* Create a client*/
         Client client = ClientBuilder.newClient();
-        WebTarget target = client.target(baseUrl + "query");
+        WebTarget target = client.target(baseUrl + "query/probe");
         /* Request all queries*/
         Response response = target.request().get();
         String entity = response.readEntity(String.class);
--- a/src/test/java/de/intevation/lada/test/land/Status.java	Thu Apr 30 16:27:28 2015 +0200
+++ b/src/test/java/de/intevation/lada/test/land/Status.java	Thu Apr 30 16:30:13 2015 +0200
@@ -35,6 +35,8 @@
 
     private static final String COMPARE =
         "{\"id\":1,\"erzeuger\":\"06010\",\"messungsId\":440,\"status\":3," +
+        "\"owner\":false,\"readonly\":false,\"treeModified\":null," +
+        "\"parentModified\":null," +
         "\"sdatum\":1373846400000,\"skommentar\":\"test\"}";
 
     private static final String CREATE =
@@ -256,7 +258,7 @@
             prot.addInfo("updated value", "status3");
             prot.addInfo("updated to", "status3updated");
             /* Send the updated messwert via put request*/
-            WebTarget putTarget = client.target(baseUrl + "status");
+            WebTarget putTarget = client.target(baseUrl + "status/" + createdId);
             Response updated = putTarget.request().put(
                 Entity.entity(updatedEntity, MediaType.APPLICATION_JSON));
             /* Try to parse the response*/
--- a/src/test/java/de/intevation/lada/test/land/Zusatzwert.java	Thu Apr 30 16:27:28 2015 +0200
+++ b/src/test/java/de/intevation/lada/test/land/Zusatzwert.java	Thu Apr 30 16:30:13 2015 +0200
@@ -36,7 +36,8 @@
     private static final String COMPARE =
         "{\"id\":1,\"letzteAenderung\":1335177176000,\"messfehler\":48.0," +
         "\"messwertPzs\":7.5,\"nwgZuMesswert\":null,\"probeId\":84," +
-        "\"pzsId\":\"A76\"}";
+        "\"pzsId\":\"A76\",\"owner\":false,\"readonly\":false," +
+        "\"treeModified\":null,\"parentModified\":null}";
 
     private static final String CREATE =
         "{\"letzteAenderung\":1335177176000,\"messfehler\":18.0," +
--- a/src/test/java/de/intevation/lada/test/stamm/Stammdaten.java	Thu Apr 30 16:27:28 2015 +0200
+++ b/src/test/java/de/intevation/lada/test/stamm/Stammdaten.java	Thu Apr 30 16:30:13 2015 +0200
@@ -40,14 +40,15 @@
             "{\"id\":\"GI\",\"beschreibung\":null,\"messmethode\":" +
             "\"Iod, Gamma-Spektrometrie\"}");
         compare.put("messstelle",
-            "{\"id\":\"03151\",\"amtskennung\":null,\"beschreibung\":" +
-            "\"E.ON Kernkraftwerk GmbH, Kernkraftwerk Stade, Postfach 1780, " +
-            "21657 Stade\",\"messStelle\":\"KKW - KKS\",\"mstTyp\":\"M\"," +
-            "\"netzbetreiberId\":\"03\"}");
+            "{\"id\":\"06010\",\"amtskennung\":null,\"beschreibung\":" +
+            "\"Hessisches Landesamt für Umwelt und Geologie, Dienststelle " +
+            "Kassel, Ludwig-Mond-Str. 33, 34121 Kassel\",\"messStelle\":" +
+            "\"helm21-HLUG-Kassel\",\"mstTyp\":\"M\",\"netzbetreiberId\":" +
+            "\"06\"}");
         compare.put("netzbetreiber",
-            "{\"id\":\"PA\",\"aktiv\":true,\"idfNetzbetreiber\":\"R\"," +
-            "\"isBmn\":true,\"mailverteiler\":\"PA\",\"netzbetreiber\":" +
-            "\"Park\",\"zustMstId\":null}");
+            "{\"id\":\"06\",\"aktiv\":true,\"idfNetzbetreiber\":\"f\"," +
+            "\"isBmn\":false,\"mailverteiler\":\"06\",\"netzbetreiber\":" +
+            "\"Hessen\",\"zustMstId\":null}");
         compare.put("pflichtmessgroesse",
             "{\"id\":33,\"messgroesseId\":904,\"datenbasisId\":4,\"mmtId\":" +
             "\"A3\",\"umweltId\":\"B2\"}");
--- a/src/test/java/de/intevation/lada/test/validator/Probe.java	Thu Apr 30 16:27:28 2015 +0200
+++ b/src/test/java/de/intevation/lada/test/validator/Probe.java	Thu Apr 30 16:30:13 2015 +0200
@@ -25,12 +25,10 @@
         prot.setPassed(false);
         protocol.add(prot);
         LProbe probe = new LProbe();
-        probe.setHauptprobenNr("1234567890");
+        probe.setHauptprobenNr("4554567890");
         Violation violation = validator.validate(probe);
         if (violation.hasErrors()) {
             Assert.assertFalse(violation.getErrors().containsKey("hauptprobenNr"));
-            prot.setPassed(true);
-            return;
         }
         prot.setPassed(true);
     }
@@ -72,12 +70,11 @@
         prot.setPassed(false);
         protocol.add(prot);
         LProbe probe = new LProbe();
-        probe.setHauptprobenNr("1234567890");
-        prot.addInfo("hauptprobenNr", "1234567890");
+        probe.setHauptprobenNr("4564567890");
+        prot.addInfo("hauptprobenNr", "4564567890");
         Violation violation = validator.validate(probe);
         if (violation.hasErrors()) {
             Assert.assertFalse(violation.getErrors().containsKey("hauptprobenNr"));
-            return;
         }
         prot.setPassed(true);
     }
@@ -90,12 +87,11 @@
         protocol.add(prot);
         LProbe probe = new LProbe();
         probe.setId(1);
-        probe.setHauptprobenNr("1234567890");
-        prot.addInfo("hauptprobenNr", "1234567890");
+        probe.setHauptprobenNr("4564567890");
+        prot.addInfo("hauptprobenNr", "4564567890");
         Violation violation = validator.validate(probe);
         if (violation.hasErrors()) {
             Assert.assertFalse(violation.getErrors().containsKey("hauptprobenNr"));
-            return;
         }
         prot.setPassed(true);
     }
@@ -158,7 +154,7 @@
         probe.setProbeentnahmeEnde(new Timestamp(1376287046511l));
         Violation violation = validator.validate(probe);
         if (violation.hasWarnings()) {
-            Assert.assertFalse(violation.getWarnings().containsKey("probeentnahmeBegin"));
+            Assert.assertFalse(violation.getWarnings().containsKey("probeentnahmeBeginn"));
         }
         prot.setPassed(true);
     }
@@ -172,8 +168,8 @@
         LProbe probe = new LProbe();
         Violation violation = validator.validate(probe);
         Assert.assertTrue(violation.hasWarnings());
-        Assert.assertTrue(violation.getWarnings().containsKey("probeentnahmeBegin"));
-        Assert.assertTrue(violation.getWarnings().get("probeentnahmeBegin").contains(631));
+        Assert.assertTrue(violation.getWarnings().containsKey("probeentnahmeBeginn"));
+        Assert.assertTrue(violation.getWarnings().get("probeentnahmeBeginn").contains(631));
         prot.setPassed(true);
     }
 
@@ -187,7 +183,7 @@
         probe.setProbeentnahmeBeginn(new Timestamp(1376287046510l));
         Violation violation = validator.validate(probe);
         if (violation.hasWarnings()) {
-            Assert.assertFalse(violation.getWarnings().containsKey("probeentnahmeBegin"));
+            Assert.assertFalse(violation.getWarnings().containsKey("probeentnahmeBeginn"));
         }
         prot.setPassed(true);
     }
@@ -201,8 +197,8 @@
         LProbe probe = new LProbe();
         probe.setProbeentnahmeEnde(new Timestamp(1376287046510l));
         Violation violation = validator.validate(probe);
-        Assert.assertTrue(violation.getWarnings().get("probeentnahmeBegin").contains(631));
-        Assert.assertTrue(violation.getWarnings().get("probeentnahmeBegin").contains(662));
+        Assert.assertTrue(violation.getWarnings().get("probeentnahmeBeginn").contains(631));
+        Assert.assertTrue(violation.getWarnings().get("probeentnahmeBeginn").contains(662));
         prot.setPassed(true);
     }
 
@@ -216,7 +212,7 @@
         probe.setProbeentnahmeBeginn(new Timestamp(1376287046511l));
         probe.setProbeentnahmeEnde(new Timestamp(1376287046510l));
         Violation violation = validator.validate(probe);
-        Assert.assertTrue(violation.getWarnings().get("probeentnahmeBegin").contains(662));
+        Assert.assertTrue(violation.getWarnings().get("probeentnahmeBeginn").contains(662));
         prot.setPassed(true);
     }
 
@@ -229,7 +225,7 @@
         LProbe probe = new LProbe();
         probe.setProbeentnahmeBeginn(new Timestamp(2376287046511l));
         Violation violation = validator.validate(probe);
-        Assert.assertTrue(violation.getWarnings().get("probeentnahmeBegin").contains(661));
+        Assert.assertTrue(violation.getWarnings().get("probeentnahmeBeginn").contains(661));
         prot.setPassed(true);
     }
 
@@ -243,7 +239,7 @@
         probe.setUmwId("A4");
         Violation violation = validator.validate(probe);
         if (violation.hasWarnings()) {
-            Assert.assertFalse(violation.getWarnings().containsKey("uwb"));
+            Assert.assertFalse(violation.getWarnings().containsKey("umwId"));
         }
         prot.setPassed(true);
     }
@@ -257,8 +253,8 @@
         LProbe probe = new LProbe();
         Violation violation = validator.validate(probe);
         Assert.assertTrue(violation.hasWarnings());
-        Assert.assertTrue(violation.getWarnings().containsKey("uwb"));
-        Assert.assertTrue(violation.getWarnings().get("uwb").contains(631));
+        Assert.assertTrue(violation.getWarnings().containsKey("umwId"));
+        Assert.assertTrue(violation.getWarnings().get("umwId").contains(631));
         prot.setPassed(true);
     }
 
@@ -272,8 +268,8 @@
         probe.setUmwId("");
         Violation violation = validator.validate(probe);
         Assert.assertTrue(violation.hasWarnings());
-        Assert.assertTrue(violation.getWarnings().containsKey("uwb"));
-        Assert.assertTrue(violation.getWarnings().get("uwb").contains(631));
+        Assert.assertTrue(violation.getWarnings().containsKey("umwId"));
+        Assert.assertTrue(violation.getWarnings().get("umwId").contains(631));
         prot.setPassed(true);
     }
 }
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)