Light, fluffy, and always free - The AWS Local Emulator alternative
fix(ses): add missing Result element to query protocol responses (#207)
Hector Ventura80e205452b79
diff --git a/src/main/java/io/github/hectorvent/floci/core/common/AwsQueryResponse.java b/src/main/java/io/github/hectorvent/floci/core/common/AwsQueryResponse.javaindex 34056341a0..84e54b2269 100644--- a/src/main/java/io/github/hectorvent/floci/core/common/AwsQueryResponse.java+++ b/src/main/java/io/github/hectorvent/floci/core/common/AwsQueryResponse.java@@ -77,6 +77,14 @@ public final class AwsQueryResponse {.build();}+ /**+ * Same as {@link #envelope} but with an empty Result element.+ * Some services (e.g. SES) require the Result element even if it is empty.+ */+ public static String envelopeEmptyResult(String action, String xmlns) {+ return envelope(action, xmlns, "");+ }+/*** Builds a Query-protocol XML error response and returns a JAX-RS {@link Response}.*diff --git a/src/main/java/io/github/hectorvent/floci/services/ses/SesQueryHandler.java b/src/main/java/io/github/hectorvent/floci/services/ses/SesQueryHandler.javaindex 898e03c253..3499c09d93 100644--- a/src/main/java/io/github/hectorvent/floci/services/ses/SesQueryHandler.java+++ b/src/main/java/io/github/hectorvent/floci/services/ses/SesQueryHandler.java@@ -62,7 +62,7 @@ public class SesQueryHandler {private Response handleVerifyEmailIdentity(MultivaluedMap<String, String> params, String region) {String emailAddress = getParam(params, "EmailAddress");sesService.verifyEmailIdentity(emailAddress, region);- return Response.ok(AwsQueryResponse.envelopeNoResult("VerifyEmailIdentity", AwsNamespaces.SES)).build();+ return Response.ok(AwsQueryResponse.envelopeEmptyResult("VerifyEmailIdentity", AwsNamespaces.SES)).build();}private Response handleVerifyEmailAddress(MultivaluedMap<String, String> params, String region) {@@ -81,7 +81,7 @@ public class SesQueryHandler {private Response handleDeleteIdentity(MultivaluedMap<String, String> params, String region) {String identityValue = getParam(params, "Identity");sesService.deleteIdentity(identityValue, region);- return Response.ok(AwsQueryResponse.envelopeNoResult("DeleteIdentity", AwsNamespaces.SES)).build();+ return Response.ok(AwsQueryResponse.envelopeEmptyResult("DeleteIdentity", AwsNamespaces.SES)).build();}private Response handleListIdentities(MultivaluedMap<String, String> params, String region) {@@ -197,7 +197,7 @@ public class SesQueryHandler {String notificationType = getParam(params, "NotificationType");String snsTopic = getParam(params, "SnsTopic");sesService.setIdentityNotificationTopic(identityValue, notificationType, snsTopic, region);- return Response.ok(AwsQueryResponse.envelopeNoResult("SetIdentityNotificationTopic", AwsNamespaces.SES)).build();+ return Response.ok(AwsQueryResponse.envelopeEmptyResult("SetIdentityNotificationTopic", AwsNamespaces.SES)).build();}private Response handleGetIdentityNotificationAttributes(MultivaluedMap<String, String> params, String region) {diff --git a/src/test/java/io/github/hectorvent/floci/services/ses/SesIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/ses/SesIntegrationTest.javaindex 06e456e667..6dc87974f1 100644--- a/src/test/java/io/github/hectorvent/floci/services/ses/SesIntegrationTest.java+++ b/src/test/java/io/github/hectorvent/floci/services/ses/SesIntegrationTest.java@@ -28,7 +28,8 @@ class SesIntegrationTest {.post("/").then().statusCode(200)- .body(containsString("VerifyEmailIdentityResponse"));+ .body(containsString("VerifyEmailIdentityResponse"))+ .body(containsString("VerifyEmailIdentityResult"));}@Test@@ -265,7 +266,8 @@ class SesIntegrationTest {.when().post("/").then()- .statusCode(200);+ .statusCode(200)+ .body(containsString("SetIdentityNotificationTopicResult"));}@Test@@ -320,7 +322,8 @@ class SesIntegrationTest {.when().post("/").then()- .statusCode(200);+ .statusCode(200)+ .body(containsString("DeleteIdentityResult"));// Verify it's gonegiven()