Mercurial > lada > lada-server
comparison src/test/java/de/intevation/lada/test/land/OrtszuordnungTest.java @ 832:59c51da59b30
Refactored test environment.
Land tests are using arquillian persistence extension (built on DBUnit).
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Fri, 18 Dec 2015 18:01:00 +0100 |
parents | |
children | cb1cfc8c81ed |
comparison
equal
deleted
inserted
replaced
831:3d76d476894f | 832:59c51da59b30 |
---|---|
1 package de.intevation.lada.test.land; | |
2 | |
3 import java.net.URL; | |
4 import java.util.Arrays; | |
5 import java.util.List; | |
6 | |
7 import javax.json.JsonObject; | |
8 import javax.json.JsonObjectBuilder; | |
9 import javax.json.JsonValue; | |
10 | |
11 import org.junit.Assert; | |
12 | |
13 import de.intevation.lada.Protocol; | |
14 | |
15 public class OrtszuordnungTest extends ServiceTest { | |
16 | |
17 private JsonObject expectedById; | |
18 private JsonObject create; | |
19 | |
20 /** | |
21 * @return The test protocol | |
22 */ | |
23 public List<Protocol> getProtocol() { | |
24 return protocol; | |
25 } | |
26 | |
27 @Override | |
28 public void init( | |
29 URL baseUrl, | |
30 List<Protocol> protocol | |
31 ) { | |
32 super.init(baseUrl, protocol); | |
33 // Attributes with timestamps | |
34 timestampAttributes = Arrays.asList(new String[]{ | |
35 "letzteAenderung" | |
36 }); | |
37 | |
38 // Prepare expected probe object | |
39 JsonObject content = readJsonResource("/datasets/dbUnit_ortszuordnung.json"); | |
40 JsonObject messung = content.getJsonArray("land.ortszuordnung").getJsonObject(0); | |
41 JsonObjectBuilder builder = convertObject(messung); | |
42 builder.add("parentModified", 1450371851654L); | |
43 builder.add("readonly", JsonValue.FALSE); | |
44 builder.add("owner", JsonValue.TRUE); | |
45 expectedById = builder.build(); | |
46 Assert.assertNotNull(expectedById); | |
47 | |
48 // Load probe object to test POST request | |
49 create = readJsonResource("/datasets/ortszuordnung.json"); | |
50 Assert.assertNotNull(create); | |
51 } | |
52 | |
53 public final void execute() { | |
54 getAll("ortszuordnung", "rest/ortszuordnung"); | |
55 getById("ortszuordnung", "rest/ortszuordnung/1000", expectedById); | |
56 JsonObject created = create("ortszuordnung", "rest/ortszuordnung", create); | |
57 update("ortszuordnung", "rest/ortszuordnung/1000", "ortszusatztext", "Test", "Test geƤndert"); | |
58 delete("ortszuordnung", "rest/ortszuordnung/" + created.getJsonObject("data").get("id")); | |
59 } | |
60 } |