|
3 | 3 | import com.amazonaws.auth.AWSStaticCredentialsProvider;
|
4 | 4 | import com.amazonaws.auth.AnonymousAWSCredentials;
|
5 | 5 | import com.amazonaws.services.s3.AmazonS3ClientBuilder;
|
| 6 | +import com.fasterxml.jackson.databind.JsonMappingException; |
6 | 7 | import com.fasterxml.jackson.databind.ObjectMapper;
|
7 | 8 | import com.github.luben.zstd.Zstd;
|
8 | 9 | import com.github.luben.zstd.ZstdCompressCtx;
|
@@ -657,30 +658,30 @@ public void testParallel(boolean useParallel) throws IOException, ZarrException
|
657 | 658 | }
|
658 | 659 |
|
659 | 660 | @Test
|
660 |
| - public void testMetadataAcceptsStorageTransformer() throws ZarrException, IOException { |
661 |
| - StoreHandle localStoreHandle = new FilesystemStore(TESTDATA).resolve("storage_transformer"); |
662 |
| - Map<String, Object>[] storageTransformers1 = Array.open(localStoreHandle).metadata.storageTransformers; |
| 661 | + public void testMetadataAcceptsEmptyStorageTransformer() throws ZarrException, IOException { |
| 662 | + // non-empty storage transformers are currently not supported |
663 | 663 |
|
664 |
| - Array array2 = Array.create( |
665 |
| - new FilesystemStore(TESTOUTPUT).resolve("storage_transformer"), |
666 |
| - Array.metadataBuilder() |
667 |
| - .withShape(1) |
668 |
| - .withChunkShape(1) |
669 |
| - .withDataType(DataType.UINT8) |
670 |
| - .withStorageTransformers(new HashMap[]{new HashMap<String, Object>(){ |
671 |
| - { |
672 |
| - put("name", "chunk-manifest-json"); |
673 |
| - put("configuration", new HashMap<String, Object>(){ |
674 |
| - { |
675 |
| - put("manifest", "./manifest.json"); |
676 |
| - } |
677 |
| - }); |
678 |
| - } |
679 |
| - }}) |
680 |
| - .build() |
| 664 | + Map<String, Object>[] storageTransformersEmpty = Array.open( |
| 665 | + new FilesystemStore(TESTDATA).resolve("storage_transformer", "empty") |
| 666 | + ).metadata.storageTransformers; |
| 667 | + assert storageTransformersEmpty.length == 0; |
| 668 | + |
| 669 | + assertThrows(JsonMappingException.class, () -> Array.open( |
| 670 | + new FilesystemStore(TESTDATA).resolve("storage_transformer", "exists")) |
681 | 671 | );
|
682 |
| - Map<String, Object>[] storageTransformers2 = array2.metadata.storageTransformers; |
683 |
| - assert Maps.difference(storageTransformers1[0], storageTransformers2[0]).areEqual(); |
| 672 | + |
| 673 | + ArrayMetadataBuilder builderWithStorageTransformer = Array.metadataBuilder() |
| 674 | + .withShape(1) |
| 675 | + .withChunkShape(1) |
| 676 | + .withDataType(DataType.UINT8) |
| 677 | + .withStorageTransformers(new HashMap[]{new HashMap<String, Object>(){{ |
| 678 | + put("some", "value"); |
| 679 | + }}}); |
| 680 | + |
| 681 | + assertThrows(ZarrException.class, () -> Array.create( |
| 682 | + new FilesystemStore(TESTOUTPUT).resolve("storage_transformer"), |
| 683 | + builderWithStorageTransformer.build() |
| 684 | + )); |
684 | 685 | }
|
685 | 686 | }
|
686 | 687 |
|
0 commit comments