|
4 | 4 | import dev.zarr.zarrjava.core.Attributes; |
5 | 5 | import dev.zarr.zarrjava.store.*; |
6 | 6 | import dev.zarr.zarrjava.v3.*; |
| 7 | +import java.net.URI; |
7 | 8 | import org.junit.jupiter.api.Assertions; |
8 | 9 | import org.junit.jupiter.api.Test; |
9 | 10 | import org.junit.jupiter.params.ParameterizedTest; |
10 | 11 | import org.junit.jupiter.params.provider.CsvSource; |
11 | 12 | import software.amazon.awssdk.auth.credentials.AnonymousCredentialsProvider; |
12 | 13 | import software.amazon.awssdk.regions.Region; |
13 | 14 | import software.amazon.awssdk.services.s3.S3Client; |
| 15 | +import software.amazon.awssdk.services.s3.S3Configuration; |
14 | 16 |
|
15 | 17 | import java.io.IOException; |
16 | 18 | import java.nio.file.Files; |
@@ -61,25 +63,31 @@ public void testFileSystemStores() throws IOException, ZarrException { |
61 | 63 | @Test |
62 | 64 | public void testS3Store() throws IOException, ZarrException { |
63 | 65 | S3Store s3Store = new S3Store(S3Client.builder() |
64 | | - .region(Region.of("eu-west-1")) |
| 66 | + .endpointOverride(URI.create("https://uk1s3.embassy.ebi.ac.uk")) |
| 67 | + .region(Region.US_EAST_1) // required, but ignored |
| 68 | + .serviceConfiguration( |
| 69 | + S3Configuration.builder() |
| 70 | + .pathStyleAccessEnabled(true) // required |
| 71 | + .build() |
| 72 | + ) |
65 | 73 | .credentialsProvider(AnonymousCredentialsProvider.create()) |
66 | | - .build(), "static.webknossos.org", "data"); |
| 74 | + .build(), "idr", "zarr/v0.5/idr0033A"); |
67 | 75 |
|
68 | | - Array arrayV3 = Array.open(s3Store.resolve("zarr_v3", "l4_sample", "color", "1")); |
69 | | - Assertions.assertArrayEquals(new long[]{1, 4096, 4096, 2048}, arrayV3.metadata().shape); |
70 | | - Assertions.assertEquals(0, arrayV3.read(new long[]{0,0,0,0}, new int[]{1,1,1,1}).getInt(0)); |
| 76 | + Array arrayV3 = Array.open(s3Store.resolve("BR00109990_C2.zarr", "0", "0")); |
| 77 | + Assertions.assertArrayEquals(new long[]{5, 1552, 2080}, arrayV3.metadata().shape); |
| 78 | + Assertions.assertEquals(574, arrayV3.read(new long[]{0,0,0}, new int[]{1,1,1}).getInt(0)); |
71 | 79 |
|
72 | | - dev.zarr.zarrjava.core.Array arrayCore = dev.zarr.zarrjava.core.Array.open(s3Store.resolve("zarr_v3", "l4_sample", "color", "1")); |
73 | | - Assertions.assertArrayEquals(new long[]{1, 4096, 4096, 2048}, arrayCore.metadata().shape); |
74 | | - Assertions.assertEquals(0, arrayCore.read(new long[]{0,0,0,0}, new int[]{1,1,1,1}).getInt(0)); |
| 80 | + dev.zarr.zarrjava.core.Array arrayCore = dev.zarr.zarrjava.core.Array.open(s3Store.resolve("BR00109990_C2.zarr", "0", "0")); |
| 81 | + Assertions.assertArrayEquals(new long[]{5, 1552, 2080}, arrayCore.metadata().shape); |
| 82 | + Assertions.assertEquals(574, arrayCore.read(new long[]{0,0,0}, new int[]{1,1,1}).getInt(0)); |
75 | 83 | } |
76 | 84 |
|
77 | 85 | @Test |
78 | 86 | public void testHttpStore() throws IOException, ZarrException { |
79 | | - HttpStore httpStore = new dev.zarr.zarrjava.store.HttpStore("https://static.webknossos.org/data/zarr_v3/l4_sample"); |
80 | | - Array array = Array.open(httpStore.resolve("color", "1")); |
| 87 | + HttpStore httpStore = new dev.zarr.zarrjava.store.HttpStore("https://uk1s3.embassy.ebi.ac.uk/idr/zarr/v0.5/idr0033A"); |
| 88 | + Array array = Array.open(httpStore.resolve("BR00109990_C2.zarr", "0", "0")); |
81 | 89 |
|
82 | | - Assertions.assertArrayEquals(new long[]{1, 4096, 4096, 2048}, array.metadata().shape); |
| 90 | + Assertions.assertArrayEquals(new long[]{5, 1552, 2080}, array.metadata().shape); |
83 | 91 | } |
84 | 92 |
|
85 | 93 | @ParameterizedTest |
|
0 commit comments