Mercurial > lada > lada-server
view 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 |
line wrap: on
line source
package de.intevation.lada.test.land; import java.net.URL; import java.util.Arrays; import java.util.List; import javax.json.JsonObject; import javax.json.JsonObjectBuilder; import javax.json.JsonValue; import org.junit.Assert; import de.intevation.lada.Protocol; public class OrtszuordnungTest extends ServiceTest { private JsonObject expectedById; private JsonObject create; /** * @return The test protocol */ public List<Protocol> getProtocol() { return protocol; } @Override public void init( URL baseUrl, List<Protocol> protocol ) { super.init(baseUrl, protocol); // Attributes with timestamps timestampAttributes = Arrays.asList(new String[]{ "letzteAenderung" }); // Prepare expected probe object JsonObject content = readJsonResource("/datasets/dbUnit_ortszuordnung.json"); JsonObject messung = content.getJsonArray("land.ortszuordnung").getJsonObject(0); JsonObjectBuilder builder = convertObject(messung); builder.add("parentModified", 1450371851654L); builder.add("readonly", JsonValue.FALSE); builder.add("owner", JsonValue.TRUE); expectedById = builder.build(); Assert.assertNotNull(expectedById); // Load probe object to test POST request create = readJsonResource("/datasets/ortszuordnung.json"); Assert.assertNotNull(create); } public final void execute() { getAll("ortszuordnung", "rest/ortszuordnung"); getById("ortszuordnung", "rest/ortszuordnung/1000", expectedById); JsonObject created = create("ortszuordnung", "rest/ortszuordnung", create); update("ortszuordnung", "rest/ortszuordnung/1000", "ortszusatztext", "Test", "Test geƤndert"); delete("ortszuordnung", "rest/ortszuordnung/" + created.getJsonObject("data").get("id")); } }