|
8 | 8 |
|
9 | 9 | import org.apache.commons.compress.archivers.zip.ZipArchiveEntry; |
10 | 10 | import org.apache.commons.compress.archivers.zip.ZipFile; |
| 11 | +import java.net.URI; |
11 | 12 | import org.junit.jupiter.api.Assertions; |
12 | 13 | import org.junit.jupiter.api.Test; |
13 | 14 | import org.junit.jupiter.params.ParameterizedTest; |
|
16 | 17 | import software.amazon.awssdk.auth.credentials.AnonymousCredentialsProvider; |
17 | 18 | import software.amazon.awssdk.regions.Region; |
18 | 19 | import software.amazon.awssdk.services.s3.S3Client; |
| 20 | +import software.amazon.awssdk.services.s3.S3Configuration; |
19 | 21 |
|
20 | 22 | import java.io.IOException; |
21 | 23 | import java.io.InputStream; |
@@ -75,17 +77,23 @@ public void testFileSystemStores() throws IOException, ZarrException { |
75 | 77 | @Test |
76 | 78 | public void testS3Store() throws IOException, ZarrException { |
77 | 79 | S3Store s3Store = new S3Store(S3Client.builder() |
78 | | - .region(Region.of("eu-west-1")) |
| 80 | + .endpointOverride(URI.create("https://uk1s3.embassy.ebi.ac.uk")) |
| 81 | + .region(Region.US_EAST_1) // required, but ignored |
| 82 | + .serviceConfiguration( |
| 83 | + S3Configuration.builder() |
| 84 | + .pathStyleAccessEnabled(true) // required |
| 85 | + .build() |
| 86 | + ) |
79 | 87 | .credentialsProvider(AnonymousCredentialsProvider.create()) |
80 | | - .build(), "static.webknossos.org", "data"); |
| 88 | + .build(), "idr", "zarr/v0.5/idr0033A"); |
81 | 89 |
|
82 | | - Array arrayV3 = Array.open(s3Store.resolve("zarr_v3", "l4_sample", "color", "1")); |
83 | | - Assertions.assertArrayEquals(new long[]{1, 4096, 4096, 2048}, arrayV3.metadata().shape); |
84 | | - Assertions.assertEquals(0, arrayV3.read(new long[]{0,0,0,0}, new int[]{1,1,1,1}).getInt(0)); |
| 90 | + Array arrayV3 = Array.open(s3Store.resolve("BR00109990_C2.zarr", "0", "0")); |
| 91 | + Assertions.assertArrayEquals(new long[]{5, 1552, 2080}, arrayV3.metadata().shape); |
| 92 | + Assertions.assertEquals(574, arrayV3.read(new long[]{0,0,0}, new int[]{1,1,1}).getInt(0)); |
85 | 93 |
|
86 | | - dev.zarr.zarrjava.core.Array arrayCore = dev.zarr.zarrjava.core.Array.open(s3Store.resolve("zarr_v3", "l4_sample", "color", "1")); |
87 | | - Assertions.assertArrayEquals(new long[]{1, 4096, 4096, 2048}, arrayCore.metadata().shape); |
88 | | - Assertions.assertEquals(0, arrayCore.read(new long[]{0,0,0,0}, new int[]{1,1,1,1}).getInt(0)); |
| 94 | + dev.zarr.zarrjava.core.Array arrayCore = dev.zarr.zarrjava.core.Array.open(s3Store.resolve("BR00109990_C2.zarr", "0", "0")); |
| 95 | + Assertions.assertArrayEquals(new long[]{5, 1552, 2080}, arrayCore.metadata().shape); |
| 96 | + Assertions.assertEquals(574, arrayCore.read(new long[]{0,0,0}, new int[]{1,1,1}).getInt(0)); |
89 | 97 | } |
90 | 98 |
|
91 | 99 | @Test |
@@ -165,10 +173,10 @@ public void testStoreGetSize(StoreHandle storeHandle) throws IOException, ZarrEx |
165 | 173 |
|
166 | 174 | @Test |
167 | 175 | public void testHttpStore() throws IOException, ZarrException { |
168 | | - HttpStore httpStore = new dev.zarr.zarrjava.store.HttpStore("https://static.webknossos.org/data/zarr_v3/l4_sample"); |
169 | | - Array array = Array.open(httpStore.resolve("color", "1")); |
| 176 | + HttpStore httpStore = new dev.zarr.zarrjava.store.HttpStore("https://uk1s3.embassy.ebi.ac.uk/idr/zarr/v0.5/idr0033A"); |
| 177 | + Array array = Array.open(httpStore.resolve("BR00109990_C2.zarr", "0", "0")); |
170 | 178 |
|
171 | | - Assertions.assertArrayEquals(new long[]{1, 4096, 4096, 2048}, array.metadata().shape); |
| 179 | + Assertions.assertArrayEquals(new long[]{5, 1552, 2080}, array.metadata().shape); |
172 | 180 | } |
173 | 181 |
|
174 | 182 | @ParameterizedTest |
|
0 commit comments