[Lada-commits] [PATCH 2 of 4] Added test for probe filter service

Wald Commits scm-commit at wald.intevation.org
Wed Feb 11 15:27:13 CET 2015


# HG changeset patch
# User Raimund Renkert <raimund.renkert at intevation.de>
# Date 1423664739 -3600
# Node ID 1d80d0c21a4459c8c0ed756b43495611b372ad2b
# Parent  819747a8d037161ba32d38b548acd1d61a3f009a
Added test for probe filter service.

diff -r 819747a8d037 -r 1d80d0c21a44 src/test/java/de/intevation/lada/test/ProbeServiceTest.java
--- a/src/test/java/de/intevation/lada/test/ProbeServiceTest.java	Wed Feb 11 15:24:52 2015 +0100
+++ b/src/test/java/de/intevation/lada/test/ProbeServiceTest.java	Wed Feb 11 15:25:39 2015 +0100
@@ -69,6 +69,7 @@
         probeCreate(baseUrl);
         probeUpdate(baseUrl);
         probeDelete(baseUrl);
+        probeFilter(baseUrl);
     }
 
     /**
@@ -236,4 +237,33 @@
         }
         System.out.println("passed");
     }
+
+    /**
+     * Test the GET service using filters.
+     *
+     * @param baseUrl The url poining to the test deployment.
+     */
+    private final void probeFilter(URL baseUrl) {
+        System.out.println("Testing filter: ");
+        try {
+            /* Create a client*/
+            Client client = ClientBuilder.newClient();
+            WebTarget target =
+                client.target(baseUrl + "probe?qid=2&mst_id=11010&umw_id=N24");
+            /* Request the probe objects using the filter*/
+            Response response = target.request().get();
+            String entity = response.readEntity(String.class);
+            /* Try to parse the response*/
+            JsonReader reader = Json.createReader(new StringReader(entity));
+            JsonObject respObj = reader.readObject();
+            /* Verify the response*/
+            Assert.assertTrue(respObj.getBoolean("success"));
+            Assert.assertEquals("200", respObj.getString("message"));
+            Assert.assertNotNull(respObj.getJsonArray("data"));
+        }
+        catch(JsonException je) {
+            Assert.fail(je.getMessage());
+        }
+        System.out.println("passed");
+    }
 }


More information about the Lada-commits mailing list