Mercurial > lada > lada-server
annotate src/test/java/de/intevation/lada/test/stamm/Stammdaten.java @ 1040:ea550e9a09a3 schema-update
Updated unit tests to fit the new data model.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Fri, 02 Sep 2016 14:03:25 +0200 |
parents | 4b5f5e253cab |
children | 93918aca306e |
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", |
1040
ea550e9a09a3
Updated unit tests to fit the new data model.
Raimund Renkert <raimund.renkert@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", |
1040
ea550e9a09a3
Updated unit tests to fit the new data model.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
973
diff
changeset
|
99 "messMethodeId", |
ea550e9a09a3
Updated unit tests to fit the new data model.
Raimund Renkert <raimund.renkert@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", |
1040
ea550e9a09a3
Updated unit tests to fit the new data model.
Raimund Renkert <raimund.renkert@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", |
1040
ea550e9a09a3
Updated unit tests to fit the new data model.
Raimund Renkert <raimund.renkert@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 "koordXExtern", |
c415d14acadd
Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents:
757
diff
changeset
|
176 "koordYExtern", |
c415d14acadd
Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents:
757
diff
changeset
|
177 "kreis", |
c415d14acadd
Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents:
757
diff
changeset
|
178 "latitude", |
c415d14acadd
Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents:
757
diff
changeset
|
179 "longitude", |
c415d14acadd
Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents:
757
diff
changeset
|
180 "nuts", |
c415d14acadd
Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents:
757
diff
changeset
|
181 "plz", |
c415d14acadd
Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents:
757
diff
changeset
|
182 "regbezirk", |
1040
ea550e9a09a3
Updated unit tests to fit the new data model.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
973
diff
changeset
|
183 "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
|
184 ) |
c415d14acadd
Tests should not depend on actual data nor order of attributes in JSON.
Tom Gottfried <tom@intevation.de>
parents:
757
diff
changeset
|
185 ); |
495
705e7d7c5f2c
Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
186 } |
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 /** |
705e7d7c5f2c
Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
189 * 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
|
190 * |
705e7d7c5f2c
Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
191 * @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
|
192 */ |
705e7d7c5f2c
Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
193 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
|
194 System.out.print("."); |
705e7d7c5f2c
Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
195 Protocol prot = new Protocol(); |
831
3d76d476894f
Updated stammdaten test.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
762
diff
changeset
|
196 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
|
197 prot.setType("get all"); |
705e7d7c5f2c
Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
198 prot.setPassed(false); |
705e7d7c5f2c
Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
199 protocol.add(prot); |
705e7d7c5f2c
Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
200 Assert.assertNotNull(type); |
705e7d7c5f2c
Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
201 /* Create a client*/ |
705e7d7c5f2c
Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
202 Client client = ClientBuilder.newClient(); |
831
3d76d476894f
Updated stammdaten test.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
762
diff
changeset
|
203 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
|
204 /* Request all objects*/ |
757
bc789d180439
Added authentication information to all requests.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
644
diff
changeset
|
205 Response response = target.request() |
bc789d180439
Added authentication information to all requests.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
644
diff
changeset
|
206 .header("X-SHIB-user", BaseTest.TEST_USER) |
bc789d180439
Added authentication information to all requests.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
644
diff
changeset
|
207 .header("X-SHIB-roles", BaseTest.TEST_ROLES) |
bc789d180439
Added authentication information to all requests.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
644
diff
changeset
|
208 .get(); |
495
705e7d7c5f2c
Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
209 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
|
210 try{ |
705e7d7c5f2c
Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
211 /* 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
|
212 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
|
213 JsonObject content = reader.readObject(); |
705e7d7c5f2c
Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
214 /* Verify the response*/ |
705e7d7c5f2c
Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
215 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
|
216 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
|
217 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
|
218 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
|
219 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
|
220 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
|
221 } |
705e7d7c5f2c
Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
222 catch(JsonException je) { |
705e7d7c5f2c
Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
223 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
|
224 Assert.fail(je.getMessage()); |
705e7d7c5f2c
Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
225 } |
705e7d7c5f2c
Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
226 prot.setPassed(true); |
705e7d7c5f2c
Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
227 } |
705e7d7c5f2c
Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
228 |
831
3d76d476894f
Updated stammdaten test.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
762
diff
changeset
|
229 @SuppressWarnings("unchecked") |
495
705e7d7c5f2c
Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
230 public final void getById( |
705e7d7c5f2c
Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
231 URL baseUrl, |
705e7d7c5f2c
Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
232 String type, |
502
ff5e10f2dc8a
Added tests for messmethode service.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
499
diff
changeset
|
233 Object id, |
495
705e7d7c5f2c
Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
234 List<Protocol> protocol |
705e7d7c5f2c
Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
235 ) { |
705e7d7c5f2c
Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
236 System.out.print("."); |
705e7d7c5f2c
Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
237 Protocol prot = new Protocol(); |
705e7d7c5f2c
Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
238 prot.setName(type + "Service"); |
705e7d7c5f2c
Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
239 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
|
240 prot.setPassed(false); |
705e7d7c5f2c
Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
241 protocol.add(prot); |
705e7d7c5f2c
Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
242 try { |
705e7d7c5f2c
Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
243 /* Create a client*/ |
705e7d7c5f2c
Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
244 Client client = ClientBuilder.newClient(); |
831
3d76d476894f
Updated stammdaten test.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
762
diff
changeset
|
245 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
|
246 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
|
247 /* Request an object by id*/ |
757
bc789d180439
Added authentication information to all requests.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
644
diff
changeset
|
248 Response response = target.request() |
bc789d180439
Added authentication information to all requests.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
644
diff
changeset
|
249 .header("X-SHIB-user", BaseTest.TEST_USER) |
bc789d180439
Added authentication information to all requests.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
644
diff
changeset
|
250 .header("X-SHIB-roles", BaseTest.TEST_ROLES) |
bc789d180439
Added authentication information to all requests.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
644
diff
changeset
|
251 .get(); |
495
705e7d7c5f2c
Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
252 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
|
253 /* 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
|
254 JsonReader fromServiceReader = |
705e7d7c5f2c
Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
255 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
|
256 JsonObject content = fromServiceReader.readObject(); |
705e7d7c5f2c
Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
257 /* Verify the response*/ |
973
4b5f5e253cab
Make tests more verbose on failure.
Tom Gottfried <tom@intevation.de>
parents:
849
diff
changeset
|
258 Assert.assertTrue("Unsuccessful response object:\n" + content, |
4b5f5e253cab
Make tests more verbose on failure.
Tom Gottfried <tom@intevation.de>
parents:
849
diff
changeset
|
259 content.getBoolean("success")); |
495
705e7d7c5f2c
Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
260 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
|
261 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
|
262 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
|
263 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
|
264 matchers.get(type)); |
495
705e7d7c5f2c
Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
265 prot.addInfo("object", "equals"); |
705e7d7c5f2c
Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
266 } |
705e7d7c5f2c
Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
267 catch(JsonException je) { |
705e7d7c5f2c
Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
268 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
|
269 Assert.fail(je.getMessage()); |
705e7d7c5f2c
Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
270 } |
705e7d7c5f2c
Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
271 prot.setPassed(true); |
705e7d7c5f2c
Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
272 } |
705e7d7c5f2c
Added test class for stammdaten including first tests for datenbasis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
273 } |