Skip to content

Commit

Permalink
feat(test): reuse buckets, remove temp buckets eagerly
Browse files Browse the repository at this point in the history
  • Loading branch information
cmhulbert committed Feb 28, 2024
1 parent cca9f86 commit 44f1045
Show file tree
Hide file tree
Showing 7 changed files with 275 additions and 249 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@

<s3mock_2.12.version>0.2.5</s3mock_2.12.version>
<jaxb-api.version>2.2.2</jaxb-api.version>
<n5.version>3.1.3</n5.version>
<n5.version>3.1.4-SNAPSHOT</n5.version>
</properties>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@
*/
public class N5AmazonS3Reader extends N5KeyValueReader {

/**
* TODO: reduce number of constructors ?
*/

/**
* Opens an {@link N5Reader} with an {@link AmazonS3} storage backend.
*
* @deprecated This class is deprecated and may be removed in a future release.
* Replace with either `N5Factory.openReader()` or `N5KeyValueAccessReader` with
* an `AmazonS3KeyValueAccess` backend.
*
* @param s3 the amazon s3 instance
* @param bucketName the bucket name
Expand All @@ -59,10 +59,11 @@ public class N5AmazonS3Reader extends N5KeyValueReader {
* independent writer will not be tracked.
* @throws N5Exception if the reader could not be created
*/
@Deprecated
public N5AmazonS3Reader(final AmazonS3 s3, final String bucketName, final String basePath, final GsonBuilder gsonBuilder, final boolean cacheMeta) throws N5Exception {

super(
new AmazonS3KeyValueAccess(s3, bucketName, false),
new AmazonS3KeyValueAccess(s3, "s3://" + bucketName + "/" + basePath, false),
basePath,
gsonBuilder,
cacheMeta);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
*/
package org.janelia.saalfeldlab.n5.s3;

import java.io.IOException;

import org.janelia.saalfeldlab.n5.N5Writer;
import org.janelia.saalfeldlab.n5.N5Exception;
import org.janelia.saalfeldlab.n5.N5KeyValueWriter;
Expand All @@ -38,14 +36,15 @@
import com.google.gson.GsonBuilder;

/**
* TODO: javadoc
* This class is used to create an N5Writer with an Amazon S3 storage backend.
*
* @deprecated This class is deprecated and may be removed in a future release.
* Replace with either `N5Factory.openWriter()` or `N5KeyValueAccessWriter` with
* an `AmazonS3KeyValueAccess` backend.
*/
@Deprecated
public class N5AmazonS3Writer extends N5KeyValueWriter {

/**
* TODO: reduce number of constructors ?
*/

/**
* Opens an {@link N5Writer} with an {@link AmazonS3} storage backend.
*
Expand All @@ -65,7 +64,7 @@ public class N5AmazonS3Writer extends N5KeyValueWriter {
public N5AmazonS3Writer(final AmazonS3 s3, final String bucketName, final String basePath, final GsonBuilder gsonBuilder, final boolean cacheAttributes) throws N5Exception {

super(
new AmazonS3KeyValueAccess(s3, bucketName, true),
new AmazonS3KeyValueAccess(s3, "s3://" + bucketName + "/" + basePath, true),
basePath,
gsonBuilder,
cacheAttributes);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,16 @@
package org.janelia.saalfeldlab.n5.s3;

import com.amazonaws.services.s3.AmazonS3;
import org.janelia.saalfeldlab.n5.s3.N5AmazonS3Tests.UseCache;
import org.janelia.saalfeldlab.n5.s3.mock.MockS3Factory;
import org.junit.Test;
import org.junit.runners.Parameterized;

import java.util.Arrays;
import java.util.Collection;

public class N5AmazonS3MockTests extends N5AmazonS3Tests {

@Parameterized.Parameters(name = "{0}")
public static Collection<Object[]> data() {

return Arrays.asList(new Object[][]{
{"mock s3, container at generated path", null, false},
{"mock s3, container at generated path , cache attributes", null, true},
{"mock s3, container at root", "/", false},
{"mock s3, container at root with , cache attributes", "/", true}
});
}

@Override
protected AmazonS3 getS3() {

Expand Down
Loading

0 comments on commit 44f1045

Please sign in to comment.