Skip to content

Commit 6689585

Browse files
committed
use different S3 source for testing
1 parent 2b959d3 commit 6689585

File tree

2 files changed

+21
-11
lines changed

2 files changed

+21
-11
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,10 @@ build/
3737

3838
### Custom ###
3939
/testdata/l4_sample
40+
/testdata/l4_sample.zip
4041
/testoutput
4142
/.python-version
4243
/main.py
4344
/pyproject.toml
4445
/uv.lock
46+
**/__pycache__

src/test/java/dev/zarr/zarrjava/ZarrStoreTest.java

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@
44
import dev.zarr.zarrjava.core.Attributes;
55
import dev.zarr.zarrjava.store.*;
66
import dev.zarr.zarrjava.v3.*;
7+
import java.net.URI;
78
import org.junit.jupiter.api.Assertions;
89
import org.junit.jupiter.api.Test;
910
import org.junit.jupiter.params.ParameterizedTest;
1011
import org.junit.jupiter.params.provider.CsvSource;
1112
import software.amazon.awssdk.auth.credentials.AnonymousCredentialsProvider;
1213
import software.amazon.awssdk.regions.Region;
1314
import software.amazon.awssdk.services.s3.S3Client;
15+
import software.amazon.awssdk.services.s3.S3Configuration;
1416

1517
import java.io.IOException;
1618
import java.nio.file.Files;
@@ -61,25 +63,31 @@ public void testFileSystemStores() throws IOException, ZarrException {
6163
@Test
6264
public void testS3Store() throws IOException, ZarrException {
6365
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+
)
6573
.credentialsProvider(AnonymousCredentialsProvider.create())
66-
.build(), "static.webknossos.org", "data");
74+
.build(), "idr", "zarr/v0.5/idr0033A");
6775

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));
7179

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));
7583
}
7684

7785
@Test
7886
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"));
8189

82-
Assertions.assertArrayEquals(new long[]{1, 4096, 4096, 2048}, array.metadata().shape);
90+
Assertions.assertArrayEquals(new long[]{5, 1552, 2080}, array.metadata().shape);
8391
}
8492

8593
@ParameterizedTest

0 commit comments

Comments
 (0)