annotate src/test/java/de/intevation/lada/test/stamm/Stammdaten.java @ 1236:d67b10dc5d4b

latitude and longitude are serialized from geom.
author Tom Gottfried <tom@intevation.de>
date Tue, 13 Dec 2016 19:05:53 +0100
parents 93918aca306e
children
rev   line source
849
d0a591b3eade Added missing file header.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 831
diff changeset
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
d0a591b3eade Added missing file header.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 831
diff changeset
2 * Software engineering by Intevation GmbH
d0a591b3eade Added missing file header.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 831
diff changeset
3 *
d0a591b3eade Added missing file header.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 831
diff changeset
4 * This file is Free Software under the GNU GPL (v>=3)
d0a591b3eade Added missing file header.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 831
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out
d0a591b3eade Added missing file header.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 831
diff changeset
6 * the documentation coming with IMIS-Labordaten-Application for details.
d0a591b3eade Added missing file header.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 831
diff changeset
7 */
495
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
8 package de.intevation.lada.test.stamm;
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
9
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
10 import java.io.StringReader;
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
11 import java.net.URL;
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
12 import java.util.HashMap;
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
13 import java.util.List;
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
14 import java.util.Map;
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
15
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
16 import javax.json.Json;
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
17 import javax.json.JsonException;
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
18 import javax.json.JsonObject;
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
19 import javax.json.JsonReader;
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
20 import javax.ws.rs.client.Client;
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
21 import javax.ws.rs.client.ClientBuilder;
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
22 import javax.ws.rs.client.WebTarget;
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
23 import javax.ws.rs.core.Response;
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
24
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
25 import org.junit.Assert;
762
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
26 import org.hamcrest.Matcher;
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
27 import org.hamcrest.Matchers;
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
28
757
bc789d180439 Added authentication information to all requests.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 644
diff changeset
29 import de.intevation.lada.BaseTest;
495
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
30 import de.intevation.lada.Protocol;
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
31
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
32 public class Stammdaten {
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
33
831
3d76d476894f Updated stammdaten test.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 762
diff changeset
34 @SuppressWarnings("rawtypes")
762
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
35 private static Map<String, Matcher> matchers;
495
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
36
831
3d76d476894f Updated stammdaten test.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 762
diff changeset
37 @SuppressWarnings("rawtypes")
495
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
38 public Stammdaten() {
762
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
39 matchers = new HashMap<String, Matcher>();
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
40
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
41 matchers.put("datenbasis",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
42 Matchers.containsInAnyOrder("id","beschreibung","datenbasis")
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
43 );
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
44
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
45 matchers.put("messeinheit",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
46 Matchers.containsInAnyOrder(
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
47 "id",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
48 "beschreibung",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
49 "einheit",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
50 "eudfMesseinheitId",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
51 "umrechnungsFaktorEudf"
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
52 )
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
53 );
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
54
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
55 matchers.put("messgroesse",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
56 Matchers.containsInAnyOrder(
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
57 "id",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
58 "beschreibung",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
59 "defaultFarbe",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
60 "eudfNuklidId",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
61 "idfNuklidKey",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
62 "istLeitnuklid",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
63 "kennungBvl",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
64 "messgroesse"
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
65 )
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
66 );
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
67
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
68 matchers.put("messmethode",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
69 Matchers.containsInAnyOrder("id","beschreibung","messmethode")
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
70 );
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
71
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
72 matchers.put("messstelle",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
73 Matchers.containsInAnyOrder(
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
74 "id",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
75 "amtskennung",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
76 "beschreibung",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
77 "messStelle",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
78 "mstTyp",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
79 "netzbetreiberId"
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
80 )
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
81 );
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
82
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
83 matchers.put("netzbetreiber",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
84 Matchers.containsInAnyOrder(
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
85 "id",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
86 "aktiv",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
87 "idfNetzbetreiber",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
88 "isBmn",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
89 "mailverteiler",
1097
186d602e031a Merged branch schema-update into default.
Tom Gottfried <tom@intevation.de>
parents: 973
diff changeset
90 "netzbetreiber"
762
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
91 )
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
92 );
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
93
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
94 matchers.put("pflichtmessgroesse",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
95 Matchers.containsInAnyOrder(
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
96 "id",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
97 "messgroesseId",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
98 "datenbasisId",
1097
186d602e031a Merged branch schema-update into default.
Tom Gottfried <tom@intevation.de>
parents: 973
diff changeset
99 "messMethodeId",
186d602e031a Merged branch schema-update into default.
Tom Gottfried <tom@intevation.de>
parents: 973
diff changeset
100 "umwId"
762
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
101 )
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
102 );
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
103
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
104 matchers.put("probenart",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
105 Matchers.containsInAnyOrder(
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
106 "id",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
107 "beschreibung",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
108 "probenart",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
109 "probenartEudfId"
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
110 )
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
111 );
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
112
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
113 matchers.put("probenzusatz",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
114 Matchers.containsInAnyOrder(
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
115 "id",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
116 "beschreibung",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
117 "eudfKeyword",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
118 "zusatzwert",
1097
186d602e031a Merged branch schema-update into default.
Tom Gottfried <tom@intevation.de>
parents: 973
diff changeset
119 "messEinheitId"
762
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
120 )
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
121 );
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
122
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
123 matchers.put("location",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
124 Matchers.containsInAnyOrder(
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
125 "id",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
126 "beschreibung",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
127 "bezeichnung",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
128 "hoeheLand",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
129 "koordXExtern",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
130 "koordYExtern",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
131 "latitude",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
132 "longitude",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
133 "letzteAenderung",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
134 "nutsCode",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
135 "unscharf",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
136 "netzbetreiberId",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
137 "staatId",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
138 "verwaltungseinheitId",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
139 "otyp",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
140 "koordinatenartId"
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
141 )
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
142 );
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
143
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
144 matchers.put("koordinatenart",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
145 Matchers.containsInAnyOrder("id","idfGeoKey","koordinatenart")
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
146 );
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
147
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
148 matchers.put("staat",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
149 Matchers.containsInAnyOrder(
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
150 "id",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
151 "eu",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
152 "hklId",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
153 "koordXExtern",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
154 "koordYExtern",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
155 "staat",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
156 "staatIso",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
157 "staatKurz",
1097
186d602e031a Merged branch schema-update into default.
Tom Gottfried <tom@intevation.de>
parents: 973
diff changeset
158 "kdaId"
762
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
159 )
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
160 );
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
161
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
162 matchers.put("umwelt",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
163 Matchers.containsInAnyOrder("id","beschreibung","umweltBereich","mehId")
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
164 );
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
165
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
166 matchers.put("verwaltungseinheit",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
167 Matchers.containsInAnyOrder(
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
168 "id",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
169 "bezeichnung",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
170 "bundesland",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
171 "isBundesland",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
172 "isGemeinde",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
173 "isLandkreis",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
174 "isRegbezirk",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
175 "kreis",
1236
d67b10dc5d4b latitude and longitude are serialized from geom.
Tom Gottfried <tom@intevation.de>
parents: 1232
diff changeset
176 "latitude",
d67b10dc5d4b latitude and longitude are serialized from geom.
Tom Gottfried <tom@intevation.de>
parents: 1232
diff changeset
177 "longitude",
762
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
178 "nuts",
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
179 "plz",
1232
93918aca306e Adapt tests to model changes in rev 1bc8ab13e1f7.
Tom Gottfried <tom@intevation.de>
parents: 1097
diff changeset
180 "regbezirk"
762
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
181 )
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
182 );
495
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
183 }
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
184
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
185 /**
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
186 * Test the GET Service by requesting all objects.
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
187 *
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
188 * @param baseUrl The url pointing to the test deployment.
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
189 */
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
190 public final void getAll(URL baseUrl, String type, List<Protocol> protocol) {
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
191 System.out.print(".");
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
192 Protocol prot = new Protocol();
831
3d76d476894f Updated stammdaten test.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 762
diff changeset
193 prot.setName(type + " service");
495
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
194 prot.setType("get all");
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
195 prot.setPassed(false);
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
196 protocol.add(prot);
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
197 Assert.assertNotNull(type);
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
198 /* Create a client*/
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
199 Client client = ClientBuilder.newClient();
831
3d76d476894f Updated stammdaten test.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 762
diff changeset
200 WebTarget target = client.target(baseUrl + "rest/" + type);
495
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
201 /* Request all objects*/
757
bc789d180439 Added authentication information to all requests.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 644
diff changeset
202 Response response = target.request()
bc789d180439 Added authentication information to all requests.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 644
diff changeset
203 .header("X-SHIB-user", BaseTest.TEST_USER)
bc789d180439 Added authentication information to all requests.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 644
diff changeset
204 .header("X-SHIB-roles", BaseTest.TEST_ROLES)
bc789d180439 Added authentication information to all requests.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 644
diff changeset
205 .get();
495
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
206 String entity = response.readEntity(String.class);
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
207 try{
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
208 /* Try to parse the response*/
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
209 JsonReader reader = Json.createReader(new StringReader(entity));
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
210 JsonObject content = reader.readObject();
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
211 /* Verify the response*/
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
212 Assert.assertTrue(content.getBoolean("success"));
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
213 prot.addInfo("success", content.getBoolean("success"));
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
214 Assert.assertEquals("200", content.getString("message"));
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
215 prot.addInfo("message", content.getString("message"));
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
216 Assert.assertNotNull(content.getJsonArray("data"));
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
217 prot.addInfo("objects", content.getJsonArray("data").size());
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
218 }
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
219 catch(JsonException je) {
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
220 prot.addInfo("exception", je.getMessage());
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
221 Assert.fail(je.getMessage());
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
222 }
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
223 prot.setPassed(true);
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
224 }
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
225
831
3d76d476894f Updated stammdaten test.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 762
diff changeset
226 @SuppressWarnings("unchecked")
495
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
227 public final void getById(
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
228 URL baseUrl,
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
229 String type,
502
ff5e10f2dc8a Added tests for messmethode service.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 499
diff changeset
230 Object id,
495
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
231 List<Protocol> protocol
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
232 ) {
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
233 System.out.print(".");
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
234 Protocol prot = new Protocol();
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
235 prot.setName(type + "Service");
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
236 prot.setType("get by Id");
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
237 prot.setPassed(false);
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
238 protocol.add(prot);
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
239 try {
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
240 /* Create a client*/
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
241 Client client = ClientBuilder.newClient();
831
3d76d476894f Updated stammdaten test.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 762
diff changeset
242 WebTarget target = client.target(baseUrl + "rest/" + type +"/" + id);
495
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
243 prot.addInfo(type + "Id", id);
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
244 /* Request an object by id*/
757
bc789d180439 Added authentication information to all requests.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 644
diff changeset
245 Response response = target.request()
bc789d180439 Added authentication information to all requests.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 644
diff changeset
246 .header("X-SHIB-user", BaseTest.TEST_USER)
bc789d180439 Added authentication information to all requests.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 644
diff changeset
247 .header("X-SHIB-roles", BaseTest.TEST_ROLES)
bc789d180439 Added authentication information to all requests.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 644
diff changeset
248 .get();
495
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
249 String entity = response.readEntity(String.class);
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
250 /* Try to parse the response*/
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
251 JsonReader fromServiceReader =
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
252 Json.createReader(new StringReader(entity));
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
253 JsonObject content = fromServiceReader.readObject();
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
254 /* Verify the response*/
973
4b5f5e253cab Make tests more verbose on failure.
Tom Gottfried <tom@intevation.de>
parents: 849
diff changeset
255 Assert.assertTrue("Unsuccessful response object:\n" + content,
4b5f5e253cab Make tests more verbose on failure.
Tom Gottfried <tom@intevation.de>
parents: 849
diff changeset
256 content.getBoolean("success"));
495
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
257 prot.addInfo("success", content.getBoolean("success"));
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
258 Assert.assertEquals("200", content.getString("message"));
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
259 prot.addInfo("message", content.getString("message"));
762
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
260 Assert.assertThat(content.getJsonObject("data").keySet(),
c415d14acadd Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents: 757
diff changeset
261 matchers.get(type));
495
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
262 prot.addInfo("object", "equals");
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
263 }
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
264 catch(JsonException je) {
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
265 prot.addInfo("exception", je.getMessage());
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
266 Assert.fail(je.getMessage());
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
267 }
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
268 prot.setPassed(true);
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
269 }
705e7d7c5f2c Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
270 }
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)