Search in sources :

Example 1 with BaseHandler

use of com.nextdoor.bender.handler.BaseHandler in project bender by Nextdoor.

the class S3HandlerTest method testSourceRegexFail.

@Test
public void testSourceRegexFail() throws Throwable {
    BaseHandler.CONFIG_FILE = "/com/nextdoor/bender/handler/config_s3_source.json";
    TestContext ctx = new TestContext();
    ctx.setFunctionName("unittest");
    ctx.setInvokedFunctionArn("arn:aws:lambda:us-east-1:123:function:test-function:staging");
    BaseHandler<S3EventNotification> handler = (BaseHandler) getHandler();
    handler.init(ctx);
    handler.handler(getTestEvent("foo", false), ctx);
    assertEquals(0, DummyTransportHelper.BufferedTransporter.output.size());
}
Also used : S3EventNotification(com.amazonaws.services.s3.event.S3EventNotification) TestContext(com.nextdoor.bender.aws.TestContext) BaseHandler(com.nextdoor.bender.handler.BaseHandler) HandlerTest(com.nextdoor.bender.handler.HandlerTest) Test(org.junit.Test)

Example 2 with BaseHandler

use of com.nextdoor.bender.handler.BaseHandler in project bender by Nextdoor.

the class S3HandlerTest method testSourceRegex.

@Test
public void testSourceRegex() throws Throwable {
    BaseHandler.CONFIG_FILE = "/com/nextdoor/bender/handler/config_s3_source.json";
    TestContext ctx = new TestContext();
    ctx.setFunctionName("unittest");
    ctx.setInvokedFunctionArn("arn:aws:lambda:us-east-1:123:function:test-function:staging");
    BaseHandler<S3EventNotification> handler = (BaseHandler) getHandler();
    handler.init(ctx);
    handler.handler(getTestEvent(), ctx);
    assertEquals(1, DummyTransportHelper.BufferedTransporter.output.size());
}
Also used : S3EventNotification(com.amazonaws.services.s3.event.S3EventNotification) TestContext(com.nextdoor.bender.aws.TestContext) BaseHandler(com.nextdoor.bender.handler.BaseHandler) HandlerTest(com.nextdoor.bender.handler.HandlerTest) Test(org.junit.Test)

Aggregations

S3EventNotification (com.amazonaws.services.s3.event.S3EventNotification)2 TestContext (com.nextdoor.bender.aws.TestContext)2 BaseHandler (com.nextdoor.bender.handler.BaseHandler)2 HandlerTest (com.nextdoor.bender.handler.HandlerTest)2 Test (org.junit.Test)2