Mercurial > lada > lada-server
comparison src/test/java/de/intevation/lada/test/stamm/DeskriptorenTest.java @ 1243:b652f4c9b75c
Add automatic tests for DeskriptorService.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Thu, 15 Dec 2016 16:16:32 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
1242:69be53d22a18 | 1243:b652f4c9b75c |
---|---|
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz | |
2 * Software engineering by Intevation GmbH | |
3 * | |
4 * This file is Free Software under the GNU GPL (v>=3) | |
5 * and comes with ABSOLUTELY NO WARRANTY! Check out | |
6 * the documentation coming with IMIS-Labordaten-Application for details. | |
7 */ | |
8 package de.intevation.lada.test.stamm; | |
9 | |
10 import java.net.URL; | |
11 import java.util.List; | |
12 | |
13 import javax.json.JsonObject; | |
14 import javax.json.JsonObjectBuilder; | |
15 | |
16 import org.junit.Assert; | |
17 | |
18 import de.intevation.lada.Protocol; | |
19 import de.intevation.lada.test.ServiceTest; | |
20 | |
21 public class DeskriptorenTest extends ServiceTest { | |
22 private JsonObject expectedById; | |
23 private JsonObject create; | |
24 | |
25 /** | |
26 * @return The test protocol | |
27 */ | |
28 public List<Protocol> getProtocol() { | |
29 return protocol; | |
30 } | |
31 | |
32 @Override | |
33 public void init( | |
34 URL baseUrl, | |
35 List<Protocol> protocol | |
36 ) { | |
37 super.init(baseUrl, protocol); | |
38 | |
39 // Prepare expected object | |
40 JsonObject content = readJsonResource("/datasets/dbUnit_deskriptor.json") | |
41 .getJsonArray("stammdaten.deskriptoren").getJsonObject(0); | |
42 JsonObjectBuilder builder = convertObject(content); | |
43 expectedById = builder.build(); | |
44 Assert.assertNotNull(expectedById); | |
45 } | |
46 | |
47 public final void execute() { | |
48 getAll("deskriptor", "rest/deskriptor"); | |
49 getAll("deskriptor", "rest/deskriptor?layer=1"); | |
50 getAll("deskriptor", "rest/deskriptor?layer=1&parents=1, 2"); | |
51 getById("deskriptor", "rest/deskriptor/1000", expectedById); | |
52 } | |
53 } |