11package dev .zarr .zarrjava ;
22
3- import static org .junit .Assert .assertArrayEquals ;
4- import static org .junit .Assert .assertEquals ;
5-
63import com .amazonaws .auth .AWSStaticCredentialsProvider ;
74import com .amazonaws .auth .AnonymousAWSCredentials ;
85import com .amazonaws .services .s3 .AmazonS3ClientBuilder ;
1310import dev .zarr .zarrjava .store .StoreHandle ;
1411import dev .zarr .zarrjava .utils .MultiArrayUtils ;
1512import dev .zarr .zarrjava .v3 .*;
13+ import org .junit .jupiter .api .Assertions ;
14+ import org .junit .jupiter .api .BeforeAll ;
15+ import org .junit .jupiter .api .Disabled ;
16+ import org .junit .jupiter .api .Test ;
17+ import org .junit .jupiter .params .ParameterizedTest ;
18+ import org .junit .jupiter .params .provider .ValueSource ;
1619
1720import java .io .BufferedReader ;
1821import java .io .File ;
2629import java .util .Map ;
2730import java .util .stream .Stream ;
2831
29- import org .junit .jupiter .api .*;
30- import org .junit .jupiter .params .ParameterizedTest ;
31- import org .junit .jupiter .params .provider .ValueSource ;
32+ import static org .junit .Assert .assertArrayEquals ;
33+ import static org .junit .Assert .assertEquals ;
3234
3335public class ZarrTest {
3436
@@ -136,12 +138,12 @@ public void testReadFromZarrita(String codec) throws IOException, ZarrException,
136138 public void testWriteToZarrita (String codec ) throws IOException , ZarrException , InterruptedException {
137139 StoreHandle storeHandle = new FilesystemStore (TESTOUTPUT ).resolve ("write_to_zarrita" , codec );
138140 ArrayMetadataBuilder builder = Array .metadataBuilder ()
139- .withShape (16 , 16 )
140- .withDataType (DataType .UINT32 )
141- .withChunkShape (8 , 8 )
142- .withFillValue (0 );
141+ .withShape (16 , 16 )
142+ .withDataType (DataType .UINT32 )
143+ .withChunkShape (8 , 8 )
144+ .withFillValue (0 );
143145
144- switch (codec ){
146+ switch (codec ) {
145147 case "blosc" :
146148 builder = builder .withCodecs (c -> c .withBlosc ());
147149 break ;
@@ -164,18 +166,18 @@ public void testWriteToZarrita(String codec) throws IOException, ZarrException,
164166 //missing
165167 break ;
166168 default :
167- throw new IllegalArgumentException ("Invalid Codec: " + codec );
169+ throw new IllegalArgumentException ("Invalid Codec: " + codec );
168170 }
169171
170- Array array = Array .create (storeHandle ,builder .build ());
172+ Array array = Array .create (storeHandle , builder .build ());
171173
172- int [] data = new int [16 * 16 ];
174+ int [] data = new int [16 * 16 ];
173175 Arrays .setAll (data , p -> p );
174176 array .write (ucar .ma2 .Array .factory (ucar .ma2 .DataType .UINT , new int []{16 , 16 }, data ));
175177
176178 String command = "zarrita/bin/python" ;
177179
178- ProcessBuilder pb = new ProcessBuilder (command , ZARRITA_READ_PATH .toString (), codec , TESTOUTPUT .toString ());
180+ ProcessBuilder pb = new ProcessBuilder (command , ZARRITA_READ_PATH .toString (), codec , TESTOUTPUT .toString ());
179181 Process process = pb .start ();
180182
181183 BufferedReader reader = new BufferedReader (new InputStreamReader (process .getInputStream ()));
@@ -195,21 +197,21 @@ public void testWriteToZarrita(String codec) throws IOException, ZarrException,
195197 }
196198
197199
198- @ ParameterizedTest
200+ @ ParameterizedTest
199201 @ ValueSource (strings = {"blosc" , "gzip" , "zstd" , "bytes" , "transpose" , "sharding" })
200202 public void testCodecsWriteRead (String codec ) throws IOException , ZarrException , InterruptedException {
201203 int [] testData = new int [16 * 16 * 16 ];
202204 Arrays .setAll (testData , p -> p );
203205
204206 StoreHandle storeHandle = new FilesystemStore (TESTOUTPUT ).resolve ("testWriteAndRead3d" , codec );
205207 ArrayMetadataBuilder builder = Array .metadataBuilder ()
206- .withShape (16 , 16 , 16 )
207- .withDataType (DataType .UINT32 )
208- .withChunkShape (2 , 4 , 8 )
209- .withFillValue (0 )
210- .withAttributes (Map .of ("test_key" , "test_value" ));
208+ .withShape (16 , 16 , 16 )
209+ .withDataType (DataType .UINT32 )
210+ .withChunkShape (2 , 4 , 8 )
211+ .withFillValue (0 )
212+ .withAttributes (Map .of ("test_key" , "test_value" ));
211213
212- switch (codec ){
214+ switch (codec ) {
213215 case "blosc" :
214216 builder = builder .withCodecs (c -> c .withBlosc ());
215217 break ;
@@ -232,10 +234,10 @@ public void testCodecsWriteRead(String codec) throws IOException, ZarrException,
232234 //missing
233235 break ;
234236 default :
235- throw new IllegalArgumentException ("Invalid Codec: " + codec );
237+ throw new IllegalArgumentException ("Invalid Codec: " + codec );
236238 }
237239
238- Array writeArray = Array .create (storeHandle ,builder .build ());
240+ Array writeArray = Array .create (storeHandle , builder .build ());
239241 writeArray .write (ucar .ma2 .Array .factory (ucar .ma2 .DataType .UINT , new int []{16 , 16 , 16 }, testData ));
240242
241243 Array readArray = Array .open (storeHandle );
@@ -263,7 +265,7 @@ public void testFileSystemStores() throws IOException, ZarrException {
263265 System .out .println (objectMapper .writeValueAsString (group ));
264266
265267 ArrayMetadata arrayMetadata = objectMapper .readValue (Files .readAllBytes (TESTDATA .resolve (
266- "l4_sample" ).resolve ("color" ).resolve ("1" ).resolve ("zarr.json" )),
268+ "l4_sample" ).resolve ("color" ).resolve ("1" ).resolve ("zarr.json" )),
267269 ArrayMetadata .class );
268270
269271 System .out .println (arrayMetadata );
0 commit comments