Java tutorial
/* * Copyright (c) 2016 ingenieux Labs * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package io.ingenieux.lambada.invoker.fixtures; import com.amazonaws.services.lambda.runtime.Context; import org.apache.commons.io.IOUtils; import java.io.InputStream; import java.io.OutputStream; public class Fixture { public void doSomethingAsANoOp() { Notifier.addMessage("doSomethingAsANoOp"); } public void doSomethingAsANoOpButWithContext(Context c) { c.getLogger().log("doSomethingAsANoOpButWithContext"); } public void doSomethingRaw(InputStream is, OutputStream os) throws Exception { Integer value = Integer.valueOf(IOUtils.toString(is)); IOUtils.write("" + (2 * value), os); } public void doSomethingRawWithContext(InputStream is, OutputStream os, Context c) throws Exception { Integer value = Integer.valueOf(IOUtils.toString(is)); final int result = 2 * value; c.getLogger().log("" + (result * 2)); IOUtils.write("" + result, os); } public void doSomethingWithJackson(String message) { Notifier.addMessage(message); } public String doSomethingWithJacksonAndContext(Integer something, Context c) { return "Hello"; } }