[Lada-commits] [PATCH 3 of 4] Added tests for stammdaten
Wald Commits
scm-commit at wald.intevation.org
Fri Jan 8 12:10:30 CET 2016
# HG changeset patch
# User Raimund Renkert <raimund.renkert at intevation.de>
# Date 1452251352 -3600
# Node ID 075f511243d5f83fb639858a5ae336b1635cbe3f
# Parent cb1cfc8c81edc1b450fc63402e67c0dce703cb6e
Added tests for stammdaten
* Datensatzerzeuger (GET, PUT, POST, DELETE)
* Probenehmer (GET, PUT, POST, DELETE)
* Messprogrammkategorie (GET, PUT, POST, DELETE)
* Ort (GET, PUT, POST, DELETE)
diff -r cb1cfc8c81ed -r 075f511243d5 src/test/java/de/intevation/lada/BaseTest.java
--- a/src/test/java/de/intevation/lada/BaseTest.java Fri Jan 08 12:07:26 2016 +0100
+++ b/src/test/java/de/intevation/lada/BaseTest.java Fri Jan 08 12:09:12 2016 +0100
@@ -28,7 +28,7 @@
public static String TEST_USER = "testeins";
- public static String TEST_ROLES = "cn=Imis-World, cn=mst_06010, cn=mst_11010, cn=mst_06_status";
+ public static String TEST_ROLES = "cn=Imis-World, cn=mst_06010, cn=mst_11010, cn=mst_06_status, cn=land_06_stamm";
private static Logger logger = Logger.getLogger(BaseTest.class);
diff -r cb1cfc8c81ed -r 075f511243d5 src/test/java/de/intevation/lada/StammdatenTest.java
--- a/src/test/java/de/intevation/lada/StammdatenTest.java Fri Jan 08 12:07:26 2016 +0100
+++ b/src/test/java/de/intevation/lada/StammdatenTest.java Fri Jan 08 12:09:12 2016 +0100
@@ -7,33 +7,36 @@
*/
package de.intevation.lada;
-import java.io.StringReader;
import java.net.URL;
import java.util.ArrayList;
-import javax.json.Json;
-import javax.json.JsonException;
-import javax.json.JsonObject;
-import javax.json.JsonReader;
-import javax.ws.rs.client.Client;
-import javax.ws.rs.client.ClientBuilder;
-import javax.ws.rs.client.Entity;
-import javax.ws.rs.client.WebTarget;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
import org.apache.log4j.Logger;
import org.jboss.arquillian.container.test.api.RunAsClient;
import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.arquillian.junit.InSequence;
+import org.jboss.arquillian.persistence.Cleanup;
+import org.jboss.arquillian.persistence.DataSource;
+import org.jboss.arquillian.persistence.TestExecutionPhase;
+import org.jboss.arquillian.persistence.UsingDataSet;
import org.jboss.arquillian.test.api.ArquillianResource;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.FixMethodOrder;
-import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.MethodSorters;
+import de.intevation.lada.model.stamm.DatensatzErzeuger;
+import de.intevation.lada.model.stamm.MessprogrammKategorie;
+import de.intevation.lada.model.stamm.Ort;
+import de.intevation.lada.model.stamm.Probenehmer;
+import de.intevation.lada.test.stamm.DatensatzErzeugerTest;
+import de.intevation.lada.test.stamm.MessprogrammKategorieTest;
+import de.intevation.lada.test.stamm.OrtTest;
+import de.intevation.lada.test.stamm.ProbenehmerTest;
import de.intevation.lada.test.stamm.Stammdaten;
@@ -48,12 +51,21 @@
private static Logger logger = Logger.getLogger(StammdatenTest.class);
- private static Integer createdOrtId;
+ @PersistenceContext(unitName="stamm")
+ EntityManager em;
private Stammdaten stammdatenTest;
+ private DatensatzErzeugerTest datensatzerzeugerTest;
+ private ProbenehmerTest probenehmerTest;
+ private MessprogrammKategorieTest messprogrammkategorieTest;
+ private OrtTest ortTest;
public StammdatenTest () {
stammdatenTest = new Stammdaten();
+ datensatzerzeugerTest = new DatensatzErzeugerTest();
+ probenehmerTest = new ProbenehmerTest();
+ messprogrammkategorieTest = new MessprogrammKategorieTest();
+ ortTest = new OrtTest();
testProtocol = new ArrayList<Protocol>();
verboseLogging = false;
}
@@ -63,6 +75,130 @@
logger.info("---------- Testing Lada Stamm Services ----------");
}
+ /**
+ * Insert a probe object into the database.
+ */
+ @Test
+ @InSequence(1)
+ @UsingDataSet("datasets/dbUnit_datensatzerzeuger.json")
+ @DataSource("java:jboss/lada-stamm")
+ @Cleanup(phase=TestExecutionPhase.NONE)
+ public final void prepareDatabaseDatensatzerzeuger() throws Exception {
+ Protocol protocol = new Protocol();
+ protocol.setName("database");
+ protocol.setType("insert datensatzerzeuger");
+ protocol.addInfo("database", "Insert datensatzerzeuger into database");
+ testProtocol.add(protocol);
+ DatensatzErzeuger erzeuger = em.find(DatensatzErzeuger.class, 1000);
+ Assert.assertNotNull(erzeuger);
+ protocol.setPassed(true);
+ }
+
+ /**
+ * Tests for probe operations
+ */
+ @Test
+ @InSequence(2)
+ @RunAsClient
+ public final void testDatensatzerzeuger(@ArquillianResource URL baseUrl)
+ throws Exception {
+ datensatzerzeugerTest.init(baseUrl, testProtocol);
+ datensatzerzeugerTest.execute();
+ }
+
+ /**
+ * Insert a probe object into the database.
+ */
+ @Test
+ @InSequence(3)
+ @UsingDataSet("datasets/dbUnit_probenehmer.json")
+ @DataSource("java:jboss/lada-stamm")
+ @Cleanup(phase=TestExecutionPhase.NONE)
+ public final void prepareDatabaseProbenehmer() throws Exception {
+ Protocol protocol = new Protocol();
+ protocol.setName("database");
+ protocol.setType("insert probenehmer");
+ protocol.addInfo("database", "Insert Probenehmer into database");
+ testProtocol.add(protocol);
+ Probenehmer probenehmer = em.find(Probenehmer.class, 1000);
+ Assert.assertNotNull(probenehmer);
+ protocol.setPassed(true);
+ }
+
+ /**
+ * Tests for probe operations
+ */
+ @Test
+ @InSequence(4)
+ @RunAsClient
+ public final void testProbenehmer(@ArquillianResource URL baseUrl)
+ throws Exception {
+ probenehmerTest.init(baseUrl, testProtocol);
+ probenehmerTest.execute();
+ }
+
+ /**
+ * Insert a probe object into the database.
+ */
+ @Test
+ @InSequence(5)
+ @UsingDataSet("datasets/dbUnit_messprogrammkategorie.json")
+ @DataSource("java:jboss/lada-stamm")
+ @Cleanup(phase=TestExecutionPhase.NONE)
+ public final void prepareDatabaseMessprogrammKategorie() throws Exception {
+ Protocol protocol = new Protocol();
+ protocol.setName("database");
+ protocol.setType("insert messprogrammkategorie");
+ protocol.addInfo("database", "Insert messprogrammkategorie into database");
+ testProtocol.add(protocol);
+ MessprogrammKategorie kategorie = em.find(MessprogrammKategorie.class, 1000);
+ Assert.assertNotNull(kategorie);
+ protocol.setPassed(true);
+ }
+
+ /**
+ * Tests for probe operations
+ */
+ @Test
+ @InSequence(6)
+ @RunAsClient
+ public final void testMessprogrammKategorie(@ArquillianResource URL baseUrl)
+ throws Exception {
+ messprogrammkategorieTest.init(baseUrl, testProtocol);
+ messprogrammkategorieTest.execute();
+ }
+
+ /**
+ * Insert a probe object into the database.
+ */
+ @Test
+ @InSequence(7)
+ @UsingDataSet("datasets/dbUnit_ort.json")
+ @DataSource("java:jboss/lada-stamm")
+ @Cleanup(phase=TestExecutionPhase.NONE)
+ public final void prepareDatabaseOrt() throws Exception {
+ Protocol protocol = new Protocol();
+ protocol.setName("database");
+ protocol.setType("insert ort");
+ protocol.addInfo("database", "Insert ortinto database");
+ testProtocol.add(protocol);
+ Ort ort = em.find(Ort.class, 1000);
+ Assert.assertNotNull(ort);
+ protocol.setPassed(true);
+ }
+
+ /**
+ * Tests for probe operations
+ */
+ @Test
+ @InSequence(8)
+ @RunAsClient
+ public final void testOrt(@ArquillianResource URL baseUrl)
+ throws Exception {
+ ortTest.init(baseUrl, testProtocol);
+ ortTest.execute();
+ }
+
@Test
@RunAsClient
public final void testDatenbasisAll(@ArquillianResource URL baseUrl) {
@@ -172,20 +308,6 @@
}
@Test
- @Ignore
- @RunAsClient
- public final void testLocationAll(@ArquillianResource URL baseUrl) {
- stammdatenTest.getAll(baseUrl, "location", testProtocol);
- }
-
- @Test
- @Ignore
- @RunAsClient
- public final void testLocationById(@ArquillianResource URL baseUrl) {
- stammdatenTest.getById(baseUrl, "location", "19", testProtocol);
- }
-
- @Test
@RunAsClient
public final void testKoordinatenartAll(@ArquillianResource URL baseUrl) {
stammdatenTest.getAll(baseUrl, "koordinatenart", testProtocol);
@@ -232,158 +354,4 @@
public final void testVerwaltungseinheitById(@ArquillianResource URL baseUrl) {
stammdatenTest.getById(baseUrl, "verwaltungseinheit", "09575134", testProtocol);
}
-
- /* TODO: The location service is moved to the "land"-services in
- future version. */
- @Test
- @Ignore
- @RunAsClient
- public final void testLocation1CreateService(@ArquillianResource URL baseUrl)
- throws Exception {
- System.out.print(".");
- Protocol prot = new Protocol();
- prot.setName("locationService");
- prot.setType("create");
- prot.setPassed(false);
- testProtocol.add(prot);
- try {
- /* Create a client*/
- Client client = ClientBuilder.newClient();
- WebTarget target = client.target(baseUrl + "location");
- /* Send a post request containing a new kommentar*/
- String newObj = "{\"beschreibung\":\"Neuer Ort\"," +
- "\"bezeichnung\":\"T123456\",\"hoeheLand\":null," +
- "\"koordXExtern\":\"32531152\",\"koordYExtern\":\"5684269\"," +
- "\"latitude\":51.30888,\"letzteAenderung\":1376287046332," +
- "\"longitude\":9.44693,\"nutsCode\":\"DE731\",\"unscharf\":" +
- "\"0\",\"netzbetreiberId\":null,\"staatId\":0," +
- "\"verwaltungseinheitId\":\"06611000\",\"otyp\":\"Z\"," +
- "\"koordinatenartId\":5}";
-
- Response response = target.request()
- .header("X-SHIB-user", BaseTest.TEST_USER)
- .header("X-SHIB-roles", BaseTest.TEST_ROLES)
- .post(Entity.entity(newObj, MediaType.APPLICATION_JSON));
- String entity = response.readEntity(String.class);
- /* Try to parse the response*/
- JsonReader fromServiceReader =
- Json.createReader(new StringReader(entity));
- JsonObject content = fromServiceReader.readObject();
- /* Save the id*/
- createdOrtId =
- content.getJsonObject("data").getJsonNumber("id").intValue();
- prot.addInfo("ortId", createdOrtId);
- /* Verify the response*/
- Assert.assertTrue(content.getBoolean("success"));
- prot.addInfo("success", content.getBoolean("success"));
- Assert.assertEquals("200", content.getString("message"));
- prot.addInfo("message", content.getString("message"));
- }
- catch(JsonException je) {
- prot.addInfo("exception", je.getMessage());
- Assert.fail(je.getMessage());
- }
- prot.setPassed(true);
- }
-
- /**
- * Test the UPDATE Service.
- *
- * @param baseUrl The url pointing to the test deployment.
- */
- @Test
- @Ignore
- @RunAsClient
- public final void testLocation2UpdateService(@ArquillianResource URL baseUrl)
- throws Exception {
- System.out.print(".");
- Protocol prot = new Protocol();
- prot.setName("locationService");
- prot.setType("update");
- prot.setPassed(false);
- testProtocol.add(prot);
- try {
- /* Create a client*/
- Client client = ClientBuilder.newClient();
- WebTarget target =
- client.target(baseUrl + "location/" + createdOrtId);
- prot.addInfo("locationId", createdOrtId);
- /* Request a kommentar with the id saved when created a kommentar*/
- Response response = target.request()
- .header("X-SHIB-user", BaseTest.TEST_USER)
- .header("X-SHIB-roles", BaseTest.TEST_ROLES)
- .get();
- String entity = response.readEntity(String.class);
- /* Try to parse the response*/
- JsonReader reader = Json.createReader(new StringReader(entity));
- JsonObject oldObj = reader.readObject().getJsonObject("data");
- /* Change the text*/
- String updatedEntity =
- oldObj.toString().replace("Neuer Ort", "Neuerer Ort");
- prot.addInfo("updated field", "beschreibung");
- prot.addInfo("updated value", "Neuer Ort");
- prot.addInfo("updated to", "Neuerer Ort");
- /* Send the updated kommentar via put reauest*/
- WebTarget putTarget = client.target(baseUrl + "location/" + createdOrtId);
- Response updated = putTarget.request()
- .header("X-SHIB-user", BaseTest.TEST_USER)
- .header("X-SHIB-roles", BaseTest.TEST_ROLES)
- .put(Entity.entity(updatedEntity, MediaType.APPLICATION_JSON));
- /* Try to parse the response*/
- JsonReader updatedReader = Json.createReader(
- new StringReader(updated.readEntity(String.class)));
- JsonObject updatedObj = updatedReader.readObject();
- /* Verify the response*/
- Assert.assertTrue(updatedObj.getBoolean("success"));
- prot.addInfo("success", updatedObj.getBoolean("success"));
- Assert.assertEquals("200", updatedObj.getString("message"));
- prot.addInfo("message", updatedObj.getString("message"));
- Assert.assertEquals("Neuerer Ort",
- updatedObj.getJsonObject("data").getString("beschreibung"));
- }
- catch(JsonException je) {
- prot.addInfo("exception", je.getMessage());
- Assert.fail(je.getMessage());
- }
- prot.setPassed(true);
- }
-
- @Test
- @Ignore
- @RunAsClient
- public final void testLocation3DeleteService(@ArquillianResource URL baseUrl)
- throws Exception {
- System.out.print(".");
- Protocol prot = new Protocol();
- prot.setName("locationService");
- prot.setType("delete");
- prot.setPassed(false);
- testProtocol.add(prot);
- try {
- /* Create a client*/
- Client client = ClientBuilder.newClient();
- WebTarget target =
- client.target(baseUrl + "location/" + createdOrtId);
- prot.addInfo("locationId", createdOrtId);
- /* Delete the object with the saved id*/
- Response response = target.request()
- .header("X-SHIB-user", BaseTest.TEST_USER)
- .header("X-SHIB-roles", BaseTest.TEST_ROLES)
- .delete();
- 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"));
- prot.addInfo("success", respObj.getBoolean("success"));
- Assert.assertEquals("200", respObj.getString("message"));
- prot.addInfo("message", respObj.getString("message"));
- }
- catch(JsonException je) {
- prot.addInfo("exception", je.getMessage());
- Assert.fail(je.getMessage());
- }
- prot.setPassed(true);
- }
}
diff -r cb1cfc8c81ed -r 075f511243d5 src/test/java/de/intevation/lada/test/stamm/DatensatzErzeugerTest.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/test/java/de/intevation/lada/test/stamm/DatensatzErzeugerTest.java Fri Jan 08 12:09:12 2016 +0100
@@ -0,0 +1,57 @@
+package de.intevation.lada.test.stamm;
+
+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;
+import de.intevation.lada.test.ServiceTest;
+
+public class DatensatzErzeugerTest 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 object
+ JsonObject content = readJsonResource("/datasets/dbUnit_datensatzerzeuger.json");
+ JsonObject erzeuger = content.getJsonArray("stammdaten.datensatz_erzeuger").getJsonObject(0);
+ JsonObjectBuilder builder = convertObject(erzeuger);
+ expectedById = builder.build();
+ Assert.assertNotNull(expectedById);
+
+ // Load object to test POST request
+ create = readJsonResource("/datasets/datensatzerzeuger.json");
+ Assert.assertNotNull(create);
+ }
+
+ public final void execute() {
+ getAll("datensatzerzeuger", "rest/datensatzerzeuger");
+ getById("datensatzerzeuger", "rest/datensatzerzeuger/1000", expectedById);
+ update("datensatzerzeuger", "rest/datensatzerzeuger/1000", "bezeichnung", "Testbezeichnung", "geändert");
+ JsonObject created = create("datensatzerzeuger", "rest/datensatzerzeuger", create);
+ delete("datensatzerzeuger", "rest/datensatzerzeuger/" + created.getJsonObject("data").get("id"));
+ }
+}
diff -r cb1cfc8c81ed -r 075f511243d5 src/test/java/de/intevation/lada/test/stamm/MessprogrammKategorieTest.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/test/java/de/intevation/lada/test/stamm/MessprogrammKategorieTest.java Fri Jan 08 12:09:12 2016 +0100
@@ -0,0 +1,57 @@
+package de.intevation.lada.test.stamm;
+
+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;
+import de.intevation.lada.test.ServiceTest;
+
+public class MessprogrammKategorieTest 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 object
+ JsonObject content = readJsonResource("/datasets/dbUnit_messprogrammkategorie.json");
+ JsonObject erzeuger = content.getJsonArray("stammdaten.messprogramm_kategorie").getJsonObject(0);
+ JsonObjectBuilder builder = convertObject(erzeuger);
+ expectedById = builder.build();
+ Assert.assertNotNull(expectedById);
+
+ // Load object to test POST request
+ create = readJsonResource("/datasets/messprogrammkategorie.json");
+ Assert.assertNotNull(create);
+ }
+
+ public final void execute() {
+ getAll("messprogrammkategorie", "rest/messprogrammkategorie");
+ getById("messprogrammkategorie", "rest/messprogrammkategorie/1000", expectedById);
+ update("messprogrammkategorie", "rest/messprogrammkategorie/1000", "bezeichnung", "Testbezeichnung", "geändert");
+ JsonObject created = create("messprogrammkategorie", "rest/messprogrammkategorie", create);
+ delete("messprogrammkategorie", "rest/messprogrammkategorie/" + created.getJsonObject("data").get("id"));
+ }
+}
diff -r cb1cfc8c81ed -r 075f511243d5 src/test/java/de/intevation/lada/test/stamm/OrtTest.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/test/java/de/intevation/lada/test/stamm/OrtTest.java Fri Jan 08 12:09:12 2016 +0100
@@ -0,0 +1,56 @@
+package de.intevation.lada.test.stamm;
+
+import java.net.URL;
+import java.util.Arrays;
+import java.util.List;
+
+import javax.json.JsonObject;
+import javax.json.JsonObjectBuilder;
+
+import org.junit.Assert;
+
+import de.intevation.lada.Protocol;
+import de.intevation.lada.test.ServiceTest;
+
+public class OrtTest 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 object
+ JsonObject content = readJsonResource("/datasets/dbUnit_ort.json");
+ JsonObject erzeuger = content.getJsonArray("stammdaten.ort").getJsonObject(0);
+ JsonObjectBuilder builder = convertObject(erzeuger);
+ expectedById = builder.build();
+ Assert.assertNotNull(expectedById);
+
+ // Load object to test POST request
+ create = readJsonResource("/datasets/ort.json");
+ Assert.assertNotNull(create);
+ }
+
+ public final void execute() {
+ getAll("ort", "rest/ort");
+ getById("ort", "rest/ort/1000", expectedById);
+ update("ort", "rest/ort/1000", "langtext", "Langer Text", "Längerer Text");
+ JsonObject created = create("ort", "rest/ort", create);
+ delete("ort", "rest/ort/" + created.getJsonObject("data").get("id"));
+ }
+}
diff -r cb1cfc8c81ed -r 075f511243d5 src/test/java/de/intevation/lada/test/stamm/ProbenehmerTest.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/test/java/de/intevation/lada/test/stamm/ProbenehmerTest.java Fri Jan 08 12:09:12 2016 +0100
@@ -0,0 +1,56 @@
+package de.intevation.lada.test.stamm;
+
+import java.net.URL;
+import java.util.Arrays;
+import java.util.List;
+
+import javax.json.JsonObject;
+import javax.json.JsonObjectBuilder;
+
+import org.junit.Assert;
+
+import de.intevation.lada.Protocol;
+import de.intevation.lada.test.ServiceTest;
+
+public class ProbenehmerTest 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 object
+ JsonObject content = readJsonResource("/datasets/dbUnit_probenehmer.json");
+ JsonObject probenehmer = content.getJsonArray("stammdaten.probenehmer").getJsonObject(0);
+ JsonObjectBuilder builder = convertObject(probenehmer);
+ expectedById = builder.build();
+ Assert.assertNotNull(expectedById);
+
+ // Load object to test POST request
+ create = readJsonResource("/datasets/probenehmer.json");
+ Assert.assertNotNull(create);
+ }
+
+ public final void execute() {
+ getAll("probenehmer", "rest/probenehmer");
+ getById("probenehmer", "rest/probenehmer/1000", expectedById);
+ update("probenehmer", "rest/probenehmer/1000", "bezeichnung", "Testbezeichnung", "geändert");
+ JsonObject created = create("probenehmer", "rest/probenehmer", create);
+ delete("probenehmer", "rest/probenehmer/" + created.getJsonObject("data").get("id"));
+ }
+}
diff -r cb1cfc8c81ed -r 075f511243d5 src/test/resources/datasets/cleanup.sql
--- a/src/test/resources/datasets/cleanup.sql Fri Jan 08 12:07:26 2016 +0100
+++ b/src/test/resources/datasets/cleanup.sql Fri Jan 08 12:09:12 2016 +0100
@@ -1,2 +1,6 @@
-DELETE from land.probe where id = 1000;
-DELETE from land.messprogramm where id = 1000;
\ No newline at end of file
+DELETE FROM land.probe WHERE id = 1000;
+DELETE FROM land.messprogramm WHERE id = 1000;
+DELETE FROM stammdaten.datensatz_erzeuger WHERE id = 1000;
+DELETE FROM stammdaten.probenehmer WHERE id = 1000;
+DELETE FROM stammdaten.messprogramm_kategorie WHERE id = 1000;
+DELETE FROM stammdaten.ort WHERE id = 1000;
\ No newline at end of file
diff -r cb1cfc8c81ed -r 075f511243d5 src/test/resources/datasets/datensatzerzeuger.json
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/test/resources/datasets/datensatzerzeuger.json Fri Jan 08 12:09:12 2016 +0100
@@ -0,0 +1,7 @@
+{
+ "daErzeugerId": "06",
+ "letzteAenderung": 1381413048800,
+ "mstId": "06010",
+ "bezeichnung": "Test 1",
+ "netzbetreiberId": "06"
+}
diff -r cb1cfc8c81ed -r 075f511243d5 src/test/resources/datasets/dbUnit_datensatzerzeuger.json
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/test/resources/datasets/dbUnit_datensatzerzeuger.json Fri Jan 08 12:09:12 2016 +0100
@@ -0,0 +1,10 @@
+{
+ "stammdaten.datensatz_erzeuger": [{
+ "id": 1000,
+ "bezeichnung": "Testbezeichnung",
+ "netzbetreiber_id": "06",
+ "mst_id": "06010",
+ "da_erzeuger_id": "06",
+ "letzte_aenderung": "2015-03-01 12:00:00"
+ }]
+}
diff -r cb1cfc8c81ed -r 075f511243d5 src/test/resources/datasets/dbUnit_messprogrammkategorie.json
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/test/resources/datasets/dbUnit_messprogrammkategorie.json Fri Jan 08 12:09:12 2016 +0100
@@ -0,0 +1,9 @@
+{
+ "stammdaten.messprogramm_kategorie": [{
+ "id": 1000,
+ "netzbetreiber_id": "06",
+ "mpl_id": "mp2",
+ "bezeichnung": "Testbezeichnung",
+ "letzte_aenderung": "2015-03-01 12:00:00"
+ }]
+}
diff -r cb1cfc8c81ed -r 075f511243d5 src/test/resources/datasets/dbUnit_ort.json
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/test/resources/datasets/dbUnit_ort.json Fri Jan 08 12:09:12 2016 +0100
@@ -0,0 +1,21 @@
+{
+ "stammdaten.ort": [{
+ "id": 1000,
+ "netzbetreiber_id": "06",
+ "ort_id": "D_ 00191",
+ "langtext": "Langer Text",
+ "staat_id": 0,
+ "gem_id": "11000000",
+ "unscharf": "t",
+ "nuts_code": "DE716",
+ "kda_id": 5,
+ "koord_x_extern": "32487017",
+ "koord_y_extern": "5519769",
+ "letzte_aenderung": "2015-03-01 12:00:00",
+ "latitude": 49.83021,
+ "longitude": 8.81948,
+ "ort_typ": 1,
+ "kurztext": "kurz",
+ "berichtstext": "bericht"
+ }]
+}
diff -r cb1cfc8c81ed -r 075f511243d5 src/test/resources/datasets/dbUnit_probenehmer.json
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/test/resources/datasets/dbUnit_probenehmer.json Fri Jan 08 12:09:12 2016 +0100
@@ -0,0 +1,19 @@
+{
+ "stammdaten.probenehmer": [{
+ "id": 1000,
+ "netzbetreiber_id": "06",
+ "prn_id": "AV6",
+ "bearbeiter": "Testbearbeiter",
+ "bemerkung": "Testbemerkung",
+ "betrieb": "Testbetrieb",
+ "bezeichnung": "Testbezeichnung",
+ "kurz_bezeichnung": "Testkurz",
+ "ort": "Testhausen",
+ "plz": "12345",
+ "strasse": "Teststrasse",
+ "telefon": "01100011",
+ "tp": "kpt",
+ "typ": "a",
+ "letzte_aenderung": "2015-03-01 12:00:00"
+ }]
+}
diff -r cb1cfc8c81ed -r 075f511243d5 src/test/resources/datasets/messprogrammkategorie.json
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/test/resources/datasets/messprogrammkategorie.json Fri Jan 08 12:09:12 2016 +0100
@@ -0,0 +1,5 @@
+{
+ "bezeichnung": "Testbezeichnung",
+ "netzbetreiberId": "06",
+ "mplId": "mp5"
+}
diff -r cb1cfc8c81ed -r 075f511243d5 src/test/resources/datasets/ort.json
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/test/resources/datasets/ort.json Fri Jan 08 12:09:12 2016 +0100
@@ -0,0 +1,17 @@
+{
+ "netzbetreiberId": "06",
+ "ortId": "D_ 00191",
+ "langtext": "Langer Text",
+ "staatId": 0,
+ "gemId": "11000000",
+ "unscharf": "t",
+ "nutsCode": "DE716",
+ "kdaId": 5,
+ "koordXExtern": "32487017",
+ "koordYExtern": "5519769",
+ "latitude": 49.83021,
+ "longitude": 8.81948,
+ "ortTyp": 1,
+ "kurztext": "kurz",
+ "berichtstext": "bericht"
+}
diff -r cb1cfc8c81ed -r 075f511243d5 src/test/resources/datasets/probenehmer.json
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/test/resources/datasets/probenehmer.json Fri Jan 08 12:09:12 2016 +0100
@@ -0,0 +1,16 @@
+{
+ "netzbetreiberId": "06",
+ "prnId": "AR6",
+ "bearbeiter": "Testbearbeiter",
+ "bemerkung": "Testbemerkung",
+ "betrieb": "Testbetrieb",
+ "bezeichnung": "Testbezeichnung",
+ "kurzBezeichnung": "Testkurz",
+ "ort": "Testhausen",
+ "plz": "12345",
+ "strasse": "Teststrasse",
+ "telefon": "01100011",
+ "tp": "kpt",
+ "typ": "a",
+ "letzteAenderung": "2015-03-01T12:00:00"
+}
More information about the Lada-commits
mailing list