-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41934 from gsmet/3.12.3-backports-1
[3.12] 3.12.3 backports 1
- Loading branch information
Showing
36 changed files
with
884 additions
and
130 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
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
20 changes: 20 additions & 0 deletions
20
.../io/quarkus/amazon/lambda/deployment/testing/AbstractInputCollectionOutputCollection.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,20 @@ | ||
package io.quarkus.amazon.lambda.deployment.testing; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import com.amazonaws.services.lambda.runtime.Context; | ||
import com.amazonaws.services.lambda.runtime.RequestHandler; | ||
|
||
import io.quarkus.amazon.lambda.deployment.testing.model.InputPerson; | ||
import io.quarkus.amazon.lambda.deployment.testing.model.OutputPerson; | ||
|
||
public abstract class AbstractInputCollectionOutputCollection implements RequestHandler<List<InputPerson>, List<OutputPerson>> { | ||
|
||
@Override | ||
public List<OutputPerson> handleRequest(List<InputPerson> inputPeronList, Context context) { | ||
List<OutputPerson> personList = new ArrayList<>(); | ||
inputPeronList.forEach(person -> personList.add(new OutputPerson(person.getName()))); | ||
return personList; | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
...s/amazon/lambda/deployment/testing/AbstractInputCollectionOutputCollectionLambdaImpl.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,5 @@ | ||
package io.quarkus.amazon.lambda.deployment.testing; | ||
|
||
public class AbstractInputCollectionOutputCollectionLambdaImpl extends AbstractInputCollectionOutputCollection { | ||
|
||
} |
46 changes: 46 additions & 0 deletions
46
...azon/lambda/deployment/testing/AbstractInputCollectionOutputCollectionLambdaImplTest.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,46 @@ | ||
package io.quarkus.amazon.lambda.deployment.testing; | ||
|
||
import static io.restassured.RestAssured.given; | ||
import static org.hamcrest.CoreMatchers.hasItem; | ||
import static org.hamcrest.CoreMatchers.not; | ||
import static org.hamcrest.Matchers.hasEntry; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.spec.JavaArchive; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.amazon.lambda.deployment.testing.model.InputPerson; | ||
import io.quarkus.amazon.lambda.deployment.testing.model.OutputPerson; | ||
import io.quarkus.test.QuarkusUnitTest; | ||
|
||
public class AbstractInputCollectionOutputCollectionLambdaImplTest { | ||
|
||
@RegisterExtension | ||
static final QuarkusUnitTest test = new QuarkusUnitTest().setArchiveProducer(() -> ShrinkWrap | ||
.create(JavaArchive.class) | ||
.addClasses(AbstractInputCollectionOutputCollectionLambdaImpl.class, AbstractInputCollectionOutputCollection.class, | ||
InputPerson.class, OutputPerson.class)); | ||
|
||
@Test | ||
void abstractRequestHandler_InputCollectionInputPerson_OutputCollectionOutputPerson() { | ||
|
||
List<InputPerson> personList = new ArrayList<>(); | ||
personList.add(new InputPerson("Chris")); | ||
personList.add(new InputPerson("Fred")); | ||
|
||
given() | ||
.body(personList) | ||
.when() | ||
.post() | ||
.then() | ||
.statusCode(200) | ||
.body("", hasItem(hasEntry("outputname", "Chris"))) // OutputPerson serializes name with key outputname | ||
.body("", hasItem(hasEntry("outputname", "Fred"))) | ||
.body("", not(hasItem(hasEntry("name", "Chris")))) // make sure that there is no key name | ||
.body("", not(hasItem(hasEntry("name", "Fred")))); | ||
} | ||
} |
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
38 changes: 38 additions & 0 deletions
38
...loyment/src/test/java/io/quarkus/amazon/lambda/deployment/testing/GreetingLambdaTest.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,38 @@ | ||
package io.quarkus.amazon.lambda.deployment.testing; | ||
|
||
import static io.restassured.RestAssured.given; | ||
import static org.hamcrest.CoreMatchers.containsString; | ||
|
||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.spec.JavaArchive; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.amazon.lambda.deployment.testing.model.InputPerson; | ||
import io.quarkus.test.QuarkusUnitTest; | ||
|
||
class GreetingLambdaTest { | ||
|
||
@RegisterExtension | ||
static final QuarkusUnitTest test = new QuarkusUnitTest().setArchiveProducer(() -> ShrinkWrap | ||
.create(JavaArchive.class) | ||
.addClasses(GreetingLambda.class, InputPerson.class)); | ||
|
||
@Test | ||
public void requestHandler_InputPerson_OutputString() throws Exception { | ||
// you test your lambdas by invoking on http://localhost:8081 | ||
// this works in dev mode too | ||
|
||
InputPerson in = new InputPerson("Stu"); | ||
given() | ||
.contentType("application/json") | ||
.accept("application/json") | ||
.body(in) | ||
.when() | ||
.post() | ||
.then() | ||
.statusCode(200) | ||
.body(containsString("Hey Stu")); | ||
} | ||
|
||
} |
24 changes: 24 additions & 0 deletions
24
...va/io/quarkus/amazon/lambda/deployment/testing/InputCollectionOutputCollectionLambda.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,24 @@ | ||
package io.quarkus.amazon.lambda.deployment.testing; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import com.amazonaws.services.lambda.runtime.Context; | ||
import com.amazonaws.services.lambda.runtime.RequestHandler; | ||
|
||
import io.quarkus.amazon.lambda.deployment.testing.model.InputPerson; | ||
import io.quarkus.amazon.lambda.deployment.testing.model.OutputPerson; | ||
|
||
public class InputCollectionOutputCollectionLambda implements RequestHandler<List<InputPerson>, List<OutputPerson>> { | ||
|
||
@Override | ||
public List<OutputPerson> handleRequest(List<InputPerson> people, Context context) { | ||
|
||
List<OutputPerson> outputPeople = new ArrayList<>(); | ||
people.forEach((person) -> { | ||
outputPeople.add(new OutputPerson(person.getName())); | ||
}); | ||
|
||
return outputPeople; | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
...o/quarkus/amazon/lambda/deployment/testing/InputCollectionOutputCollectionLambdaTest.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,45 @@ | ||
package io.quarkus.amazon.lambda.deployment.testing; | ||
|
||
import static io.restassured.RestAssured.given; | ||
import static org.hamcrest.CoreMatchers.hasItem; | ||
import static org.hamcrest.CoreMatchers.not; | ||
import static org.hamcrest.Matchers.hasEntry; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.spec.JavaArchive; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.amazon.lambda.deployment.testing.model.InputPerson; | ||
import io.quarkus.amazon.lambda.deployment.testing.model.OutputPerson; | ||
import io.quarkus.test.QuarkusUnitTest; | ||
|
||
public class InputCollectionOutputCollectionLambdaTest { | ||
|
||
@RegisterExtension | ||
static final QuarkusUnitTest test = new QuarkusUnitTest().setArchiveProducer(() -> ShrinkWrap | ||
.create(JavaArchive.class) | ||
.addClasses(InputCollectionOutputCollectionLambda.class, InputPerson.class, OutputPerson.class)); | ||
|
||
@Test | ||
void requestHandler_InputCollectionInputPerson_OutputCollectionOutputPerson() { | ||
|
||
List<InputPerson> personList = new ArrayList<>(); | ||
personList.add(new InputPerson("Chris")); | ||
personList.add(new InputPerson("Fred")); | ||
|
||
given() | ||
.body(personList) | ||
.when() | ||
.post() | ||
.then() | ||
.statusCode(200) | ||
.body("", hasItem(hasEntry("outputname", "Chris"))) // OutputPerson serializes name with key outputname | ||
.body("", hasItem(hasEntry("outputname", "Fred"))) | ||
.body("", not(hasItem(hasEntry("name", "Chris")))) // make sure that there is no key name | ||
.body("", not(hasItem(hasEntry("name", "Fred")))); | ||
} | ||
} |
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
31 changes: 0 additions & 31 deletions
31
...deployment/src/test/java/io/quarkus/amazon/lambda/deployment/testing/LambdaHandlerET.java
This file was deleted.
Oops, something went wrong.
15 changes: 0 additions & 15 deletions
15
...n-lambda/deployment/src/test/java/io/quarkus/amazon/lambda/deployment/testing/Person.java
This file was deleted.
Oops, something went wrong.
22 changes: 22 additions & 0 deletions
22
...ployment/src/test/java/io/quarkus/amazon/lambda/deployment/testing/model/InputPerson.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 io.quarkus.amazon.lambda.deployment.testing.model; | ||
|
||
public class InputPerson { | ||
|
||
public InputPerson() { | ||
} | ||
|
||
public InputPerson(String name) { | ||
this.name = name; | ||
} | ||
|
||
private String name; | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public InputPerson setName(String name) { | ||
this.name = name; | ||
return this; | ||
} | ||
} |
Oops, something went wrong.