in python/rpdk/java/templates/generate/HandlerWrapper.java [93:126]
public void testEntrypoint(
final InputStream inputStream,
final OutputStream outputStream,
final Context context) throws IOException {
this.loggerProxy = new LoggerProxy();
this.loggerProxy.addLogPublisher(new LambdaLogPublisher(context.getLogger()));
ProgressEvent<{{ pojo_name }}, CallbackContext> response = ProgressEvent.failed(null, null,
HandlerErrorCode.InternalFailure, "Uninitialized");
try {
final String input = IOUtils.toString(inputStream, "UTF-8");
final ResourceHandlerTestPayload<{{ pojo_name }}, CallbackContext, TypeConfigurationModel> payload =
this.serializer.deserialize(
input,
TEST_ENTRY_TYPE_REFERENCE);
final AmazonWebServicesClientProxy proxy = new AmazonWebServicesClientProxy(
loggerProxy, payload.getCredentials(), () -> (long) context.getRemainingTimeInMillis());
response = invokeHandler(proxy, payload.getRequest(), payload.getAction(), payload.getCallbackContext(),
payload.getTypeConfiguration());
} catch (final BaseHandlerException e) {
response = ProgressEvent.defaultFailureHandler(e, e.getErrorCode());
} catch (final AmazonServiceException | AwsServiceException e) {
response = ProgressEvent.defaultFailureHandler(e, HandlerErrorCode.GeneralServiceException);
} catch (final Throwable e) {
e.printStackTrace();
response = ProgressEvent.defaultFailureHandler(e, HandlerErrorCode.InternalFailure);
} finally {
writeResponse(outputStream, response);
outputStream.close();
}
}