@@ -230,42 +230,42 @@ def test_find_common_store(self):
230230 dataset_configs = [
231231 {
232232 'Identifier' : 'z_0' ,
233- 'FileSystem' : 'local ' ,
233+ 'FileSystem' : 'file ' ,
234234 'Path' : '/one/path/abc.zarr'
235235 },
236236 {
237237 'Identifier' : 'z_1' ,
238- 'FileSystem' : 'local ' ,
238+ 'FileSystem' : 'file ' ,
239239 'Path' : '/one/path/def.zarr'
240240 },
241241 {
242242 'Identifier' : 'z_4' ,
243- 'FileSystem' : 'obs ' ,
243+ 'FileSystem' : 's3 ' ,
244244 'Path' : '/one/path/mno.zarr'
245245 },
246246 {
247247 'Identifier' : 'z_2' ,
248- 'FileSystem' : 'local ' ,
248+ 'FileSystem' : 'file ' ,
249249 'Path' : '/another/path/ghi.zarr'
250250 },
251251 {
252252 'Identifier' : 'z_3' ,
253- 'FileSystem' : 'local ' ,
253+ 'FileSystem' : 'file ' ,
254254 'Path' : '/one/more/path/jkl.zarr'
255255 },
256256 {
257257 'Identifier' : 'z_5' ,
258- 'FileSystem' : 'obs ' ,
258+ 'FileSystem' : 's3 ' ,
259259 'Path' : '/one/path/pqr.zarr'
260260 },
261261 {
262262 'Identifier' : 'z_6' ,
263- 'FileSystem' : 'local ' ,
263+ 'FileSystem' : 'file ' ,
264264 'Path' : '/one/path/stu.zarr'
265265 },
266266 {
267267 'Identifier' : 'z_7' ,
268- 'FileSystem' : 'local ' ,
268+ 'FileSystem' : 'file ' ,
269269 'Path' : '/one/more/path/vwx.zarr'
270270 },
271271 ]
@@ -275,51 +275,51 @@ def test_find_common_store(self):
275275 expected_dataset_configs = [
276276 {
277277 'Identifier' : 'z_0' ,
278- 'FileSystem' : 'local ' ,
278+ 'FileSystem' : 'file ' ,
279279 'Path' : 'path/abc.zarr' ,
280- 'StoreInstanceId' : 'local_2 '
280+ 'StoreInstanceId' : 'file_2 '
281281 },
282282 {
283283 'Identifier' : 'z_1' ,
284- 'FileSystem' : 'local ' ,
284+ 'FileSystem' : 'file ' ,
285285 'Path' : 'path/def.zarr' ,
286- 'StoreInstanceId' : 'local_2 '
286+ 'StoreInstanceId' : 'file_2 '
287287 },
288288 {
289289 'Identifier' : 'z_4' ,
290- 'FileSystem' : 'obs ' ,
290+ 'FileSystem' : 's3 ' ,
291291 'Path' : 'mno.zarr' ,
292- 'StoreInstanceId' : 'obs_1 '
292+ 'StoreInstanceId' : 's3_1 '
293293 },
294294 {
295295 'Identifier' : 'z_2' ,
296- 'FileSystem' : 'local ' ,
296+ 'FileSystem' : 'file ' ,
297297 'Path' : 'ghi.zarr' ,
298- 'StoreInstanceId' : 'local_1 '
298+ 'StoreInstanceId' : 'file_1 '
299299 },
300300 {
301301 'Identifier' : 'z_3' ,
302- 'FileSystem' : 'local ' ,
302+ 'FileSystem' : 'file ' ,
303303 'Path' : 'more/path/jkl.zarr' ,
304- 'StoreInstanceId' : 'local_2 '
304+ 'StoreInstanceId' : 'file_2 '
305305 },
306306 {
307307 'Identifier' : 'z_5' ,
308- 'FileSystem' : 'obs ' ,
308+ 'FileSystem' : 's3 ' ,
309309 'Path' : 'pqr.zarr' ,
310- 'StoreInstanceId' : 'obs_1 '
310+ 'StoreInstanceId' : 's3_1 '
311311 },
312312 {
313313 'Identifier' : 'z_6' ,
314- 'FileSystem' : 'local ' ,
314+ 'FileSystem' : 'file ' ,
315315 'Path' : 'path/stu.zarr' ,
316- 'StoreInstanceId' : 'local_2 '
316+ 'StoreInstanceId' : 'file_2 '
317317 },
318318 {
319319 'Identifier' : 'z_7' ,
320- 'FileSystem' : 'local ' ,
320+ 'FileSystem' : 'file ' ,
321321 'Path' : 'more/path/vwx.zarr' ,
322- 'StoreInstanceId' : 'local_2 '
322+ 'StoreInstanceId' : 'file_2 '
323323 },
324324 ]
325325 self .assertEqual (expected_dataset_configs , adjusted_dataset_configs )
@@ -328,7 +328,7 @@ def test_with_instance_id(self):
328328 ctx = new_test_service_context ()
329329 dataset_config = {'Identifier' : 'zero' ,
330330 'Title' : 'Test 0' ,
331- 'FileSystem' : 'local ' ,
331+ 'FileSystem' : 'file ' ,
332332 'StoreInstanceId' : 'some_id' }
333333 dataset_config_copy = dataset_config .copy ()
334334
@@ -337,7 +337,30 @@ def test_with_instance_id(self):
337337
338338 self .assertEqual (dataset_config_copy , dataset_config )
339339
340+ def test_file (self ):
341+ ctx = new_test_service_context ()
342+ dataset_config = {'Identifier' : 'one' ,
343+ 'Title' : 'Test 1' ,
344+ 'FileSystem' : 'file' ,
345+ 'Path' : 'cube-1-250-250.zarr' }
346+
347+ ctx .config ['Datasets' ] = [dataset_config ]
348+ dataset_config = ctx .get_dataset_configs ()[0 ]
349+
350+ self .assertEqual (['Identifier' , 'Title' , 'FileSystem' , 'Path' ,
351+ 'StoreInstanceId' ],
352+ list (dataset_config .keys ()))
353+ self .assertEqual ('one' ,
354+ dataset_config ['Identifier' ])
355+ self .assertEqual ('Test 1' , dataset_config ['Title' ])
356+ self .assertEqual ('file' , dataset_config ['FileSystem' ])
357+ self .assertEqual ('cube-1-250-250.zarr' , dataset_config ["Path" ])
358+ self .assertEqual ('file_1' , dataset_config ['StoreInstanceId' ])
359+
340360 def test_local (self ):
361+ # this test tests backwards compatibility.
362+ # TODO please remove when support for file systems 'local' and 'obs'
363+ # has ended
341364 ctx = new_test_service_context ()
342365 dataset_config = {'Identifier' : 'one' ,
343366 'Title' : 'Test 1' ,
@@ -355,9 +378,36 @@ def test_local(self):
355378 self .assertEqual ('Test 1' , dataset_config ['Title' ])
356379 self .assertEqual ('local' , dataset_config ['FileSystem' ])
357380 self .assertEqual ('cube-1-250-250.zarr' , dataset_config ["Path" ])
358- self .assertEqual ('local_1 ' , dataset_config ['StoreInstanceId' ])
381+ self .assertEqual ('file_1 ' , dataset_config ['StoreInstanceId' ])
359382
360383 def test_s3 (self ):
384+ ctx = new_test_service_context ()
385+ dataset_config = {'Identifier' : 'two' ,
386+ 'Title' : 'Test 2' ,
387+ 'FileSystem' : 's3' ,
388+ 'Endpoint' : 'https://s3.eu-central-1.amazonaws.com' ,
389+ 'Path' : 'xcube-examples/OLCI-SNS-RAW-CUBE-2.zarr' ,
390+ 'Region' : 'eu-central-1' }
391+
392+ ctx .config ['Datasets' ] = [dataset_config ]
393+ dataset_config = ctx .get_dataset_configs ()[0 ]
394+
395+ self .assertEqual (['Identifier' , 'Title' , 'FileSystem' , 'Endpoint' ,
396+ 'Path' , 'Region' , 'StoreInstanceId' ],
397+ list (dataset_config .keys ()))
398+ self .assertEqual ('two' , dataset_config ['Identifier' ])
399+ self .assertEqual ('Test 2' , dataset_config ['Title' ])
400+ self .assertEqual ('s3' , dataset_config ['FileSystem' ])
401+ self .assertEqual ('https://s3.eu-central-1.amazonaws.com' ,
402+ dataset_config ['Endpoint' ])
403+ self .assertEqual ('OLCI-SNS-RAW-CUBE-2.zarr' , dataset_config ['Path' ])
404+ self .assertEqual ('eu-central-1' , dataset_config ['Region' ])
405+ self .assertEqual ('s3_1' , dataset_config ['StoreInstanceId' ])
406+
407+ def test_obs (self ):
408+ # this test tests backwards compatibility.
409+ # TODO please remove when support for file systems 'local' and 'obs'
410+ # has ended
361411 ctx = new_test_service_context ()
362412 dataset_config = {'Identifier' : 'two' ,
363413 'Title' : 'Test 2' ,
@@ -379,7 +429,7 @@ def test_s3(self):
379429 dataset_config ['Endpoint' ])
380430 self .assertEqual ('OLCI-SNS-RAW-CUBE-2.zarr' , dataset_config ['Path' ])
381431 self .assertEqual ('eu-central-1' , dataset_config ['Region' ])
382- self .assertEqual ('obs_1 ' , dataset_config ['StoreInstanceId' ])
432+ self .assertEqual ('s3_1 ' , dataset_config ['StoreInstanceId' ])
383433
384434 def test_memory (self ):
385435 ctx = new_test_service_context ()
@@ -407,7 +457,7 @@ def test_missing_file_system(self):
407457 self .assertEqual ('five' , dataset_config ['Identifier' ])
408458 self .assertEqual ('Test 5' , dataset_config ['Title' ])
409459 self .assertEqual ('cube-1-250-250.zarr' , dataset_config ['Path' ])
410- self .assertEqual ('local_1 ' , dataset_config ['StoreInstanceId' ])
460+ self .assertEqual ('file_1 ' , dataset_config ['StoreInstanceId' ])
411461
412462 def test_invalid_file_system (self ):
413463 ctx = new_test_service_context ()
@@ -430,11 +480,11 @@ def test_local_store_already_existing(self):
430480 ctx = new_test_service_context ()
431481 dataset_config_1 = {'Identifier' : 'six' ,
432482 'Title' : 'Test 6' ,
433- 'FileSystem' : 'local ' ,
483+ 'FileSystem' : 'file ' ,
434484 'Path' : 'cube-1-250-250.zarr' }
435485 dataset_config_2 = {'Identifier' : 'six_a' ,
436486 'Title' : 'Test 6 a' ,
437- 'FileSystem' : 'local ' ,
487+ 'FileSystem' : 'file ' ,
438488 'Path' : 'cube-5-100-200.zarr' }
439489
440490 ctx .config ['Datasets' ] = [dataset_config_1 , dataset_config_2 ]
@@ -447,14 +497,14 @@ def test_s3_store_already_existing(self):
447497 ctx = new_test_service_context ()
448498 dataset_config_1 = {'Identifier' : 'seven' ,
449499 'Title' : 'Test 7' ,
450- 'FileSystem' : 'obs ' ,
500+ 'FileSystem' : 's3 ' ,
451501 'Endpoint' : 'https://s3.eu-central-1.amazonaws.com' ,
452502 'Path' : 'xcube-examples/OLCI-SNS-RAW-CUBE-2.zarr' ,
453503 'Region' : 'eu-central-1' }
454504
455505 dataset_config_2 = {'Identifier' : 'seven_a' ,
456506 'Title' : 'Test 7 a' ,
457- 'FileSystem' : 'obs ' ,
507+ 'FileSystem' : 's3 ' ,
458508 'Endpoint' : 'https://s3.eu-central-1.amazonaws.com' ,
459509 'Path' : 'xcube-examples/OLCI-SNS-RAW-CUBE-3.zarr' ,
460510 'Region' : 'eu-central-1' }
0 commit comments