From 80969e6f10f4531c64c7d35965a35e1a2f671c1d Mon Sep 17 00:00:00 2001 From: Gustav Date: Wed, 26 Jan 2022 15:03:13 +0100 Subject: [PATCH 01/14] MSLRES-4816 Add flash_message property --- .../java/com/sinch/xms/api/MtBatchSmsCreate.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/main/java/com/sinch/xms/api/MtBatchSmsCreate.java b/src/main/java/com/sinch/xms/api/MtBatchSmsCreate.java index 323c00d..1ab1f94 100644 --- a/src/main/java/com/sinch/xms/api/MtBatchSmsCreate.java +++ b/src/main/java/com/sinch/xms/api/MtBatchSmsCreate.java @@ -126,6 +126,22 @@ public abstract class MtBatchSmsCreate { @JsonProperty("client_reference") public abstract String clientReference(); + /** + * Shows message on screen without user interaction while not saving the message to the inbox. + * Defaults to false. + */ + @Nullable + @JsonProperty("flash_message") + public abstract Boolean flashMessage(); + + /** + * Message will be dispatched only if it is not split to more parts than Max Number of Message + * Parts. Defaults to false. + */ + @Nullable + @JsonProperty("max_number_of_message_parts") + public abstract Integer maxNumberOfMessageParts(); + /** * The DLT principal entity identifier to attach to this message. * From e212b69f05ff320836eee9fb568258d5eea3fed8 Mon Sep 17 00:00:00 2001 From: Gustav Date: Wed, 26 Jan 2022 17:05:27 +0100 Subject: [PATCH 02/14] MSLRES-4816 Add properties to MtBatchSmsResult --- .../java/com/sinch/xms/api/MtBatchSmsResult.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/main/java/com/sinch/xms/api/MtBatchSmsResult.java b/src/main/java/com/sinch/xms/api/MtBatchSmsResult.java index 02f4b5a..e888da1 100644 --- a/src/main/java/com/sinch/xms/api/MtBatchSmsResult.java +++ b/src/main/java/com/sinch/xms/api/MtBatchSmsResult.java @@ -137,6 +137,19 @@ public abstract class MtBatchSmsResult { @JsonProperty("client_reference") public abstract String clientReference(); + /** Shows message on screen without user interaction while not saving the message to the inbox. */ + @Nullable + @JsonProperty("flash_message") + public abstract Boolean flashMessage(); + + /** + * Message will be dispatched only if it is not split to more parts than Max Number of Message + * Parts. + */ + @Nullable + @JsonProperty("max_number_of_message_parts") + public abstract Integer maxNumberOfMessageParts(); + /** * The DLT principal entity identifier to attach to this message. * From e64845a003628614decc8a28dd20ba99ceda1cc2 Mon Sep 17 00:00:00 2001 From: Gustav Date: Thu, 27 Jan 2022 11:27:16 +0100 Subject: [PATCH 03/14] MSLRES-4816 Add @return javadoc --- src/main/java/com/sinch/xms/api/MtBatchSmsCreate.java | 4 ++++ src/main/java/com/sinch/xms/api/MtBatchSmsResult.java | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/sinch/xms/api/MtBatchSmsCreate.java b/src/main/java/com/sinch/xms/api/MtBatchSmsCreate.java index 1ab1f94..d7d9c45 100644 --- a/src/main/java/com/sinch/xms/api/MtBatchSmsCreate.java +++ b/src/main/java/com/sinch/xms/api/MtBatchSmsCreate.java @@ -129,6 +129,8 @@ public abstract class MtBatchSmsCreate { /** * Shows message on screen without user interaction while not saving the message to the inbox. * Defaults to false. + * + * @return boolean indicating if it's a flash message */ @Nullable @JsonProperty("flash_message") @@ -137,6 +139,8 @@ public abstract class MtBatchSmsCreate { /** * Message will be dispatched only if it is not split to more parts than Max Number of Message * Parts. Defaults to false. + * + * @return the maximum allowed number of message parts */ @Nullable @JsonProperty("max_number_of_message_parts") diff --git a/src/main/java/com/sinch/xms/api/MtBatchSmsResult.java b/src/main/java/com/sinch/xms/api/MtBatchSmsResult.java index e888da1..7d4169f 100644 --- a/src/main/java/com/sinch/xms/api/MtBatchSmsResult.java +++ b/src/main/java/com/sinch/xms/api/MtBatchSmsResult.java @@ -137,7 +137,11 @@ public abstract class MtBatchSmsResult { @JsonProperty("client_reference") public abstract String clientReference(); - /** Shows message on screen without user interaction while not saving the message to the inbox. */ + /** + * Shows message on screen without user interaction while not saving the message to the inbox. + * + * @return boolean indicating if it's a flash message + */ @Nullable @JsonProperty("flash_message") public abstract Boolean flashMessage(); @@ -145,6 +149,8 @@ public abstract class MtBatchSmsResult { /** * Message will be dispatched only if it is not split to more parts than Max Number of Message * Parts. + * + * @return the maximum allowed number of message parts */ @Nullable @JsonProperty("max_number_of_message_parts") From 1e3740292476f11ba89dfc92317e7f9f05afc2a1 Mon Sep 17 00:00:00 2001 From: Gustav Date: Thu, 27 Jan 2022 11:29:04 +0100 Subject: [PATCH 04/14] MSLRES-4816 Make flash message non-nullable in sms result --- src/main/java/com/sinch/xms/api/MtBatchSmsResult.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/com/sinch/xms/api/MtBatchSmsResult.java b/src/main/java/com/sinch/xms/api/MtBatchSmsResult.java index 7d4169f..c8fb3ff 100644 --- a/src/main/java/com/sinch/xms/api/MtBatchSmsResult.java +++ b/src/main/java/com/sinch/xms/api/MtBatchSmsResult.java @@ -142,9 +142,8 @@ public abstract class MtBatchSmsResult { * * @return boolean indicating if it's a flash message */ - @Nullable @JsonProperty("flash_message") - public abstract Boolean flashMessage(); + public abstract boolean flashMessage(); /** * Message will be dispatched only if it is not split to more parts than Max Number of Message From 74da5d9e44f2e173671f53e63dda00e3e15193f1 Mon Sep 17 00:00:00 2001 From: Gustav Date: Thu, 27 Jan 2022 11:32:32 +0100 Subject: [PATCH 05/14] MSLRES-4816 Update ReportType return value --- src/main/java/com/sinch/xms/api/MtBatchSmsResult.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/com/sinch/xms/api/MtBatchSmsResult.java b/src/main/java/com/sinch/xms/api/MtBatchSmsResult.java index c8fb3ff..f58fbf9 100644 --- a/src/main/java/com/sinch/xms/api/MtBatchSmsResult.java +++ b/src/main/java/com/sinch/xms/api/MtBatchSmsResult.java @@ -68,9 +68,8 @@ public abstract class MtBatchSmsResult { /** * The type of delivery report used for this batch. * - * @return a type of report or null for the default type + * @return a type of report, ReportType.NONE if not provided */ - @Nullable public abstract ReportType deliveryReport(); /** From df64eb05071c2358216255c4c0811be3ff56c45e Mon Sep 17 00:00:00 2001 From: Gustav Date: Thu, 27 Jan 2022 11:55:13 +0100 Subject: [PATCH 06/14] MSLRES-4816 add delivery_report JsonProperty --- src/main/java/com/sinch/xms/api/MtBatchSmsResult.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/sinch/xms/api/MtBatchSmsResult.java b/src/main/java/com/sinch/xms/api/MtBatchSmsResult.java index f58fbf9..9fe3a53 100644 --- a/src/main/java/com/sinch/xms/api/MtBatchSmsResult.java +++ b/src/main/java/com/sinch/xms/api/MtBatchSmsResult.java @@ -70,6 +70,7 @@ public abstract class MtBatchSmsResult { * * @return a type of report, ReportType.NONE if not provided */ + @JsonProperty("delivery_report") public abstract ReportType deliveryReport(); /** From 6034f890358a64a131af020e3d808f4713d2be3a Mon Sep 17 00:00:00 2001 From: Gustav Date: Thu, 27 Jan 2022 11:55:37 +0100 Subject: [PATCH 07/14] MSLRES-4816 Fix unit tests --- .../sinch/xms/api/MtBatchBinarySmsResultTest.java | 4 ++++ .../com/sinch/xms/api/MtBatchTextSmsResultTest.java | 8 ++++++++ .../java/com/sinch/xms/api/PagedBatchResultTest.java | 12 ++++++++++++ 3 files changed, 24 insertions(+) diff --git a/src/test/java/com/sinch/xms/api/MtBatchBinarySmsResultTest.java b/src/test/java/com/sinch/xms/api/MtBatchBinarySmsResultTest.java index 0a04f8b..1101863 100644 --- a/src/test/java/com/sinch/xms/api/MtBatchBinarySmsResultTest.java +++ b/src/test/java/com/sinch/xms/api/MtBatchBinarySmsResultTest.java @@ -43,6 +43,8 @@ public void canSerializeMinimal() throws Exception { " 'from': '1234',", " 'to': [ '987654321' ],", " 'canceled': false,", + " 'flash_message': false,", + " 'delivery_report': 'none',", " 'id': '" + input.id() + "',", " 'body': 'SGVsbG8sIHdvcmxkIQ==',", " 'udh': '01020304'", @@ -69,6 +71,8 @@ private static MtBatchBinarySmsResult.Builder minimalBatchBuilder() { return new MtBatchBinarySmsResult.Builder() .sender("1234") .addRecipient("987654321") + .flashMessage(false) + .deliveryReport(ReportType.NONE) .body("Hello, world!".getBytes(TestUtils.US_ASCII)) .udh(new byte[] {1, 2, 3, 4}) .canceled(false) diff --git a/src/test/java/com/sinch/xms/api/MtBatchTextSmsResultTest.java b/src/test/java/com/sinch/xms/api/MtBatchTextSmsResultTest.java index 765fca2..f4f1834 100644 --- a/src/test/java/com/sinch/xms/api/MtBatchTextSmsResultTest.java +++ b/src/test/java/com/sinch/xms/api/MtBatchTextSmsResultTest.java @@ -45,6 +45,8 @@ public void canSerializeMinimal() throws Exception { " 'to': [ '987654321' ],", " 'body': 'Hello, world!',", " 'canceled': false,", + " 'flash_message': false,", + " 'delivery_report': 'none',", " 'id': '" + input.id() + "'", "}") .replace('\'', '"'); @@ -86,6 +88,8 @@ public void canSerializeWithParameters() throws Exception { " 'to': [ '987654321' ],", " 'body': 'Hello, world!',", " 'canceled': false,", + " 'flash_message': false,", + " 'delivery_report': 'none',", " 'id': '" + input.id() + "',", " 'parameters': {", " 'param1': {", @@ -142,6 +146,8 @@ public void canSerializeWithParametersAndDefault() throws Exception { " 'to': [ '987654321' ],", " 'body': 'Hello, world!',", " 'canceled': false,", + " 'flash_message': false,", + " 'delivery_report': 'none',", " 'id': '" + input.id() + "',", " 'parameters': {", " 'param1': {", @@ -182,6 +188,8 @@ private static MtBatchTextSmsResult.Builder minimalBatchBuilder() { return new MtBatchTextSmsResult.Builder() .sender("1234") .addRecipient("987654321") + .flashMessage(false) + .deliveryReport(ReportType.NONE) .body("Hello, world!") .canceled(false) .id(TestUtils.freshBatchId()); diff --git a/src/test/java/com/sinch/xms/api/PagedBatchResultTest.java b/src/test/java/com/sinch/xms/api/PagedBatchResultTest.java index 549f9ff..d1c243f 100644 --- a/src/test/java/com/sinch/xms/api/PagedBatchResultTest.java +++ b/src/test/java/com/sinch/xms/api/PagedBatchResultTest.java @@ -80,6 +80,8 @@ public void canSerializeJsonWithNonEmptyBatches() throws Exception { .id(batchId1) .createdAt(smsTime) .modifiedAt(smsTime) + .flashMessage(false) + .deliveryReport(ReportType.NONE) .build(); MtBatchSmsResult batchResult2 = @@ -88,6 +90,8 @@ public void canSerializeJsonWithNonEmptyBatches() throws Exception { .id(batchId2) .body("foobar".getBytes(TestUtils.US_ASCII)) .udh(new byte[] {1, 2, 3}) + .flashMessage(false) + .deliveryReport(ReportType.NONE) .build(); PagedBatchResult input = @@ -117,6 +121,8 @@ public void canSerializeJsonWithNonEmptyBatches() throws Exception { " 'canceled': false,", " 'id': '" + batchId1 + "',", " 'from': '12345',", + " 'flash_message': false,", + " 'delivery_report': 'none',", " 'created_at': " + smsTimeString + ",", " 'modified_at': " + smsTimeString + "", " },", @@ -131,6 +137,8 @@ public void canSerializeJsonWithNonEmptyBatches() throws Exception { " 'canceled': false,", " 'id': '" + batchId2 + "',", " 'from': '12345',", + " 'flash_message': false,", + " 'delivery_report': 'none',", " 'created_at': " + smsTimeString + ",", " 'modified_at': " + smsTimeString + "", " }", @@ -156,6 +164,8 @@ public void canDeserializeJsonWithNonEmptyBatches() throws Exception { .body("Hello, world!") .canceled(false) .id(batchId1) + .flashMessage(false) + .deliveryReport(ReportType.NONE) .createdAt(smsTime) .modifiedAt(smsTime) .build(); @@ -164,6 +174,8 @@ public void canDeserializeJsonWithNonEmptyBatches() throws Exception { new MtBatchBinarySmsResult.Builder() .using(batchResult1) .id(batchId2) + .flashMessage(false) + .deliveryReport(ReportType.NONE) .body("Hello, again!".getBytes()) .udh("udh".getBytes()) .build(); From 879060482b80dbeae3a8bac951c9d9a1d258fe18 Mon Sep 17 00:00:00 2001 From: Gustav Date: Thu, 27 Jan 2022 12:53:48 +0100 Subject: [PATCH 08/14] MSLRES-4816 Fix ITs --- .../java/com/sinch/xms/ApiConnectionIT.java | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/src/test/java/com/sinch/xms/ApiConnectionIT.java b/src/test/java/com/sinch/xms/ApiConnectionIT.java index cf41150..383f35a 100644 --- a/src/test/java/com/sinch/xms/ApiConnectionIT.java +++ b/src/test/java/com/sinch/xms/ApiConnectionIT.java @@ -71,6 +71,7 @@ import com.sinch.xms.api.PagedGroupResult; import com.sinch.xms.api.PagedInboundsResult; import com.sinch.xms.api.RecipientDeliveryReport; +import com.sinch.xms.api.ReportType; import com.sinch.xms.api.Tags; import com.sinch.xms.api.TagsUpdate; import java.io.IOException; @@ -152,6 +153,8 @@ public void canCreateBinaryBatch() throws Exception { .body(request.body()) .udh(request.udh()) .canceled(false) + .flashMessage(false) + .deliveryReport(ReportType.NONE) .id(batchId) .createdAt(time) .modifiedAt(time) @@ -194,6 +197,8 @@ public void canCreateTextBatch() throws Exception { MtBatchTextSmsResult expected = MtBatchTextSmsResult.builder() + .flashMessage(false) + .deliveryReport(ReportType.NONE) .sender(request.sender()) .recipients(request.recipients()) .body(request.body()) @@ -246,6 +251,8 @@ public void canCreateTextBatchWithSubstitutions() throws Exception { MtBatchTextSmsResult expected = MtBatchTextSmsResult.builder() + .flashMessage(false) + .deliveryReport(ReportType.NONE) .sender(request.sender()) .recipients(request.recipients()) .body(request.body()) @@ -533,6 +540,8 @@ public void canReplaceBinaryBatch() throws Exception { .recipients(request.recipients()) .body(request.body()) .udh(request.udh()) + .flashMessage(false) + .deliveryReport(ReportType.NONE) .canceled(false) .id(batchId) .createdAt(time) @@ -576,6 +585,8 @@ public void canReplaceTextBatch() throws Exception { MtBatchTextSmsResult expected = MtBatchTextSmsResult.builder() + .flashMessage(false) + .deliveryReport(ReportType.NONE) .sender(request.sender()) .recipients(request.recipients()) .body(request.body()) @@ -622,6 +633,8 @@ public void canUpdateSimpleTextBatch() throws Exception { MtBatchTextSmsResult expected = MtBatchTextSmsResult.builder() + .flashMessage(false) + .deliveryReport(ReportType.NONE) .sender(request.sender()) .addRecipient("123") .body(request.body()) @@ -675,6 +688,8 @@ public void canUpdateSimpleBinaryBatch() throws Exception { .addRecipient("123") .body(request.body()) .udh((byte) 1, (byte) 0xff) + .flashMessage(false) + .deliveryReport(ReportType.NONE) .canceled(false) .id(batchId) .createdAt(time) @@ -712,6 +727,8 @@ public void canFetchTextBatch() throws Exception { final MtBatchSmsResult expected = MtBatchTextSmsResult.builder() + .flashMessage(false) + .deliveryReport(ReportType.NONE) .sender("12345") .addRecipient("123456789", "987654321") .body("Hello, world!") @@ -750,6 +767,8 @@ public void canFetchTextBatchAsync() throws Exception { final MtBatchSmsResult expected = MtBatchTextSmsResult.builder() + .flashMessage(false) + .deliveryReport(ReportType.NONE) .sender("12345") .addRecipient("123456789", "987654321") .body("Hello, world!") @@ -801,6 +820,8 @@ public void canFetchBinaryBatch() throws Exception { .addRecipient("123456789", "987654321") .body((byte) 0xf0, (byte) 0x0f) .udh((byte) 0x50, (byte) 0x05) + .flashMessage(false) + .deliveryReport(ReportType.NONE) .canceled(false) .id(batchId) .createdAt(time) @@ -1018,6 +1039,8 @@ public void canCancelBatch() throws Exception { MtBatchSmsResult expected = MtBatchTextSmsResult.builder() + .flashMessage(false) + .deliveryReport(ReportType.NONE) .sender("12345") .addRecipient("123456789", "987654321") .body("Hello, world!") @@ -1058,6 +1081,8 @@ public void canCancelBatchConcurrently() throws Exception { // Set up the first request (the one that will be delayed). MtBatchSmsResult expected1 = MtBatchTextSmsResult.builder() + .flashMessage(false) + .deliveryReport(ReportType.NONE) .sender("12345") .addRecipient("123456789", "987654321") .body("Hello, world!") @@ -1086,6 +1111,8 @@ public void canCancelBatchConcurrently() throws Exception { .addRecipient("123456789", "987654321") .body("Hello, world!".getBytes()) .udh((byte) 1) + .flashMessage(false) + .deliveryReport(ReportType.NONE) .canceled(true) .id(TestUtils.freshBatchId()) .createdAt(OffsetDateTime.now()) @@ -1252,6 +1279,8 @@ public void canIterateOverPages() throws Exception { .totalSize(2) .addContent( MtBatchTextSmsResult.builder() + .flashMessage(false) + .deliveryReport(ReportType.NONE) .id(TestUtils.freshBatchId()) .body("body") .canceled(false) @@ -1274,9 +1303,13 @@ public void canIterateOverPages() throws Exception { .body((byte) 0) .udh((byte) 1) .canceled(false) + .flashMessage(false) + .deliveryReport(ReportType.NONE) .build()) .addContent( MtBatchTextSmsResult.builder() + .flashMessage(false) + .deliveryReport(ReportType.NONE) .id(TestUtils.freshBatchId()) .body("body") .canceled(false) @@ -1329,6 +1362,8 @@ public void canIterateOverBatchesWithTwoPages() throws Exception { .totalSize(3) .addContent( MtBatchTextSmsResult.builder() + .flashMessage(false) + .deliveryReport(ReportType.NONE) .id(TestUtils.freshBatchId()) .body("body") .canceled(false) @@ -1351,9 +1386,13 @@ public void canIterateOverBatchesWithTwoPages() throws Exception { .body((byte) 0) .udh((byte) 1) .canceled(false) + .flashMessage(false) + .deliveryReport(ReportType.NONE) .build()) .addContent( MtBatchTextSmsResult.builder() + .flashMessage(false) + .deliveryReport(ReportType.NONE) .id(TestUtils.freshBatchId()) .body("body") .canceled(false) From 042b25d42fb86cd48a896cab8c98acf451a652ba Mon Sep 17 00:00:00 2001 From: Gustav Date: Fri, 28 Jan 2022 11:43:18 +0100 Subject: [PATCH 09/14] MSLRES-4816 Add feedback_enabled to SmsBatchResult --- src/main/java/com/sinch/xms/api/MtBatchSmsResult.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/java/com/sinch/xms/api/MtBatchSmsResult.java b/src/main/java/com/sinch/xms/api/MtBatchSmsResult.java index 9fe3a53..7f752c6 100644 --- a/src/main/java/com/sinch/xms/api/MtBatchSmsResult.java +++ b/src/main/java/com/sinch/xms/api/MtBatchSmsResult.java @@ -145,6 +145,15 @@ public abstract class MtBatchSmsResult { @JsonProperty("flash_message") public abstract boolean flashMessage(); + /** + * Send feedback if your system can confirm successful message delivery. + * Feedback can only be provided if feedback_enabled was set when batch was submitted. + * + * @return boolean indicating if feedback is enabled + */ + @JsonProperty("feedback_enabled") + public abstract boolean feedbackEnabled(); + /** * Message will be dispatched only if it is not split to more parts than Max Number of Message * Parts. From 0f0b731a98ff60c07575dacb5ba00958b98de5dd Mon Sep 17 00:00:00 2001 From: Gustav Date: Fri, 28 Jan 2022 11:43:52 +0100 Subject: [PATCH 10/14] MSLRES-4816 Update feedback_enabled description to match online documentation --- src/main/java/com/sinch/xms/api/MtBatchSmsCreate.java | 3 ++- src/main/java/com/sinch/xms/api/MtBatchSmsResult.java | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/sinch/xms/api/MtBatchSmsCreate.java b/src/main/java/com/sinch/xms/api/MtBatchSmsCreate.java index d7d9c45..d9810e0 100644 --- a/src/main/java/com/sinch/xms/api/MtBatchSmsCreate.java +++ b/src/main/java/com/sinch/xms/api/MtBatchSmsCreate.java @@ -98,7 +98,8 @@ public abstract class MtBatchSmsCreate { public abstract URI callbackUrl(); /** - * The boolean value which determines if feedback is allowed to be sent + * Send feedback if your system can confirm successful message delivery. Feedback can only be + * provided if feedback_enabled was set when batch was submitted. * * @return boolean value */ diff --git a/src/main/java/com/sinch/xms/api/MtBatchSmsResult.java b/src/main/java/com/sinch/xms/api/MtBatchSmsResult.java index 7f752c6..06b3b91 100644 --- a/src/main/java/com/sinch/xms/api/MtBatchSmsResult.java +++ b/src/main/java/com/sinch/xms/api/MtBatchSmsResult.java @@ -146,8 +146,8 @@ public abstract class MtBatchSmsResult { public abstract boolean flashMessage(); /** - * Send feedback if your system can confirm successful message delivery. - * Feedback can only be provided if feedback_enabled was set when batch was submitted. + * Send feedback if your system can confirm successful message delivery. Feedback can only be + * provided if feedback_enabled was set when batch was submitted. * * @return boolean indicating if feedback is enabled */ From 076e55e058b3cdd24f10121af73f74c40e7f5a67 Mon Sep 17 00:00:00 2001 From: Gustav Date: Fri, 28 Jan 2022 12:04:09 +0100 Subject: [PATCH 11/14] MSLRES-4816 Update tests with feedback_enabled --- src/test/java/com/sinch/xms/ApiConnectionIT.java | 4 ++-- .../java/com/sinch/xms/api/MtBatchBinarySmsResultTest.java | 2 ++ .../java/com/sinch/xms/api/MtBatchTextSmsResultTest.java | 4 ++++ src/test/java/com/sinch/xms/api/PagedBatchResultTest.java | 6 ++++++ 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/test/java/com/sinch/xms/ApiConnectionIT.java b/src/test/java/com/sinch/xms/ApiConnectionIT.java index 383f35a..91f0515 100644 --- a/src/test/java/com/sinch/xms/ApiConnectionIT.java +++ b/src/test/java/com/sinch/xms/ApiConnectionIT.java @@ -103,7 +103,7 @@ public class ApiConnectionIT { /** * A convenient {@link FutureCallback} for use in tests. By default all callback methods will call - * {@link #fail(String)}. Override the one that should succeed. + * {@link #failed(Exception)}. Override the one that should succeed. * * @param the callback result type */ @@ -154,6 +154,7 @@ public void canCreateBinaryBatch() throws Exception { .udh(request.udh()) .canceled(false) .flashMessage(false) + .feedbackEnabled(false) .deliveryReport(ReportType.NONE) .id(batchId) .createdAt(time) @@ -3413,7 +3414,6 @@ private void verifyGetRequest(String path) { * * @param response the response to give, serialized to JSON * @param path the path on which to listen - * @param status the response HTTP status * @throws JsonProcessingException if the given response object could not be serialized */ private void stubDeleteResponse(Object response, String path) throws JsonProcessingException { diff --git a/src/test/java/com/sinch/xms/api/MtBatchBinarySmsResultTest.java b/src/test/java/com/sinch/xms/api/MtBatchBinarySmsResultTest.java index 1101863..5f27f65 100644 --- a/src/test/java/com/sinch/xms/api/MtBatchBinarySmsResultTest.java +++ b/src/test/java/com/sinch/xms/api/MtBatchBinarySmsResultTest.java @@ -43,6 +43,7 @@ public void canSerializeMinimal() throws Exception { " 'from': '1234',", " 'to': [ '987654321' ],", " 'canceled': false,", + " 'feedback_enabled': false,", " 'flash_message': false,", " 'delivery_report': 'none',", " 'id': '" + input.id() + "',", @@ -72,6 +73,7 @@ private static MtBatchBinarySmsResult.Builder minimalBatchBuilder() { .sender("1234") .addRecipient("987654321") .flashMessage(false) + .feedbackEnabled(false) .deliveryReport(ReportType.NONE) .body("Hello, world!".getBytes(TestUtils.US_ASCII)) .udh(new byte[] {1, 2, 3, 4}) diff --git a/src/test/java/com/sinch/xms/api/MtBatchTextSmsResultTest.java b/src/test/java/com/sinch/xms/api/MtBatchTextSmsResultTest.java index f4f1834..ef9ad5a 100644 --- a/src/test/java/com/sinch/xms/api/MtBatchTextSmsResultTest.java +++ b/src/test/java/com/sinch/xms/api/MtBatchTextSmsResultTest.java @@ -45,6 +45,7 @@ public void canSerializeMinimal() throws Exception { " 'to': [ '987654321' ],", " 'body': 'Hello, world!',", " 'canceled': false,", + " 'feedback_enabled': false,", " 'flash_message': false,", " 'delivery_report': 'none',", " 'id': '" + input.id() + "'", @@ -89,6 +90,7 @@ public void canSerializeWithParameters() throws Exception { " 'body': 'Hello, world!',", " 'canceled': false,", " 'flash_message': false,", + " 'feedback_enabled': false,", " 'delivery_report': 'none',", " 'id': '" + input.id() + "',", " 'parameters': {", @@ -146,6 +148,7 @@ public void canSerializeWithParametersAndDefault() throws Exception { " 'to': [ '987654321' ],", " 'body': 'Hello, world!',", " 'canceled': false,", + " 'feedback_enabled': false,", " 'flash_message': false,", " 'delivery_report': 'none',", " 'id': '" + input.id() + "',", @@ -189,6 +192,7 @@ private static MtBatchTextSmsResult.Builder minimalBatchBuilder() { .sender("1234") .addRecipient("987654321") .flashMessage(false) + .feedbackEnabled(false) .deliveryReport(ReportType.NONE) .body("Hello, world!") .canceled(false) diff --git a/src/test/java/com/sinch/xms/api/PagedBatchResultTest.java b/src/test/java/com/sinch/xms/api/PagedBatchResultTest.java index d1c243f..0c51411 100644 --- a/src/test/java/com/sinch/xms/api/PagedBatchResultTest.java +++ b/src/test/java/com/sinch/xms/api/PagedBatchResultTest.java @@ -81,6 +81,7 @@ public void canSerializeJsonWithNonEmptyBatches() throws Exception { .createdAt(smsTime) .modifiedAt(smsTime) .flashMessage(false) + .feedbackEnabled(false) .deliveryReport(ReportType.NONE) .build(); @@ -91,6 +92,7 @@ public void canSerializeJsonWithNonEmptyBatches() throws Exception { .body("foobar".getBytes(TestUtils.US_ASCII)) .udh(new byte[] {1, 2, 3}) .flashMessage(false) + .feedbackEnabled(false) .deliveryReport(ReportType.NONE) .build(); @@ -119,6 +121,7 @@ public void canSerializeJsonWithNonEmptyBatches() throws Exception { " ],", " 'body': 'Hello, world!',", " 'canceled': false,", + " 'feedback_enabled': false,", " 'id': '" + batchId1 + "',", " 'from': '12345',", " 'flash_message': false,", @@ -135,6 +138,7 @@ public void canSerializeJsonWithNonEmptyBatches() throws Exception { " 'body': 'Zm9vYmFy',", " 'udh': '010203',", " 'canceled': false,", + " 'feedback_enabled': false,", " 'id': '" + batchId2 + "',", " 'from': '12345',", " 'flash_message': false,", @@ -165,6 +169,7 @@ public void canDeserializeJsonWithNonEmptyBatches() throws Exception { .canceled(false) .id(batchId1) .flashMessage(false) + .feedbackEnabled(false) .deliveryReport(ReportType.NONE) .createdAt(smsTime) .modifiedAt(smsTime) @@ -175,6 +180,7 @@ public void canDeserializeJsonWithNonEmptyBatches() throws Exception { .using(batchResult1) .id(batchId2) .flashMessage(false) + .feedbackEnabled(false) .deliveryReport(ReportType.NONE) .body("Hello, again!".getBytes()) .udh("udh".getBytes()) From 622885862518f0b31397218f9f96f7fa1db868ad Mon Sep 17 00:00:00 2001 From: Gustav Date: Fri, 28 Jan 2022 12:07:45 +0100 Subject: [PATCH 12/14] MSLRES-4816 Update ITs --- .../java/com/sinch/xms/ApiConnectionIT.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/test/java/com/sinch/xms/ApiConnectionIT.java b/src/test/java/com/sinch/xms/ApiConnectionIT.java index 91f0515..77c75c0 100644 --- a/src/test/java/com/sinch/xms/ApiConnectionIT.java +++ b/src/test/java/com/sinch/xms/ApiConnectionIT.java @@ -199,6 +199,7 @@ public void canCreateTextBatch() throws Exception { MtBatchTextSmsResult expected = MtBatchTextSmsResult.builder() .flashMessage(false) + .feedbackEnabled(false) .deliveryReport(ReportType.NONE) .sender(request.sender()) .recipients(request.recipients()) @@ -253,6 +254,7 @@ public void canCreateTextBatchWithSubstitutions() throws Exception { MtBatchTextSmsResult expected = MtBatchTextSmsResult.builder() .flashMessage(false) + .feedbackEnabled(false) .deliveryReport(ReportType.NONE) .sender(request.sender()) .recipients(request.recipients()) @@ -542,6 +544,7 @@ public void canReplaceBinaryBatch() throws Exception { .body(request.body()) .udh(request.udh()) .flashMessage(false) + .feedbackEnabled(false) .deliveryReport(ReportType.NONE) .canceled(false) .id(batchId) @@ -587,6 +590,7 @@ public void canReplaceTextBatch() throws Exception { MtBatchTextSmsResult expected = MtBatchTextSmsResult.builder() .flashMessage(false) + .feedbackEnabled(false) .deliveryReport(ReportType.NONE) .sender(request.sender()) .recipients(request.recipients()) @@ -635,6 +639,7 @@ public void canUpdateSimpleTextBatch() throws Exception { MtBatchTextSmsResult expected = MtBatchTextSmsResult.builder() .flashMessage(false) + .feedbackEnabled(false) .deliveryReport(ReportType.NONE) .sender(request.sender()) .addRecipient("123") @@ -690,6 +695,7 @@ public void canUpdateSimpleBinaryBatch() throws Exception { .body(request.body()) .udh((byte) 1, (byte) 0xff) .flashMessage(false) + .feedbackEnabled(false) .deliveryReport(ReportType.NONE) .canceled(false) .id(batchId) @@ -729,6 +735,7 @@ public void canFetchTextBatch() throws Exception { final MtBatchSmsResult expected = MtBatchTextSmsResult.builder() .flashMessage(false) + .feedbackEnabled(false) .deliveryReport(ReportType.NONE) .sender("12345") .addRecipient("123456789", "987654321") @@ -769,6 +776,7 @@ public void canFetchTextBatchAsync() throws Exception { final MtBatchSmsResult expected = MtBatchTextSmsResult.builder() .flashMessage(false) + .feedbackEnabled(false) .deliveryReport(ReportType.NONE) .sender("12345") .addRecipient("123456789", "987654321") @@ -822,6 +830,7 @@ public void canFetchBinaryBatch() throws Exception { .body((byte) 0xf0, (byte) 0x0f) .udh((byte) 0x50, (byte) 0x05) .flashMessage(false) + .feedbackEnabled(false) .deliveryReport(ReportType.NONE) .canceled(false) .id(batchId) @@ -1041,6 +1050,7 @@ public void canCancelBatch() throws Exception { MtBatchSmsResult expected = MtBatchTextSmsResult.builder() .flashMessage(false) + .feedbackEnabled(false) .deliveryReport(ReportType.NONE) .sender("12345") .addRecipient("123456789", "987654321") @@ -1083,6 +1093,7 @@ public void canCancelBatchConcurrently() throws Exception { MtBatchSmsResult expected1 = MtBatchTextSmsResult.builder() .flashMessage(false) + .feedbackEnabled(false) .deliveryReport(ReportType.NONE) .sender("12345") .addRecipient("123456789", "987654321") @@ -1113,6 +1124,7 @@ public void canCancelBatchConcurrently() throws Exception { .body("Hello, world!".getBytes()) .udh((byte) 1) .flashMessage(false) + .feedbackEnabled(false) .deliveryReport(ReportType.NONE) .canceled(true) .id(TestUtils.freshBatchId()) @@ -1281,6 +1293,7 @@ public void canIterateOverPages() throws Exception { .addContent( MtBatchTextSmsResult.builder() .flashMessage(false) + .feedbackEnabled(false) .deliveryReport(ReportType.NONE) .id(TestUtils.freshBatchId()) .body("body") @@ -1305,11 +1318,13 @@ public void canIterateOverPages() throws Exception { .udh((byte) 1) .canceled(false) .flashMessage(false) + .feedbackEnabled(false) .deliveryReport(ReportType.NONE) .build()) .addContent( MtBatchTextSmsResult.builder() .flashMessage(false) + .feedbackEnabled(false) .deliveryReport(ReportType.NONE) .id(TestUtils.freshBatchId()) .body("body") @@ -1364,6 +1379,7 @@ public void canIterateOverBatchesWithTwoPages() throws Exception { .addContent( MtBatchTextSmsResult.builder() .flashMessage(false) + .feedbackEnabled(false) .deliveryReport(ReportType.NONE) .id(TestUtils.freshBatchId()) .body("body") @@ -1388,11 +1404,13 @@ public void canIterateOverBatchesWithTwoPages() throws Exception { .udh((byte) 1) .canceled(false) .flashMessage(false) + .feedbackEnabled(false) .deliveryReport(ReportType.NONE) .build()) .addContent( MtBatchTextSmsResult.builder() .flashMessage(false) + .feedbackEnabled(false) .deliveryReport(ReportType.NONE) .id(TestUtils.freshBatchId()) .body("body") From 3ad88c3961134b82d19fcacd49ef27181c0101be Mon Sep 17 00:00:00 2001 From: Gustav Date: Fri, 28 Jan 2022 14:38:20 +0100 Subject: [PATCH 13/14] MSLRES-4816 Make feedback_enabled Nullable to match actual API behaviour --- src/main/java/com/sinch/xms/api/MtBatchSmsResult.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/sinch/xms/api/MtBatchSmsResult.java b/src/main/java/com/sinch/xms/api/MtBatchSmsResult.java index 06b3b91..9049b34 100644 --- a/src/main/java/com/sinch/xms/api/MtBatchSmsResult.java +++ b/src/main/java/com/sinch/xms/api/MtBatchSmsResult.java @@ -151,8 +151,9 @@ public abstract class MtBatchSmsResult { * * @return boolean indicating if feedback is enabled */ + @Nullable @JsonProperty("feedback_enabled") - public abstract boolean feedbackEnabled(); + public abstract Boolean feedbackEnabled(); /** * Message will be dispatched only if it is not split to more parts than Max Number of Message From 52e17b38c9ea4a0a1559c5dd05a9d9e1e54b9755 Mon Sep 17 00:00:00 2001 From: Gustav Date: Mon, 31 Jan 2022 09:45:20 +0100 Subject: [PATCH 14/14] MSLRES-4816 Temporarily upload snapshot --- .github/workflows/pr.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 33203b6..f118579 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -15,3 +15,8 @@ jobs: distribution: 'adopt' - name: Build with Maven run: mvn --batch-mode --update-snapshots verify -Dgpg.skip + - run: mkdir snapshots && cp target/*.jar snapshots + - uses: actions/upload-artifact@v2 + with: + name: Package + path: snapshots