use of com.nextdoor.bender.aws.S3MockClientFactory in project bender by Nextdoor.
the class SNSS3HandlerTest method setup.
@Override
public void setup() {
/*
* Patch the handler to use this test's factory which produces a mock client.
*/
S3MockClientFactory f;
try {
f = new S3MockClientFactory(tmpFolder);
} catch (Exception e) {
throw new RuntimeException("unable to start s3proxy", e);
}
this.clientFactory = f;
this.client = f.newInstance();
}
use of com.nextdoor.bender.aws.S3MockClientFactory in project bender by Nextdoor.
the class GeoIpOperationFactoryTest method setup.
@Before
public void setup() {
/*
* Patch the handler to use this test's factory which produces a mock client.
*/
S3MockClientFactory f;
try {
f = new S3MockClientFactory(tmpFolder);
} catch (Exception e) {
throw new RuntimeException("unable to start s3proxy", e);
}
this.clientFactory = f;
this.client = f.newInstance();
/*
* Populate S3
*/
this.client.createBucket(BUCKET);
InputStream is = this.getClass().getResourceAsStream("my-ip-data.mmdb");
this.client.putObject(BUCKET, "my-ip-data.mmdb", is, new ObjectMetadata());
this.opFactory = new GeoIpOperationFactory();
this.opFactory.s3Factory = this.clientFactory;
}
use of com.nextdoor.bender.aws.S3MockClientFactory in project bender by Nextdoor.
the class BaseHandlerS3Test method setup.
@Before
public void setup() throws UnsupportedEncodingException, IOException {
/*
* Patch the handler to use this test's factory which produces a mock client.
*/
S3MockClientFactory f;
try {
f = new S3MockClientFactory(tmpFolder);
} catch (Exception e) {
throw new RuntimeException("unable to start s3proxy", e);
}
AmazonS3Client client = f.newInstance();
client.createBucket(S3_BUCKET);
this.clientFactory = f;
/*
* Upload config file
*/
String payload = IOUtils.toString(new InputStreamReader(this.getClass().getResourceAsStream("/config/handler_config.json"), "UTF-8"));
client.putObject(S3_BUCKET, "bender/config.json", payload);
/*
* Export config file as env var
*/
envVars.set("BENDER_CONFIG", "s3://" + S3_BUCKET + "/bender/config.json");
}
use of com.nextdoor.bender.aws.S3MockClientFactory in project bender by Nextdoor.
the class S3HandlerTest method setup.
@Override
public void setup() {
/*
* Patch the handler to use this test's factory which produces a mock client.
*/
S3MockClientFactory f;
try {
f = new S3MockClientFactory(tmpFolder);
} catch (Exception e) {
throw new RuntimeException("unable to start s3proxy", e);
}
this.clientFactory = f;
this.client = f.newInstance();
}
Aggregations