Mercurial > lada > lada-server
changeset 453:1d80d0c21a44
Added test for probe filter service.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Wed, 11 Feb 2015 15:25:39 +0100 |
parents | 819747a8d037 |
children | 13ed418234f9 |
files | src/test/java/de/intevation/lada/test/ProbeServiceTest.java |
diffstat | 1 files changed, 30 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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"); + } }