-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deployment changes for BuildSteps with RequestStreamHandler, and Runt…
…ime with AmazonLambdaRecorder
- Loading branch information
1 parent
4bf5498
commit c4e4b11
Showing
10 changed files
with
284 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
...da/maven-archetype/src/main/resources/archetype-resources/src/main/java/StreamLambda.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package ${package}; | ||
|
||
import javax.inject.Inject; | ||
import javax.inject.Named; | ||
|
||
import com.amazonaws.services.lambda.runtime.Context; | ||
import com.amazonaws.services.lambda.runtime.RequestStreamHandler; | ||
|
||
import java.io.InputStream; | ||
import java.io.OutputStream; | ||
import java.io.IOException; | ||
|
||
|
||
@Named("stream") | ||
public class StreamLambda implements RequestStreamHandler { | ||
|
||
@Override | ||
public void handleRequest(InputStream inputStream, OutputStream outputStream, Context context) throws IOException { | ||
int letter; | ||
while ((letter = inputStream.read()) != -1) { | ||
int character = Character.toUpperCase(letter); | ||
outputStream.write(character); | ||
} | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
...rchetype/src/main/resources/archetype-resources/src/main/resources/application.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
quarkus.lambda.handler=test | ||
|
||
quarkus.lambda.enable-polling-jvm-mode=true |
22 changes: 22 additions & 0 deletions
22
...ven-archetype/src/main/resources/archetype-resources/src/test/java/LambdaHandlerTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package ${package}; | ||
|
||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import io.quarkus.amazon.lambda.test.LambdaClient; | ||
import io.quarkus.test.junit.QuarkusTest; | ||
|
||
@QuarkusTest | ||
public class LambdaHandlerTest { | ||
|
||
@Test | ||
public void testSimpleLambdaSuccess() throws Exception { | ||
InputObject in = new InputObject(); | ||
in.setGreeting("Hello"); | ||
in.setName("Stu"); | ||
OutputObject out = LambdaClient.invoke(OutputObject.class, in); | ||
Assertions.assertEquals("Hello Stu", out.getResult()); | ||
Assertions.assertTrue(out.getRequestId().matches("aws-request-\\d"), "Expected requestId as 'aws-request-<number>'"); | ||
} | ||
|
||
} |
5 changes: 5 additions & 0 deletions
5
...rchetype/src/main/resources/archetype-resources/src/test/resources/application.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
quarkus.lambda.handler=test | ||
|
||
quarkus.lambda.enable-polling-jvm-mode=true | ||
|
||
|
Oops, something went wrong.