@@ -54,7 +54,7 @@ public void testCollections() {
54
54
+ " \" collections\" : [ {\n "
55
55
+ " \" name\" : \" flurstueck\" ,\n "
56
56
+ " \" title\" : \" Flurstück\" ,\n " + " \" extent\" : {\n "
57
- + " \" spatial\" : { \" bbox\" : [ 5.61272621360749, 50.2373512077239, 9.58963433710139, 52.5286304537795 ] },\n "
57
+ + " \" spatial\" : { \" bbox\" : [[ 5.61272621360749, 50.2373512077239, 9.58963433710139, 52.5286304537795 ] ] },\n "
58
58
+ " \" temporal\" : { \" interval\" : [[ \" 2018-05-18T14:45:44Z\" , \" 2019-06-17T21:41:19Z\" ]] }\n "
59
59
+ " },\n " + " \" links\" : [ {\n "
60
60
+ " \" rel\" : \" item\" ,\n "
@@ -90,7 +90,7 @@ public void testCollections() {
90
90
+ " \" name\" : \" gebaeudebauwerk\" ,\n "
91
91
+ " \" title\" : \" Gebäude, Bauwerk\" ,\n "
92
92
+ " \" extent\" : {\n "
93
- + " \" spatial\" : { \" bbox\" : [ 5.61272621360749, 50.2373512077239, 9.58963433710139, 52.5286304537795 ] },\n "
93
+ + " \" spatial\" : { \" bbox\" : [[ 5.61272621360749, 50.2373512077239, 9.58963433710139, 52.5286304537795 ] ] },\n "
94
94
+ " \" temporal\" : { \" interval\" : [[ \" 2018-05-18T14:45:44Z\" , \" 2019-06-17T21:41:19Z\" ]] }\n "
95
95
+ " },\n " + " \" links\" : [ {\n "
96
96
+ " \" rel\" : \" item\" ,\n "
@@ -122,7 +122,7 @@ public void testCollections() {
122
122
+ " }, {\n " + " \" name\" : \" verwaltungseinheit\" ,\n "
123
123
+ " \" title\" : \" Verwaltungseinheit\" ,\n "
124
124
+ " \" extent\" : {\n "
125
- + " \" spatial\" : { \" bbox\" : [ 5.61272621360749, 50.2373512077239, 9.58963433710139, 52.5286304537795 ] },\n "
125
+ + " \" spatial\" : { \" bbox\" : [[ 5.61272621360749, 50.2373512077239, 9.58963433710139, 52.5286304537795 ] ] },\n "
126
126
+ " \" temporal\" : { \" interval\" : [[ \" 2018-05-18T14:45:44Z\" , \" 2019-06-17T21:41:19Z\" ]] }\n "
127
127
+ " },\n " + " \" links\" : [ {\n "
128
128
+ " \" rel\" : \" item\" ,\n "
@@ -161,6 +161,130 @@ public void testCollections() {
161
161
162
162
}
163
163
164
+ /**
165
+ * Test collections
166
+ */
167
+ @ Test
168
+ public void testCollections2 () {
169
+
170
+ String content = "{\" links\" : ["
171
+ + "{ \" href\" : \" http://data.example.org/collections.json\" ,"
172
+ + "\" rel\" : \" self\" , \" type\" : \" application/json\" , \" title\" : \" this document\" },"
173
+ + "{ \" href\" : \" http://data.example.org/collections.html\" ,"
174
+ + "\" rel\" : \" alternate\" , \" type\" : \" text/html\" , \" title\" : \" this document as HTML\" },"
175
+ + "{ \" href\" : \" http://schemas.example.org/1.0/buildings.xsd\" ,"
176
+ + "\" rel\" : \" describedby\" , \" type\" : \" application/xml\" , \" title\" : \" GML application schema for Acme Corporation building data\" },"
177
+ + "{ \" href\" : \" http://download.example.org/buildings.gpkg\" ,"
178
+ + "\" rel\" : \" enclosure\" , \" type\" : \" application/geopackage+sqlite3\" , \" title\" : \" Bulk download (GeoPackage)\" , \" length\" : 472546 }"
179
+ + "]," + "\" collections\" : [" + "{" + "\" id\" : \" buildings\" ,"
180
+ + "\" title\" : \" Buildings\" ,"
181
+ + "\" description\" : \" Buildings in the city of Bonn.\" ,"
182
+ + "\" extent\" : {" + "\" spatial\" : {"
183
+ + "\" bbox\" : [ [ 7.01, 50.63, 7.22, 50.78 ] ]" + "},"
184
+ + "\" temporal\" : {"
185
+ + "\" interval\" : [ [ \" 2010-02-15T12:34:56Z\" , null ] ]" + "}"
186
+ + "}," + "\" itemType\" : \" feature\" ," + "\" links\" : ["
187
+ + "{ \" href\" : \" http://data.example.org/collections/buildings\" ,"
188
+ + "\" rel\" : \" self\" , \" title\" : \" This collection\" },"
189
+ + "{ \" href\" : \" http://data.example.org/collections/buildings/items\" ,"
190
+ + "\" rel\" : \" items\" , \" type\" : \" application/geo+json\" ,"
191
+ + "\" title\" : \" Buildings\" },"
192
+ + "{ \" href\" : \" https://creativecommons.org/publicdomain/zero/1.0/\" ,"
193
+ + "\" rel\" : \" license\" , \" type\" : \" text/html\" ,"
194
+ + "\" title\" : \" CC0-1.0\" },"
195
+ + "{ \" href\" : \" https://creativecommons.org/publicdomain/zero/1.0/rdf\" ,"
196
+ + "\" rel\" : \" license\" , \" type\" : \" application/rdf+xml\" ,"
197
+ + "\" title\" : \" CC0-1.0\" }" + "]" + "}" + "]" + "}" ;
198
+ Collections collections = FeaturesConverter .toCollections (content );
199
+ TestCase .assertNotNull (collections );
200
+ List <Link > links = collections .getLinks ();
201
+ TestCase .assertNotNull (links );
202
+ TestCase .assertEquals (4 , links .size ());
203
+ TestCase .assertEquals ("http://data.example.org/collections.json" ,
204
+ links .get (0 ).getHref ());
205
+ TestCase .assertEquals ("self" , links .get (0 ).getRel ());
206
+ TestCase .assertEquals ("application/json" , links .get (0 ).getType ());
207
+ TestCase .assertEquals ("this document" , links .get (0 ).getTitle ());
208
+ TestCase .assertEquals ("http://data.example.org/collections.html" ,
209
+ links .get (1 ).getHref ());
210
+ TestCase .assertEquals ("alternate" , links .get (1 ).getRel ());
211
+ TestCase .assertEquals ("text/html" , links .get (1 ).getType ());
212
+ TestCase .assertEquals ("this document as HTML" , links .get (1 ).getTitle ());
213
+ TestCase .assertEquals ("http://schemas.example.org/1.0/buildings.xsd" ,
214
+ links .get (2 ).getHref ());
215
+ TestCase .assertEquals ("describedby" , links .get (2 ).getRel ());
216
+ TestCase .assertEquals ("application/xml" , links .get (2 ).getType ());
217
+ TestCase .assertEquals (
218
+ "GML application schema for Acme Corporation building data" ,
219
+ links .get (2 ).getTitle ());
220
+ TestCase .assertEquals ("http://download.example.org/buildings.gpkg" ,
221
+ links .get (3 ).getHref ());
222
+ TestCase .assertEquals ("enclosure" , links .get (3 ).getRel ());
223
+ TestCase .assertEquals ("application/geopackage+sqlite3" ,
224
+ links .get (3 ).getType ());
225
+ TestCase .assertEquals ("Bulk download (GeoPackage)" ,
226
+ links .get (3 ).getTitle ());
227
+ TestCase .assertEquals (472546 , links .get (3 ).getLength ().intValue ());
228
+ TestCase .assertEquals (1 , collections .getCollections ().size ());
229
+ Collection collection = collections .getCollections ().get (0 );
230
+ TestCase .assertEquals ("buildings" , collection .getId ());
231
+ TestCase .assertEquals ("Buildings" , collection .getTitle ());
232
+ TestCase .assertEquals ("Buildings in the city of Bonn." ,
233
+ collection .getDescription ());
234
+ Extent extent = collection .getExtent ();
235
+ TestCase .assertNotNull (extent );
236
+ TestCase .assertEquals (1 , extent .getSpatial ().getBbox ().size ());
237
+ TestCase .assertEquals (4 , extent .getSpatial ().getBbox ().get (0 ).size ());
238
+ TestCase .assertEquals (7.01 ,
239
+ extent .getSpatial ().getBbox ().get (0 ).get (0 ));
240
+ TestCase .assertEquals (50.63 ,
241
+ extent .getSpatial ().getBbox ().get (0 ).get (1 ));
242
+ TestCase .assertEquals (7.22 ,
243
+ extent .getSpatial ().getBbox ().get (0 ).get (2 ));
244
+ TestCase .assertEquals (50.78 ,
245
+ extent .getSpatial ().getBbox ().get (0 ).get (3 ));
246
+ TestCase .assertEquals (1 , extent .getTemporal ().getInterval ().size ());
247
+ TestCase .assertEquals (2 ,
248
+ extent .getTemporal ().getInterval ().get (0 ).size ());
249
+ TestCase .assertEquals ("2010-02-15T12:34:56Z" ,
250
+ extent .getTemporal ().getInterval ().get (0 ).get (0 ));
251
+ TestCase .assertNull (extent .getTemporal ().getInterval ().get (0 ).get (1 ));
252
+ TestCase .assertEquals ("feature" , collection .getItemType ());
253
+ List <Link > collectionLinks = collection .getLinks ();
254
+ TestCase .assertNotNull (collectionLinks );
255
+ TestCase .assertEquals (4 , collectionLinks .size ());
256
+ TestCase .assertEquals ("http://data.example.org/collections/buildings" ,
257
+ collectionLinks .get (0 ).getHref ());
258
+ TestCase .assertEquals ("self" , collectionLinks .get (0 ).getRel ());
259
+ TestCase .assertEquals ("This collection" ,
260
+ collectionLinks .get (0 ).getTitle ());
261
+ TestCase .assertEquals (
262
+ "http://data.example.org/collections/buildings/items" ,
263
+ collectionLinks .get (1 ).getHref ());
264
+ TestCase .assertEquals ("items" , collectionLinks .get (1 ).getRel ());
265
+ TestCase .assertEquals ("application/geo+json" ,
266
+ collectionLinks .get (1 ).getType ());
267
+ TestCase .assertEquals ("Buildings" , collectionLinks .get (1 ).getTitle ());
268
+ TestCase .assertEquals (
269
+ "https://creativecommons.org/publicdomain/zero/1.0/" ,
270
+ collectionLinks .get (2 ).getHref ());
271
+ TestCase .assertEquals ("license" , collectionLinks .get (2 ).getRel ());
272
+ TestCase .assertEquals ("text/html" , collectionLinks .get (2 ).getType ());
273
+ TestCase .assertEquals ("CC0-1.0" , collectionLinks .get (2 ).getTitle ());
274
+ TestCase .assertEquals (
275
+ "https://creativecommons.org/publicdomain/zero/1.0/rdf" ,
276
+ collectionLinks .get (3 ).getHref ());
277
+ TestCase .assertEquals ("license" , collectionLinks .get (3 ).getRel ());
278
+ TestCase .assertEquals ("application/rdf+xml" ,
279
+ collectionLinks .get (3 ).getType ());
280
+ TestCase .assertEquals ("CC0-1.0" , collectionLinks .get (3 ).getTitle ());
281
+
282
+ content = FeaturesConverter .toStringValue (collections );
283
+ TestCase .assertNotNull (content );
284
+ TestCase .assertNotNull (FeaturesConverter .toCollections (content ));
285
+
286
+ }
287
+
164
288
/**
165
289
* Test a collection
166
290
*/
@@ -171,7 +295,7 @@ public void testCollection() {
171
295
+ " \" title\" : \" Buildings\" ,\n "
172
296
+ " \" description\" : \" Buildings in the city of Bonn.\" ,\n "
173
297
+ " \" extent\" : {\n "
174
- + " \" spatial\" : { \" bbox\" : [ 7.01, 50.63, 7.22, 50.78 ] },\n "
298
+ + " \" spatial\" : { \" bbox\" : [[ 7.01, 50.63, 7.22, 50.78 ] ] },\n "
175
299
+ " \" temporal\" : { \" interval\" : [[ \" 2010-02-15T12:34:56Z\" , \" 2018-03-18T12:11:00Z\" ]] }\n "
176
300
+ " },\n " + " \" links\" : [\n "
177
301
+ " { \" href\" : \" http://data.example.org/collections/buildings/items\" ,\n "
@@ -189,19 +313,25 @@ public void testCollection() {
189
313
collection .getDescription ());
190
314
Extent extent = collection .getExtent ();
191
315
TestCase .assertNotNull (extent );
192
- TestCase .assertEquals (4 , extent .getSpatial ().getBbox ().size ());
193
- TestCase .assertEquals (7.01 , extent .getSpatial ().getBbox ().get (0 ));
194
- TestCase .assertEquals (50.63 , extent .getSpatial ().getBbox ().get (1 ));
195
- TestCase .assertEquals (7.22 , extent .getSpatial ().getBbox ().get (2 ));
196
- TestCase .assertEquals (50.78 , extent .getSpatial ().getBbox ().get (3 ));
316
+ TestCase .assertEquals (1 , extent .getSpatial ().getBbox ().size ());
317
+ TestCase .assertEquals (4 , extent .getSpatial ().getBbox ().get (0 ).size ());
318
+ TestCase .assertEquals (7.01 ,
319
+ extent .getSpatial ().getBbox ().get (0 ).get (0 ));
320
+ TestCase .assertEquals (50.63 ,
321
+ extent .getSpatial ().getBbox ().get (0 ).get (1 ));
322
+ TestCase .assertEquals (7.22 ,
323
+ extent .getSpatial ().getBbox ().get (0 ).get (2 ));
324
+ TestCase .assertEquals (50.78 ,
325
+ extent .getSpatial ().getBbox ().get (0 ).get (3 ));
197
326
TestCase .assertEquals (1 , extent .getTemporal ().getInterval ().size ());
198
- TestCase .assertEquals (2 , extent .getTemporal ().getInterval ().get (0 ).size ());
327
+ TestCase .assertEquals (2 ,
328
+ extent .getTemporal ().getInterval ().get (0 ).size ());
199
329
TestCase .assertEquals ("2010-02-15T12:34:56Z" ,
200
330
extent .getTemporal ().getInterval ().get (0 ).get (0 ));
201
331
TestCase .assertEquals ("2018-03-18T12:11:00Z" ,
202
332
extent .getTemporal ().getInterval ().get (0 ).get (1 ));
203
333
List <Link > links = collection .getLinks ();
204
- TestCase .assertNotNull (extent );
334
+ TestCase .assertNotNull (links );
205
335
TestCase .assertEquals (2 , links .size ());
206
336
TestCase .assertEquals (
207
337
"http://data.example.org/collections/buildings/items" ,
0 commit comments