From c939c59f3c8ce2a54a450f2238ebb063b3485666 Mon Sep 17 00:00:00 2001 From: Fabian Heuberger Date: Wed, 18 Oct 2023 17:00:45 +0200 Subject: [PATCH 01/58] added first draft of mock service --- .../singleRecipient/singleRecipient.xhtml | 6 +- .../threema/mocks/ThreemaServiceMock.java | 58 +++++++++++++++++++ .../test/process/GetReceiverInfoTest.java | 8 +++ 3 files changed, 69 insertions(+), 3 deletions(-) create mode 100644 threema-connector-test/src/ch/ivyteam/threema/mocks/ThreemaServiceMock.java diff --git a/threema-connector-demo/src_hd/threema/connector/demo/singleRecipient/singleRecipient.xhtml b/threema-connector-demo/src_hd/threema/connector/demo/singleRecipient/singleRecipient.xhtml index 00ce132..8c8a008 100644 --- a/threema-connector-demo/src_hd/threema/connector/demo/singleRecipient/singleRecipient.xhtml +++ b/threema-connector-demo/src_hd/threema/connector/demo/singleRecipient/singleRecipient.xhtml @@ -22,9 +22,9 @@ - - - + + + diff --git a/threema-connector-test/src/ch/ivyteam/threema/mocks/ThreemaServiceMock.java b/threema-connector-test/src/ch/ivyteam/threema/mocks/ThreemaServiceMock.java new file mode 100644 index 0000000..7cb9276 --- /dev/null +++ b/threema-connector-test/src/ch/ivyteam/threema/mocks/ThreemaServiceMock.java @@ -0,0 +1,58 @@ +package ch.ivyteam.threema.mocks; + +import javax.annotation.security.PermitAll; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.Response.ResponseBuilder; + +import ch.ivyteam.ivy.rest.client.config.IvyDefaultJaxRsTemplates; +import io.swagger.v3.oas.annotations.Hidden; + +@Path(ThreemaServiceMock.PATH_SUFFIX) +@PermitAll +@Hidden +@SuppressWarnings("all") +public class ThreemaServiceMock { + + static final String PATH_SUFFIX = "mock"; + + public static final String URI = "{"+IvyDefaultJaxRsTemplates.APP_URL+"}/api/"+PATH_SUFFIX; + + @GET + @Path("/lookup/{a:phone|email}") + @Produces(MediaType.TEXT_PLAIN) + public Response getThreemaIdByPhone(@QueryParam("id") String id) { + Response resp; + String threemaId = "ECHOECHO"; + + if(id.equals("validId")) { + resp = Response.ok().entity(threemaId).build(); + }else { + resp = Response.status(403).build(); + } + + return resp; + } + + + @GET + @Path("lookup/pubkeys") + @Produces(MediaType.TEXT_PLAIN) + public Response getPublicKey(@QueryParam("id") String id) { + Response resp; + String pubKey = ""; + + if(id.equals("validId")) { + resp = Response.ok().entity(pubKey).build(); + }else { + resp = Response.status(404).build(); + } + + return resp; + } + +} diff --git a/threema-connector-test/src_test/threema/connector/test/process/GetReceiverInfoTest.java b/threema-connector-test/src_test/threema/connector/test/process/GetReceiverInfoTest.java index 8338c01..11469a6 100644 --- a/threema-connector-test/src_test/threema/connector/test/process/GetReceiverInfoTest.java +++ b/threema-connector-test/src_test/threema/connector/test/process/GetReceiverInfoTest.java @@ -1,5 +1,6 @@ package threema.connector.test.process; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; @@ -10,6 +11,8 @@ import ch.ivyteam.ivy.bpm.engine.client.element.BpmElement; import ch.ivyteam.ivy.bpm.engine.client.element.BpmProcess; import ch.ivyteam.ivy.bpm.exec.client.IvyProcessTest; +import ch.ivyteam.ivy.environment.AppFixture; +import ch.ivyteam.threema.mocks.ThreemaServiceMock; import threema.connector.receiverData; import util.LookupType; @@ -19,6 +22,11 @@ public class GetReceiverInfoTest { private static final BpmProcess RECEIVER_INFO_PROCESS = BpmProcess.name("getReceiverInfo"); private static final String ECHO_PUBLIC_KEY = "4a6a1b34dcef15d43cb74de2fd36091be99fbbaf126d099d47d83d919712c72b"; + @BeforeEach + void setup(AppFixture fixture) { + fixture.config("RestClients.ThreemaGateway.Url", ThreemaServiceMock.URI); + } + @Test void getIDByInvalidEmail(BpmClient bpmClient) { BpmElement callable = RECEIVER_INFO_PROCESS.elementName("call(receiverData)"); From 358f536823849394ca06630c7b66a10a88a1be35 Mon Sep 17 00:00:00 2001 From: Fabian Heuberger Date: Thu, 19 Oct 2023 09:03:06 +0200 Subject: [PATCH 02/58] Fixed mock service --- .../src/ch/ivyteam/threema/mocks/ThreemaServiceMock.java | 5 +++-- .../connector/test/process/GetReceiverInfoTest.java | 7 +++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/threema-connector-test/src/ch/ivyteam/threema/mocks/ThreemaServiceMock.java b/threema-connector-test/src/ch/ivyteam/threema/mocks/ThreemaServiceMock.java index 7cb9276..00757b8 100644 --- a/threema-connector-test/src/ch/ivyteam/threema/mocks/ThreemaServiceMock.java +++ b/threema-connector-test/src/ch/ivyteam/threema/mocks/ThreemaServiceMock.java @@ -23,9 +23,10 @@ public class ThreemaServiceMock { public static final String URI = "{"+IvyDefaultJaxRsTemplates.APP_URL+"}/api/"+PATH_SUFFIX; @GET - @Path("/lookup/{a:phone|email}") + @Path("/lookup/email") @Produces(MediaType.TEXT_PLAIN) - public Response getThreemaIdByPhone(@QueryParam("id") String id) { + public Response getThreemaIdByPhone() { + String id = "validId"; Response resp; String threemaId = "ECHOECHO"; diff --git a/threema-connector-test/src_test/threema/connector/test/process/GetReceiverInfoTest.java b/threema-connector-test/src_test/threema/connector/test/process/GetReceiverInfoTest.java index 11469a6..2ef8b37 100644 --- a/threema-connector-test/src_test/threema/connector/test/process/GetReceiverInfoTest.java +++ b/threema-connector-test/src_test/threema/connector/test/process/GetReceiverInfoTest.java @@ -1,6 +1,7 @@ package threema.connector.test.process; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; @@ -16,7 +17,7 @@ import threema.connector.receiverData; import util.LookupType; -@IvyProcessTest +@IvyProcessTest(enableWebServer = true) public class GetReceiverInfoTest { private static final BpmProcess RECEIVER_INFO_PROCESS = BpmProcess.name("getReceiverInfo"); @@ -40,7 +41,7 @@ void getIDByInvalidEmail(BpmClient bpmClient) { receiverData resultDataMail = resultMail.data().last(); History historyMail = resultMail.history(); - assertThat(resultDataMail.getApiResponse()).isEqualTo("404"); + assertThat(resultDataMail.getApiResponse()).contains("404"); assertThat(historyMail.elementNames()).contains("call(receiverData)"); assertThat(historyMail.elementNames()).contains("LookupId"); assertThat(historyMail.elementNames()).doesNotContain("LookupPubKey"); @@ -48,6 +49,7 @@ void getIDByInvalidEmail(BpmClient bpmClient) { } @Test + @Disabled void getPublicKeyByID(BpmClient bpmClient) { BpmElement callable = RECEIVER_INFO_PROCESS.elementName("call(receiverData)"); @@ -69,6 +71,7 @@ void getPublicKeyByID(BpmClient bpmClient) { @Test + @Disabled void getPublicKeyByInvalidID(BpmClient bpmClient) { BpmElement callable = RECEIVER_INFO_PROCESS.elementName("call(receiverData)"); From 5141dee1ee1b27b8195473cae432d96a51c03a4b Mon Sep 17 00:00:00 2001 From: Fabian Heuberger Date: Thu, 19 Oct 2023 11:46:35 +0200 Subject: [PATCH 03/58] finished mocking for GetReveiverInfoTest --- .../threema/mocks/ThreemaServiceMock.java | 31 ++++++----- .../test/process/GetReceiverInfoTest.java | 53 ++++++++++++++++--- 2 files changed, 61 insertions(+), 23 deletions(-) diff --git a/threema-connector-test/src/ch/ivyteam/threema/mocks/ThreemaServiceMock.java b/threema-connector-test/src/ch/ivyteam/threema/mocks/ThreemaServiceMock.java index 00757b8..c645558 100644 --- a/threema-connector-test/src/ch/ivyteam/threema/mocks/ThreemaServiceMock.java +++ b/threema-connector-test/src/ch/ivyteam/threema/mocks/ThreemaServiceMock.java @@ -1,6 +1,7 @@ package ch.ivyteam.threema.mocks; import javax.annotation.security.PermitAll; +import javax.ws.rs.PathParam; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; @@ -9,6 +10,7 @@ import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.ResponseBuilder; +import ch.ivyteam.ivy.environment.Ivy; import ch.ivyteam.ivy.rest.client.config.IvyDefaultJaxRsTemplates; import io.swagger.v3.oas.annotations.Hidden; @@ -19,35 +21,33 @@ public class ThreemaServiceMock { static final String PATH_SUFFIX = "mock"; + private static final String THREEMA_ID = "ECHOECHO"; public static final String URI = "{"+IvyDefaultJaxRsTemplates.APP_URL+"}/api/"+PATH_SUFFIX; + // {ivy.app.baseurl}/api/mock + // https://msgapi.threema.ch @GET - @Path("/lookup/email") + @Path("/lookup/{type}/{id}") @Produces(MediaType.TEXT_PLAIN) - public Response getThreemaIdByPhone() { - String id = "validId"; + public Response getThreemaIdByMail(@PathParam("type") String type, @PathParam("id") String id) { Response resp; - String threemaId = "ECHOECHO"; - + Ivy.log().debug(id); if(id.equals("validId")) { - resp = Response.ok().entity(threemaId).build(); + resp = Response.ok().entity(THREEMA_ID).build(); }else { - resp = Response.status(403).build(); + resp = Response.status(404).build(); } - return resp; - } - + } @GET - @Path("lookup/pubkeys") + @Path("/pubkeys/{id}") @Produces(MediaType.TEXT_PLAIN) - public Response getPublicKey(@QueryParam("id") String id) { + public Response getPublicKey(@PathParam("id") String id) { Response resp; - String pubKey = ""; - - if(id.equals("validId")) { + String pubKey = "validPubkey"; + if(id.equals(THREEMA_ID)) { resp = Response.ok().entity(pubKey).build(); }else { resp = Response.status(404).build(); @@ -55,5 +55,4 @@ public Response getPublicKey(@QueryParam("id") String id) { return resp; } - } diff --git a/threema-connector-test/src_test/threema/connector/test/process/GetReceiverInfoTest.java b/threema-connector-test/src_test/threema/connector/test/process/GetReceiverInfoTest.java index 2ef8b37..381286e 100644 --- a/threema-connector-test/src_test/threema/connector/test/process/GetReceiverInfoTest.java +++ b/threema-connector-test/src_test/threema/connector/test/process/GetReceiverInfoTest.java @@ -21,13 +21,33 @@ public class GetReceiverInfoTest { private static final BpmProcess RECEIVER_INFO_PROCESS = BpmProcess.name("getReceiverInfo"); - private static final String ECHO_PUBLIC_KEY = "4a6a1b34dcef15d43cb74de2fd36091be99fbbaf126d099d47d83d919712c72b"; + private static final String VALID_ID = "validId"; @BeforeEach void setup(AppFixture fixture) { fixture.config("RestClients.ThreemaGateway.Url", ThreemaServiceMock.URI); } + @Test + void getIDByValidEmail(BpmClient bpmClient) { + BpmElement callable = RECEIVER_INFO_PROCESS.elementName("call(receiverData)"); + + String email = VALID_ID; + receiverData recDatMail = new receiverData(); + recDatMail.setIdentifier(email); + recDatMail.setType(LookupType.EMAIL); + + ExecutionResult resultMail = bpmClient.start().subProcess(callable).execute(recDatMail); + receiverData resultDataMail = resultMail.data().last(); + History historyMail = resultMail.history(); + + assertThat(resultDataMail.getApiResponse()).contains("200"); + assertThat(historyMail.elementNames()).contains("call(receiverData)"); + assertThat(historyMail.elementNames()).contains("LookupId"); + assertThat(historyMail.elementNames()).contains("LookupPubKey"); + + } + @Test void getIDByInvalidEmail(BpmClient bpmClient) { BpmElement callable = RECEIVER_INFO_PROCESS.elementName("call(receiverData)"); @@ -49,7 +69,26 @@ void getIDByInvalidEmail(BpmClient bpmClient) { } @Test - @Disabled + void getIDByValidPhone(BpmClient bpmClient) { + BpmElement callable = RECEIVER_INFO_PROCESS.elementName("call(receiverData)"); + + String phone = VALID_ID; + receiverData recDatMail = new receiverData(); + recDatMail.setIdentifier(phone); + recDatMail.setType(LookupType.PHONE); + + ExecutionResult resultMail = bpmClient.start().subProcess(callable).execute(recDatMail); + receiverData resultDataMail = resultMail.data().last(); + History historyMail = resultMail.history(); + + assertThat(resultDataMail.getApiResponse()).contains("200"); + assertThat(historyMail.elementNames()).contains("call(receiverData)"); + assertThat(historyMail.elementNames()).contains("LookupId"); + assertThat(historyMail.elementNames()).contains("LookupPubKey"); + + } + + @Test void getPublicKeyByID(BpmClient bpmClient) { BpmElement callable = RECEIVER_INFO_PROCESS.elementName("call(receiverData)"); @@ -62,8 +101,8 @@ void getPublicKeyByID(BpmClient bpmClient) { receiverData resultDataId = resultId.data().last(); History historyId = resultId.history(); - assertThat(resultDataId.getApiResponse()).isEqualTo("200"); - assertThat(resultDataId.getPublicKey()).isEqualTo(ECHO_PUBLIC_KEY); + assertThat(resultDataId.getApiResponse()).contains("200"); + assertThat(resultDataId.getPublicKey()).isEqualTo("validPubkey"); assertThat(historyId.elementNames()).contains("call(receiverData)"); assertThat(historyId.elementNames()).contains("LookupPubKey"); assertThat(historyId.elementNames()).doesNotContain("LookupId"); @@ -71,7 +110,6 @@ void getPublicKeyByID(BpmClient bpmClient) { @Test - @Disabled void getPublicKeyByInvalidID(BpmClient bpmClient) { BpmElement callable = RECEIVER_INFO_PROCESS.elementName("call(receiverData)"); @@ -83,8 +121,9 @@ void getPublicKeyByInvalidID(BpmClient bpmClient) { ExecutionResult resultId = bpmClient.start().subProcess(callable).execute(recDatId); receiverData resultDataId = resultId.data().last(); History historyId = resultId.history(); - - assertThat(resultDataId.getApiResponse()).isEqualTo("404"); + + + assertThat(resultDataId.getApiResponse()).contains("404"); assertThat(historyId.elementNames()).contains("call(receiverData)"); assertThat(historyId.elementNames()).contains("LookupPubKey"); assertThat(historyId.elementNames()).doesNotContain("LookupId"); From 0c9ee0678c8691d6b241ab0fd7a72a8a87e88022 Mon Sep 17 00:00:00 2001 From: Fabian Heuberger Date: Thu, 19 Oct 2023 11:49:53 +0200 Subject: [PATCH 04/58] changed returned public key to be valid 64bit key --- .../src/ch/ivyteam/threema/mocks/ThreemaServiceMock.java | 2 +- .../threema/connector/test/process/GetReceiverInfoTest.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/threema-connector-test/src/ch/ivyteam/threema/mocks/ThreemaServiceMock.java b/threema-connector-test/src/ch/ivyteam/threema/mocks/ThreemaServiceMock.java index c645558..e16dfe2 100644 --- a/threema-connector-test/src/ch/ivyteam/threema/mocks/ThreemaServiceMock.java +++ b/threema-connector-test/src/ch/ivyteam/threema/mocks/ThreemaServiceMock.java @@ -46,7 +46,7 @@ public Response getThreemaIdByMail(@PathParam("type") String type, @PathParam("i @Produces(MediaType.TEXT_PLAIN) public Response getPublicKey(@PathParam("id") String id) { Response resp; - String pubKey = "validPubkey"; + String pubKey = "ffbb40cfced42f75c4d83c7d35300c0698bf3ef1ab49ace323a1bbc38ee23f36"; if(id.equals(THREEMA_ID)) { resp = Response.ok().entity(pubKey).build(); }else { diff --git a/threema-connector-test/src_test/threema/connector/test/process/GetReceiverInfoTest.java b/threema-connector-test/src_test/threema/connector/test/process/GetReceiverInfoTest.java index 381286e..db318db 100644 --- a/threema-connector-test/src_test/threema/connector/test/process/GetReceiverInfoTest.java +++ b/threema-connector-test/src_test/threema/connector/test/process/GetReceiverInfoTest.java @@ -102,7 +102,7 @@ void getPublicKeyByID(BpmClient bpmClient) { History historyId = resultId.history(); assertThat(resultDataId.getApiResponse()).contains("200"); - assertThat(resultDataId.getPublicKey()).isEqualTo("validPubkey"); + assertThat(resultDataId.getPublicKey()).isEqualTo("ffbb40cfced42f75c4d83c7d35300c0698bf3ef1ab49ace323a1bbc38ee23f36"); assertThat(historyId.elementNames()).contains("call(receiverData)"); assertThat(historyId.elementNames()).contains("LookupPubKey"); assertThat(historyId.elementNames()).doesNotContain("LookupId"); From 2c7ac39612c1360d37724d49aac1d7d15c538c85 Mon Sep 17 00:00:00 2001 From: Fabian Heuberger Date: Thu, 19 Oct 2023 13:43:55 +0200 Subject: [PATCH 05/58] finished api mocking and changed tests to fit mock api --- .../threema/mocks/ThreemaServiceMock.java | 28 ++++++++++++++++-- .../test/process/GetReceiverInfoTest.java | 2 +- .../test/process/MultipleRecipientsTest.java | 10 ++++++- .../test/process/SendMessageTest.java | 29 ++++++++++++++----- .../test/process/SingleRecipientTest.java | 21 +++++++++++--- 5 files changed, 74 insertions(+), 16 deletions(-) diff --git a/threema-connector-test/src/ch/ivyteam/threema/mocks/ThreemaServiceMock.java b/threema-connector-test/src/ch/ivyteam/threema/mocks/ThreemaServiceMock.java index e16dfe2..1bd300f 100644 --- a/threema-connector-test/src/ch/ivyteam/threema/mocks/ThreemaServiceMock.java +++ b/threema-connector-test/src/ch/ivyteam/threema/mocks/ThreemaServiceMock.java @@ -2,7 +2,10 @@ import javax.annotation.security.PermitAll; import javax.ws.rs.PathParam; +import javax.ws.rs.Consumes; +import javax.ws.rs.FormParam; import javax.ws.rs.GET; +import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; @@ -21,7 +24,7 @@ public class ThreemaServiceMock { static final String PATH_SUFFIX = "mock"; - private static final String THREEMA_ID = "ECHOECHO"; + private static final String THREEMA_ID = "validId"; public static final String URI = "{"+IvyDefaultJaxRsTemplates.APP_URL+"}/api/"+PATH_SUFFIX; // {ivy.app.baseurl}/api/mock @@ -32,7 +35,6 @@ public class ThreemaServiceMock { @Produces(MediaType.TEXT_PLAIN) public Response getThreemaIdByMail(@PathParam("type") String type, @PathParam("id") String id) { Response resp; - Ivy.log().debug(id); if(id.equals("validId")) { resp = Response.ok().entity(THREEMA_ID).build(); }else { @@ -55,4 +57,26 @@ public Response getPublicKey(@PathParam("id") String id) { return resp; } + + @POST + @Consumes(MediaType.APPLICATION_FORM_URLENCODED) + @Path("/send_e2e") + @Produces(MediaType.TEXT_PLAIN) + public Response sendMessage( + @FormParam("from") String from, + @FormParam("box") String box, + @FormParam("to") String to, + @FormParam("secret") String secret, + @FormParam("nonce") String nonce + ) { + String msgId = "b2885aa81e9b9c93"; + Response resp; + if(to.equals("validId")) { + resp = Response.ok().entity(msgId).build(); + }else { + resp = Response.status(404).build(); + } + + return resp; + } } diff --git a/threema-connector-test/src_test/threema/connector/test/process/GetReceiverInfoTest.java b/threema-connector-test/src_test/threema/connector/test/process/GetReceiverInfoTest.java index db318db..66a971c 100644 --- a/threema-connector-test/src_test/threema/connector/test/process/GetReceiverInfoTest.java +++ b/threema-connector-test/src_test/threema/connector/test/process/GetReceiverInfoTest.java @@ -92,7 +92,7 @@ void getIDByValidPhone(BpmClient bpmClient) { void getPublicKeyByID(BpmClient bpmClient) { BpmElement callable = RECEIVER_INFO_PROCESS.elementName("call(receiverData)"); - String threemaId = "ECHOECHO"; + String threemaId = "validId"; receiverData recDatId = new receiverData(); recDatId.setIdentifier(threemaId); recDatId.setType(LookupType.THREEMAID); diff --git a/threema-connector-test/src_test/threema/connector/test/process/MultipleRecipientsTest.java b/threema-connector-test/src_test/threema/connector/test/process/MultipleRecipientsTest.java index d1b2558..60e8613 100644 --- a/threema-connector-test/src_test/threema/connector/test/process/MultipleRecipientsTest.java +++ b/threema-connector-test/src_test/threema/connector/test/process/MultipleRecipientsTest.java @@ -2,6 +2,7 @@ import static org.assertj.core.api.Assertions.assertThat; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import ch.ivyteam.ivy.bpm.engine.client.BpmClient; @@ -9,17 +10,24 @@ import ch.ivyteam.ivy.bpm.engine.client.element.BpmElement; import ch.ivyteam.ivy.bpm.engine.client.element.BpmProcess; import ch.ivyteam.ivy.bpm.exec.client.IvyProcessTest; +import ch.ivyteam.ivy.environment.AppFixture; import ch.ivyteam.ivy.scripting.objects.List; +import ch.ivyteam.threema.mocks.ThreemaServiceMock; import threema.connector.receiverData; import threema.connector.sendThreemaMessageData; import util.LookupType; -@IvyProcessTest +@IvyProcessTest(enableWebServer = true) public class MultipleRecipientsTest { private final static BpmProcess MULTIPLE_RECIPIENTS_PROCESS = BpmProcess.name("multipleRecipients"); private final static String MESSAGE = "Hello World"; + @BeforeEach + void setup(AppFixture fixture) { + fixture.config("RestClients.ThreemaGateway.Url", ThreemaServiceMock.URI); + } + @Test void prepareMultipleRecipients(BpmClient bpmClient) { diff --git a/threema-connector-test/src_test/threema/connector/test/process/SendMessageTest.java b/threema-connector-test/src_test/threema/connector/test/process/SendMessageTest.java index 62584f5..c4b49ca 100644 --- a/threema-connector-test/src_test/threema/connector/test/process/SendMessageTest.java +++ b/threema-connector-test/src_test/threema/connector/test/process/SendMessageTest.java @@ -5,27 +5,32 @@ import javax.xml.bind.DatatypeConverter; import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import ch.ivyteam.ivy.bpm.engine.client.BpmClient; import ch.ivyteam.ivy.bpm.engine.client.ExecutionResult; import ch.ivyteam.ivy.bpm.engine.client.element.BpmElement; import ch.ivyteam.ivy.bpm.engine.client.element.BpmProcess; +import ch.ivyteam.ivy.bpm.engine.client.sub.SubRequestBuilder; import ch.ivyteam.ivy.bpm.exec.client.IvyProcessTest; import ch.threema.apitool.CryptTool; import ch.threema.apitool.results.EncryptResult; import threema.connector.receiverData; +import ch.ivyteam.ivy.environment.AppFixture; import ch.ivyteam.ivy.environment.Ivy; +import ch.ivyteam.threema.mocks.ThreemaServiceMock; -@IvyProcessTest +@IvyProcessTest(enableWebServer = true) public class SendMessageTest { private static final BpmProcess SEND_MESSAGE_PROCESS = BpmProcess.name("sendMessage"); private static final String ECHO_PUBLIC_KEY = "4a6a1b34dcef15d43cb74de2fd36091be99fbbaf126d099d47d83d919712c72b"; + private static final String PRIVATE_KEY = "ff364c727068fd6e3e6a711918393fa37649d902402a8eb31af108e79f625d82"; private static final String INVALID_PUBLIC_KEY = "0000004dcef15d43cb74de2fd36091be99fbbaf126d099d47d83d919712c72b"; - private static final String ECHO_ID = "ECHOECHO"; - private static final String INVALID_ID = "INVALIDID"; + private static final String VALID_ID = "validId"; + private static final String INVALID_ID = "invalidId"; private static final String message = "Hello World"; private static String encryptedMessage; private static String nonce; @@ -33,18 +38,26 @@ public class SendMessageTest { @BeforeAll static void encryptMessage() { - byte[] privKey = DatatypeConverter.parseHexBinary(Ivy.var().get("connector.privatekey")); - EncryptResult encryptResult = CryptTool.encryptTextMessage(message, privKey, DatatypeConverter.parseHexBinary(ECHO_PUBLIC_KEY)); + EncryptResult encryptResult = CryptTool.encryptTextMessage( + message, + DatatypeConverter.parseHexBinary(PRIVATE_KEY), + DatatypeConverter.parseHexBinary(ECHO_PUBLIC_KEY) + ); encryptedMessage = DatatypeConverter.printHexBinary(encryptResult.getResult()); nonce = DatatypeConverter.printHexBinary(encryptResult.getNonce()); } + @BeforeEach + void setup(AppFixture fixture) { + fixture.config("RestClients.ThreemaGateway.Url", ThreemaServiceMock.URI); + } + @Test void sendValidMessage(BpmClient bpmClient) { BpmElement callable = SEND_MESSAGE_PROCESS.elementName("call(receiverData)"); receiverData recDat = new receiverData(); - recDat.setThreemaId(ECHO_ID); + recDat.setThreemaId(VALID_ID); recDat.setPublicKey(ECHO_PUBLIC_KEY); recDat.setEncryptedMessage(encryptedMessage); recDat.setNonce(nonce); @@ -53,7 +66,7 @@ void sendValidMessage(BpmClient bpmClient) { ExecutionResult result = bpmClient.start().subProcess(callable).execute(recDat); receiverData resultData = result.data().last(); - assertThat(resultData.getApiResponse()).isEqualTo("Sent successfully (200)"); + assertThat(resultData.getApiResponse()).contains("200"); } @Test @@ -70,7 +83,7 @@ void sendInvalidMessage(BpmClient bpmClient) { ExecutionResult result = bpmClient.start().subProcess(callable).execute(recDat); receiverData resultData = result.data().last(); - assertThat(resultData.getApiResponse()).contains("Error"); + assertThat(resultData.getApiResponse()).contains("404"); } diff --git a/threema-connector-test/src_test/threema/connector/test/process/SingleRecipientTest.java b/threema-connector-test/src_test/threema/connector/test/process/SingleRecipientTest.java index 2995aef..537c565 100644 --- a/threema-connector-test/src_test/threema/connector/test/process/SingleRecipientTest.java +++ b/threema-connector-test/src_test/threema/connector/test/process/SingleRecipientTest.java @@ -4,6 +4,7 @@ import static org.assertj.core.api.Assertions.assertThat; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import ch.ivyteam.ivy.bpm.engine.client.BpmClient; @@ -11,16 +12,28 @@ import ch.ivyteam.ivy.bpm.engine.client.element.BpmElement; import ch.ivyteam.ivy.bpm.engine.client.element.BpmProcess; import ch.ivyteam.ivy.bpm.exec.client.IvyProcessTest; +import ch.ivyteam.ivy.environment.AppFixture; +import ch.ivyteam.ivy.environment.Ivy; +import ch.ivyteam.threema.mocks.ThreemaServiceMock; import threema.connector.receiverData; -@IvyProcessTest +@IvyProcessTest(enableWebServer = true) public class SingleRecipientTest { private static final BpmProcess SINGLE_RECEIVER_PROCESS = BpmProcess.name("singleRecipient"); - private static final String VALID_ID = "ECHOECHO"; + private static final String VALID_ID = "validId"; private static final String INVALID_EMAIL = "invalid@mail.ch"; private static final String INVALID_PHONE = "41000000000"; private static final String MESSAGE = "Hello World"; + private static final String PRIVATE_KEY = "ff364c727068fd6e3e6a711918393fa37649d902402a8eb31af108e79f625d82"; + + @BeforeEach + void setup(AppFixture fixture) { + Ivy.var().set("connector.privateKey", PRIVATE_KEY); + Ivy.var().set("connector.secret", "secret"); + Ivy.var().set("connector.threemaId", "threemaId"); + fixture.config("RestClients.ThreemaGateway.Url", ThreemaServiceMock.URI); + } @Test void sendMessageToValidSingleRecipientById(BpmClient bpmClient) { @@ -39,7 +52,7 @@ void sendMessageToInvalidSingleRecipientByEmail(BpmClient bpmClient) { receiverData resultData = result.data().last(); String apiStatus = resultData.getApiResponse(); - assertThat(apiStatus).contains("404"); + assertThat(apiStatus).isEqualTo("ID-Lookup: 404"); } @Test @@ -49,7 +62,7 @@ void sendMessageToInvalidSingleRecipientByPhone(BpmClient bpmClient) { receiverData resultData = result.data().last(); String apiStatus = resultData.getApiResponse(); - assertThat(apiStatus).contains("404"); + assertThat(apiStatus).isEqualTo("ID-Lookup: 404"); } } From 041be51295c2fb9791a31197819304e7201ae621 Mon Sep 17 00:00:00 2001 From: Fabian Heuberger Date: Thu, 19 Oct 2023 13:48:30 +0200 Subject: [PATCH 06/58] fixed testcases --- threema-connector/config/rest-clients.yaml | 2 +- threema-connector/processes/util/getReceiverInfo.p.json | 2 +- threema-connector/processes/util/sendMessage.p.json | 4 ++++ threema-connector/src/util/LookupType.java | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/threema-connector/config/rest-clients.yaml b/threema-connector/config/rest-clients.yaml index c842ecc..52b6940 100644 --- a/threema-connector/config/rest-clients.yaml +++ b/threema-connector/config/rest-clients.yaml @@ -1,6 +1,6 @@ RestClients: ThreemaGateway: UUID: af315689-b538-4142-a823-0632d66754d7 - Url: https://msgapi.threema.ch/ + Url: https://msgapi.threema.ch Features: - ch.ivyteam.ivy.rest.client.mapper.JsonFeature diff --git a/threema-connector/processes/util/getReceiverInfo.p.json b/threema-connector/processes/util/getReceiverInfo.p.json index f8b5e41..deca549 100644 --- a/threema-connector/processes/util/getReceiverInfo.p.json +++ b/threema-connector/processes/util/getReceiverInfo.p.json @@ -65,7 +65,7 @@ "resultType" : "java.lang.String" }, "visual" : { - "at" : { "x" : 320, "y" : 64 }, + "at" : { "x" : 328, "y" : 64 }, "icon" : "res:/webContent/icons/threema-icon_black.png" }, "connect" : { "id" : "f8", "to" : "f4" } diff --git a/threema-connector/processes/util/sendMessage.p.json b/threema-connector/processes/util/sendMessage.p.json index 843a248..40151fb 100644 --- a/threema-connector/processes/util/sendMessage.p.json +++ b/threema-connector/processes/util/sendMessage.p.json @@ -52,6 +52,10 @@ "secret" : "ivy.var.connector_secret" }, "path" : "send_e2e", + "headers" : { + "Accept" : "*/*", + "X-Requested-By" : "\"ivy\"" + }, "clientId" : "af315689-b538-4142-a823-0632d66754d7", "clientErrorCode" : "ivy:error:rest:client", "method" : "POST", diff --git a/threema-connector/src/util/LookupType.java b/threema-connector/src/util/LookupType.java index 4267ec9..4f8cfdb 100644 --- a/threema-connector/src/util/LookupType.java +++ b/threema-connector/src/util/LookupType.java @@ -13,7 +13,7 @@ public String toString() { } public static LookupType getByString(String id) { - return switch(id) { + return switch(id.toLowerCase()) { case "phone" -> LookupType.PHONE; case "email" -> LookupType.EMAIL; case "threemaid" -> LookupType.THREEMAID; From 5354afce8f6ce4e019e3cdcfc55f051a3bc92ffb Mon Sep 17 00:00:00 2001 From: Fabian Heuberger Date: Thu, 19 Oct 2023 13:49:19 +0200 Subject: [PATCH 07/58] added templates to .gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index d66b510..26bc82b 100644 --- a/.gitignore +++ b/.gitignore @@ -20,5 +20,7 @@ src_wsproc/ # local config **/resources/ threema-connector/config/variables.yaml +threema-connector/config/variables.yaml_template +threema-connector/config/variables.yaml_complete **/threema-connector-webtest/** From 903780d548a8a303e433a8a722b25b01b8f5cf3a Mon Sep 17 00:00:00 2001 From: Fabian Heuberger Date: Thu, 19 Oct 2023 13:52:20 +0200 Subject: [PATCH 08/58] moved process to the right --- threema-connector/processes/util/getReceiverInfo.p.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/threema-connector/processes/util/getReceiverInfo.p.json b/threema-connector/processes/util/getReceiverInfo.p.json index deca549..e9e478a 100644 --- a/threema-connector/processes/util/getReceiverInfo.p.json +++ b/threema-connector/processes/util/getReceiverInfo.p.json @@ -65,7 +65,7 @@ "resultType" : "java.lang.String" }, "visual" : { - "at" : { "x" : 328, "y" : 64 }, + "at" : { "x" : 336, "y" : 64 }, "icon" : "res:/webContent/icons/threema-icon_black.png" }, "connect" : { "id" : "f8", "to" : "f4" } From a68f54a35f85aa04485c56726dc45308753e72df Mon Sep 17 00:00:00 2001 From: Fabian Heuberger Date: Thu, 19 Oct 2023 15:30:50 +0200 Subject: [PATCH 09/58] added support for international phone pattern --- .../threema/connector/test/util/LookupTypeTest.java | 12 ++++++++++-- threema-connector/processes/singleRecipient.p.json | 11 ++++++++++- threema-connector/src/util/LookupType.java | 3 ++- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/threema-connector-test/src_test/threema/connector/test/util/LookupTypeTest.java b/threema-connector-test/src_test/threema/connector/test/util/LookupTypeTest.java index 391a21e..95ebf13 100644 --- a/threema-connector-test/src_test/threema/connector/test/util/LookupTypeTest.java +++ b/threema-connector-test/src_test/threema/connector/test/util/LookupTypeTest.java @@ -34,13 +34,21 @@ void getTypeByString() { @Test void getTypebyPattern() { String email = "xyz@xyz.yz"; - String phone = "00000000000"; + String phoneSimple = "00000000000"; + String phoneComplete = "+00000000000"; + String phoneCompleteSpace = "+00 00 000 00 00"; String threemaId = "didegiasdfl"; LookupType typeEmail = LookupType.getByPattern(email); assertThat(typeEmail).isEqualTo(LookupType.EMAIL); - LookupType typePhone = LookupType.getByPattern(phone); + LookupType typePhone = LookupType.getByPattern(phoneSimple); + assertThat(typePhone).isEqualTo(LookupType.PHONE); + + typePhone = LookupType.getByPattern(phoneComplete); + assertThat(typePhone).isEqualTo(LookupType.PHONE); + + typePhone = LookupType.getByPattern(phoneCompleteSpace); assertThat(typePhone).isEqualTo(LookupType.PHONE); LookupType typeThreemaId = LookupType.getByPattern(threemaId); diff --git a/threema-connector/processes/singleRecipient.p.json b/threema-connector/processes/singleRecipient.p.json index 4468de7..4cf5b74 100644 --- a/threema-connector/processes/singleRecipient.p.json +++ b/threema-connector/processes/singleRecipient.p.json @@ -21,7 +21,16 @@ "out.identifier" : "param.receiverID", "out.plainMessage" : "param.plainMsg", "out.type" : "param.lookupType" - } + }, + "code" : [ + "import util.LookupType;", + "", + "if(param.lookupType == LookupType.PHONE){", + " out.identifier = param.receiverID.replaceAll(\" \",\"\").replaceAll(\"\\\\+\", \"\");", + "}else{", + " out.identifier = param.receiverID;", + "}" + ] }, "result" : { "params" : [ diff --git a/threema-connector/src/util/LookupType.java b/threema-connector/src/util/LookupType.java index 4f8cfdb..698c90d 100644 --- a/threema-connector/src/util/LookupType.java +++ b/threema-connector/src/util/LookupType.java @@ -23,9 +23,10 @@ public static LookupType getByString(String id) { public static LookupType getByPattern(String id) { LookupType type = LookupType.INVALID; + id = id.replaceAll(" ", ""); if(id.lastIndexOf('@') < id.lastIndexOf('.')){ type = LookupType.EMAIL; - }else if(id.matches("\\d{11}")) { + }else if(id.matches("\\+?\\d{11}")) { type = LookupType.PHONE; }else { type = LookupType.THREEMAID; From b604bfd337c511d1e6742e24e4a09c66ffa49b80 Mon Sep 17 00:00:00 2001 From: Fabian Heuberger Date: Thu, 19 Oct 2023 15:32:21 +0200 Subject: [PATCH 10/58] initial webtest commit --- .gitignore | 1 - threema-connector-webtest/.classpath | 40 +++++++++++++++ threema-connector-webtest/.gitignore | 19 +++++++ threema-connector-webtest/.project | 49 +++++++++++++++++++ .../.settings/.jsdtscope | 12 +++++ .../.settings/ch.ivyteam.ivy.designer.prefs | 5 ++ .../.settings/org.eclipse.jdt.core.prefs | 10 ++++ .../org.eclipse.wst.common.component | 11 +++++ ...se.wst.common.project.facet.core.prefs.xml | 7 +++ ....eclipse.wst.common.project.facet.core.xml | 8 +++ .../.settings/org.eclipse.wst.css.core.prefs | 2 + ...rg.eclipse.wst.jsdt.ui.superType.container | 1 + .../org.eclipse.wst.jsdt.ui.superType.name | 1 + .../config/custom-fields.yaml | 20 ++++++++ .../config/databases.yaml | 1 + .../config/overrides.any | 1 + .../config/persistence.xml | 2 + .../config/rest-clients.yaml | 1 + threema-connector-webtest/config/roles.xml | 4 ++ threema-connector-webtest/config/users.xml | 2 + .../config/variables.yaml | 9 ++++ .../config/webservice-clients.yaml | 1 + .../threema/connector/webtest/Data.ivyClass | 2 + threema-connector-webtest/pom.xml | 34 +++++++++++++ .../MessageMultipleRecipientsTest.java | 40 +++++++++++++++ .../webtest/MessageSingleRecipientTest.java | 44 +++++++++++++++++ 26 files changed, 326 insertions(+), 1 deletion(-) create mode 100644 threema-connector-webtest/.classpath create mode 100644 threema-connector-webtest/.gitignore create mode 100644 threema-connector-webtest/.project create mode 100644 threema-connector-webtest/.settings/.jsdtscope create mode 100644 threema-connector-webtest/.settings/ch.ivyteam.ivy.designer.prefs create mode 100644 threema-connector-webtest/.settings/org.eclipse.jdt.core.prefs create mode 100644 threema-connector-webtest/.settings/org.eclipse.wst.common.component create mode 100644 threema-connector-webtest/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml create mode 100644 threema-connector-webtest/.settings/org.eclipse.wst.common.project.facet.core.xml create mode 100644 threema-connector-webtest/.settings/org.eclipse.wst.css.core.prefs create mode 100644 threema-connector-webtest/.settings/org.eclipse.wst.jsdt.ui.superType.container create mode 100644 threema-connector-webtest/.settings/org.eclipse.wst.jsdt.ui.superType.name create mode 100644 threema-connector-webtest/config/custom-fields.yaml create mode 100644 threema-connector-webtest/config/databases.yaml create mode 100644 threema-connector-webtest/config/overrides.any create mode 100644 threema-connector-webtest/config/persistence.xml create mode 100644 threema-connector-webtest/config/rest-clients.yaml create mode 100644 threema-connector-webtest/config/roles.xml create mode 100644 threema-connector-webtest/config/users.xml create mode 100644 threema-connector-webtest/config/variables.yaml create mode 100644 threema-connector-webtest/config/webservice-clients.yaml create mode 100644 threema-connector-webtest/dataclasses/threema/connector/webtest/Data.ivyClass create mode 100644 threema-connector-webtest/pom.xml create mode 100644 threema-connector-webtest/src_test/threema/connector/webtest/MessageMultipleRecipientsTest.java create mode 100644 threema-connector-webtest/src_test/threema/connector/webtest/MessageSingleRecipientTest.java diff --git a/.gitignore b/.gitignore index 26bc82b..851ab69 100644 --- a/.gitignore +++ b/.gitignore @@ -23,4 +23,3 @@ threema-connector/config/variables.yaml threema-connector/config/variables.yaml_template threema-connector/config/variables.yaml_complete -**/threema-connector-webtest/** diff --git a/threema-connector-webtest/.classpath b/threema-connector-webtest/.classpath new file mode 100644 index 0000000..e938886 --- /dev/null +++ b/threema-connector-webtest/.classpath @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/threema-connector-webtest/.gitignore b/threema-connector-webtest/.gitignore new file mode 100644 index 0000000..1b2547b --- /dev/null +++ b/threema-connector-webtest/.gitignore @@ -0,0 +1,19 @@ +# general +Thumbs.db +.DS_Store +*~ +*.log + +# java +*.class +hs_err_pid* + +# maven +target/ +lib/mvn-deps/ + +# ivy +classes/ +src_dataClasses/ +src_wsproc/ +logs/ diff --git a/threema-connector-webtest/.project b/threema-connector-webtest/.project new file mode 100644 index 0000000..a0bb838 --- /dev/null +++ b/threema-connector-webtest/.project @@ -0,0 +1,49 @@ + + + threema-connector-webtest + + + + + + ch.ivyteam.ivy.designer.dataClasses.ui.ivyDataClassBuilder + + + + + ch.ivyteam.ivy.designer.process.ui.ivyWebServiceProcessClassBuilder + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + ch.ivyteam.ivy.designer.ide.ivyModelValidationBuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + ch.ivyteam.ivy.project.IvyProjectNature + org.eclipse.wst.common.modulecore.ModuleCoreNature + org.eclipse.jem.workbench.JavaEMFNature + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + org.eclipse.jem.beaninfo.BeanInfoNature + org.eclipse.wst.common.project.facet.core.nature + org.eclipse.wst.jsdt.core.jsNature + + diff --git a/threema-connector-webtest/.settings/.jsdtscope b/threema-connector-webtest/.settings/.jsdtscope new file mode 100644 index 0000000..869c01d --- /dev/null +++ b/threema-connector-webtest/.settings/.jsdtscope @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/threema-connector-webtest/.settings/ch.ivyteam.ivy.designer.prefs b/threema-connector-webtest/.settings/ch.ivyteam.ivy.designer.prefs new file mode 100644 index 0000000..822cc6b --- /dev/null +++ b/threema-connector-webtest/.settings/ch.ivyteam.ivy.designer.prefs @@ -0,0 +1,5 @@ +ch.ivyteam.ivy.designer.preferences.DataClassPreferencePage\:DEFAULT_DATA_CLASS=threema.connector.webtest.Data +ch.ivyteam.ivy.designer.preferences.DataClassPreferencePage\:DEFAULT_NAMESPACE=threema.connector.webtest +ch.ivyteam.ivy.project.preferences\:PRIMEFACES_VERSION=11 +ch.ivyteam.ivy.project.preferences\:PROJECT_VERSION=100000 +eclipse.preferences.version=1 diff --git a/threema-connector-webtest/.settings/org.eclipse.jdt.core.prefs b/threema-connector-webtest/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..d4540a5 --- /dev/null +++ b/threema-connector-webtest/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,10 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=17 +org.eclipse.jdt.core.compiler.compliance=17 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=17 diff --git a/threema-connector-webtest/.settings/org.eclipse.wst.common.component b/threema-connector-webtest/.settings/org.eclipse.wst.common.component new file mode 100644 index 0000000..0df1516 --- /dev/null +++ b/threema-connector-webtest/.settings/org.eclipse.wst.common.component @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/threema-connector-webtest/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml b/threema-connector-webtest/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml new file mode 100644 index 0000000..9b4b9fc --- /dev/null +++ b/threema-connector-webtest/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/threema-connector-webtest/.settings/org.eclipse.wst.common.project.facet.core.xml b/threema-connector-webtest/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 0000000..156ecdb --- /dev/null +++ b/threema-connector-webtest/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/threema-connector-webtest/.settings/org.eclipse.wst.css.core.prefs b/threema-connector-webtest/.settings/org.eclipse.wst.css.core.prefs new file mode 100644 index 0000000..5ddc6bd --- /dev/null +++ b/threema-connector-webtest/.settings/org.eclipse.wst.css.core.prefs @@ -0,0 +1,2 @@ +css-profile/=org.eclipse.wst.css.core.cssprofile.css3 +eclipse.preferences.version=1 diff --git a/threema-connector-webtest/.settings/org.eclipse.wst.jsdt.ui.superType.container b/threema-connector-webtest/.settings/org.eclipse.wst.jsdt.ui.superType.container new file mode 100644 index 0000000..3bd5d0a --- /dev/null +++ b/threema-connector-webtest/.settings/org.eclipse.wst.jsdt.ui.superType.container @@ -0,0 +1 @@ +org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/threema-connector-webtest/.settings/org.eclipse.wst.jsdt.ui.superType.name b/threema-connector-webtest/.settings/org.eclipse.wst.jsdt.ui.superType.name new file mode 100644 index 0000000..05bd71b --- /dev/null +++ b/threema-connector-webtest/.settings/org.eclipse.wst.jsdt.ui.superType.name @@ -0,0 +1 @@ +Window \ No newline at end of file diff --git a/threema-connector-webtest/config/custom-fields.yaml b/threema-connector-webtest/config/custom-fields.yaml new file mode 100644 index 0000000..aa19ae0 --- /dev/null +++ b/threema-connector-webtest/config/custom-fields.yaml @@ -0,0 +1,20 @@ +# == Custom Fields Information == +# +# You can define here your project custom fields. +# Have a look at our documentation for more information. +# +CustomFields: +# Tasks: +# MyTaskCustomField: +# Label: My task custom field +# Description: This new task custom field can be used to ... +# Type: STRING +# Cases: +# MyCaseCustomField: +# Label: My case custom field +# Description: This new case custom field can be used to ... +# Type: STRING +# Starts: +# MyStartCustomField: +# Label: My start custom field +# Description: This new start custom field can be used to ... diff --git a/threema-connector-webtest/config/databases.yaml b/threema-connector-webtest/config/databases.yaml new file mode 100644 index 0000000..247b128 --- /dev/null +++ b/threema-connector-webtest/config/databases.yaml @@ -0,0 +1 @@ +Databases: diff --git a/threema-connector-webtest/config/overrides.any b/threema-connector-webtest/config/overrides.any new file mode 100644 index 0000000..f59ec20 --- /dev/null +++ b/threema-connector-webtest/config/overrides.any @@ -0,0 +1 @@ +* \ No newline at end of file diff --git a/threema-connector-webtest/config/persistence.xml b/threema-connector-webtest/config/persistence.xml new file mode 100644 index 0000000..d6b96d7 --- /dev/null +++ b/threema-connector-webtest/config/persistence.xml @@ -0,0 +1,2 @@ + + diff --git a/threema-connector-webtest/config/rest-clients.yaml b/threema-connector-webtest/config/rest-clients.yaml new file mode 100644 index 0000000..8e85296 --- /dev/null +++ b/threema-connector-webtest/config/rest-clients.yaml @@ -0,0 +1 @@ +RestClients: diff --git a/threema-connector-webtest/config/roles.xml b/threema-connector-webtest/config/roles.xml new file mode 100644 index 0000000..59892fe --- /dev/null +++ b/threema-connector-webtest/config/roles.xml @@ -0,0 +1,4 @@ + + + Everybody + diff --git a/threema-connector-webtest/config/users.xml b/threema-connector-webtest/config/users.xml new file mode 100644 index 0000000..51a6906 --- /dev/null +++ b/threema-connector-webtest/config/users.xml @@ -0,0 +1,2 @@ + + diff --git a/threema-connector-webtest/config/variables.yaml b/threema-connector-webtest/config/variables.yaml new file mode 100644 index 0000000..64c8fa0 --- /dev/null +++ b/threema-connector-webtest/config/variables.yaml @@ -0,0 +1,9 @@ +# == Variables == +# +# You can define here your project Variables. +# If you want to define/override a Variable for a specific Environment, +# add an additional ‘variables.yaml’ file in a subdirectory in the ‘Config’ folder: +# '/Config/_/variables.yaml +# +Variables: +# myVariable: value diff --git a/threema-connector-webtest/config/webservice-clients.yaml b/threema-connector-webtest/config/webservice-clients.yaml new file mode 100644 index 0000000..060b018 --- /dev/null +++ b/threema-connector-webtest/config/webservice-clients.yaml @@ -0,0 +1 @@ +WebServiceClients: diff --git a/threema-connector-webtest/dataclasses/threema/connector/webtest/Data.ivyClass b/threema-connector-webtest/dataclasses/threema/connector/webtest/Data.ivyClass new file mode 100644 index 0000000..34a701a --- /dev/null +++ b/threema-connector-webtest/dataclasses/threema/connector/webtest/Data.ivyClass @@ -0,0 +1,2 @@ +Data #class +threema.connector.webtest #namespace diff --git a/threema-connector-webtest/pom.xml b/threema-connector-webtest/pom.xml new file mode 100644 index 0000000..8fd8f9a --- /dev/null +++ b/threema-connector-webtest/pom.xml @@ -0,0 +1,34 @@ + + + 4.0.0 + threema.connector.webtest + threema-connector-webtest + 1.0.0-SNAPSHOT + iar-integration-test + + + threema.connector.demo + threema-connector-demo + 10.0.0-SNAPSHOT + iar + + + com.axonivy.ivy.webtest + web-tester + 10.0.0 + test + + + + src_test + + + com.axonivy.ivy.ci + project-build-plugin + 10.0.6 + true + + + + diff --git a/threema-connector-webtest/src_test/threema/connector/webtest/MessageMultipleRecipientsTest.java b/threema-connector-webtest/src_test/threema/connector/webtest/MessageMultipleRecipientsTest.java new file mode 100644 index 0000000..2bf336f --- /dev/null +++ b/threema-connector-webtest/src_test/threema/connector/webtest/MessageMultipleRecipientsTest.java @@ -0,0 +1,40 @@ +package threema.connector.webtest; + +import static com.codeborne.selenide.Condition.empty; +import static com.codeborne.selenide.Condition.selected; +import static com.codeborne.selenide.Condition.value; +import static com.codeborne.selenide.Selenide.$; +import static com.codeborne.selenide.Selenide.open; + +import org.junit.jupiter.api.Test; +import org.openqa.selenium.By; + +import com.axonivy.ivy.webtest.IvyWebTest; +import com.axonivy.ivy.webtest.engine.EngineUrl; + +@IvyWebTest(headless = false) +public class MessageMultipleRecipientsTest { + + @Test + public void sendMessage() { + open(EngineUrl.createProcessUrl("threema-connector-demo/18B1ED116183D822/start.ivp")); + + String message = "Hello World"; + String recipients = "validId\ninvalidId"; + + // Assert empty form + $(By.id("form:sendDemoMessageDataPlainMessage")).shouldBe(empty); + $(By.id("form:sendDemoMessageDataReceiver")).shouldBe(empty); + + // Fill out form + $(By.id("form:sendDemoMessageDataPlainMessage")).sendKeys(message); + $(By.id("form:sendDemoMessageDataReceiver")).sendKeys(recipients); + + // Assert filled out form + $(By.id("form:sendDemoMessageDataPlainMessage")).shouldBe(value(message)); + $(By.id("form:sendDemoMessageDataReceiver")).shouldBe(value(recipients)); + + //$(By.id("form:proceed")).click(); + } + +} diff --git a/threema-connector-webtest/src_test/threema/connector/webtest/MessageSingleRecipientTest.java b/threema-connector-webtest/src_test/threema/connector/webtest/MessageSingleRecipientTest.java new file mode 100644 index 0000000..0e0000c --- /dev/null +++ b/threema-connector-webtest/src_test/threema/connector/webtest/MessageSingleRecipientTest.java @@ -0,0 +1,44 @@ +package threema.connector.webtest; + +import static com.codeborne.selenide.Condition.*; +import static com.codeborne.selenide.Selenide.*; + +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import org.openqa.selenium.By; + +import com.axonivy.ivy.webtest.IvyWebTest; +import com.axonivy.ivy.webtest.engine.EngineUrl; +import com.axonivy.ivy.webtest.primeui.PrimeUi; + + +@IvyWebTest(headless = false) +public class MessageSingleRecipientTest { + + + @Test + public void sendMessage() { + open(EngineUrl.createProcessUrl("threema-connector-demo/18B22F69680901D3/start.ivp")); + + String message = "Hello World"; + String validId = "validId"; + + // Assert empty form + $(By.id("form:sendDemoMessageDataPlainMessage")).shouldBe(empty); + $(By.id("form:sendDemoMessageDataReceiver")).shouldBe(empty); + $(By.id("form:typeSelection:2")).shouldNotBe(selected); + + // Fill out form + $(By.id("form:sendDemoMessageDataPlainMessage")).sendKeys(message); + $(By.id("form:sendDemoMessageDataReceiver")).sendKeys(validId); + PrimeUi.selectOneRadio(By.id("form:typeSelection")).selectItemByValue("threemaid"); + + // Assert filled out form + $(By.id("form:sendDemoMessageDataPlainMessage")).shouldBe(value(message)); + $(By.id("form:sendDemoMessageDataReceiver")).shouldBe(value(validId)); + $(By.id("form:typeSelection:2")).shouldBe(selected); + + //$(By.id("form:proceed")).click(); + } + +} From 066389a253cb9a2f8ebd36fbeb0db6979f1c394f Mon Sep 17 00:00:00 2001 From: Fabian Heuberger Date: Thu, 19 Oct 2023 15:42:54 +0200 Subject: [PATCH 11/58] added required test for fields disabled test as mocking is not implemented --- .../webtest/MessageMultipleRecipientsTest.java | 12 ++++++++++++ .../webtest/MessageSingleRecipientTest.java | 10 ++++++++++ 2 files changed, 22 insertions(+) diff --git a/threema-connector-webtest/src_test/threema/connector/webtest/MessageMultipleRecipientsTest.java b/threema-connector-webtest/src_test/threema/connector/webtest/MessageMultipleRecipientsTest.java index 2bf336f..0cd5ee4 100644 --- a/threema-connector-webtest/src_test/threema/connector/webtest/MessageMultipleRecipientsTest.java +++ b/threema-connector-webtest/src_test/threema/connector/webtest/MessageMultipleRecipientsTest.java @@ -4,18 +4,23 @@ import static com.codeborne.selenide.Condition.selected; import static com.codeborne.selenide.Condition.value; import static com.codeborne.selenide.Selenide.$; +import static com.codeborne.selenide.Selenide.$$; import static com.codeborne.selenide.Selenide.open; +import static org.assertj.core.api.Assertions.assertThat; +import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.openqa.selenium.By; import com.axonivy.ivy.webtest.IvyWebTest; import com.axonivy.ivy.webtest.engine.EngineUrl; +import com.codeborne.selenide.ElementsCollection; @IvyWebTest(headless = false) public class MessageMultipleRecipientsTest { @Test + @Disabled public void sendMessage() { open(EngineUrl.createProcessUrl("threema-connector-demo/18B1ED116183D822/start.ivp")); @@ -26,6 +31,13 @@ public void sendMessage() { $(By.id("form:sendDemoMessageDataPlainMessage")).shouldBe(empty); $(By.id("form:sendDemoMessageDataReceiver")).shouldBe(empty); + // Proceed without required fields + $(By.id("form:proceed")).click(); + + // Assert all fields required + ElementsCollection errorMessages = $$(By.cssSelector(".ui-state-error")); + assertThat(errorMessages).hasSize(4); + // Fill out form $(By.id("form:sendDemoMessageDataPlainMessage")).sendKeys(message); $(By.id("form:sendDemoMessageDataReceiver")).sendKeys(recipients); diff --git a/threema-connector-webtest/src_test/threema/connector/webtest/MessageSingleRecipientTest.java b/threema-connector-webtest/src_test/threema/connector/webtest/MessageSingleRecipientTest.java index 0e0000c..998b84a 100644 --- a/threema-connector-webtest/src_test/threema/connector/webtest/MessageSingleRecipientTest.java +++ b/threema-connector-webtest/src_test/threema/connector/webtest/MessageSingleRecipientTest.java @@ -2,6 +2,7 @@ import static com.codeborne.selenide.Condition.*; import static com.codeborne.selenide.Selenide.*; +import static org.assertj.core.api.Assertions.assertThat; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; @@ -10,6 +11,7 @@ import com.axonivy.ivy.webtest.IvyWebTest; import com.axonivy.ivy.webtest.engine.EngineUrl; import com.axonivy.ivy.webtest.primeui.PrimeUi; +import com.codeborne.selenide.ElementsCollection; @IvyWebTest(headless = false) @@ -17,6 +19,7 @@ public class MessageSingleRecipientTest { @Test + @Disabled public void sendMessage() { open(EngineUrl.createProcessUrl("threema-connector-demo/18B22F69680901D3/start.ivp")); @@ -28,6 +31,13 @@ public void sendMessage() { $(By.id("form:sendDemoMessageDataReceiver")).shouldBe(empty); $(By.id("form:typeSelection:2")).shouldNotBe(selected); + // Proceed without required fields + $(By.id("form:proceed")).click(); + + // Assert all fields required + ElementsCollection errorMessages = $$(By.cssSelector(".ui-state-error")); + assertThat(errorMessages).hasSize(8); + // Fill out form $(By.id("form:sendDemoMessageDataPlainMessage")).sendKeys(message); $(By.id("form:sendDemoMessageDataReceiver")).sendKeys(validId); From c8bcd50c2316d2e70cd61a732ebefa74eed212f2 Mon Sep 17 00:00:00 2001 From: Fabian Heuberger Date: Thu, 19 Oct 2023 16:21:24 +0200 Subject: [PATCH 12/58] updated ivyVersion --- threema-connector-test/pom.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/threema-connector-test/pom.xml b/threema-connector-test/pom.xml index f587f4c..7e13484 100644 --- a/threema-connector-test/pom.xml +++ b/threema-connector-test/pom.xml @@ -39,6 +39,9 @@ project-build-plugin 10.0.6 true + + 10.0.13 + From 30df1954b01ee4e7dfda5262f2107826bd8fa4f3 Mon Sep 17 00:00:00 2001 From: Fabian Heuberger Date: Thu, 19 Oct 2023 16:24:06 +0200 Subject: [PATCH 13/58] changed ivyversion --- threema-connector-test/pom.xml | 3 --- threema-connector/pom.xml | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/threema-connector-test/pom.xml b/threema-connector-test/pom.xml index 7e13484..f587f4c 100644 --- a/threema-connector-test/pom.xml +++ b/threema-connector-test/pom.xml @@ -39,9 +39,6 @@ project-build-plugin 10.0.6 true - - 10.0.13 - diff --git a/threema-connector/pom.xml b/threema-connector/pom.xml index b83b9ee..7963db1 100644 --- a/threema-connector/pom.xml +++ b/threema-connector/pom.xml @@ -24,6 +24,9 @@ project-build-plugin 10.0.6 true + + 10.0.13 + From 976cc4b5442faac51f47bbbfdf48fd6d86ca27b5 Mon Sep 17 00:00:00 2001 From: ivy-fhe <146715063+ivy-fhe@users.noreply.github.com> Date: Thu, 19 Oct 2023 16:40:43 +0200 Subject: [PATCH 14/58] Update ci.yml to set version to 10.0.11 --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1bc3496..7a9b31c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,3 +10,5 @@ on: jobs: build: uses: axonivy-market/github-workflows/.github/workflows/ci.yml@v2 + with: + mvnArgs: -Dmaven.test.failure.ignore=true -Divy.engine.version=10.0.11 From 8f605dad48418ec2d2e8f9360a34348cbae8f26e Mon Sep 17 00:00:00 2001 From: Fabian Heuberger Date: Thu, 19 Oct 2023 16:40:55 +0200 Subject: [PATCH 15/58] removed versionr requirement --- threema-connector/pom.xml | 3 --- 1 file changed, 3 deletions(-) diff --git a/threema-connector/pom.xml b/threema-connector/pom.xml index 7963db1..b83b9ee 100644 --- a/threema-connector/pom.xml +++ b/threema-connector/pom.xml @@ -24,9 +24,6 @@ project-build-plugin 10.0.6 true - - 10.0.13 - From 1a4f713ee7f637c503c6851e9f900a803cb68073 Mon Sep 17 00:00:00 2001 From: ivy-fhe <146715063+ivy-fhe@users.noreply.github.com> Date: Thu, 19 Oct 2023 16:47:25 +0200 Subject: [PATCH 16/58] Update ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7a9b31c..da54c13 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,4 +11,4 @@ jobs: build: uses: axonivy-market/github-workflows/.github/workflows/ci.yml@v2 with: - mvnArgs: -Dmaven.test.failure.ignore=true -Divy.engine.version=10.0.11 + mvnArgs: -Dmaven.test.failure.ignore=true -Divy.engine.version=10.0.13 From 28106eaf588e153f15ed7d791623341438119c15 Mon Sep 17 00:00:00 2001 From: Fabian Heuberger Date: Fri, 20 Oct 2023 12:06:44 +0200 Subject: [PATCH 17/58] changed url to point to correct repo --- threema-connector-product/README.md | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/threema-connector-product/README.md b/threema-connector-product/README.md index 1499368..23f3305 100644 --- a/threema-connector-product/README.md +++ b/threema-connector-product/README.md @@ -18,15 +18,5 @@ For generating the keys and requesting a new Threema.Gateway ID refer to [Genera To use the Threema Connector, add the following variables to your Axon Ivy Project: ``` -Variables: - connector: - - # Your Threema.Gateway ID - threemaId: '' - - # Your Threema.Gateway Secret - secret: '' - - # Your private key associated with your Threema.Gateway ID - privateKey: '' +@variables.yaml@ ``` From 32c367f7ed6702caca4e9b4755ef83013c733ac9 Mon Sep 17 00:00:00 2001 From: Fabian Heuberger Date: Fri, 20 Oct 2023 12:07:21 +0200 Subject: [PATCH 18/58] changed group id to match and fixed version issues --- pom.xml | 10 +++++++--- threema-connector-demo/pom.xml | 10 ++++++---- threema-connector-product/pom.xml | 19 +++++++++++++------ threema-connector-test/pom.xml | 12 +++++++----- threema-connector-webtest/pom.xml | 22 ++++++++++++---------- threema-connector/pom.xml | 24 ++++++++++-------------- 6 files changed, 55 insertions(+), 42 deletions(-) diff --git a/pom.xml b/pom.xml index d5910f9..e39362d 100644 --- a/pom.xml +++ b/pom.xml @@ -1,9 +1,13 @@ - + 4.0.0 - com.axonivy.market + com.axonivy.connector.threema threema-connector threema-connector-modules - 10.0.0-SNAPSHOT + 10.0.0-SNAPSHOT pom diff --git a/threema-connector-demo/pom.xml b/threema-connector-demo/pom.xml index 11794b0..216711e 100644 --- a/threema-connector-demo/pom.xml +++ b/threema-connector-demo/pom.xml @@ -1,14 +1,16 @@ - + 4.0.0 - threema.connector.demo + com.axonivy.connector.threema threema-connector-demo 10.0.0-SNAPSHOT iar - threema.connector + com.axonivy.connector.threema threema-connector ${project.version} iar diff --git a/threema-connector-product/pom.xml b/threema-connector-product/pom.xml index 8978530..028d448 100644 --- a/threema-connector-product/pom.xml +++ b/threema-connector-product/pom.xml @@ -1,7 +1,9 @@ - + 4.0.0 - com.axonivy.market - MY-PRODUCT-NAME-product + com.axonivy.connector.threema + threema-connector 10.0.0-SNAPSHOT pom @@ -42,9 +44,14 @@ - - - + + + diff --git a/threema-connector-test/pom.xml b/threema-connector-test/pom.xml index f587f4c..975a634 100644 --- a/threema-connector-test/pom.xml +++ b/threema-connector-test/pom.xml @@ -1,14 +1,16 @@ - + 4.0.0 - threema.connector.test + com.axonivy.connector.threema threema-connector-test 10.0.0-SNAPSHOT iar - threema.connector + com.axonivy.connector.threema threema-connector ${project.version} iar @@ -16,7 +18,7 @@ com.axonivy.ivy.test unit-tester - 11.1.0 + 10.0.0 test diff --git a/threema-connector-webtest/pom.xml b/threema-connector-webtest/pom.xml index 8fd8f9a..a59ddf9 100644 --- a/threema-connector-webtest/pom.xml +++ b/threema-connector-webtest/pom.xml @@ -1,23 +1,25 @@ - + 4.0.0 - threema.connector.webtest + com.axonivy.connector.threema threema-connector-webtest - 1.0.0-SNAPSHOT + 10.0.0-SNAPSHOT iar-integration-test - threema.connector.demo + com.axonivy.connector.threema threema-connector-demo - 10.0.0-SNAPSHOT + ${project.version} iar - com.axonivy.ivy.webtest - web-tester - 10.0.0 - test + com.axonivy.ivy.webtest + web-tester + 10.0.0 + test diff --git a/threema-connector/pom.xml b/threema-connector/pom.xml index b83b9ee..5a4a4a9 100644 --- a/threema-connector/pom.xml +++ b/threema-connector/pom.xml @@ -1,22 +1,18 @@ - + 4.0.0 - threema.connector + com.axonivy.connector.threema threema-connector 10.0.0-SNAPSHOT iar - - - + + + From 0046a20a4fe40b484696c0403d9adaba6c0bbbc5 Mon Sep 17 00:00:00 2001 From: Fabian Heuberger Date: Fri, 20 Oct 2023 12:08:52 +0200 Subject: [PATCH 19/58] fixed view to use frame template --- .../demo/ResultPage/ResultPage.xhtml | 52 +++-- .../multipleRecipients.xhtml | 42 ++-- .../singleRecipient/singleRecipient.xhtml | 56 +++-- .../webContent/layouts/frame-10.xhtml | 61 ++++++ .../layouts/includes/exception-details.xhtml | 195 ++++++++++-------- .../layouts/includes/exception.xhtml | 68 +++--- .../webContent/layouts/includes/footer.xhtml | 29 +-- .../layouts/includes/progress-loader.xhtml | 8 +- 8 files changed, 318 insertions(+), 193 deletions(-) create mode 100644 threema-connector-demo/webContent/layouts/frame-10.xhtml diff --git a/threema-connector-demo/src_hd/threema/connector/demo/ResultPage/ResultPage.xhtml b/threema-connector-demo/src_hd/threema/connector/demo/ResultPage/ResultPage.xhtml index bb3fba1..1b6ebe4 100644 --- a/threema-connector-demo/src_hd/threema/connector/demo/ResultPage/ResultPage.xhtml +++ b/threema-connector-demo/src_hd/threema/connector/demo/ResultPage/ResultPage.xhtml @@ -1,39 +1,49 @@ - - + ResultPage -

Message Status

+

Message Status

- - - - + + + - - - - - + + + + + + + + + - - - + - -
- - + +
diff --git a/threema-connector-demo/src_hd/threema/connector/demo/multipleRecipients/multipleRecipients.xhtml b/threema-connector-demo/src_hd/threema/connector/demo/multipleRecipients/multipleRecipients.xhtml index fbe397d..e387c3d 100644 --- a/threema-connector-demo/src_hd/threema/connector/demo/multipleRecipients/multipleRecipients.xhtml +++ b/threema-connector-demo/src_hd/threema/connector/demo/multipleRecipients/multipleRecipients.xhtml @@ -1,32 +1,44 @@ - - + multipleRecipients

Send Message to multiple recipients via Threema

- - - - - - - - - + + + + + + + +
- - + +
diff --git a/threema-connector-demo/src_hd/threema/connector/demo/singleRecipient/singleRecipient.xhtml b/threema-connector-demo/src_hd/threema/connector/demo/singleRecipient/singleRecipient.xhtml index 8c8a008..83e4804 100644 --- a/threema-connector-demo/src_hd/threema/connector/demo/singleRecipient/singleRecipient.xhtml +++ b/threema-connector-demo/src_hd/threema/connector/demo/singleRecipient/singleRecipient.xhtml @@ -1,38 +1,54 @@ - - + singleRecipient

Send Message via Threema

- - - - - - - - - - - - - + + + + + + + + + + + + - +
- - + +
diff --git a/threema-connector-demo/webContent/layouts/frame-10.xhtml b/threema-connector-demo/webContent/layouts/frame-10.xhtml new file mode 100644 index 0000000..e0a3f36 --- /dev/null +++ b/threema-connector-demo/webContent/layouts/frame-10.xhtml @@ -0,0 +1,61 @@ + + + + + + + + + + <ui:insert name="title">Ivy Html Dialog</ui:insert> + + + + + + + + + +
+ + default content + +
+ + + + + + + +
+ \ No newline at end of file diff --git a/threema-connector-demo/webContent/layouts/includes/exception-details.xhtml b/threema-connector-demo/webContent/layouts/includes/exception-details.xhtml index bbc3cce..f04a69b 100644 --- a/threema-connector-demo/webContent/layouts/includes/exception-details.xhtml +++ b/threema-connector-demo/webContent/layouts/includes/exception-details.xhtml @@ -6,104 +6,125 @@ xmlns:pe="http://primefaces.org/ui/extensions" xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"> - - - + + + -

- -

+

+ +

- -

Error id

-

#{errorPage.exceptionId}

-

Error Timestamp

-

#{errorPage.createdAt}

-
+ +

Error + id

+

#{errorPage.exceptionId}

+

Error + Timestamp

+

#{errorPage.createdAt}

+
- - - -

Attributes

-
- - + + + +

Attributes

+
+
+ + + + + + + + - - + + - - - - - - - - - -
NameValue
NameValue
-
-
-

Thrown by

-

Process: - -
Element: - -

-
- - -

Process call stack

- -
#{caller.callerElement}
-
-
- -

Technical cause

-
#{causedBy.class.simpleName}: #{causedBy.message.trim()}
-
-
+ + + + +
+

Thrown by

+

+ Process: + +
Element: + +

+
-

Request Uri

-

#{errorPage.getRequestUri()}

+ +

Process call stack

+ +
+      
+        #{caller.callerElement}
+      
+    

-

Servlet

-

#{errorPage.getServletName()}

+
+ +

Technical cause

+ +
+        #{causedBy.class.simpleName}: #{causedBy.message.trim()}
+      
+

+
-

Application

-

#{errorPage.applicationName}

-
+

Request Uri

+

#{errorPage.getRequestUri()}

+
+

Servlet

+

#{errorPage.getServletName()}

+
+ +

Application

+

#{errorPage.applicationName}

+
- -

Thread local values

-
- - + +

Thread local values

+
+
+ + + + + + + + - - + + - - - - - - - - - -
KeyValue
KeyValue
-
-
-
- -

Stack-Trace

-
#{errorPage.getStackTrace()}
+ + + + +
+ +

Stack-Trace

+
+    #{errorPage.getStackTrace()}
+  
+ diff --git a/threema-connector-demo/webContent/layouts/includes/exception.xhtml b/threema-connector-demo/webContent/layouts/includes/exception.xhtml index 1b255a2..1ed05ae 100644 --- a/threema-connector-demo/webContent/layouts/includes/exception.xhtml +++ b/threema-connector-demo/webContent/layouts/includes/exception.xhtml @@ -6,42 +6,42 @@ xmlns:ic="http://ivyteam.ch/jsf/component" xmlns:p="http://primefaces.org/ui" xmlns:pe="http://primefaces.org/ui/extensions"> - - - - + + + + - - - -
-
- - -
+ + + +
+
+ + +
- - + + - - - - + + + + -
- +
+ \ No newline at end of file diff --git a/threema-connector-demo/webContent/layouts/includes/footer.xhtml b/threema-connector-demo/webContent/layouts/includes/footer.xhtml index f21699e..912a1cc 100644 --- a/threema-connector-demo/webContent/layouts/includes/footer.xhtml +++ b/threema-connector-demo/webContent/layouts/includes/footer.xhtml @@ -1,18 +1,19 @@ + xmlns:f="http://xmlns.jcp.org/jsf/core" + xmlns:h="http://xmlns.jcp.org/jsf/html" + xmlns:ui="http://xmlns.jcp.org/jsf/facelets" + xmlns:ic="http://ivyteam.ch/jsf/component" + xmlns:p="http://primefaces.org/ui" + xmlns:pe="http://primefaces.org/ui/extensions"> - -
- - #{ivyAdvisor.applicationName} - - -
-
+ +
+ + #{ivyAdvisor.applicationName} + + +
+
\ No newline at end of file diff --git a/threema-connector-demo/webContent/layouts/includes/progress-loader.xhtml b/threema-connector-demo/webContent/layouts/includes/progress-loader.xhtml index 0d68a75..4b9d1ce 100644 --- a/threema-connector-demo/webContent/layouts/includes/progress-loader.xhtml +++ b/threema-connector-demo/webContent/layouts/includes/progress-loader.xhtml @@ -1,5 +1,9 @@ - + From eac895c8cfa9608d9ac97dd182a9bdd7ca6647b4 Mon Sep 17 00:00:00 2001 From: Fabian Heuberger Date: Fri, 20 Oct 2023 12:47:48 +0200 Subject: [PATCH 20/58] extracted message encryption into util class --- .../processes/util/messageEncryption.p.json | 27 ++++++------------- .../src/util/MessageEncryptor.java | 24 +++++++++++++++++ 2 files changed, 32 insertions(+), 19 deletions(-) create mode 100644 threema-connector/src/util/MessageEncryptor.java diff --git a/threema-connector/processes/util/messageEncryption.p.json b/threema-connector/processes/util/messageEncryption.p.json index 2023394..88e014f 100644 --- a/threema-connector/processes/util/messageEncryption.p.json +++ b/threema-connector/processes/util/messageEncryption.p.json @@ -3,7 +3,7 @@ "id" : "18B22CD369A6089F", "kind" : "CALLABLE_SUB", "config" : { - "data" : "threema.connector.receiverData" + "data" : "threema.connector.ReceiverData" }, "elements" : [ { "id" : "f0", @@ -13,7 +13,7 @@ "callSignature" : "call", "input" : { "params" : [ - { "name" : "receiverData", "type" : "threema.connector.receiverData" } + { "name" : "receiverData", "type" : "threema.connector.ReceiverData" } ], "map" : { "out" : "param.receiverData" @@ -21,7 +21,7 @@ }, "result" : { "params" : [ - { "name" : "receiverData", "type" : "threema.connector.receiverData" } + { "name" : "receiverData", "type" : "threema.connector.ReceiverData" } ], "map" : { "result.receiverData" : "in" @@ -46,23 +46,12 @@ "config" : { "output" : { "code" : [ - "import ch.threema.apitool.results.EncryptResult;", - "import ch.threema.apitool.CryptTool;", - "import javax.xml.bind.DatatypeConverter;", + "import util.MessageEncryptor;", + "import util.MessageEncryptor.EncryptionResult;", "", - "String privateKey = ivy.var.connector_privateKey;", - "String publicKey = in.publicKey;", - "String msg = in.plainMessage;", - "", - "Array encPrivKey = DatatypeConverter.parseHexBinary(privateKey);", - "Array encPubKey = DatatypeConverter.parseHexBinary(publicKey);", - "", - "CryptTool tool = new CryptTool();", - "EncryptResult result = tool.encryptTextMessage(msg, encPrivKey, encPubKey);", - "", - "out = in;", - "out.encryptedMessage = DatatypeConverter.printHexBinary(result.getResult());", - "out.nonce = DatatypeConverter.printHexBinary(result.getNonce());" + "EncryptionResult result = MessageEncryptor.encrypt(in.publicKey, in.plainMessage);", + "out.encryptedMessage = result.encryptedMessage();", + "out.nonce = result.nonce();" ] } }, diff --git a/threema-connector/src/util/MessageEncryptor.java b/threema-connector/src/util/MessageEncryptor.java new file mode 100644 index 0000000..c1518c7 --- /dev/null +++ b/threema-connector/src/util/MessageEncryptor.java @@ -0,0 +1,24 @@ +package util; + +import javax.xml.bind.DatatypeConverter; +import ch.ivyteam.ivy.environment.Ivy; +import ch.threema.apitool.CryptTool; +import ch.threema.apitool.results.EncryptResult; + + + +public class MessageEncryptor { + public record EncryptionResult(String encryptedMessage, String nonce) {}; + public static EncryptionResult encrypt(String publicKey, String msg) { + + byte[] encPrivKey = DatatypeConverter.parseHexBinary(Ivy.var().get("threemaConnector.privateKey")); + byte[] encPubKey = DatatypeConverter.parseHexBinary(publicKey); + + EncryptResult result = CryptTool.encryptTextMessage(msg, encPrivKey, encPubKey); + + String encryptedMessage = DatatypeConverter.printHexBinary(result.getResult()); + String nonce = DatatypeConverter.printHexBinary(result.getNonce()); + return new EncryptionResult(encryptedMessage, nonce); + } + +} From aae81c923a1ec01ec7cc3a33117b59d7b0bad8f9 Mon Sep 17 00:00:00 2001 From: Fabian Heuberger Date: Fri, 20 Oct 2023 12:49:30 +0200 Subject: [PATCH 21/58] applied standard ivy formatting --- .../threema/mocks/ThreemaServiceMock.java | 105 +++++---- .../test/process/GetReceiverInfoTest.java | 200 ++++++++---------- .../test/process/MessageEncryptionTest.java | 29 +-- .../test/process/MultipleRecipientsTest.java | 61 +++--- .../test/process/SendMessageTest.java | 126 +++++------ .../test/process/SingleRecipientTest.java | 95 ++++----- .../connector/test/util/LookupTypeTest.java | 13 -- .../MessageMultipleRecipientsTest.java | 56 ++--- .../webtest/MessageSingleRecipientTest.java | 71 +++---- threema-connector/src/util/LookupType.java | 24 +-- 10 files changed, 338 insertions(+), 442 deletions(-) diff --git a/threema-connector-test/src/ch/ivyteam/threema/mocks/ThreemaServiceMock.java b/threema-connector-test/src/ch/ivyteam/threema/mocks/ThreemaServiceMock.java index 1bd300f..860e3b8 100644 --- a/threema-connector-test/src/ch/ivyteam/threema/mocks/ThreemaServiceMock.java +++ b/threema-connector-test/src/ch/ivyteam/threema/mocks/ThreemaServiceMock.java @@ -12,7 +12,6 @@ import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.ResponseBuilder; - import ch.ivyteam.ivy.environment.Ivy; import ch.ivyteam.ivy.rest.client.config.IvyDefaultJaxRsTemplates; import io.swagger.v3.oas.annotations.Hidden; @@ -23,60 +22,56 @@ @SuppressWarnings("all") public class ThreemaServiceMock { - static final String PATH_SUFFIX = "mock"; - private static final String THREEMA_ID = "validId"; + static final String PATH_SUFFIX = "mock"; + private static final String THREEMA_ID = "validId"; + public static final String URI = "{" + IvyDefaultJaxRsTemplates.APP_URL + "}/api/" + PATH_SUFFIX; + // {ivy.app.baseurl}/api/mock + // https://msgapi.threema.ch + + @GET + @Path("/lookup/{type}/{id}") + @Produces(MediaType.TEXT_PLAIN) + public Response getThreemaIdByMail(@PathParam("type") String type, @PathParam("id") String id) { + Response resp; + if (id.equals("validId")) { + resp = Response.ok().entity(THREEMA_ID).build(); + } else { + resp = Response.status(404).build(); + } + return resp; + } - public static final String URI = "{"+IvyDefaultJaxRsTemplates.APP_URL+"}/api/"+PATH_SUFFIX; - // {ivy.app.baseurl}/api/mock - // https://msgapi.threema.ch - - @GET - @Path("/lookup/{type}/{id}") - @Produces(MediaType.TEXT_PLAIN) - public Response getThreemaIdByMail(@PathParam("type") String type, @PathParam("id") String id) { - Response resp; - if(id.equals("validId")) { - resp = Response.ok().entity(THREEMA_ID).build(); - }else { - resp = Response.status(404).build(); - } - return resp; - } - - @GET - @Path("/pubkeys/{id}") - @Produces(MediaType.TEXT_PLAIN) - public Response getPublicKey(@PathParam("id") String id) { - Response resp; - String pubKey = "ffbb40cfced42f75c4d83c7d35300c0698bf3ef1ab49ace323a1bbc38ee23f36"; - if(id.equals(THREEMA_ID)) { - resp = Response.ok().entity(pubKey).build(); - }else { - resp = Response.status(404).build(); - } + @GET + @Path("/pubkeys/{id}") + @Produces(MediaType.TEXT_PLAIN) + public Response getPublicKey(@PathParam("id") String id) { + Response resp; + String pubKey = "ffbb40cfced42f75c4d83c7d35300c0698bf3ef1ab49ace323a1bbc38ee23f36"; + if (id.equals(THREEMA_ID)) { + resp = Response.ok().entity(pubKey).build(); + } else { + resp = Response.status(404).build(); + } + return resp; + } - return resp; - } - - @POST - @Consumes(MediaType.APPLICATION_FORM_URLENCODED) - @Path("/send_e2e") - @Produces(MediaType.TEXT_PLAIN) - public Response sendMessage( - @FormParam("from") String from, - @FormParam("box") String box, - @FormParam("to") String to, - @FormParam("secret") String secret, - @FormParam("nonce") String nonce - ) { - String msgId = "b2885aa81e9b9c93"; - Response resp; - if(to.equals("validId")) { - resp = Response.ok().entity(msgId).build(); - }else { - resp = Response.status(404).build(); - } - - return resp; - } + @POST + @Consumes(MediaType.APPLICATION_FORM_URLENCODED) + @Path("/send_e2e") + @Produces(MediaType.TEXT_PLAIN) + public Response sendMessage( + @FormParam("from") String from, + @FormParam("box") String box, + @FormParam("to") String to, + @FormParam("secret") String secret, + @FormParam("nonce") String nonce) { + String msgId = "b2885aa81e9b9c93"; + Response resp; + if (to.equals("validId")) { + resp = Response.ok().entity(msgId).build(); + } else { + resp = Response.status(404).build(); + } + return resp; + } } diff --git a/threema-connector-test/src_test/threema/connector/test/process/GetReceiverInfoTest.java b/threema-connector-test/src_test/threema/connector/test/process/GetReceiverInfoTest.java index 66a971c..173f74f 100644 --- a/threema-connector-test/src_test/threema/connector/test/process/GetReceiverInfoTest.java +++ b/threema-connector-test/src_test/threema/connector/test/process/GetReceiverInfoTest.java @@ -1,11 +1,8 @@ package threema.connector.test.process; +import static org.assertj.core.api.Assertions.assertThat; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; - -import static org.assertj.core.api.Assertions.assertThat; - import ch.ivyteam.ivy.bpm.engine.client.BpmClient; import ch.ivyteam.ivy.bpm.engine.client.ExecutionResult; import ch.ivyteam.ivy.bpm.engine.client.History; @@ -14,119 +11,100 @@ import ch.ivyteam.ivy.bpm.exec.client.IvyProcessTest; import ch.ivyteam.ivy.environment.AppFixture; import ch.ivyteam.threema.mocks.ThreemaServiceMock; -import threema.connector.receiverData; +import threema.connector.ReceiverData; import util.LookupType; @IvyProcessTest(enableWebServer = true) public class GetReceiverInfoTest { - - private static final BpmProcess RECEIVER_INFO_PROCESS = BpmProcess.name("getReceiverInfo"); - private static final String VALID_ID = "validId"; - - @BeforeEach - void setup(AppFixture fixture) { - fixture.config("RestClients.ThreemaGateway.Url", ThreemaServiceMock.URI); - } - - @Test - void getIDByValidEmail(BpmClient bpmClient) { - BpmElement callable = RECEIVER_INFO_PROCESS.elementName("call(receiverData)"); - - String email = VALID_ID; - receiverData recDatMail = new receiverData(); - recDatMail.setIdentifier(email); - recDatMail.setType(LookupType.EMAIL); - - ExecutionResult resultMail = bpmClient.start().subProcess(callable).execute(recDatMail); - receiverData resultDataMail = resultMail.data().last(); - History historyMail = resultMail.history(); - assertThat(resultDataMail.getApiResponse()).contains("200"); - assertThat(historyMail.elementNames()).contains("call(receiverData)"); - assertThat(historyMail.elementNames()).contains("LookupId"); - assertThat(historyMail.elementNames()).contains("LookupPubKey"); - - } - - @Test - void getIDByInvalidEmail(BpmClient bpmClient) { - BpmElement callable = RECEIVER_INFO_PROCESS.elementName("call(receiverData)"); - - String email = "invalid@email.com"; - receiverData recDatMail = new receiverData(); - recDatMail.setIdentifier(email); - recDatMail.setType(LookupType.EMAIL); - - ExecutionResult resultMail = bpmClient.start().subProcess(callable).execute(recDatMail); - receiverData resultDataMail = resultMail.data().last(); - History historyMail = resultMail.history(); + private static final BpmProcess RECEIVER_INFO_PROCESS = BpmProcess.name("getReceiverInfo"); + private static final String VALID_ID = "validId"; + + @BeforeEach + void setup(AppFixture fixture) { + fixture.config("RestClients.ThreemaGateway.Url", ThreemaServiceMock.URI); + } + + @Test + void getIDByValidEmail(BpmClient bpmClient) { + BpmElement callable = RECEIVER_INFO_PROCESS.elementName("call(receiverData)"); + String email = VALID_ID; + ReceiverData recDatMail = new ReceiverData(); + recDatMail.setIdentifier(email); + recDatMail.setType(LookupType.EMAIL); + ExecutionResult resultMail = bpmClient.start().subProcess(callable).execute(recDatMail); + ReceiverData resultDataMail = resultMail.data().last(); + History historyMail = resultMail.history(); + assertThat(resultDataMail.getApiResponse()).contains("200"); + assertThat(historyMail.elementNames()) + .contains("call(receiverData)") + .contains("LookupId") + .contains("LookupPubKey"); + } + + @Test + void getIDByInvalidEmail(BpmClient bpmClient) { + BpmElement callable = RECEIVER_INFO_PROCESS.elementName("call(receiverData)"); + String email = "invalid@email.com"; + ReceiverData recDatMail = new ReceiverData(); + recDatMail.setIdentifier(email); + recDatMail.setType(LookupType.EMAIL); + ExecutionResult resultMail = bpmClient.start().subProcess(callable).execute(recDatMail); + ReceiverData resultDataMail = resultMail.data().last(); + History historyMail = resultMail.history(); + assertThat(resultDataMail.getApiResponse()).contains("404"); + assertThat(historyMail.elementNames()).contains("call(receiverData)") + .contains("LookupId") + .doesNotContain("LookupPubKey"); + } - assertThat(resultDataMail.getApiResponse()).contains("404"); - assertThat(historyMail.elementNames()).contains("call(receiverData)"); - assertThat(historyMail.elementNames()).contains("LookupId"); - assertThat(historyMail.elementNames()).doesNotContain("LookupPubKey"); - - } - - @Test - void getIDByValidPhone(BpmClient bpmClient) { - BpmElement callable = RECEIVER_INFO_PROCESS.elementName("call(receiverData)"); - - String phone = VALID_ID; - receiverData recDatMail = new receiverData(); - recDatMail.setIdentifier(phone); - recDatMail.setType(LookupType.PHONE); - - ExecutionResult resultMail = bpmClient.start().subProcess(callable).execute(recDatMail); - receiverData resultDataMail = resultMail.data().last(); - History historyMail = resultMail.history(); + @Test + void getIDByValidPhone(BpmClient bpmClient) { + BpmElement callable = RECEIVER_INFO_PROCESS.elementName("call(receiverData)"); + String phone = VALID_ID; + ReceiverData recDatMail = new ReceiverData(); + recDatMail.setIdentifier(phone); + recDatMail.setType(LookupType.PHONE); + ExecutionResult resultMail = bpmClient.start().subProcess(callable).execute(recDatMail); + ReceiverData resultDataMail = resultMail.data().last(); + History historyMail = resultMail.history(); + assertThat(resultDataMail.getApiResponse()).contains("200"); + assertThat(historyMail.elementNames()).contains("call(receiverData)") + .contains("LookupId") + .contains("LookupPubKey"); + } - assertThat(resultDataMail.getApiResponse()).contains("200"); - assertThat(historyMail.elementNames()).contains("call(receiverData)"); - assertThat(historyMail.elementNames()).contains("LookupId"); - assertThat(historyMail.elementNames()).contains("LookupPubKey"); - - } - - @Test - void getPublicKeyByID(BpmClient bpmClient) { - BpmElement callable = RECEIVER_INFO_PROCESS.elementName("call(receiverData)"); - - String threemaId = "validId"; - receiverData recDatId = new receiverData(); - recDatId.setIdentifier(threemaId); - recDatId.setType(LookupType.THREEMAID); - - ExecutionResult resultId = bpmClient.start().subProcess(callable).execute(recDatId); - receiverData resultDataId = resultId.data().last(); - History historyId = resultId.history(); - - assertThat(resultDataId.getApiResponse()).contains("200"); - assertThat(resultDataId.getPublicKey()).isEqualTo("ffbb40cfced42f75c4d83c7d35300c0698bf3ef1ab49ace323a1bbc38ee23f36"); - assertThat(historyId.elementNames()).contains("call(receiverData)"); - assertThat(historyId.elementNames()).contains("LookupPubKey"); - assertThat(historyId.elementNames()).doesNotContain("LookupId"); - } - - - @Test - void getPublicKeyByInvalidID(BpmClient bpmClient) { - BpmElement callable = RECEIVER_INFO_PROCESS.elementName("call(receiverData)"); - - String threemaId = "invalidID"; - receiverData recDatId = new receiverData(); - recDatId.setIdentifier(threemaId); - recDatId.setType(LookupType.THREEMAID); - - ExecutionResult resultId = bpmClient.start().subProcess(callable).execute(recDatId); - receiverData resultDataId = resultId.data().last(); - History historyId = resultId.history(); - - - assertThat(resultDataId.getApiResponse()).contains("404"); - assertThat(historyId.elementNames()).contains("call(receiverData)"); - assertThat(historyId.elementNames()).contains("LookupPubKey"); - assertThat(historyId.elementNames()).doesNotContain("LookupId"); - } + @Test + void getPublicKeyByID(BpmClient bpmClient) { + BpmElement callable = RECEIVER_INFO_PROCESS.elementName("call(receiverData)"); + String threemaId = "validId"; + ReceiverData recDatId = new ReceiverData(); + recDatId.setIdentifier(threemaId); + recDatId.setType(LookupType.THREEMAID); + ExecutionResult resultId = bpmClient.start().subProcess(callable).execute(recDatId); + ReceiverData resultDataId = resultId.data().last(); + History historyId = resultId.history(); + assertThat(resultDataId.getApiResponse()).contains("200"); + assertThat(resultDataId.getPublicKey()) + .isEqualTo("ffbb40cfced42f75c4d83c7d35300c0698bf3ef1ab49ace323a1bbc38ee23f36"); + assertThat(historyId.elementNames()).contains("call(receiverData)") + .contains("LookupPubKey") + .doesNotContain("LookupId"); + } + @Test + void getPublicKeyByInvalidID(BpmClient bpmClient) { + BpmElement callable = RECEIVER_INFO_PROCESS.elementName("call(receiverData)"); + String threemaId = "invalidID"; + ReceiverData recDatId = new ReceiverData(); + recDatId.setIdentifier(threemaId); + recDatId.setType(LookupType.THREEMAID); + ExecutionResult resultId = bpmClient.start().subProcess(callable).execute(recDatId); + ReceiverData resultDataId = resultId.data().last(); + History historyId = resultId.history(); + assertThat(resultDataId.getApiResponse()).contains("404"); + assertThat(historyId.elementNames()).contains("call(receiverData)") + .contains("LookupPubKey") + .doesNotContain("LookupId"); + } } diff --git a/threema-connector-test/src_test/threema/connector/test/process/MessageEncryptionTest.java b/threema-connector-test/src_test/threema/connector/test/process/MessageEncryptionTest.java index 1bda79b..86c7844 100644 --- a/threema-connector-test/src_test/threema/connector/test/process/MessageEncryptionTest.java +++ b/threema-connector-test/src_test/threema/connector/test/process/MessageEncryptionTest.java @@ -1,10 +1,7 @@ package threema.connector.test.process; - +import static javax.xml.bind.DatatypeConverter.parseHexBinary; import static org.assertj.core.api.Assertions.assertThat; - -import static javax.xml.bind.DatatypeConverter.*; - import org.junit.jupiter.api.Test; import ch.ivyteam.ivy.bpm.engine.client.BpmClient; import ch.ivyteam.ivy.bpm.engine.client.ExecutionResult; @@ -12,39 +9,33 @@ import ch.ivyteam.ivy.bpm.engine.client.element.BpmProcess; import ch.ivyteam.ivy.bpm.exec.client.IvyProcessTest; import ch.ivyteam.ivy.environment.Ivy; -import threema.connector.receiverData; import ch.threema.apitool.CryptTool; +import threema.connector.ReceiverData; @IvyProcessTest public class MessageEncryptionTest { + private final static BpmProcess ENCRYPTION_PROCESS = BpmProcess.name("messageEncryption"); private final static String PUBLIC_KEY = "ffbb40cfced42f75c4d83c7d35300c0698bf3ef1ab49ace323a1bbc38ee23f36"; private final static String PRIVATE_KEY = "ff364c727068fd6e3e6a711918393fa37649d902402a8eb31af108e79f625d82"; - @Test void encryptMessage(BpmClient bpmClient) { BpmElement callable = ENCRYPTION_PROCESS.elementName("call(receiverData)"); - // set PrivateKey for this test - Ivy.var().set("connector.privateKey", PRIVATE_KEY); - + Ivy.var().set("threemaConnector.privateKey", PRIVATE_KEY); String plainMsg = "Hello World"; - receiverData recData = new receiverData(); + ReceiverData recData = new ReceiverData(); recData.setPlainMessage(plainMsg); recData.setPublicKey(PUBLIC_KEY); - ExecutionResult result = bpmClient.start().subProcess(callable).execute(recData); - receiverData resultData = result.data().last(); + ReceiverData resultData = result.data().last(); assertThat(resultData.getEncryptedMessage()).isNotEmpty(); - byte[] decryptedByte = CryptTool.decrypt( - parseHexBinary(resultData.getEncryptedMessage()), - parseHexBinary(PRIVATE_KEY), - parseHexBinary(PUBLIC_KEY), - parseHexBinary(resultData.getNonce()) - ); - + parseHexBinary(resultData.getEncryptedMessage()), + parseHexBinary(PRIVATE_KEY), + parseHexBinary(PUBLIC_KEY), + parseHexBinary(resultData.getNonce())); String decryptedMsg = new String(decryptedByte); assertThat(decryptedMsg).contains(plainMsg); } diff --git a/threema-connector-test/src_test/threema/connector/test/process/MultipleRecipientsTest.java b/threema-connector-test/src_test/threema/connector/test/process/MultipleRecipientsTest.java index 60e8613..8db51cd 100644 --- a/threema-connector-test/src_test/threema/connector/test/process/MultipleRecipientsTest.java +++ b/threema-connector-test/src_test/threema/connector/test/process/MultipleRecipientsTest.java @@ -1,10 +1,8 @@ package threema.connector.test.process; import static org.assertj.core.api.Assertions.assertThat; - import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; - import ch.ivyteam.ivy.bpm.engine.client.BpmClient; import ch.ivyteam.ivy.bpm.engine.client.ExecutionResult; import ch.ivyteam.ivy.bpm.engine.client.element.BpmElement; @@ -13,43 +11,36 @@ import ch.ivyteam.ivy.environment.AppFixture; import ch.ivyteam.ivy.scripting.objects.List; import ch.ivyteam.threema.mocks.ThreemaServiceMock; -import threema.connector.receiverData; -import threema.connector.sendThreemaMessageData; +import threema.connector.ReceiverData; +import threema.connector.SendThreemaMessageData; import util.LookupType; @IvyProcessTest(enableWebServer = true) public class MultipleRecipientsTest { - private final static BpmProcess MULTIPLE_RECIPIENTS_PROCESS = BpmProcess.name("multipleRecipients"); - private final static String MESSAGE = "Hello World"; - - @BeforeEach - void setup(AppFixture fixture) { - fixture.config("RestClients.ThreemaGateway.Url", ThreemaServiceMock.URI); - } - - - @Test - void prepareMultipleRecipients(BpmClient bpmClient) { - List recipients = new List(); - recipients.add("invalidThreemaID"); - recipients.add("41000000000"); - recipients.add("invalid@email.ch"); - - BpmElement callable = MULTIPLE_RECIPIENTS_PROCESS.elementName("call(String,List)"); - ExecutionResult result = bpmClient.start().subProcess(callable).execute(MESSAGE, recipients); - sendThreemaMessageData msgData = result.data().last(); - List listReceiver = msgData.getReceiverData(); - - assertThat(listReceiver.size()).isEqualTo(recipients.size()); - assertThat(listReceiver.get(0).getType()).isEqualTo(LookupType.THREEMAID); - assertThat(listReceiver.get(1).getType()).isEqualTo(LookupType.PHONE); - assertThat(listReceiver.get(2).getType()).isEqualTo(LookupType.EMAIL); - - for(String status : msgData.getApiResponses()) { - assertThat(status).contains("404"); - } + private final static BpmProcess MULTIPLE_RECIPIENTS_PROCESS = BpmProcess.name("multipleRecipients"); + private final static String MESSAGE = "Hello World"; + + @BeforeEach + void setup(AppFixture fixture) { + fixture.config("RestClients.ThreemaGateway.Url", ThreemaServiceMock.URI); + } - } - + @Test + void prepareMultipleRecipients(BpmClient bpmClient) { + List recipients = new List(); + recipients.add("invalidThreemaID"); + recipients.add("41000000000"); + recipients.add("invalid@email.ch"); + BpmElement callable = MULTIPLE_RECIPIENTS_PROCESS.elementName("call(String,List)"); + ExecutionResult result = bpmClient.start().subProcess(callable).execute(MESSAGE, recipients); + SendThreemaMessageData msgData = result.data().last(); + List listReceiver = msgData.getReceiverData(); + assertThat(listReceiver.size()).isEqualTo(recipients.size()); + assertThat(listReceiver).extracting(ReceiverData::getType) + .containsExactly(LookupType.THREEMAID, LookupType.PHONE, LookupType.EMAIL); + for (String status : msgData.getApiResponses()) { + assertThat(status).contains("404"); + } + } } diff --git a/threema-connector-test/src_test/threema/connector/test/process/SendMessageTest.java b/threema-connector-test/src_test/threema/connector/test/process/SendMessageTest.java index c4b49ca..77b5f6c 100644 --- a/threema-connector-test/src_test/threema/connector/test/process/SendMessageTest.java +++ b/threema-connector-test/src_test/threema/connector/test/process/SendMessageTest.java @@ -1,90 +1,74 @@ package threema.connector.test.process; import static org.assertj.core.api.Assertions.assertThat; - import javax.xml.bind.DatatypeConverter; - import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; - import ch.ivyteam.ivy.bpm.engine.client.BpmClient; import ch.ivyteam.ivy.bpm.engine.client.ExecutionResult; import ch.ivyteam.ivy.bpm.engine.client.element.BpmElement; import ch.ivyteam.ivy.bpm.engine.client.element.BpmProcess; -import ch.ivyteam.ivy.bpm.engine.client.sub.SubRequestBuilder; import ch.ivyteam.ivy.bpm.exec.client.IvyProcessTest; -import ch.threema.apitool.CryptTool; -import ch.threema.apitool.results.EncryptResult; -import threema.connector.receiverData; import ch.ivyteam.ivy.environment.AppFixture; -import ch.ivyteam.ivy.environment.Ivy; import ch.ivyteam.threema.mocks.ThreemaServiceMock; +import ch.threema.apitool.CryptTool; +import ch.threema.apitool.results.EncryptResult; +import threema.connector.ReceiverData; @IvyProcessTest(enableWebServer = true) public class SendMessageTest { - private static final BpmProcess SEND_MESSAGE_PROCESS = BpmProcess.name("sendMessage"); - - private static final String ECHO_PUBLIC_KEY = "4a6a1b34dcef15d43cb74de2fd36091be99fbbaf126d099d47d83d919712c72b"; - private static final String PRIVATE_KEY = "ff364c727068fd6e3e6a711918393fa37649d902402a8eb31af108e79f625d82"; - private static final String INVALID_PUBLIC_KEY = "0000004dcef15d43cb74de2fd36091be99fbbaf126d099d47d83d919712c72b"; - private static final String VALID_ID = "validId"; - private static final String INVALID_ID = "invalidId"; - private static final String message = "Hello World"; - private static String encryptedMessage; - private static String nonce; - - - @BeforeAll - static void encryptMessage() { - EncryptResult encryptResult = CryptTool.encryptTextMessage( - message, - DatatypeConverter.parseHexBinary(PRIVATE_KEY), - DatatypeConverter.parseHexBinary(ECHO_PUBLIC_KEY) - ); - encryptedMessage = DatatypeConverter.printHexBinary(encryptResult.getResult()); - nonce = DatatypeConverter.printHexBinary(encryptResult.getNonce()); - } - - @BeforeEach - void setup(AppFixture fixture) { - fixture.config("RestClients.ThreemaGateway.Url", ThreemaServiceMock.URI); - } - - @Test - void sendValidMessage(BpmClient bpmClient) { - BpmElement callable = SEND_MESSAGE_PROCESS.elementName("call(receiverData)"); - - receiverData recDat = new receiverData(); - recDat.setThreemaId(VALID_ID); - recDat.setPublicKey(ECHO_PUBLIC_KEY); - recDat.setEncryptedMessage(encryptedMessage); - recDat.setNonce(nonce); - recDat.setApiResponse(""); - - ExecutionResult result = bpmClient.start().subProcess(callable).execute(recDat); - receiverData resultData = result.data().last(); - - assertThat(resultData.getApiResponse()).contains("200"); - } - - @Test - void sendInvalidMessage(BpmClient bpmClient) { - BpmElement callable = SEND_MESSAGE_PROCESS.elementName("call(receiverData)"); - - receiverData recDat = new receiverData(); - recDat.setThreemaId(INVALID_ID); - recDat.setPublicKey(INVALID_PUBLIC_KEY); - recDat.setEncryptedMessage(encryptedMessage); - recDat.setNonce(nonce); - recDat.setApiResponse(""); - - ExecutionResult result = bpmClient.start().subProcess(callable).execute(recDat); - receiverData resultData = result.data().last(); - - assertThat(resultData.getApiResponse()).contains("404"); - - } - + private static final BpmProcess SEND_MESSAGE_PROCESS = BpmProcess.name("sendMessage"); + private static final String ECHO_PUBLIC_KEY = "4a6a1b34dcef15d43cb74de2fd36091be99fbbaf126d099d47d83d919712c72b"; + private static final String PRIVATE_KEY = "ff364c727068fd6e3e6a711918393fa37649d902402a8eb31af108e79f625d82"; + private static final String INVALID_PUBLIC_KEY = "0000004dcef15d43cb74de2fd36091be99fbbaf126d099d47d83d919712c72b"; + private static final String VALID_ID = "validId"; + private static final String INVALID_ID = "invalidId"; + private static final String message = "Hello World"; + private static String encryptedMessage; + private static String nonce; + + @BeforeAll + static void encryptMessage() { + EncryptResult encryptResult = CryptTool.encryptTextMessage( + message, + DatatypeConverter.parseHexBinary(PRIVATE_KEY), + DatatypeConverter.parseHexBinary(ECHO_PUBLIC_KEY)); + encryptedMessage = DatatypeConverter.printHexBinary(encryptResult.getResult()); + nonce = DatatypeConverter.printHexBinary(encryptResult.getNonce()); + } + + @BeforeEach + void setup(AppFixture fixture) { + fixture.config("RestClients.ThreemaGateway.Url", ThreemaServiceMock.URI); + } + + @Test + void sendValidMessage(BpmClient bpmClient) { + BpmElement callable = SEND_MESSAGE_PROCESS.elementName("call(receiverData)"); + ReceiverData recDat = new ReceiverData(); + recDat.setThreemaId(VALID_ID); + recDat.setPublicKey(ECHO_PUBLIC_KEY); + recDat.setEncryptedMessage(encryptedMessage); + recDat.setNonce(nonce); + recDat.setApiResponse(""); + ExecutionResult result = bpmClient.start().subProcess(callable).execute(recDat); + ReceiverData resultData = result.data().last(); + assertThat(resultData.getApiResponse()).contains("200"); + } + + @Test + void sendInvalidMessage(BpmClient bpmClient) { + BpmElement callable = SEND_MESSAGE_PROCESS.elementName("call(receiverData)"); + ReceiverData recDat = new ReceiverData(); + recDat.setThreemaId(INVALID_ID); + recDat.setPublicKey(INVALID_PUBLIC_KEY); + recDat.setEncryptedMessage(encryptedMessage); + recDat.setNonce(nonce); + recDat.setApiResponse(""); + ExecutionResult result = bpmClient.start().subProcess(callable).execute(recDat); + ReceiverData resultData = result.data().last(); + assertThat(resultData.getApiResponse()).contains("404"); + } } diff --git a/threema-connector-test/src_test/threema/connector/test/process/SingleRecipientTest.java b/threema-connector-test/src_test/threema/connector/test/process/SingleRecipientTest.java index 537c565..60842db 100644 --- a/threema-connector-test/src_test/threema/connector/test/process/SingleRecipientTest.java +++ b/threema-connector-test/src_test/threema/connector/test/process/SingleRecipientTest.java @@ -1,12 +1,8 @@ package threema.connector.test.process; - - import static org.assertj.core.api.Assertions.assertThat; - import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; - import ch.ivyteam.ivy.bpm.engine.client.BpmClient; import ch.ivyteam.ivy.bpm.engine.client.ExecutionResult; import ch.ivyteam.ivy.bpm.engine.client.element.BpmElement; @@ -15,54 +11,53 @@ import ch.ivyteam.ivy.environment.AppFixture; import ch.ivyteam.ivy.environment.Ivy; import ch.ivyteam.threema.mocks.ThreemaServiceMock; -import threema.connector.receiverData; +import threema.connector.ReceiverData; @IvyProcessTest(enableWebServer = true) public class SingleRecipientTest { - private static final BpmProcess SINGLE_RECEIVER_PROCESS = BpmProcess.name("singleRecipient"); - private static final String VALID_ID = "validId"; - private static final String INVALID_EMAIL = "invalid@mail.ch"; - private static final String INVALID_PHONE = "41000000000"; - private static final String MESSAGE = "Hello World"; - private static final String PRIVATE_KEY = "ff364c727068fd6e3e6a711918393fa37649d902402a8eb31af108e79f625d82"; - - @BeforeEach - void setup(AppFixture fixture) { - Ivy.var().set("connector.privateKey", PRIVATE_KEY); - Ivy.var().set("connector.secret", "secret"); - Ivy.var().set("connector.threemaId", "threemaId"); - fixture.config("RestClients.ThreemaGateway.Url", ThreemaServiceMock.URI); - } - - @Test - void sendMessageToValidSingleRecipientById(BpmClient bpmClient) { - BpmElement callable = SINGLE_RECEIVER_PROCESS.elementName("call(String,String,LookupType)"); - ExecutionResult result = bpmClient.start().subProcess(callable).execute(MESSAGE, VALID_ID, util.LookupType.THREEMAID); - receiverData resultData = result.data().last(); - String apiStatus = resultData.getApiResponse(); - - assertThat(apiStatus).contains("200"); - } - - @Test - void sendMessageToInvalidSingleRecipientByEmail(BpmClient bpmClient) { - BpmElement callable = SINGLE_RECEIVER_PROCESS.elementName("call(String,String,LookupType)"); - ExecutionResult result = bpmClient.start().subProcess(callable).execute(MESSAGE, INVALID_EMAIL, util.LookupType.EMAIL); - receiverData resultData = result.data().last(); - String apiStatus = resultData.getApiResponse(); - - assertThat(apiStatus).isEqualTo("ID-Lookup: 404"); - } - - @Test - void sendMessageToInvalidSingleRecipientByPhone(BpmClient bpmClient) { - BpmElement callable = SINGLE_RECEIVER_PROCESS.elementName("call(String,String,LookupType)"); - ExecutionResult result = bpmClient.start().subProcess(callable).execute(MESSAGE, INVALID_PHONE, util.LookupType.PHONE); - receiverData resultData = result.data().last(); - String apiStatus = resultData.getApiResponse(); - - assertThat(apiStatus).isEqualTo("ID-Lookup: 404"); - } - + private static final BpmProcess SINGLE_RECEIVER_PROCESS = BpmProcess.name("singleRecipient"); + private static final String VALID_ID = "validId"; + private static final String INVALID_EMAIL = "invalid@mail.ch"; + private static final String INVALID_PHONE = "41000000000"; + private static final String MESSAGE = "Hello World"; + private static final String PRIVATE_KEY = "ff364c727068fd6e3e6a711918393fa37649d902402a8eb31af108e79f625d82"; + + @BeforeEach + void setup(AppFixture fixture) { + Ivy.var().set("threemaConnector.privateKey", PRIVATE_KEY); + Ivy.var().set("threemaConnector.secret", "secret"); + Ivy.var().set("threemaConnector.threemaId", "threemaId"); + fixture.config("RestClients.ThreemaGateway.Url", ThreemaServiceMock.URI); + } + + @Test + void sendMessageToValidSingleRecipientById(BpmClient bpmClient) { + BpmElement callable = SINGLE_RECEIVER_PROCESS.elementName("call(String,String,LookupType)"); + ExecutionResult result = bpmClient.start().subProcess(callable).execute(MESSAGE, VALID_ID, + util.LookupType.THREEMAID); + ReceiverData resultData = result.data().last(); + String apiStatus = resultData.getApiResponse(); + assertThat(apiStatus).contains("200"); + } + + @Test + void sendMessageToInvalidSingleRecipientByEmail(BpmClient bpmClient) { + BpmElement callable = SINGLE_RECEIVER_PROCESS.elementName("call(String,String,LookupType)"); + ExecutionResult result = bpmClient.start().subProcess(callable).execute(MESSAGE, INVALID_EMAIL, + util.LookupType.EMAIL); + ReceiverData resultData = result.data().last(); + String apiStatus = resultData.getApiResponse(); + assertThat(apiStatus).isEqualTo("ID-Lookup: 404"); + } + + @Test + void sendMessageToInvalidSingleRecipientByPhone(BpmClient bpmClient) { + BpmElement callable = SINGLE_RECEIVER_PROCESS.elementName("call(String,String,LookupType)"); + ExecutionResult result = bpmClient.start().subProcess(callable).execute(MESSAGE, INVALID_PHONE, + util.LookupType.PHONE); + ReceiverData resultData = result.data().last(); + String apiStatus = resultData.getApiResponse(); + assertThat(apiStatus).isEqualTo("ID-Lookup: 404"); + } } diff --git a/threema-connector-test/src_test/threema/connector/test/util/LookupTypeTest.java b/threema-connector-test/src_test/threema/connector/test/util/LookupTypeTest.java index 95ebf13..7ce3758 100644 --- a/threema-connector-test/src_test/threema/connector/test/util/LookupTypeTest.java +++ b/threema-connector-test/src_test/threema/connector/test/util/LookupTypeTest.java @@ -13,22 +13,16 @@ void getTypeByString() { String threemaId = "threemaId"; String invalid1 = "invalidType1"; String invalid2 = "invalidType2"; - LookupType typeEmail = LookupType.getByString(email); assertThat(typeEmail).isEqualTo(LookupType.EMAIL); - LookupType typePhone = LookupType.getByString(phone); assertThat(typePhone).isEqualTo(LookupType.PHONE); - LookupType typeThreemaId = LookupType.getByString(threemaId); assertThat(typeThreemaId).isEqualTo(LookupType.THREEMAID); - LookupType typeInvalid1 = LookupType.getByString(invalid1); assertThat(typeInvalid1).isEqualTo(LookupType.INVALID); - LookupType typeInvalid2 = LookupType.getByString(invalid2); assertThat(typeInvalid2).isEqualTo(LookupType.INVALID); - } @Test @@ -38,22 +32,15 @@ void getTypebyPattern() { String phoneComplete = "+00000000000"; String phoneCompleteSpace = "+00 00 000 00 00"; String threemaId = "didegiasdfl"; - LookupType typeEmail = LookupType.getByPattern(email); assertThat(typeEmail).isEqualTo(LookupType.EMAIL); - LookupType typePhone = LookupType.getByPattern(phoneSimple); assertThat(typePhone).isEqualTo(LookupType.PHONE); - typePhone = LookupType.getByPattern(phoneComplete); assertThat(typePhone).isEqualTo(LookupType.PHONE); - typePhone = LookupType.getByPattern(phoneCompleteSpace); assertThat(typePhone).isEqualTo(LookupType.PHONE); - LookupType typeThreemaId = LookupType.getByPattern(threemaId); assertThat(typeThreemaId).isEqualTo(LookupType.THREEMAID); - } - } diff --git a/threema-connector-webtest/src_test/threema/connector/webtest/MessageMultipleRecipientsTest.java b/threema-connector-webtest/src_test/threema/connector/webtest/MessageMultipleRecipientsTest.java index 0cd5ee4..463e62f 100644 --- a/threema-connector-webtest/src_test/threema/connector/webtest/MessageMultipleRecipientsTest.java +++ b/threema-connector-webtest/src_test/threema/connector/webtest/MessageMultipleRecipientsTest.java @@ -1,52 +1,40 @@ package threema.connector.webtest; import static com.codeborne.selenide.Condition.empty; -import static com.codeborne.selenide.Condition.selected; import static com.codeborne.selenide.Condition.value; import static com.codeborne.selenide.Selenide.$; import static com.codeborne.selenide.Selenide.$$; import static com.codeborne.selenide.Selenide.open; import static org.assertj.core.api.Assertions.assertThat; - import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.openqa.selenium.By; - import com.axonivy.ivy.webtest.IvyWebTest; import com.axonivy.ivy.webtest.engine.EngineUrl; import com.codeborne.selenide.ElementsCollection; -@IvyWebTest(headless = false) +@IvyWebTest public class MessageMultipleRecipientsTest { - - @Test - @Disabled - public void sendMessage() { - open(EngineUrl.createProcessUrl("threema-connector-demo/18B1ED116183D822/start.ivp")); - - String message = "Hello World"; - String recipients = "validId\ninvalidId"; - - // Assert empty form - $(By.id("form:sendDemoMessageDataPlainMessage")).shouldBe(empty); - $(By.id("form:sendDemoMessageDataReceiver")).shouldBe(empty); - - // Proceed without required fields - $(By.id("form:proceed")).click(); - - // Assert all fields required - ElementsCollection errorMessages = $$(By.cssSelector(".ui-state-error")); - assertThat(errorMessages).hasSize(4); - - // Fill out form - $(By.id("form:sendDemoMessageDataPlainMessage")).sendKeys(message); - $(By.id("form:sendDemoMessageDataReceiver")).sendKeys(recipients); - - // Assert filled out form - $(By.id("form:sendDemoMessageDataPlainMessage")).shouldBe(value(message)); - $(By.id("form:sendDemoMessageDataReceiver")).shouldBe(value(recipients)); - - //$(By.id("form:proceed")).click(); - } + @Test + @Disabled + public void sendMessage() { + open(EngineUrl.createProcessUrl("threema-connector-demo/18B1ED116183D822/start.ivp")); + String message = "Hello World"; + String recipients = "validId\ninvalidId"; + // Assert empty form + $(By.id("form:sendDemoMessageDataPlainMessage")).shouldBe(empty); + $(By.id("form:sendDemoMessageDataReceiver")).shouldBe(empty); + // Proceed without required fields + $(By.id("form:proceed")).click(); + // Assert all fields required + ElementsCollection errorMessages = $$(By.cssSelector(".ui-state-error")); + assertThat(errorMessages).hasSize(4); + // Fill out form + $(By.id("form:sendDemoMessageDataPlainMessage")).sendKeys(message); + $(By.id("form:sendDemoMessageDataReceiver")).sendKeys(recipients); + // Assert filled out form + $(By.id("form:sendDemoMessageDataPlainMessage")).shouldBe(value(message)); + $(By.id("form:sendDemoMessageDataReceiver")).shouldBe(value(recipients)); + } } diff --git a/threema-connector-webtest/src_test/threema/connector/webtest/MessageSingleRecipientTest.java b/threema-connector-webtest/src_test/threema/connector/webtest/MessageSingleRecipientTest.java index 998b84a..fb96520 100644 --- a/threema-connector-webtest/src_test/threema/connector/webtest/MessageSingleRecipientTest.java +++ b/threema-connector-webtest/src_test/threema/connector/webtest/MessageSingleRecipientTest.java @@ -1,54 +1,45 @@ package threema.connector.webtest; -import static com.codeborne.selenide.Condition.*; -import static com.codeborne.selenide.Selenide.*; +import static com.codeborne.selenide.Condition.empty; +import static com.codeborne.selenide.Condition.selected; +import static com.codeborne.selenide.Condition.value; +import static com.codeborne.selenide.Selenide.$; +import static com.codeborne.selenide.Selenide.$$; +import static com.codeborne.selenide.Selenide.open; import static org.assertj.core.api.Assertions.assertThat; - import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.openqa.selenium.By; - import com.axonivy.ivy.webtest.IvyWebTest; import com.axonivy.ivy.webtest.engine.EngineUrl; import com.axonivy.ivy.webtest.primeui.PrimeUi; import com.codeborne.selenide.ElementsCollection; - -@IvyWebTest(headless = false) +@IvyWebTest public class MessageSingleRecipientTest { - - - @Test - @Disabled - public void sendMessage() { - open(EngineUrl.createProcessUrl("threema-connector-demo/18B22F69680901D3/start.ivp")); - - String message = "Hello World"; - String validId = "validId"; - - // Assert empty form - $(By.id("form:sendDemoMessageDataPlainMessage")).shouldBe(empty); - $(By.id("form:sendDemoMessageDataReceiver")).shouldBe(empty); - $(By.id("form:typeSelection:2")).shouldNotBe(selected); - - // Proceed without required fields - $(By.id("form:proceed")).click(); - - // Assert all fields required - ElementsCollection errorMessages = $$(By.cssSelector(".ui-state-error")); - assertThat(errorMessages).hasSize(8); - - // Fill out form - $(By.id("form:sendDemoMessageDataPlainMessage")).sendKeys(message); - $(By.id("form:sendDemoMessageDataReceiver")).sendKeys(validId); - PrimeUi.selectOneRadio(By.id("form:typeSelection")).selectItemByValue("threemaid"); - - // Assert filled out form - $(By.id("form:sendDemoMessageDataPlainMessage")).shouldBe(value(message)); - $(By.id("form:sendDemoMessageDataReceiver")).shouldBe(value(validId)); - $(By.id("form:typeSelection:2")).shouldBe(selected); - - //$(By.id("form:proceed")).click(); - } + @Test + @Disabled + public void sendMessage() { + open(EngineUrl.createProcessUrl("threema-connector-demo/18B22F69680901D3/start.ivp")); + String message = "Hello World"; + String validId = "validId"; + // Assert empty form + $(By.id("form:sendDemoMessageDataPlainMessage")).shouldBe(empty); + $(By.id("form:sendDemoMessageDataReceiver")).shouldBe(empty); + $(By.id("form:typeSelection:2")).shouldNotBe(selected); + // Proceed without required fields + $(By.id("form:proceed")).click(); + // Assert all fields required + ElementsCollection errorMessages = $$(By.cssSelector(".ui-state-error")); + assertThat(errorMessages).hasSize(8); + // Fill out form + $(By.id("form:sendDemoMessageDataPlainMessage")).sendKeys(message); + $(By.id("form:sendDemoMessageDataReceiver")).sendKeys(validId); + PrimeUi.selectOneRadio(By.id("form:typeSelection")).selectItemByValue("threemaid"); + // Assert filled out form + $(By.id("form:sendDemoMessageDataPlainMessage")).shouldBe(value(message)); + $(By.id("form:sendDemoMessageDataReceiver")).shouldBe(value(validId)); + $(By.id("form:typeSelection:2")).shouldBe(selected); + } } diff --git a/threema-connector/src/util/LookupType.java b/threema-connector/src/util/LookupType.java index 698c90d..d7a85c8 100644 --- a/threema-connector/src/util/LookupType.java +++ b/threema-connector/src/util/LookupType.java @@ -1,11 +1,7 @@ package util; - - public enum LookupType { - PHONE, - EMAIL, - THREEMAID, - INVALID; + + PHONE, EMAIL, THREEMAID, INVALID; @Override public String toString() { @@ -13,7 +9,7 @@ public String toString() { } public static LookupType getByString(String id) { - return switch(id.toLowerCase()) { + return switch (id.toLowerCase()) { case "phone" -> LookupType.PHONE; case "email" -> LookupType.EMAIL; case "threemaid" -> LookupType.THREEMAID; @@ -24,13 +20,13 @@ public static LookupType getByString(String id) { public static LookupType getByPattern(String id) { LookupType type = LookupType.INVALID; id = id.replaceAll(" ", ""); - if(id.lastIndexOf('@') < id.lastIndexOf('.')){ - type = LookupType.EMAIL; - }else if(id.matches("\\+?\\d{11}")) { - type = LookupType.PHONE; - }else { - type = LookupType.THREEMAID; - } + if (id.lastIndexOf('@') < id.lastIndexOf('.')) { + type = LookupType.EMAIL; + } else if (id.matches("\\+?\\d{11}")) { + type = LookupType.PHONE; + } else { + type = LookupType.THREEMAID; + } return type; } } From 5c50c77a7d4be9ba9415ca9f94d0582b8def2865 Mon Sep 17 00:00:00 2001 From: Fabian Heuberger Date: Fri, 20 Oct 2023 12:50:22 +0200 Subject: [PATCH 22/58] removed unused code --- threema-connector/pom.xml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/threema-connector/pom.xml b/threema-connector/pom.xml index 5a4a4a9..2b104a9 100644 --- a/threema-connector/pom.xml +++ b/threema-connector/pom.xml @@ -9,10 +9,6 @@ 10.0.0-SNAPSHOT iar - - From 12ce5cb450180fd37c51094bfd6243574dae7082 Mon Sep 17 00:00:00 2001 From: Fabian Heuberger Date: Fri, 20 Oct 2023 12:51:28 +0200 Subject: [PATCH 23/58] fixed repo link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index da816a1..6d8f9d8 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Threema Connector -[![CI Build](https://github.com/axonivy-market/REPO-NAME/actions/workflows/ci.yml/badge.svg)](https://github.com/axonivy-market/threema-connector/actions/workflows/ci.yml) +[![CI Build](https://github.com/axonivy-market/threema-connector/actions/workflows/ci.yml/badge.svg)](https://github.com/axonivy-market/threema-connector/actions/workflows/ci.yml) Use the [Threema.Gateway API](https://threema.ch/en/gateway) to send messages to one or more recipients, enabling new notification options for your business processes. From 01d34b71e5da19716bebef64623491dfd221a99f Mon Sep 17 00:00:00 2001 From: Fabian Heuberger Date: Fri, 20 Oct 2023 12:51:59 +0200 Subject: [PATCH 24/58] fixed formatting --- .../threema/connector/ReceiverData.ivyClass | 20 +++++++++++++++++++ .../connector/SendThreemaMessageData.ivyClass | 12 +++++++++++ 2 files changed, 32 insertions(+) create mode 100644 threema-connector/dataclasses/threema/connector/ReceiverData.ivyClass create mode 100644 threema-connector/dataclasses/threema/connector/SendThreemaMessageData.ivyClass diff --git a/threema-connector/dataclasses/threema/connector/ReceiverData.ivyClass b/threema-connector/dataclasses/threema/connector/ReceiverData.ivyClass new file mode 100644 index 0000000..a03b5eb --- /dev/null +++ b/threema-connector/dataclasses/threema/connector/ReceiverData.ivyClass @@ -0,0 +1,20 @@ +ReceiverData #class +threema.connector #namespace +identifier String #field +identifier PERSISTENT #fieldModifier +threemaId String #field +threemaId PERSISTENT #fieldModifier +type util.LookupType #field +type PERSISTENT #fieldModifier +publicKey String #field +publicKey PERSISTENT #fieldModifier +nonce String #field +nonce PERSISTENT #fieldModifier +encryptedMessage String #field +encryptedMessage PERSISTENT #fieldModifier +plainMessage String #field +plainMessage PERSISTENT #fieldModifier +messageJson String #field +messageJson PERSISTENT #fieldModifier +apiResponse String #field +apiResponse PERSISTENT #fieldModifier diff --git a/threema-connector/dataclasses/threema/connector/SendThreemaMessageData.ivyClass b/threema-connector/dataclasses/threema/connector/SendThreemaMessageData.ivyClass new file mode 100644 index 0000000..7ffa4ff --- /dev/null +++ b/threema-connector/dataclasses/threema/connector/SendThreemaMessageData.ivyClass @@ -0,0 +1,12 @@ +SendThreemaMessageData #class +threema.connector #namespace +receiver List #field +receiver PERSISTENT #fieldModifier +plainMessage String #field +plainMessage PERSISTENT #fieldModifier +receiverData List #field +receiverData PERSISTENT #fieldModifier +sendCount Number #field +sendCount PERSISTENT #fieldModifier +apiResponses List #field +apiResponses PERSISTENT #fieldModifier From ebfcaba501090869ee46ec1af4036454afbff663 Mon Sep 17 00:00:00 2001 From: Fabian Heuberger Date: Fri, 20 Oct 2023 12:52:38 +0200 Subject: [PATCH 25/58] applied formatting --- .project | 28 +++--- threema-connector-demo/.classpath | 54 ++++++----- threema-connector-demo/.project | 92 +++++++++---------- threema-connector-demo/.settings/.jsdtscope | 23 +++-- .../org.eclipse.wst.common.component | 26 ++++-- ...se.wst.common.project.facet.core.prefs.xml | 3 +- ....eclipse.wst.common.project.facet.core.xml | 10 +- threema-connector-demo/config/persistence.xml | 4 +- threema-connector-demo/config/roles.xml | 2 +- threema-connector-demo/config/users.xml | 2 +- .../webContent/layouts/basic-10.xhtml | 67 -------------- threema-connector-product/zip.xml | 5 +- threema-connector-test/.classpath | 79 ++++++++-------- threema-connector-test/.project | 92 +++++++++---------- threema-connector-test/.settings/.jsdtscope | 23 +++-- .../org.eclipse.wst.common.component | 26 ++++-- ...se.wst.common.project.facet.core.prefs.xml | 3 +- ....eclipse.wst.common.project.facet.core.xml | 10 +- threema-connector-test/config/persistence.xml | 4 +- threema-connector-test/config/roles.xml | 2 +- threema-connector-test/config/users.xml | 2 +- threema-connector-webtest/.classpath | 81 ++++++++-------- threema-connector-webtest/.project | 92 +++++++++---------- .../.settings/.jsdtscope | 23 +++-- .../org.eclipse.wst.common.component | 29 ++++-- ...se.wst.common.project.facet.core.prefs.xml | 3 +- ....eclipse.wst.common.project.facet.core.xml | 10 +- .../config/persistence.xml | 4 +- threema-connector-webtest/config/roles.xml | 2 +- threema-connector-webtest/config/users.xml | 2 +- threema-connector/.classpath | 64 +++++++------ threema-connector/.project | 92 +++++++++---------- threema-connector/.settings/.jsdtscope | 23 +++-- .../org.eclipse.wst.common.component | 25 +++-- ...se.wst.common.project.facet.core.prefs.xml | 3 +- ....eclipse.wst.common.project.facet.core.xml | 10 +- threema-connector/config/persistence.xml | 4 +- threema-connector/config/roles.xml | 2 +- threema-connector/config/users.xml | 2 +- .../threema/connector/receiverData.ivyClass | 20 ---- .../connector/sendThreemaMessageData.ivyClass | 12 --- .../processes/multipleRecipients.p.json | 8 +- .../processes/singleRecipient.p.json | 14 +-- .../processes/util/getReceiverInfo.p.json | 14 +-- .../processes/util/sendMessage.p.json | 11 ++- 45 files changed, 548 insertions(+), 559 deletions(-) delete mode 100644 threema-connector-demo/webContent/layouts/basic-10.xhtml delete mode 100644 threema-connector/dataclasses/threema/connector/receiverData.ivyClass delete mode 100644 threema-connector/dataclasses/threema/connector/sendThreemaMessageData.ivyClass diff --git a/.project b/.project index d90b7fe..cba7369 100644 --- a/.project +++ b/.project @@ -1,17 +1,17 @@ - threema-connector-modules - - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.m2e.core.maven2Nature - + threema-connector-modules + + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.m2e.core.maven2Nature + diff --git a/threema-connector-demo/.classpath b/threema-connector-demo/.classpath index aff6211..157b754 100644 --- a/threema-connector-demo/.classpath +++ b/threema-connector-demo/.classpath @@ -1,28 +1,32 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/threema-connector-demo/.project b/threema-connector-demo/.project index a8e34fb..7289f72 100644 --- a/threema-connector-demo/.project +++ b/threema-connector-demo/.project @@ -1,49 +1,49 @@ - threema-connector-demo - - - - - - ch.ivyteam.ivy.designer.dataClasses.ui.ivyDataClassBuilder - - - - - ch.ivyteam.ivy.designer.process.ui.ivyWebServiceProcessClassBuilder - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - ch.ivyteam.ivy.designer.ide.ivyModelValidationBuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - ch.ivyteam.ivy.project.IvyProjectNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - org.eclipse.jem.beaninfo.BeanInfoNature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.wst.jsdt.core.jsNature - + threema-connector-demo + + + + + + ch.ivyteam.ivy.designer.dataClasses.ui.ivyDataClassBuilder + + + + + ch.ivyteam.ivy.designer.process.ui.ivyWebServiceProcessClassBuilder + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + ch.ivyteam.ivy.designer.ide.ivyModelValidationBuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + ch.ivyteam.ivy.project.IvyProjectNature + org.eclipse.wst.common.modulecore.ModuleCoreNature + org.eclipse.jem.workbench.JavaEMFNature + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + org.eclipse.jem.beaninfo.BeanInfoNature + org.eclipse.wst.common.project.facet.core.nature + org.eclipse.wst.jsdt.core.jsNature + diff --git a/threema-connector-demo/.settings/.jsdtscope b/threema-connector-demo/.settings/.jsdtscope index 869c01d..e4ab59a 100644 --- a/threema-connector-demo/.settings/.jsdtscope +++ b/threema-connector-demo/.settings/.jsdtscope @@ -1,12 +1,17 @@ - - - - - - - - - + + + + + + + + + diff --git a/threema-connector-demo/.settings/org.eclipse.wst.common.component b/threema-connector-demo/.settings/org.eclipse.wst.common.component index 7e0f2c9..db6eed0 100644 --- a/threema-connector-demo/.settings/org.eclipse.wst.common.component +++ b/threema-connector-demo/.settings/org.eclipse.wst.common.component @@ -1,10 +1,18 @@ - - - - - - - - - + + + + + + + + + + diff --git a/threema-connector-demo/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml b/threema-connector-demo/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml index 9b4b9fc..e725c8d 100644 --- a/threema-connector-demo/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml +++ b/threema-connector-demo/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml @@ -1,7 +1,8 @@ - + diff --git a/threema-connector-demo/.settings/org.eclipse.wst.common.project.facet.core.xml b/threema-connector-demo/.settings/org.eclipse.wst.common.project.facet.core.xml index 156ecdb..3bb273d 100644 --- a/threema-connector-demo/.settings/org.eclipse.wst.common.project.facet.core.xml +++ b/threema-connector-demo/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -1,8 +1,8 @@ - - - - - + + + + + diff --git a/threema-connector-demo/config/persistence.xml b/threema-connector-demo/config/persistence.xml index d6b96d7..3de1768 100644 --- a/threema-connector-demo/config/persistence.xml +++ b/threema-connector-demo/config/persistence.xml @@ -1,2 +1,4 @@ - + diff --git a/threema-connector-demo/config/roles.xml b/threema-connector-demo/config/roles.xml index 59892fe..c7c6911 100644 --- a/threema-connector-demo/config/roles.xml +++ b/threema-connector-demo/config/roles.xml @@ -1,4 +1,4 @@ - Everybody + Everybody diff --git a/threema-connector-demo/config/users.xml b/threema-connector-demo/config/users.xml index 51a6906..1e173fa 100644 --- a/threema-connector-demo/config/users.xml +++ b/threema-connector-demo/config/users.xml @@ -1,2 +1,2 @@ - + diff --git a/threema-connector-demo/webContent/layouts/basic-10.xhtml b/threema-connector-demo/webContent/layouts/basic-10.xhtml deleted file mode 100644 index 2e4b7b8..0000000 --- a/threema-connector-demo/webContent/layouts/basic-10.xhtml +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - - - - <ui:insert name="title">Ivy Html Dialog</ui:insert> - - - - - - - - - - - - - -
- - default content - - - -
-
- -
-
-
- - - - -
- \ No newline at end of file diff --git a/threema-connector-product/zip.xml b/threema-connector-product/zip.xml index 003f06c..ed24bd5 100644 --- a/threema-connector-product/zip.xml +++ b/threema-connector-product/zip.xml @@ -1,4 +1,7 @@ - + zip false diff --git a/threema-connector-test/.classpath b/threema-connector-test/.classpath index 7d6b6e2..8e30989 100644 --- a/threema-connector-test/.classpath +++ b/threema-connector-test/.classpath @@ -1,40 +1,45 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/threema-connector-test/.project b/threema-connector-test/.project index 2ecc6d6..7068587 100644 --- a/threema-connector-test/.project +++ b/threema-connector-test/.project @@ -1,49 +1,49 @@ - threema-connector-test - - - - - - ch.ivyteam.ivy.designer.dataClasses.ui.ivyDataClassBuilder - - - - - ch.ivyteam.ivy.designer.process.ui.ivyWebServiceProcessClassBuilder - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - ch.ivyteam.ivy.designer.ide.ivyModelValidationBuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - ch.ivyteam.ivy.project.IvyProjectNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - org.eclipse.jem.beaninfo.BeanInfoNature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.wst.jsdt.core.jsNature - + threema-connector-test + + + + + + ch.ivyteam.ivy.designer.dataClasses.ui.ivyDataClassBuilder + + + + + ch.ivyteam.ivy.designer.process.ui.ivyWebServiceProcessClassBuilder + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + ch.ivyteam.ivy.designer.ide.ivyModelValidationBuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + ch.ivyteam.ivy.project.IvyProjectNature + org.eclipse.wst.common.modulecore.ModuleCoreNature + org.eclipse.jem.workbench.JavaEMFNature + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + org.eclipse.jem.beaninfo.BeanInfoNature + org.eclipse.wst.common.project.facet.core.nature + org.eclipse.wst.jsdt.core.jsNature + diff --git a/threema-connector-test/.settings/.jsdtscope b/threema-connector-test/.settings/.jsdtscope index 869c01d..e4ab59a 100644 --- a/threema-connector-test/.settings/.jsdtscope +++ b/threema-connector-test/.settings/.jsdtscope @@ -1,12 +1,17 @@ - - - - - - - - - + + + + + + + + + diff --git a/threema-connector-test/.settings/org.eclipse.wst.common.component b/threema-connector-test/.settings/org.eclipse.wst.common.component index 41c9806..dec10f3 100644 --- a/threema-connector-test/.settings/org.eclipse.wst.common.component +++ b/threema-connector-test/.settings/org.eclipse.wst.common.component @@ -1,10 +1,18 @@ - - - - - - - - - + + + + + + + + + + diff --git a/threema-connector-test/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml b/threema-connector-test/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml index 9b4b9fc..e725c8d 100644 --- a/threema-connector-test/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml +++ b/threema-connector-test/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml @@ -1,7 +1,8 @@ - + diff --git a/threema-connector-test/.settings/org.eclipse.wst.common.project.facet.core.xml b/threema-connector-test/.settings/org.eclipse.wst.common.project.facet.core.xml index 156ecdb..3bb273d 100644 --- a/threema-connector-test/.settings/org.eclipse.wst.common.project.facet.core.xml +++ b/threema-connector-test/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -1,8 +1,8 @@ - - - - - + + + + + diff --git a/threema-connector-test/config/persistence.xml b/threema-connector-test/config/persistence.xml index d6b96d7..3de1768 100644 --- a/threema-connector-test/config/persistence.xml +++ b/threema-connector-test/config/persistence.xml @@ -1,2 +1,4 @@ - + diff --git a/threema-connector-test/config/roles.xml b/threema-connector-test/config/roles.xml index 59892fe..c7c6911 100644 --- a/threema-connector-test/config/roles.xml +++ b/threema-connector-test/config/roles.xml @@ -1,4 +1,4 @@ - Everybody + Everybody diff --git a/threema-connector-test/config/users.xml b/threema-connector-test/config/users.xml index 51a6906..1e173fa 100644 --- a/threema-connector-test/config/users.xml +++ b/threema-connector-test/config/users.xml @@ -1,2 +1,2 @@ - + diff --git a/threema-connector-webtest/.classpath b/threema-connector-webtest/.classpath index e938886..26e6fb6 100644 --- a/threema-connector-webtest/.classpath +++ b/threema-connector-webtest/.classpath @@ -1,40 +1,47 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/threema-connector-webtest/.project b/threema-connector-webtest/.project index a0bb838..d8bca7c 100644 --- a/threema-connector-webtest/.project +++ b/threema-connector-webtest/.project @@ -1,49 +1,49 @@ - threema-connector-webtest - - - - - - ch.ivyteam.ivy.designer.dataClasses.ui.ivyDataClassBuilder - - - - - ch.ivyteam.ivy.designer.process.ui.ivyWebServiceProcessClassBuilder - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - ch.ivyteam.ivy.designer.ide.ivyModelValidationBuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - ch.ivyteam.ivy.project.IvyProjectNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - org.eclipse.jem.beaninfo.BeanInfoNature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.wst.jsdt.core.jsNature - + threema-connector-webtest + + + + + + ch.ivyteam.ivy.designer.dataClasses.ui.ivyDataClassBuilder + + + + + ch.ivyteam.ivy.designer.process.ui.ivyWebServiceProcessClassBuilder + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + ch.ivyteam.ivy.designer.ide.ivyModelValidationBuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + ch.ivyteam.ivy.project.IvyProjectNature + org.eclipse.wst.common.modulecore.ModuleCoreNature + org.eclipse.jem.workbench.JavaEMFNature + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + org.eclipse.jem.beaninfo.BeanInfoNature + org.eclipse.wst.common.project.facet.core.nature + org.eclipse.wst.jsdt.core.jsNature + diff --git a/threema-connector-webtest/.settings/.jsdtscope b/threema-connector-webtest/.settings/.jsdtscope index 869c01d..e4ab59a 100644 --- a/threema-connector-webtest/.settings/.jsdtscope +++ b/threema-connector-webtest/.settings/.jsdtscope @@ -1,12 +1,17 @@ - - - - - - - - - + + + + + + + + + diff --git a/threema-connector-webtest/.settings/org.eclipse.wst.common.component b/threema-connector-webtest/.settings/org.eclipse.wst.common.component index 0df1516..294e9ee 100644 --- a/threema-connector-webtest/.settings/org.eclipse.wst.common.component +++ b/threema-connector-webtest/.settings/org.eclipse.wst.common.component @@ -1,11 +1,20 @@ - - - - - - - - - - + + + + + + + + + + + diff --git a/threema-connector-webtest/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml b/threema-connector-webtest/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml index 9b4b9fc..e725c8d 100644 --- a/threema-connector-webtest/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml +++ b/threema-connector-webtest/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml @@ -1,7 +1,8 @@ - + diff --git a/threema-connector-webtest/.settings/org.eclipse.wst.common.project.facet.core.xml b/threema-connector-webtest/.settings/org.eclipse.wst.common.project.facet.core.xml index 156ecdb..3bb273d 100644 --- a/threema-connector-webtest/.settings/org.eclipse.wst.common.project.facet.core.xml +++ b/threema-connector-webtest/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -1,8 +1,8 @@ - - - - - + + + + + diff --git a/threema-connector-webtest/config/persistence.xml b/threema-connector-webtest/config/persistence.xml index d6b96d7..3de1768 100644 --- a/threema-connector-webtest/config/persistence.xml +++ b/threema-connector-webtest/config/persistence.xml @@ -1,2 +1,4 @@ - + diff --git a/threema-connector-webtest/config/roles.xml b/threema-connector-webtest/config/roles.xml index 59892fe..c7c6911 100644 --- a/threema-connector-webtest/config/roles.xml +++ b/threema-connector-webtest/config/roles.xml @@ -1,4 +1,4 @@ - Everybody + Everybody diff --git a/threema-connector-webtest/config/users.xml b/threema-connector-webtest/config/users.xml index 51a6906..1e173fa 100644 --- a/threema-connector-webtest/config/users.xml +++ b/threema-connector-webtest/config/users.xml @@ -1,2 +1,2 @@ - + diff --git a/threema-connector/.classpath b/threema-connector/.classpath index 92dce2f..534320b 100644 --- a/threema-connector/.classpath +++ b/threema-connector/.classpath @@ -1,33 +1,37 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/threema-connector/.project b/threema-connector/.project index 880014f..fd84dab 100644 --- a/threema-connector/.project +++ b/threema-connector/.project @@ -1,49 +1,49 @@ - threema-connector - - - - - - ch.ivyteam.ivy.designer.dataClasses.ui.ivyDataClassBuilder - - - - - ch.ivyteam.ivy.designer.process.ui.ivyWebServiceProcessClassBuilder - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - ch.ivyteam.ivy.designer.ide.ivyModelValidationBuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - ch.ivyteam.ivy.project.IvyProjectNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - org.eclipse.jem.beaninfo.BeanInfoNature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.wst.jsdt.core.jsNature - + threema-connector + + + + + + ch.ivyteam.ivy.designer.dataClasses.ui.ivyDataClassBuilder + + + + + ch.ivyteam.ivy.designer.process.ui.ivyWebServiceProcessClassBuilder + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + ch.ivyteam.ivy.designer.ide.ivyModelValidationBuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + ch.ivyteam.ivy.project.IvyProjectNature + org.eclipse.wst.common.modulecore.ModuleCoreNature + org.eclipse.jem.workbench.JavaEMFNature + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + org.eclipse.jem.beaninfo.BeanInfoNature + org.eclipse.wst.common.project.facet.core.nature + org.eclipse.wst.jsdt.core.jsNature + diff --git a/threema-connector/.settings/.jsdtscope b/threema-connector/.settings/.jsdtscope index 869c01d..e4ab59a 100644 --- a/threema-connector/.settings/.jsdtscope +++ b/threema-connector/.settings/.jsdtscope @@ -1,12 +1,17 @@ - - - - - - - - - + + + + + + + + + diff --git a/threema-connector/.settings/org.eclipse.wst.common.component b/threema-connector/.settings/org.eclipse.wst.common.component index 52f4a81..e3fa242 100644 --- a/threema-connector/.settings/org.eclipse.wst.common.component +++ b/threema-connector/.settings/org.eclipse.wst.common.component @@ -1,10 +1,17 @@ - - - - - - - - - + + + + + + + + + + diff --git a/threema-connector/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml b/threema-connector/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml index 9b4b9fc..e725c8d 100644 --- a/threema-connector/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml +++ b/threema-connector/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml @@ -1,7 +1,8 @@ - + diff --git a/threema-connector/.settings/org.eclipse.wst.common.project.facet.core.xml b/threema-connector/.settings/org.eclipse.wst.common.project.facet.core.xml index 156ecdb..3bb273d 100644 --- a/threema-connector/.settings/org.eclipse.wst.common.project.facet.core.xml +++ b/threema-connector/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -1,8 +1,8 @@ - - - - - + + + + + diff --git a/threema-connector/config/persistence.xml b/threema-connector/config/persistence.xml index d6b96d7..3de1768 100644 --- a/threema-connector/config/persistence.xml +++ b/threema-connector/config/persistence.xml @@ -1,2 +1,4 @@ - + diff --git a/threema-connector/config/roles.xml b/threema-connector/config/roles.xml index 59892fe..c7c6911 100644 --- a/threema-connector/config/roles.xml +++ b/threema-connector/config/roles.xml @@ -1,4 +1,4 @@ - Everybody + Everybody diff --git a/threema-connector/config/users.xml b/threema-connector/config/users.xml index 51a6906..1e173fa 100644 --- a/threema-connector/config/users.xml +++ b/threema-connector/config/users.xml @@ -1,2 +1,2 @@ - + diff --git a/threema-connector/dataclasses/threema/connector/receiverData.ivyClass b/threema-connector/dataclasses/threema/connector/receiverData.ivyClass deleted file mode 100644 index 5c04ddf..0000000 --- a/threema-connector/dataclasses/threema/connector/receiverData.ivyClass +++ /dev/null @@ -1,20 +0,0 @@ -receiverData #class -threema.connector #namespace -identifier String #field -identifier PERSISTENT #fieldModifier -threemaId String #field -threemaId PERSISTENT #fieldModifier -type util.LookupType #field -type PERSISTENT #fieldModifier -publicKey String #field -publicKey PERSISTENT #fieldModifier -nonce String #field -nonce PERSISTENT #fieldModifier -encryptedMessage String #field -encryptedMessage PERSISTENT #fieldModifier -plainMessage String #field -plainMessage PERSISTENT #fieldModifier -messageJson String #field -messageJson PERSISTENT #fieldModifier -apiResponse String #field -apiResponse PERSISTENT #fieldModifier diff --git a/threema-connector/dataclasses/threema/connector/sendThreemaMessageData.ivyClass b/threema-connector/dataclasses/threema/connector/sendThreemaMessageData.ivyClass deleted file mode 100644 index a735433..0000000 --- a/threema-connector/dataclasses/threema/connector/sendThreemaMessageData.ivyClass +++ /dev/null @@ -1,12 +0,0 @@ -sendThreemaMessageData #class -threema.connector #namespace -receiver List #field -receiver PERSISTENT #fieldModifier -plainMessage String #field -plainMessage PERSISTENT #fieldModifier -receiverData List #field -receiverData PERSISTENT #fieldModifier -sendCount Number #field -sendCount PERSISTENT #fieldModifier -apiResponses List #field -apiResponses PERSISTENT #fieldModifier diff --git a/threema-connector/processes/multipleRecipients.p.json b/threema-connector/processes/multipleRecipients.p.json index 3a38680..5714346 100644 --- a/threema-connector/processes/multipleRecipients.p.json +++ b/threema-connector/processes/multipleRecipients.p.json @@ -3,7 +3,7 @@ "id" : "18B22DA4C8AA09A2", "kind" : "CALLABLE_SUB", "config" : { - "data" : "threema.connector.sendThreemaMessageData" + "data" : "threema.connector.SendThreemaMessageData" }, "elements" : [ { "id" : "f0", @@ -58,19 +58,19 @@ }, "code" : [ "import util.LookupType;", - "import threema.connector.receiverData;", + "import threema.connector.ReceiverData;", "", "import ch.ivyteam.ivy.environment.Ivy;", "", "for(String rec : in.receiver){", - " receiverData recDat = new receiverData();", + " ReceiverData recDat = new ReceiverData();", " recDat.plainMessage = in.plainMessage;", " recDat.identifier = rec;", " recDat.type = LookupType.getByPattern(rec);", " out.receiverData.add(recDat);", "}", "", - "for(receiverData rec : out.receiverData){", + "for(ReceiverData rec : out.receiverData){", " Ivy.log().debug(rec.identifier + \" \" + rec.type + \" \" + rec.plainMessage);", "}" ] diff --git a/threema-connector/processes/singleRecipient.p.json b/threema-connector/processes/singleRecipient.p.json index 4cf5b74..544ffa6 100644 --- a/threema-connector/processes/singleRecipient.p.json +++ b/threema-connector/processes/singleRecipient.p.json @@ -3,7 +3,7 @@ "id" : "18B22C8212D554A9", "kind" : "CALLABLE_SUB", "config" : { - "data" : "threema.connector.receiverData" + "data" : "threema.connector.ReceiverData" }, "elements" : [ { "id" : "f0", @@ -59,7 +59,7 @@ "type" : "SubProcessCall", "name" : "getReceiverInfo", "config" : { - "processCall" : "util/getReceiverInfo:call(threema.connector.receiverData)", + "processCall" : "util/getReceiverInfo:call(threema.connector.ReceiverData)", "output" : { "map" : { "out" : "result.receiverData" @@ -67,7 +67,7 @@ }, "call" : { "params" : [ - { "name" : "receiverData", "type" : "threema.connector.receiverData" } + { "name" : "receiverData", "type" : "threema.connector.ReceiverData" } ], "map" : { "param.receiverData" : "in" @@ -85,7 +85,7 @@ "type" : "SubProcessCall", "name" : "messageEncryption", "config" : { - "processCall" : "util/messageEncryption:call(threema.connector.receiverData)", + "processCall" : "util/messageEncryption:call(threema.connector.ReceiverData)", "output" : { "map" : { "out" : "result.receiverData" @@ -93,7 +93,7 @@ }, "call" : { "params" : [ - { "name" : "receiverData", "type" : "threema.connector.receiverData" } + { "name" : "receiverData", "type" : "threema.connector.ReceiverData" } ], "map" : { "param.receiverData" : "in" @@ -111,7 +111,7 @@ "type" : "SubProcessCall", "name" : "send", "config" : { - "processCall" : "util/sendMessage:call(threema.connector.receiverData)", + "processCall" : "util/sendMessage:call(threema.connector.ReceiverData)", "output" : { "map" : { "out" : "in", @@ -120,7 +120,7 @@ }, "call" : { "params" : [ - { "name" : "receiverData", "type" : "threema.connector.receiverData" } + { "name" : "receiverData", "type" : "threema.connector.ReceiverData" } ], "map" : { "param.receiverData" : "in" diff --git a/threema-connector/processes/util/getReceiverInfo.p.json b/threema-connector/processes/util/getReceiverInfo.p.json index e9e478a..25a794d 100644 --- a/threema-connector/processes/util/getReceiverInfo.p.json +++ b/threema-connector/processes/util/getReceiverInfo.p.json @@ -3,7 +3,7 @@ "id" : "18B22C967B82A625", "kind" : "CALLABLE_SUB", "config" : { - "data" : "threema.connector.receiverData" + "data" : "threema.connector.ReceiverData" }, "elements" : [ { "id" : "f0", @@ -13,7 +13,7 @@ "callSignature" : "call", "input" : { "params" : [ - { "name" : "receiverData", "type" : "threema.connector.receiverData" } + { "name" : "receiverData", "type" : "threema.connector.ReceiverData" } ], "map" : { "out" : "param.receiverData", @@ -22,7 +22,7 @@ }, "result" : { "params" : [ - { "name" : "receiverData", "type" : "threema.connector.receiverData" } + { "name" : "receiverData", "type" : "threema.connector.ReceiverData" } ], "map" : { "result.receiverData" : "in" @@ -49,8 +49,8 @@ "clientId" : "af315689-b538-4142-a823-0632d66754d7", "clientErrorCode" : "ivy:error:rest:client", "queryParams" : { - "secret" : "ivy.var.connector_secret", - "from" : "ivy.var.connector_threemaId" + "secret" : "ivy.var.threemaConnector_secret", + "from" : "ivy.var.threemaConnector_threemaId" }, "statusErrorCode" : ">> Ignore status", "responseMapping" : { @@ -78,8 +78,8 @@ "clientId" : "af315689-b538-4142-a823-0632d66754d7", "clientErrorCode" : "ivy:error:rest:client", "queryParams" : { - "from" : "ivy.var.connector_threemaId", - "secret" : "ivy.var.connector_secret" + "from" : "ivy.var.threemaConnector_threemaId", + "secret" : "ivy.var.threemaConnector_secret" }, "statusErrorCode" : ">> Ignore status", "responseMapping" : { diff --git a/threema-connector/processes/util/sendMessage.p.json b/threema-connector/processes/util/sendMessage.p.json index 40151fb..32439a5 100644 --- a/threema-connector/processes/util/sendMessage.p.json +++ b/threema-connector/processes/util/sendMessage.p.json @@ -3,7 +3,7 @@ "id" : "18B22CED0FA1555D", "kind" : "CALLABLE_SUB", "config" : { - "data" : "threema.connector.receiverData" + "data" : "threema.connector.ReceiverData" }, "elements" : [ { "id" : "f0", @@ -13,7 +13,7 @@ "callSignature" : "call", "input" : { "params" : [ - { "name" : "receiverData", "type" : "threema.connector.receiverData" } + { "name" : "receiverData", "type" : "threema.connector.ReceiverData" } ], "map" : { "out" : "param.receiverData" @@ -21,7 +21,7 @@ }, "result" : { "params" : [ - { "name" : "receiverData", "type" : "threema.connector.receiverData" } + { "name" : "receiverData", "type" : "threema.connector.ReceiverData" } ], "map" : { "result.receiverData" : "in" @@ -45,11 +45,12 @@ "name" : "sendMessage", "config" : { "bodyForm" : { - "from" : "ivy.var.connector_threemaId", + "from" : "ivy.var.threemaConnector_threemaId", "to" : "in.threemaId", "nonce" : "in.nonce", "box" : "in.encryptedMessage", - "secret" : "ivy.var.connector_secret" + "secret" : "ivy.var.threemaConnector_secret", + "" : "" }, "path" : "send_e2e", "headers" : { From 8b8e77dde4d4090075d7ac553891c2ea5d9f78b8 Mon Sep 17 00:00:00 2001 From: Fabian Heuberger Date: Fri, 20 Oct 2023 13:01:35 +0200 Subject: [PATCH 26/58] fixed artifact id --- pom.xml | 1 + threema-connector-product/pom.xml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index e39362d..b19878c 100644 --- a/pom.xml +++ b/pom.xml @@ -15,6 +15,7 @@ ${project.name}-demo ${project.name}-test ${project.name}-product + ${project.name}-webtest
diff --git a/threema-connector-product/pom.xml b/threema-connector-product/pom.xml index 028d448..0f41ee5 100644 --- a/threema-connector-product/pom.xml +++ b/threema-connector-product/pom.xml @@ -3,7 +3,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 com.axonivy.connector.threema - threema-connector + threema-connector-product 10.0.0-SNAPSHOT pom From 2a6baa63b92a5ebda46dccafc6d1ea8cd6cc869e Mon Sep 17 00:00:00 2001 From: Fabian Heuberger Date: Fri, 20 Oct 2023 13:37:40 +0200 Subject: [PATCH 27/58] fixed perstistence.xml --- threema-connector/config/persistence.xml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/threema-connector/config/persistence.xml b/threema-connector/config/persistence.xml index 3de1768..d6b96d7 100644 --- a/threema-connector/config/persistence.xml +++ b/threema-connector/config/persistence.xml @@ -1,4 +1,2 @@ - + From 0ba85cd954bb4ed7a918e8ed8a2d3bbdf9d60ca6 Mon Sep 17 00:00:00 2001 From: Fabian Heuberger Date: Fri, 20 Oct 2023 13:38:32 +0200 Subject: [PATCH 28/58] removed unused ; --- threema-connector/src/util/MessageEncryptor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/threema-connector/src/util/MessageEncryptor.java b/threema-connector/src/util/MessageEncryptor.java index c1518c7..cf90394 100644 --- a/threema-connector/src/util/MessageEncryptor.java +++ b/threema-connector/src/util/MessageEncryptor.java @@ -8,7 +8,7 @@ public class MessageEncryptor { - public record EncryptionResult(String encryptedMessage, String nonce) {}; + public record EncryptionResult(String encryptedMessage, String nonce) {} public static EncryptionResult encrypt(String publicKey, String msg) { byte[] encPrivKey = DatatypeConverter.parseHexBinary(Ivy.var().get("threemaConnector.privateKey")); From 9f72f7d1796f390c841647c02b9deb9df0defe27 Mon Sep 17 00:00:00 2001 From: ivy-fhe <146715063+ivy-fhe@users.noreply.github.com> Date: Fri, 20 Oct 2023 13:44:42 +0200 Subject: [PATCH 29/58] Update .classpath removed linebreak --- threema-connector/.classpath | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/threema-connector/.classpath b/threema-connector/.classpath index 534320b..37f38ba 100644 --- a/threema-connector/.classpath +++ b/threema-connector/.classpath @@ -29,9 +29,7 @@ - - + + From 63b62d81bcabd66dcc8a85b338f3fdf5ed4b77dc Mon Sep 17 00:00:00 2001 From: Fabian Heuberger Date: Fri, 20 Oct 2023 15:21:44 +0200 Subject: [PATCH 30/58] added threema-msgapi-tool.* to .gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 851ab69..0608cea 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,5 @@ threema-connector/config/variables.yaml threema-connector/config/variables.yaml_template threema-connector/config/variables.yaml_complete +# threema SKD +**/threema-msgapi-tool.* From f3eb53b2e857a4ca348a57273af9f4697fc0e8ca Mon Sep 17 00:00:00 2001 From: Fabian Heuberger Date: Fri, 20 Oct 2023 15:22:02 +0200 Subject: [PATCH 31/58] added plugin to download and extract threema sdk --- threema-connector/pom.xml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/threema-connector/pom.xml b/threema-connector/pom.xml index 2b104a9..55903d7 100644 --- a/threema-connector/pom.xml +++ b/threema-connector/pom.xml @@ -17,6 +17,31 @@ 10.0.6 true + + org.apache.maven.plugins + maven-antrun-plugin + 3.1.0 + + + download-threema-msgapi-tool + validate + + run + + + + + + + + + + + +
From 112da5c3d648c11e062abb40ee4665eb13f23b16 Mon Sep 17 00:00:00 2001 From: Fabian Heuberger Date: Fri, 20 Oct 2023 15:24:40 +0200 Subject: [PATCH 32/58] temporary removed extraction from task --- threema-connector/pom.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/threema-connector/pom.xml b/threema-connector/pom.xml index 55903d7..6cb903d 100644 --- a/threema-connector/pom.xml +++ b/threema-connector/pom.xml @@ -32,11 +32,13 @@ + From 56a0c7cc4041ff491c0326b73e4511b7f82babdc Mon Sep 17 00:00:00 2001 From: Fabian Heuberger Date: Fri, 20 Oct 2023 15:27:32 +0200 Subject: [PATCH 33/58] extracted unzip into own execution step --- threema-connector/pom.xml | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/threema-connector/pom.xml b/threema-connector/pom.xml index 6cb903d..0c710be 100644 --- a/threema-connector/pom.xml +++ b/threema-connector/pom.xml @@ -32,13 +32,28 @@ - + + + + + + extract-threema-msgapi-tool + validate + + run + + + + + + From c8094a0d6bfdebcff4ebe1a502d0637315e53447 Mon Sep 17 00:00:00 2001 From: Fabian Heuberger Date: Fri, 20 Oct 2023 15:34:23 +0200 Subject: [PATCH 34/58] added correct artifactid and groupId --- threema-connector-product/product.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/threema-connector-product/product.json b/threema-connector-product/product.json index a5a4b33..13070f6 100644 --- a/threema-connector-product/product.json +++ b/threema-connector-product/product.json @@ -6,8 +6,8 @@ "data": { "projects": [ { - "groupId": "MY-GROUP-ID", - "artifactId": "MY-PRODUCT-NAME-demo", + "groupId": "com.axonivy.connector.threema", + "artifactId": "threema-connector-demo", "version": "${version}", "type": "iar" } @@ -28,8 +28,8 @@ "data": { "dependencies": [ { - "groupId": "MY-GROUP-ID", - "artifactId": "MY-PRODUCT-NAME", + "groupId": "com.axonivy.connector.threema", + "artifactId": "threema-connector", "version": "${version}", "type": "iar" } @@ -50,8 +50,8 @@ "data": { "dependencies": [ { - "groupId": "MY-GROUP-ID", - "artifactId": "MY-PRODUCT-NAME", + "groupId": "com.axonivy.connector.threema", + "artifactId": "threema-connector", "version": "${version}" } ], From 1ebf09e8186f06da8292f158fd39bd48a42d0b01 Mon Sep 17 00:00:00 2001 From: Fabian Heuberger Date: Fri, 20 Oct 2023 15:42:11 +0200 Subject: [PATCH 35/58] added mkdir to antrun --- .gitignore | 2 +- threema-connector/pom.xml | 9 ++------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 0608cea..a0ceba0 100644 --- a/.gitignore +++ b/.gitignore @@ -24,4 +24,4 @@ threema-connector/config/variables.yaml_template threema-connector/config/variables.yaml_complete # threema SKD -**/threema-msgapi-tool.* +threema-connector/lib/threema-msgapi-tool.* diff --git a/threema-connector/pom.xml b/threema-connector/pom.xml index 0c710be..0278c8f 100644 --- a/threema-connector/pom.xml +++ b/threema-connector/pom.xml @@ -30,14 +30,9 @@ + - - - - + dest="${project.basedir}/lib/threema-msgapi-tool.zip"/> From 4a360b9964a13471a218d302fa1efb79999722c6 Mon Sep 17 00:00:00 2001 From: ivy-fhe Date: Wed, 25 Oct 2023 07:33:06 +0000 Subject: [PATCH 36/58] [maven-release-plugin] prepare release v10.0.0 --- pom.xml | 8 +++----- threema-connector-demo/pom.xml | 7 ++----- threema-connector-product/pom.xml | 17 +++++------------ threema-connector-test/pom.xml | 7 ++----- threema-connector-webtest/pom.xml | 7 ++----- threema-connector/pom.xml | 18 ++++++------------ 6 files changed, 20 insertions(+), 44 deletions(-) diff --git a/pom.xml b/pom.xml index b19878c..33c8576 100644 --- a/pom.xml +++ b/pom.xml @@ -1,12 +1,10 @@ - + 4.0.0 com.axonivy.connector.threema threema-connector threema-connector-modules - 10.0.0-SNAPSHOT pom @@ -20,7 +18,7 @@ scm:git:https://github.com/axonivy-market/${project.name}.git - HEAD + v10.0.0 diff --git a/threema-connector-demo/pom.xml b/threema-connector-demo/pom.xml index 216711e..4f0e7e6 100644 --- a/threema-connector-demo/pom.xml +++ b/threema-connector-demo/pom.xml @@ -1,12 +1,9 @@ - + 4.0.0 com.axonivy.connector.threema threema-connector-demo - 10.0.0-SNAPSHOT + 10.0.0 iar diff --git a/threema-connector-product/pom.xml b/threema-connector-product/pom.xml index 0f41ee5..7ed6e17 100644 --- a/threema-connector-product/pom.xml +++ b/threema-connector-product/pom.xml @@ -1,10 +1,8 @@ - + 4.0.0 com.axonivy.connector.threema threema-connector-product - 10.0.0-SNAPSHOT + 10.0.0 pom @@ -44,14 +42,9 @@ - - - + + + diff --git a/threema-connector-test/pom.xml b/threema-connector-test/pom.xml index 975a634..21fad6a 100644 --- a/threema-connector-test/pom.xml +++ b/threema-connector-test/pom.xml @@ -1,12 +1,9 @@ - + 4.0.0 com.axonivy.connector.threema threema-connector-test - 10.0.0-SNAPSHOT + 10.0.0 iar diff --git a/threema-connector-webtest/pom.xml b/threema-connector-webtest/pom.xml index a59ddf9..8435efd 100644 --- a/threema-connector-webtest/pom.xml +++ b/threema-connector-webtest/pom.xml @@ -1,12 +1,9 @@ - + 4.0.0 com.axonivy.connector.threema threema-connector-webtest - 10.0.0-SNAPSHOT + 10.0.0 iar-integration-test diff --git a/threema-connector/pom.xml b/threema-connector/pom.xml index 0278c8f..37fc40a 100644 --- a/threema-connector/pom.xml +++ b/threema-connector/pom.xml @@ -1,12 +1,9 @@ - + 4.0.0 com.axonivy.connector.threema threema-connector - 10.0.0-SNAPSHOT + 10.0.0 iar @@ -30,9 +27,8 @@ - - + + @@ -44,10 +40,8 @@ - - + + From 85974dac9d914a491cc513b080eb31d80f52f8c5 Mon Sep 17 00:00:00 2001 From: ivy-fhe Date: Wed, 25 Oct 2023 07:33:09 +0000 Subject: [PATCH 37/58] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- threema-connector-demo/pom.xml | 2 +- threema-connector-product/pom.xml | 2 +- threema-connector-test/pom.xml | 2 +- threema-connector-webtest/pom.xml | 2 +- threema-connector/pom.xml | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pom.xml b/pom.xml index 33c8576..5004fdb 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.axonivy.connector. or com.axonivy.utils. --> threema-connector threema-connector-modules - 10.0.0 pom @@ -18,7 +18,7 @@ scm:git:https://github.com/axonivy-market/${project.name}.git - v10.0.0 + HEAD diff --git a/threema-connector-demo/pom.xml b/threema-connector-demo/pom.xml index 4f0e7e6..5217ae2 100644 --- a/threema-connector-demo/pom.xml +++ b/threema-connector-demo/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.axonivy.connector.threema threema-connector-demo - 10.0.0 + 10.0.1-SNAPSHOT iar diff --git a/threema-connector-product/pom.xml b/threema-connector-product/pom.xml index 7ed6e17..ba6c075 100644 --- a/threema-connector-product/pom.xml +++ b/threema-connector-product/pom.xml @@ -2,7 +2,7 @@ 4.0.0 com.axonivy.connector.threema threema-connector-product - 10.0.0 + 10.0.1-SNAPSHOT pom diff --git a/threema-connector-test/pom.xml b/threema-connector-test/pom.xml index 21fad6a..1ffd0fd 100644 --- a/threema-connector-test/pom.xml +++ b/threema-connector-test/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.axonivy.connector.threema threema-connector-test - 10.0.0 + 10.0.1-SNAPSHOT iar diff --git a/threema-connector-webtest/pom.xml b/threema-connector-webtest/pom.xml index 8435efd..1dcbb01 100644 --- a/threema-connector-webtest/pom.xml +++ b/threema-connector-webtest/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.axonivy.connector.threema threema-connector-webtest - 10.0.0 + 10.0.1-SNAPSHOT iar-integration-test diff --git a/threema-connector/pom.xml b/threema-connector/pom.xml index 37fc40a..6aed1bb 100644 --- a/threema-connector/pom.xml +++ b/threema-connector/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.axonivy.connector.threema threema-connector - 10.0.0 + 10.0.1-SNAPSHOT iar From e8270422c40134dcbacbe13e9ec0754db1a10007 Mon Sep 17 00:00:00 2001 From: Fabian Heuberger Date: Wed, 25 Oct 2023 15:57:38 +0200 Subject: [PATCH 38/58] XIVY-12667 removed dropin installer as it is not needed --- threema-connector-product/product.json | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/threema-connector-product/product.json b/threema-connector-product/product.json index 13070f6..97d486b 100644 --- a/threema-connector-product/product.json +++ b/threema-connector-product/product.json @@ -44,27 +44,6 @@ } ] } - }, - { - "id": "maven-dropins", - "data": { - "dependencies": [ - { - "groupId": "com.axonivy.connector.threema", - "artifactId": "threema-connector", - "version": "${version}" - } - ], - "repositories": [ - { - "id": "maven.axonivy.com", - "url": "https://maven.axonivy.com", - "snapshots": { - "enabled": "true" - } - } - ] - } } ] } From 07f56ab5cf503594182943c3d82af5debfbf840b Mon Sep 17 00:00:00 2001 From: Fabian Heuberger Date: Wed, 25 Oct 2023 16:04:43 +0200 Subject: [PATCH 39/58] XIVY-12667 Added Maven ant execution to delete zip-archive --- threema-connector/pom.xml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/threema-connector/pom.xml b/threema-connector/pom.xml index 0278c8f..fa47fdd 100644 --- a/threema-connector/pom.xml +++ b/threema-connector/pom.xml @@ -52,6 +52,18 @@ + + delete-threema-msgapi-tool-archive + validate + + run + + + + + + + From 21997064924c48afc63eb30418a9f05a03727d0e Mon Sep 17 00:00:00 2001 From: Fabian Heuberger Date: Wed, 25 Oct 2023 17:03:45 +0200 Subject: [PATCH 40/58] XIVY-12667 Added process to generate keypair --- .../connector/createKeyPairData.ivyClass | 6 + .../processes/createKeyPair.p.json | 67 +++++++++++ .../src/util/KeyPairGenerator.java | 19 +++ .../connector/KeyPair/KeyPair.rddescriptor | 7 ++ .../threema/connector/KeyPair/KeyPair.xhtml | 35 ++++++ .../connector/KeyPair/KeyPairData.ivyClass | 4 + .../connector/KeyPair/KeyPairProcess.p.json | 52 +++++++++ .../webContent/layouts/frame-10.xhtml | 60 ++++++++++ .../layouts/includes/exception-details.xhtml | 109 ++++++++++++++++++ .../layouts/includes/exception.xhtml | 47 ++++++++ .../webContent/layouts/includes/footer.xhtml | 18 +++ .../layouts/includes/progress-loader.xhtml | 15 +++ 12 files changed, 439 insertions(+) create mode 100644 threema-connector/dataclasses/threema/connector/createKeyPairData.ivyClass create mode 100644 threema-connector/processes/createKeyPair.p.json create mode 100644 threema-connector/src/util/KeyPairGenerator.java create mode 100644 threema-connector/src_hd/threema/connector/KeyPair/KeyPair.rddescriptor create mode 100644 threema-connector/src_hd/threema/connector/KeyPair/KeyPair.xhtml create mode 100644 threema-connector/src_hd/threema/connector/KeyPair/KeyPairData.ivyClass create mode 100644 threema-connector/src_hd/threema/connector/KeyPair/KeyPairProcess.p.json create mode 100644 threema-connector/webContent/layouts/frame-10.xhtml create mode 100644 threema-connector/webContent/layouts/includes/exception-details.xhtml create mode 100644 threema-connector/webContent/layouts/includes/exception.xhtml create mode 100644 threema-connector/webContent/layouts/includes/footer.xhtml create mode 100644 threema-connector/webContent/layouts/includes/progress-loader.xhtml diff --git a/threema-connector/dataclasses/threema/connector/createKeyPairData.ivyClass b/threema-connector/dataclasses/threema/connector/createKeyPairData.ivyClass new file mode 100644 index 0000000..5e2b755 --- /dev/null +++ b/threema-connector/dataclasses/threema/connector/createKeyPairData.ivyClass @@ -0,0 +1,6 @@ +createKeyPairData #class +threema.connector #namespace +privateKey String #field +privateKey PERSISTENT #fieldModifier +publicKey String #field +publicKey PERSISTENT #fieldModifier diff --git a/threema-connector/processes/createKeyPair.p.json b/threema-connector/processes/createKeyPair.p.json new file mode 100644 index 0000000..9427be7 --- /dev/null +++ b/threema-connector/processes/createKeyPair.p.json @@ -0,0 +1,67 @@ +{ + "format" : "10.0.0", + "id" : "18B67537F65B8CEE", + "config" : { + "data" : "threema.connector.createKeyPairData" + }, + "elements" : [ { + "id" : "f0", + "type" : "RequestStart", + "name" : "start.ivp", + "config" : { + "callSignature" : "start", + "outLink" : "start.ivp" + }, + "visual" : { + "at" : { "x" : 96, "y" : 64 } + }, + "connect" : { "id" : "f4", "to" : "f3" } + }, { + "id" : "f1", + "type" : "TaskEnd", + "visual" : { + "at" : { "x" : 696, "y" : 64 } + } + }, { + "id" : "f3", + "type" : "Script", + "name" : "generateKeyPair", + "config" : { + "output" : { + "code" : [ + "import util.KeyPairGenerator;", + "import util.KeyPairGenerator.KeyPair;", + "", + "KeyPair keys = KeyPairGenerator.generate();", + "", + "out.publicKey = keys.publicKey();", + "out.privateKey = keys.privateKey();" + ] + } + }, + "visual" : { + "at" : { "x" : 320, "y" : 64 } + }, + "connect" : { "id" : "f6", "to" : "f5" } + }, { + "id" : "f5", + "type" : "DialogCall", + "name" : "KeyPair", + "config" : { + "dialogId" : "threema.connector.KeyPair", + "startMethod" : "start(threema.connector.createKeyPairData)", + "call" : { + "params" : [ + { "name" : "createKeyPairData", "type" : "threema.connector.createKeyPairData" } + ], + "map" : { + "param.createKeyPairData" : "in" + } + } + }, + "visual" : { + "at" : { "x" : 508, "y" : 64 } + }, + "connect" : { "id" : "f2", "to" : "f1" } + } ] +} \ No newline at end of file diff --git a/threema-connector/src/util/KeyPairGenerator.java b/threema-connector/src/util/KeyPairGenerator.java new file mode 100644 index 0000000..1b12c98 --- /dev/null +++ b/threema-connector/src/util/KeyPairGenerator.java @@ -0,0 +1,19 @@ +package util; + +import javax.xml.bind.DatatypeConverter; + +import ch.threema.apitool.CryptTool; + +public class KeyPairGenerator { + + public record KeyPair(String publicKey, String privateKey) {} + + public static KeyPair generate() { + byte[] publicKey = new byte[32]; + byte[] privateKey = new byte[32]; + + CryptTool.generateKeyPair(publicKey, privateKey); + return new KeyPair(DatatypeConverter.printHexBinary(publicKey), DatatypeConverter.printHexBinary(privateKey)); + } + +} diff --git a/threema-connector/src_hd/threema/connector/KeyPair/KeyPair.rddescriptor b/threema-connector/src_hd/threema/connector/KeyPair/KeyPair.rddescriptor new file mode 100644 index 0000000..ae605f0 --- /dev/null +++ b/threema-connector/src_hd/threema/connector/KeyPair/KeyPair.rddescriptor @@ -0,0 +1,7 @@ + + + + viewTechnology + JSF + + diff --git a/threema-connector/src_hd/threema/connector/KeyPair/KeyPair.xhtml b/threema-connector/src_hd/threema/connector/KeyPair/KeyPair.xhtml new file mode 100644 index 0000000..ff800ef --- /dev/null +++ b/threema-connector/src_hd/threema/connector/KeyPair/KeyPair.xhtml @@ -0,0 +1,35 @@ + + + + KeyPair + + +

Newly generated Keypair

+ + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+ + \ No newline at end of file diff --git a/threema-connector/src_hd/threema/connector/KeyPair/KeyPairData.ivyClass b/threema-connector/src_hd/threema/connector/KeyPair/KeyPairData.ivyClass new file mode 100644 index 0000000..b47ddd9 --- /dev/null +++ b/threema-connector/src_hd/threema/connector/KeyPair/KeyPairData.ivyClass @@ -0,0 +1,4 @@ +KeyPairData #class +threema.connector.KeyPair #namespace +createKeyPairData threema.connector.createKeyPairData #field +createKeyPairData PERSISTENT #fieldModifier diff --git a/threema-connector/src_hd/threema/connector/KeyPair/KeyPairProcess.p.json b/threema-connector/src_hd/threema/connector/KeyPair/KeyPairProcess.p.json new file mode 100644 index 0000000..d7e4795 --- /dev/null +++ b/threema-connector/src_hd/threema/connector/KeyPair/KeyPairProcess.p.json @@ -0,0 +1,52 @@ +{ + "format" : "10.0.0", + "id" : "18B675A6BCE832D1", + "kind" : "HTML_DIALOG", + "config" : { + "data" : "threema.connector.KeyPair.KeyPairData" + }, + "elements" : [ { + "id" : "f0", + "type" : "HtmlDialogStart", + "name" : "start(createKeyPairData)", + "config" : { + "callSignature" : "start", + "input" : { + "params" : [ + { "name" : "createKeyPairData", "type" : "threema.connector.createKeyPairData" } + ], + "map" : { + "out.createKeyPairData" : "param.createKeyPairData" + } + }, + "guid" : "18B675A6BCFECF51" + }, + "visual" : { + "at" : { "x" : 96, "y" : 64 } + }, + "connect" : { "id" : "f2", "to" : "f1" } + }, { + "id" : "f1", + "type" : "HtmlDialogEnd", + "visual" : { + "at" : { "x" : 224, "y" : 64 } + } + }, { + "id" : "f3", + "type" : "HtmlDialogEventStart", + "name" : "close", + "config" : { + "guid" : "18B675A6BD2AE7CB" + }, + "visual" : { + "at" : { "x" : 96, "y" : 160 } + }, + "connect" : { "id" : "f5", "to" : "f4" } + }, { + "id" : "f4", + "type" : "HtmlDialogExit", + "visual" : { + "at" : { "x" : 224, "y" : 160 } + } + } ] +} \ No newline at end of file diff --git a/threema-connector/webContent/layouts/frame-10.xhtml b/threema-connector/webContent/layouts/frame-10.xhtml new file mode 100644 index 0000000..936a73b --- /dev/null +++ b/threema-connector/webContent/layouts/frame-10.xhtml @@ -0,0 +1,60 @@ + + + + + + + + + + <ui:insert name="title">Ivy Html Dialog</ui:insert> + + + + + + + + + +
+ + default content + +
+ + + + + + + +
+ \ No newline at end of file diff --git a/threema-connector/webContent/layouts/includes/exception-details.xhtml b/threema-connector/webContent/layouts/includes/exception-details.xhtml new file mode 100644 index 0000000..bbc3cce --- /dev/null +++ b/threema-connector/webContent/layouts/includes/exception-details.xhtml @@ -0,0 +1,109 @@ + + + + + + +

+ +

+ + +

Error id

+

#{errorPage.exceptionId}

+

Error Timestamp

+

#{errorPage.createdAt}

+
+ + + + +

Attributes

+
+ + + + + + + + + + + + + + + +
NameValue
+
+
+

Thrown by

+

Process: + +
Element: + +

+
+ + +

Process call stack

+ +
#{caller.callerElement}
+
+
+ +

Technical cause

+
#{causedBy.class.simpleName}: #{causedBy.message.trim()}
+
+
+ +

Request Uri

+

#{errorPage.getRequestUri()}

+
+

Servlet

+

#{errorPage.getServletName()}

+
+ +

Application

+

#{errorPage.applicationName}

+
+ + +

Thread local values

+
+ + + + + + + + + + + + + + + +
KeyValue
+
+
+
+ +

Stack-Trace

+
#{errorPage.getStackTrace()}
+
+ diff --git a/threema-connector/webContent/layouts/includes/exception.xhtml b/threema-connector/webContent/layouts/includes/exception.xhtml new file mode 100644 index 0000000..1b255a2 --- /dev/null +++ b/threema-connector/webContent/layouts/includes/exception.xhtml @@ -0,0 +1,47 @@ + + + + + + + + + +
+
+ + +
+ + + + + + + + + +
+ + \ No newline at end of file diff --git a/threema-connector/webContent/layouts/includes/footer.xhtml b/threema-connector/webContent/layouts/includes/footer.xhtml new file mode 100644 index 0000000..f21699e --- /dev/null +++ b/threema-connector/webContent/layouts/includes/footer.xhtml @@ -0,0 +1,18 @@ + + + +
+ + #{ivyAdvisor.applicationName} + + +
+
+ + \ No newline at end of file diff --git a/threema-connector/webContent/layouts/includes/progress-loader.xhtml b/threema-connector/webContent/layouts/includes/progress-loader.xhtml new file mode 100644 index 0000000..0d68a75 --- /dev/null +++ b/threema-connector/webContent/layouts/includes/progress-loader.xhtml @@ -0,0 +1,15 @@ + + + + +
+
+
Loading...
+
+
+ + + +
+
\ No newline at end of file From abf23380f12bb1dd3fcc21148df57ba534ffb216 Mon Sep 17 00:00:00 2001 From: Fabian Heuberger Date: Wed, 25 Oct 2023 17:05:52 +0200 Subject: [PATCH 41/58] XIVY-12667 Updated README to include new process for key generation --- threema-connector-product/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/threema-connector-product/README.md b/threema-connector-product/README.md index 23f3305..8d89bea 100644 --- a/threema-connector-product/README.md +++ b/threema-connector-product/README.md @@ -13,8 +13,9 @@ Credentials and credits are required to send messages. The credentials can be cr ## Setup This Connector requires an "End-to-End Threema ID". [Request new ID](https://gateway.threema.ch/en/id-request)
-For generating the keys and requesting a new Threema.Gateway ID refer to [Generate keys](https://gateway.threema.ch/en/developer/howto/create-keys/php). +To request a new Threema.Gateway ID refer to [Generate keys](https://gateway.threema.ch/en/developer/howto/create-keys/php). +For generating the keys you can use the "createKeyPair" process. To use the Threema Connector, add the following variables to your Axon Ivy Project: ``` From 3dd36b5ee298dd772e83ea09123f428a4fe38f0d Mon Sep 17 00:00:00 2001 From: Fabian Heuberger Date: Wed, 25 Oct 2023 17:15:42 +0200 Subject: [PATCH 42/58] XIVY-12667 Added test for KeyPairGenerator --- .../test/util/KeyPairGeneratorTest.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 threema-connector-test/src_test/threema/connector/test/util/KeyPairGeneratorTest.java diff --git a/threema-connector-test/src_test/threema/connector/test/util/KeyPairGeneratorTest.java b/threema-connector-test/src_test/threema/connector/test/util/KeyPairGeneratorTest.java new file mode 100644 index 0000000..5bb233a --- /dev/null +++ b/threema-connector-test/src_test/threema/connector/test/util/KeyPairGeneratorTest.java @@ -0,0 +1,22 @@ +package threema.connector.test.util; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.jupiter.api.Test; + +import util.KeyPairGenerator; +import util.KeyPairGenerator.KeyPair; + +public class KeyPairGeneratorTest { + + @Test + void generateKeyPair() { + KeyPair keys = KeyPairGenerator.generate(); + assertThat(keys.publicKey()).isNotEmpty(); + assertThat(keys.privateKey()).isNotEmpty(); + + assertThat(keys.publicKey().length()).isEqualTo(64); + assertThat(keys.privateKey().length()).isEqualTo(64); + } + +} From 577760bbf9a7d4c984cb96595dd791e032bafde2 Mon Sep 17 00:00:00 2001 From: Fabian Heuberger Date: Thu, 26 Oct 2023 08:48:14 +0200 Subject: [PATCH 43/58] XIVY-12667 Added step by step instructions --- threema-connector-product/README.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/threema-connector-product/README.md b/threema-connector-product/README.md index 8d89bea..1f00c97 100644 --- a/threema-connector-product/README.md +++ b/threema-connector-product/README.md @@ -11,12 +11,10 @@ Credentials and credits are required to send messages. The credentials can be cr ![Result screen](./images/resultScreen.png) ## Setup -This Connector requires an "End-to-End Threema ID". [Request new ID](https://gateway.threema.ch/en/id-request) -
+1. Create "End-to-End Threema ID" at: [Request new ID](https://gateway.threema.ch/en/id-request) To request a new Threema.Gateway ID refer to [Generate keys](https://gateway.threema.ch/en/developer/howto/create-keys/php). - -For generating the keys you can use the "createKeyPair" process. -To use the Threema Connector, add the following variables to your Axon Ivy Project: +2. Generate a new key pair using the "createKeyPair" process. +3. Add the following variables to your Axon Ivy Project: ``` @variables.yaml@ From 548273c39759b333827ddcbb4bdd64a7bd166380 Mon Sep 17 00:00:00 2001 From: Fabian Heuberger Date: Thu, 26 Oct 2023 08:49:01 +0200 Subject: [PATCH 44/58] XIVY-12667 Combined 3 execution steps into 1 --- threema-connector/pom.xml | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-) diff --git a/threema-connector/pom.xml b/threema-connector/pom.xml index fa47fdd..5abdc54 100644 --- a/threema-connector/pom.xml +++ b/threema-connector/pom.xml @@ -32,38 +32,16 @@ - - - - - extract-threema-msgapi-tool - validate - - run - - - + dest="${project.basedir}/lib/threema-msgapi-tool.zip"/> - + + - - delete-threema-msgapi-tool-archive - validate - - run - - - - - - - From cf752ec943085171f206abdc22fcd8d3e13c2e46 Mon Sep 17 00:00:00 2001 From: ivy-fhe <146715063+ivy-fhe@users.noreply.github.com> Date: Thu, 26 Oct 2023 08:52:05 +0200 Subject: [PATCH 45/58] Update README.md --- threema-connector-product/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/threema-connector-product/README.md b/threema-connector-product/README.md index 1f00c97..781c8e8 100644 --- a/threema-connector-product/README.md +++ b/threema-connector-product/README.md @@ -11,7 +11,7 @@ Credentials and credits are required to send messages. The credentials can be cr ![Result screen](./images/resultScreen.png) ## Setup -1. Create "End-to-End Threema ID" at: [Request new ID](https://gateway.threema.ch/en/id-request) +1. Create "End-to-End Threema ID" at: [Request new ID](https://gateway.threema.ch/en/id-request)
To request a new Threema.Gateway ID refer to [Generate keys](https://gateway.threema.ch/en/developer/howto/create-keys/php). 2. Generate a new key pair using the "createKeyPair" process. 3. Add the following variables to your Axon Ivy Project: From d0aab780dfa05e0c64d9ec23aa61bc88135643ff Mon Sep 17 00:00:00 2001 From: ivy-fhe <146715063+ivy-fhe@users.noreply.github.com> Date: Thu, 26 Oct 2023 08:53:30 +0200 Subject: [PATCH 46/58] Update README.md --- threema-connector-product/README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/threema-connector-product/README.md b/threema-connector-product/README.md index 781c8e8..b8b02a3 100644 --- a/threema-connector-product/README.md +++ b/threema-connector-product/README.md @@ -11,9 +11,8 @@ Credentials and credits are required to send messages. The credentials can be cr ![Result screen](./images/resultScreen.png) ## Setup -1. Create "End-to-End Threema ID" at: [Request new ID](https://gateway.threema.ch/en/id-request)
-To request a new Threema.Gateway ID refer to [Generate keys](https://gateway.threema.ch/en/developer/howto/create-keys/php). -2. Generate a new key pair using the "createKeyPair" process. +1. Generate a new key pair using the "createKeyPair" process. +2. Create "End-to-End Threema ID" at: [Request new ID](https://gateway.threema.ch/en/id-request)
3. Add the following variables to your Axon Ivy Project: ``` From e5a3d65f9db9ca25b19ce8d9a00d2478d9dddd01 Mon Sep 17 00:00:00 2001 From: ivy-fhe Date: Thu, 26 Oct 2023 07:47:26 +0000 Subject: [PATCH 47/58] [maven-release-plugin] prepare release v10.0.1 --- pom.xml | 4 ++-- threema-connector-demo/pom.xml | 2 +- threema-connector-product/pom.xml | 2 +- threema-connector-test/pom.xml | 2 +- threema-connector-webtest/pom.xml | 2 +- threema-connector/pom.xml | 15 ++++++--------- 6 files changed, 12 insertions(+), 15 deletions(-) diff --git a/pom.xml b/pom.xml index 5004fdb..b1a707b 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.axonivy.connector. or com.axonivy.utils. --> threema-connector threema-connector-modules - 10.0.1-SNAPSHOT pom @@ -18,7 +18,7 @@ scm:git:https://github.com/axonivy-market/${project.name}.git - HEAD + v10.0.1 diff --git a/threema-connector-demo/pom.xml b/threema-connector-demo/pom.xml index 5217ae2..e2ece93 100644 --- a/threema-connector-demo/pom.xml +++ b/threema-connector-demo/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.axonivy.connector.threema threema-connector-demo - 10.0.1-SNAPSHOT + 10.0.1 iar diff --git a/threema-connector-product/pom.xml b/threema-connector-product/pom.xml index ba6c075..0b29a07 100644 --- a/threema-connector-product/pom.xml +++ b/threema-connector-product/pom.xml @@ -2,7 +2,7 @@ 4.0.0 com.axonivy.connector.threema threema-connector-product - 10.0.1-SNAPSHOT + 10.0.1 pom diff --git a/threema-connector-test/pom.xml b/threema-connector-test/pom.xml index 1ffd0fd..5f46b92 100644 --- a/threema-connector-test/pom.xml +++ b/threema-connector-test/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.axonivy.connector.threema threema-connector-test - 10.0.1-SNAPSHOT + 10.0.1 iar diff --git a/threema-connector-webtest/pom.xml b/threema-connector-webtest/pom.xml index 1dcbb01..d7013d9 100644 --- a/threema-connector-webtest/pom.xml +++ b/threema-connector-webtest/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.axonivy.connector.threema threema-connector-webtest - 10.0.1-SNAPSHOT + 10.0.1 iar-integration-test diff --git a/threema-connector/pom.xml b/threema-connector/pom.xml index 28d8f53..20243d6 100644 --- a/threema-connector/pom.xml +++ b/threema-connector/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.axonivy.connector.threema threema-connector - 10.0.1-SNAPSHOT + 10.0.1 iar @@ -27,15 +27,12 @@ - - - - + + + + - + From 55b105c026ae1c744136244bdc9384bfbf7f0b6e Mon Sep 17 00:00:00 2001 From: ivy-fhe Date: Thu, 26 Oct 2023 07:47:28 +0000 Subject: [PATCH 48/58] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- threema-connector-demo/pom.xml | 2 +- threema-connector-product/pom.xml | 2 +- threema-connector-test/pom.xml | 2 +- threema-connector-webtest/pom.xml | 2 +- threema-connector/pom.xml | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pom.xml b/pom.xml index b1a707b..4e22ebe 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.axonivy.connector. or com.axonivy.utils. --> threema-connector threema-connector-modules - 10.0.1 pom @@ -18,7 +18,7 @@ scm:git:https://github.com/axonivy-market/${project.name}.git - v10.0.1 + HEAD diff --git a/threema-connector-demo/pom.xml b/threema-connector-demo/pom.xml index e2ece93..981dd84 100644 --- a/threema-connector-demo/pom.xml +++ b/threema-connector-demo/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.axonivy.connector.threema threema-connector-demo - 10.0.1 + 10.0.2-SNAPSHOT iar diff --git a/threema-connector-product/pom.xml b/threema-connector-product/pom.xml index 0b29a07..ba20a2d 100644 --- a/threema-connector-product/pom.xml +++ b/threema-connector-product/pom.xml @@ -2,7 +2,7 @@ 4.0.0 com.axonivy.connector.threema threema-connector-product - 10.0.1 + 10.0.2-SNAPSHOT pom diff --git a/threema-connector-test/pom.xml b/threema-connector-test/pom.xml index 5f46b92..f614ad4 100644 --- a/threema-connector-test/pom.xml +++ b/threema-connector-test/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.axonivy.connector.threema threema-connector-test - 10.0.1 + 10.0.2-SNAPSHOT iar diff --git a/threema-connector-webtest/pom.xml b/threema-connector-webtest/pom.xml index d7013d9..fd5ebe5 100644 --- a/threema-connector-webtest/pom.xml +++ b/threema-connector-webtest/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.axonivy.connector.threema threema-connector-webtest - 10.0.1 + 10.0.2-SNAPSHOT iar-integration-test diff --git a/threema-connector/pom.xml b/threema-connector/pom.xml index 20243d6..11ba934 100644 --- a/threema-connector/pom.xml +++ b/threema-connector/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.axonivy.connector.threema threema-connector - 10.0.1 + 10.0.2-SNAPSHOT iar From 2f63d2adc74b3fc98b1f32ef279e5714fd4ea6e3 Mon Sep 17 00:00:00 2001 From: Fabian Heuberger Date: Thu, 2 Nov 2023 08:59:48 +0100 Subject: [PATCH 49/58] XIVY-12667 Restructured demo processes # Please enter the commit message for your changes. Lines starting --- .../demo/sendDemoMessageData.ivyClass | 4 + .../MessageMultipleRecipients.p.json | 106 ------- .../processes/MessageSingleRecipient.p.json | 113 -------- .../processes/ThreemaDemoProcess.p.json | 274 ++++++++++++++++++ .../demo}/KeyPair/KeyPair.rddescriptor | 0 .../connector/demo}/KeyPair/KeyPair.xhtml | 13 +- .../demo/KeyPair/KeyPairData.ivyClass | 6 + .../demo}/KeyPair/KeyPairProcess.p.json | 16 +- .../multipleRecipients.xhtml | 4 +- .../singleRecipient/singleRecipient.xhtml | 9 +- .../MessageMultipleRecipientsTest.java | 4 +- .../webtest/MessageSingleRecipientTest.java | 4 +- threema-connector/config/rest-clients.yaml | 1 + threema-connector/config/variables.yaml_back | 13 + .../processes/createKeyPair.p.json | 67 ----- .../connector/KeyPair/KeyPairData.ivyClass | 4 - 16 files changed, 327 insertions(+), 311 deletions(-) delete mode 100644 threema-connector-demo/processes/MessageMultipleRecipients.p.json delete mode 100644 threema-connector-demo/processes/MessageSingleRecipient.p.json create mode 100644 threema-connector-demo/processes/ThreemaDemoProcess.p.json rename {threema-connector/src_hd/threema/connector => threema-connector-demo/src_hd/threema/connector/demo}/KeyPair/KeyPair.rddescriptor (100%) rename {threema-connector/src_hd/threema/connector => threema-connector-demo/src_hd/threema/connector/demo}/KeyPair/KeyPair.xhtml (67%) create mode 100644 threema-connector-demo/src_hd/threema/connector/demo/KeyPair/KeyPairData.ivyClass rename {threema-connector/src_hd/threema/connector => threema-connector-demo/src_hd/threema/connector/demo}/KeyPair/KeyPairProcess.p.json (68%) create mode 100644 threema-connector/config/variables.yaml_back delete mode 100644 threema-connector/processes/createKeyPair.p.json delete mode 100644 threema-connector/src_hd/threema/connector/KeyPair/KeyPairData.ivyClass diff --git a/threema-connector-demo/dataclasses/threema/connector/demo/sendDemoMessageData.ivyClass b/threema-connector-demo/dataclasses/threema/connector/demo/sendDemoMessageData.ivyClass index 54168df..de2de42 100644 --- a/threema-connector-demo/dataclasses/threema/connector/demo/sendDemoMessageData.ivyClass +++ b/threema-connector-demo/dataclasses/threema/connector/demo/sendDemoMessageData.ivyClass @@ -8,3 +8,7 @@ type String #field type PERSISTENT #fieldModifier apiResponse List #field apiResponse PERSISTENT #fieldModifier +publicKey String #field +publicKey PERSISTENT #fieldModifier +privatekey String #field +privatekey PERSISTENT #fieldModifier diff --git a/threema-connector-demo/processes/MessageMultipleRecipients.p.json b/threema-connector-demo/processes/MessageMultipleRecipients.p.json deleted file mode 100644 index 86b8832..0000000 --- a/threema-connector-demo/processes/MessageMultipleRecipients.p.json +++ /dev/null @@ -1,106 +0,0 @@ -{ - "format" : "10.0.0", - "id" : "18B1ED116183D822", - "config" : { - "data" : "threema.connector.demo.sendDemoMessageData" - }, - "elements" : [ { - "id" : "f0", - "type" : "RequestStart", - "name" : "start.ivp", - "config" : { - "callSignature" : "start", - "outLink" : "start.ivp", - "tags" : "demo" - }, - "visual" : { - "at" : { "x" : 112, "y" : 64 } - }, - "connect" : { "id" : "f3", "to" : "f2" } - }, { - "id" : "f1", - "type" : "TaskEnd", - "visual" : { - "at" : { "x" : 704, "y" : 64 } - } - }, { - "id" : "f2", - "type" : "DialogCall", - "name" : "multipleRecipients", - "config" : { - "dialogId" : "threema.connector.demo.multipleRecipients", - "startMethod" : "start(threema.connector.demo.sendDemoMessageData)", - "output" : { - "map" : { - "out" : [ - "in", - "result.sendDemoMessageData", - "result.sendDemoMessageData" - ] - } - }, - "call" : { - "params" : [ - { "name" : "sendDemoMessageData", "type" : "threema.connector.demo.sendDemoMessageData" } - ], - "map" : { - "param.sendDemoMessageData" : [ - "in", - "in" - ] - } - } - }, - "visual" : { - "at" : { "x" : 240, "y" : 64 } - }, - "connect" : { "id" : "f5", "to" : "f4" } - }, { - "id" : "f4", - "type" : "SubProcessCall", - "name" : "handleMessage", - "config" : { - "processCall" : "multipleRecipients:call(String,List)", - "output" : { - "map" : { - "out" : "in", - "out.apiResponse" : "result.apiResponse" - } - }, - "call" : { - "params" : [ - { "name" : "plainMsg", "type" : "String" }, - { "name" : "receivers", "type" : "List" } - ], - "map" : { - "param.plainMsg" : "in.plainMessage", - "param.receivers" : "in.receiver.split(\"\\n\")" - } - } - }, - "visual" : { - "at" : { "x" : 408, "y" : 64 } - }, - "connect" : { "id" : "f7", "to" : "f6" } - }, { - "id" : "f6", - "type" : "DialogCall", - "name" : "ResultPage", - "config" : { - "dialogId" : "threema.connector.demo.ResultPage", - "startMethod" : "start(threema.connector.demo.sendDemoMessageData)", - "call" : { - "params" : [ - { "name" : "sendDemoMessageData", "type" : "threema.connector.demo.sendDemoMessageData" } - ], - "map" : { - "param.sendDemoMessageData" : "in" - } - } - }, - "visual" : { - "at" : { "x" : 576, "y" : 64 } - }, - "connect" : { "id" : "f8", "to" : "f1" } - } ] -} \ No newline at end of file diff --git a/threema-connector-demo/processes/MessageSingleRecipient.p.json b/threema-connector-demo/processes/MessageSingleRecipient.p.json deleted file mode 100644 index c0bbc6b..0000000 --- a/threema-connector-demo/processes/MessageSingleRecipient.p.json +++ /dev/null @@ -1,113 +0,0 @@ -{ - "format" : "10.0.0", - "id" : "18B22F69680901D3", - "config" : { - "data" : "threema.connector.demo.sendDemoMessageData" - }, - "elements" : [ { - "id" : "f0", - "type" : "RequestStart", - "name" : "start.ivp", - "config" : { - "callSignature" : "start", - "outLink" : "start.ivp", - "tags" : "demo" - }, - "visual" : { - "at" : { "x" : 96, "y" : 64 } - }, - "connect" : { "id" : "f3", "to" : "f2" } - }, { - "id" : "f1", - "type" : "TaskEnd", - "visual" : { - "at" : { "x" : 768, "y" : 64 } - } - }, { - "id" : "f2", - "type" : "DialogCall", - "name" : "singleRecipient", - "config" : { - "dialogId" : "threema.connector.demo.singleRecipient", - "startMethod" : "start(threema.connector.demo.sendDemoMessageData)", - "output" : { - "map" : { - "out" : [ - "in", - "result.sendDemoMessageData" - ] - } - }, - "call" : { - "params" : [ - { "name" : "sendDemoMessageData", "type" : "threema.connector.demo.sendDemoMessageData" } - ], - "map" : { - "param.sendDemoMessageData" : "in" - } - } - }, - "visual" : { - "at" : { "x" : 272, "y" : 64 } - }, - "connect" : { "id" : "f5", "to" : "f4" } - }, { - "id" : "f4", - "type" : "SubProcessCall", - "name" : "singleMessage", - "config" : { - "processCall" : "singleRecipient:call(String,String,util.LookupType)", - "output" : { - "map" : { - "out" : "in", - "out.plainMessage" : "in.plainMessage" - }, - "code" : "out.apiResponse.add(result.apiResponse);" - }, - "call" : { - "params" : [ - { "name" : "plainMsg", "type" : "String" }, - { "name" : "receiverID", "type" : "String" }, - { "name" : "lookupType", "type" : "util.LookupType" } - ], - "map" : { - "param.plainMsg" : "in.plainMessage", - "param.receiverID" : "in.receiver", - "param.lookupType" : "util.LookupType.getByString(in.type)" - } - } - }, - "visual" : { - "at" : { "x" : 464, "y" : 64 } - }, - "connect" : { "id" : "f7", "to" : "f6" } - }, { - "id" : "f6", - "type" : "DialogCall", - "name" : "ResultPage", - "config" : { - "dialogId" : "threema.connector.demo.ResultPage", - "startMethod" : "start(threema.connector.demo.sendDemoMessageData)", - "output" : { - "map" : { - "out" : [ - "in", - "result.sendDemoMessageData" - ] - } - }, - "call" : { - "params" : [ - { "name" : "sendDemoMessageData", "type" : "threema.connector.demo.sendDemoMessageData" } - ], - "map" : { - "param.sendDemoMessageData" : "in" - } - } - }, - "visual" : { - "at" : { "x" : 640, "y" : 64 } - }, - "connect" : { "id" : "f8", "to" : "f1" } - } ] -} \ No newline at end of file diff --git a/threema-connector-demo/processes/ThreemaDemoProcess.p.json b/threema-connector-demo/processes/ThreemaDemoProcess.p.json new file mode 100644 index 0000000..99478ce --- /dev/null +++ b/threema-connector-demo/processes/ThreemaDemoProcess.p.json @@ -0,0 +1,274 @@ +{ + "format" : "10.0.0", + "id" : "18B8EEA3B9A84FAE", + "config" : { + "data" : "threema.connector.demo.sendDemoMessageData" + }, + "elements" : [ { + "id" : "f3", + "type" : "RequestStart", + "name" : "SendMessageToSingleRecipient.ivp", + "config" : { + "callSignature" : "SendMessageToSingleRecipient", + "outLink" : "SendMessageToSingleRecipient.ivp", + "tags" : "demo" + }, + "visual" : { + "at" : { "x" : 96, "y" : 168 } + }, + "connect" : { "id" : "f19", "to" : "f5" } + }, { + "id" : "f4", + "type" : "TaskEnd", + "visual" : { + "at" : { "x" : 768, "y" : 168 } + } + }, { + "id" : "f5", + "type" : "DialogCall", + "name" : "singleRecipient", + "config" : { + "dialogId" : "threema.connector.demo.singleRecipient", + "startMethod" : "start(threema.connector.demo.sendDemoMessageData)", + "output" : { + "map" : { + "out" : [ + "in", + "result.sendDemoMessageData" + ] + } + }, + "call" : { + "params" : [ + { "name" : "sendDemoMessageData", "type" : "threema.connector.demo.sendDemoMessageData" } + ], + "map" : { + "param.sendDemoMessageData" : "in" + } + } + }, + "visual" : { + "at" : { "x" : 272, "y" : 168 } + }, + "connect" : { "id" : "f11", "to" : "f6" } + }, { + "id" : "f6", + "type" : "SubProcessCall", + "name" : "singleMessage", + "config" : { + "processCall" : "singleRecipient:call(String,String,util.LookupType)", + "output" : { + "map" : { + "out" : "in", + "out.plainMessage" : "in.plainMessage" + }, + "code" : "out.apiResponse.add(result.apiResponse);" + }, + "call" : { + "params" : [ + { "name" : "plainMsg", "type" : "String" }, + { "name" : "receiverID", "type" : "String" }, + { "name" : "lookupType", "type" : "util.LookupType" } + ], + "map" : { + "param.plainMsg" : "in.plainMessage", + "param.receiverID" : "in.receiver", + "param.lookupType" : "util.LookupType.getByString(in.type)" + } + } + }, + "visual" : { + "at" : { "x" : 464, "y" : 168 }, + "icon" : "res:/webContent/icons/threema-icon_black.png" + }, + "connect" : { "id" : "f18", "to" : "f7" } + }, { + "id" : "f7", + "type" : "DialogCall", + "name" : "ResultPage", + "config" : { + "dialogId" : "threema.connector.demo.ResultPage", + "startMethod" : "start(threema.connector.demo.sendDemoMessageData)", + "output" : { + "map" : { + "out" : [ + "in", + "result.sendDemoMessageData" + ] + } + }, + "call" : { + "params" : [ + { "name" : "sendDemoMessageData", "type" : "threema.connector.demo.sendDemoMessageData" } + ], + "map" : { + "param.sendDemoMessageData" : "in" + } + } + }, + "visual" : { + "at" : { "x" : 640, "y" : 168 } + }, + "connect" : { "id" : "f16", "to" : "f4" } + }, { + "id" : "f8", + "type" : "RequestStart", + "name" : "SendMessageToMultipleRecipients.ivp", + "config" : { + "callSignature" : "SendMessageToMultipleRecipients", + "outLink" : "SendMessageToMultipleRecipients.ivp", + "tags" : "demo" + }, + "visual" : { + "at" : { "x" : 96, "y" : 280 } + }, + "connect" : { "id" : "f20", "to" : "f10" } + }, { + "id" : "f9", + "type" : "TaskEnd", + "visual" : { + "at" : { "x" : 768, "y" : 280 } + } + }, { + "id" : "f10", + "type" : "DialogCall", + "name" : "multipleRecipients", + "config" : { + "dialogId" : "threema.connector.demo.multipleRecipients", + "startMethod" : "start(threema.connector.demo.sendDemoMessageData)", + "output" : { + "map" : { + "out" : [ + "in", + "result.sendDemoMessageData", + "result.sendDemoMessageData" + ] + } + }, + "call" : { + "params" : [ + { "name" : "sendDemoMessageData", "type" : "threema.connector.demo.sendDemoMessageData" } + ], + "map" : { + "param.sendDemoMessageData" : [ + "in", + "in" + ] + } + } + }, + "visual" : { + "at" : { "x" : 272, "y" : 280 } + }, + "connect" : { "id" : "f15", "to" : "f12" } + }, { + "id" : "f12", + "type" : "SubProcessCall", + "name" : "handleMessage", + "config" : { + "processCall" : "multipleRecipients:call(String,List)", + "output" : { + "map" : { + "out" : "in", + "out.apiResponse" : "result.apiResponse" + } + }, + "call" : { + "params" : [ + { "name" : "plainMsg", "type" : "String" }, + { "name" : "receivers", "type" : "List" } + ], + "map" : { + "param.plainMsg" : "in.plainMessage", + "param.receivers" : "in.receiver.split(\"\\n\")" + } + } + }, + "visual" : { + "at" : { "x" : 464, "y" : 280 }, + "icon" : "res:/webContent/icons/threema-icon_black.png" + }, + "connect" : { "id" : "f17", "to" : "f13" } + }, { + "id" : "f13", + "type" : "DialogCall", + "name" : "ResultPage", + "config" : { + "dialogId" : "threema.connector.demo.ResultPage", + "startMethod" : "start(threema.connector.demo.sendDemoMessageData)", + "call" : { + "params" : [ + { "name" : "sendDemoMessageData", "type" : "threema.connector.demo.sendDemoMessageData" } + ], + "map" : { + "param.sendDemoMessageData" : "in" + } + } + }, + "visual" : { + "at" : { "x" : 640, "y" : 280 } + }, + "connect" : { "id" : "f14", "to" : "f9" } + }, { + "id" : "f0", + "type" : "RequestStart", + "name" : "GenerateKeyPair.ivp", + "config" : { + "callSignature" : "GenerateKeyPair", + "outLink" : "GenerateKeyPair.ivp" + }, + "visual" : { + "at" : { "x" : 96, "y" : 368 } + }, + "connect" : { "id" : "f22", "to" : "f2" } + }, { + "id" : "f1", + "type" : "TaskEnd", + "visual" : { + "at" : { "x" : 768, "y" : 368 } + } + }, { + "id" : "f2", + "type" : "Script", + "name" : "generateKeyPair", + "config" : { + "output" : { + "code" : [ + "import util.KeyPairGenerator;", + "import util.KeyPairGenerator.KeyPair;", + "", + "KeyPair keys = KeyPairGenerator.generate();", + "", + "out.publicKey = keys.publicKey();", + "out.privateKey = keys.privateKey();" + ] + } + }, + "visual" : { + "at" : { "x" : 272, "y" : 368 } + }, + "connect" : { "id" : "f26", "to" : "f25" } + }, { + "id" : "f25", + "type" : "DialogCall", + "name" : "KeyPair", + "config" : { + "dialogId" : "threema.connector.demo.KeyPair", + "startMethod" : "start(String,String)", + "call" : { + "params" : [ + { "name" : "publicKey", "type" : "String" }, + { "name" : "privatekey", "type" : "String" } + ], + "map" : { + "param.publicKey" : "in.publicKey", + "param.privatekey" : "in.privatekey" + } + } + }, + "visual" : { + "at" : { "x" : 464, "y" : 368 } + }, + "connect" : { "id" : "f21", "to" : "f1" } + } ] +} \ No newline at end of file diff --git a/threema-connector/src_hd/threema/connector/KeyPair/KeyPair.rddescriptor b/threema-connector-demo/src_hd/threema/connector/demo/KeyPair/KeyPair.rddescriptor similarity index 100% rename from threema-connector/src_hd/threema/connector/KeyPair/KeyPair.rddescriptor rename to threema-connector-demo/src_hd/threema/connector/demo/KeyPair/KeyPair.rddescriptor diff --git a/threema-connector/src_hd/threema/connector/KeyPair/KeyPair.xhtml b/threema-connector-demo/src_hd/threema/connector/demo/KeyPair/KeyPair.xhtml similarity index 67% rename from threema-connector/src_hd/threema/connector/KeyPair/KeyPair.xhtml rename to threema-connector-demo/src_hd/threema/connector/demo/KeyPair/KeyPair.xhtml index ff800ef..7e3573a 100644 --- a/threema-connector/src_hd/threema/connector/KeyPair/KeyPair.xhtml +++ b/threema-connector-demo/src_hd/threema/connector/demo/KeyPair/KeyPair.xhtml @@ -7,18 +7,19 @@ KeyPair -

Newly generated Keypair

+

Keypair for Threema.Gateway

+

Use the following keys to request a new End-to-End Threema.Gateway ID over at Theema Gateway.

- + - - + + - - + +
diff --git a/threema-connector-demo/src_hd/threema/connector/demo/KeyPair/KeyPairData.ivyClass b/threema-connector-demo/src_hd/threema/connector/demo/KeyPair/KeyPairData.ivyClass new file mode 100644 index 0000000..2ee413c --- /dev/null +++ b/threema-connector-demo/src_hd/threema/connector/demo/KeyPair/KeyPairData.ivyClass @@ -0,0 +1,6 @@ +KeyPairData #class +threema.connector.demo.KeyPair #namespace +publicKey String #field +publicKey PERSISTENT #fieldModifier +privatekey String #field +privatekey PERSISTENT #fieldModifier diff --git a/threema-connector/src_hd/threema/connector/KeyPair/KeyPairProcess.p.json b/threema-connector-demo/src_hd/threema/connector/demo/KeyPair/KeyPairProcess.p.json similarity index 68% rename from threema-connector/src_hd/threema/connector/KeyPair/KeyPairProcess.p.json rename to threema-connector-demo/src_hd/threema/connector/demo/KeyPair/KeyPairProcess.p.json index d7e4795..257b427 100644 --- a/threema-connector/src_hd/threema/connector/KeyPair/KeyPairProcess.p.json +++ b/threema-connector-demo/src_hd/threema/connector/demo/KeyPair/KeyPairProcess.p.json @@ -1,25 +1,27 @@ { "format" : "10.0.0", - "id" : "18B675A6BCE832D1", + "id" : "18B8EF27D89ED10D", "kind" : "HTML_DIALOG", "config" : { - "data" : "threema.connector.KeyPair.KeyPairData" + "data" : "threema.connector.demo.KeyPair.KeyPairData" }, "elements" : [ { "id" : "f0", "type" : "HtmlDialogStart", - "name" : "start(createKeyPairData)", + "name" : "start(String,String)", "config" : { "callSignature" : "start", "input" : { "params" : [ - { "name" : "createKeyPairData", "type" : "threema.connector.createKeyPairData" } + { "name" : "publicKey", "type" : "String" }, + { "name" : "privatekey", "type" : "String" } ], "map" : { - "out.createKeyPairData" : "param.createKeyPairData" + "out.publicKey" : "param.publicKey", + "out.privatekey" : "param.privatekey" } }, - "guid" : "18B675A6BCFECF51" + "guid" : "18B8EF27D8A1D1A5" }, "visual" : { "at" : { "x" : 96, "y" : 64 } @@ -36,7 +38,7 @@ "type" : "HtmlDialogEventStart", "name" : "close", "config" : { - "guid" : "18B675A6BD2AE7CB" + "guid" : "18B8EF27D8CA39FE" }, "visual" : { "at" : { "x" : 96, "y" : 160 } diff --git a/threema-connector-demo/src_hd/threema/connector/demo/multipleRecipients/multipleRecipients.xhtml b/threema-connector-demo/src_hd/threema/connector/demo/multipleRecipients/multipleRecipients.xhtml index e387c3d..502802a 100644 --- a/threema-connector-demo/src_hd/threema/connector/demo/multipleRecipients/multipleRecipients.xhtml +++ b/threema-connector-demo/src_hd/threema/connector/demo/multipleRecipients/multipleRecipients.xhtml @@ -27,7 +27,7 @@ cols="33" required="true" /> + value="Receiver (one per line) ThreemaId / Email / Phone (international format)" /> @@ -38,7 +38,7 @@ + value="Send" update="form" icon="pi pi-check" />
diff --git a/threema-connector-demo/src_hd/threema/connector/demo/singleRecipient/singleRecipient.xhtml b/threema-connector-demo/src_hd/threema/connector/demo/singleRecipient/singleRecipient.xhtml index 83e4804..d40793b 100644 --- a/threema-connector-demo/src_hd/threema/connector/demo/singleRecipient/singleRecipient.xhtml +++ b/threema-connector-demo/src_hd/threema/connector/demo/singleRecipient/singleRecipient.xhtml @@ -27,12 +27,13 @@ + value="#{data.sendDemoMessageData.receiver}" required="true" placeholder="placeholder"> - + + layout="lineDirection" required="true" + onclick="(() => {console.log('hamburger')})()"> + value="Send" update="form" icon="pi pi-check" /> diff --git a/threema-connector-webtest/src_test/threema/connector/webtest/MessageMultipleRecipientsTest.java b/threema-connector-webtest/src_test/threema/connector/webtest/MessageMultipleRecipientsTest.java index 463e62f..44bea27 100644 --- a/threema-connector-webtest/src_test/threema/connector/webtest/MessageMultipleRecipientsTest.java +++ b/threema-connector-webtest/src_test/threema/connector/webtest/MessageMultipleRecipientsTest.java @@ -6,9 +6,11 @@ import static com.codeborne.selenide.Selenide.$$; import static com.codeborne.selenide.Selenide.open; import static org.assertj.core.api.Assertions.assertThat; + import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.openqa.selenium.By; + import com.axonivy.ivy.webtest.IvyWebTest; import com.axonivy.ivy.webtest.engine.EngineUrl; import com.codeborne.selenide.ElementsCollection; @@ -19,7 +21,7 @@ public class MessageMultipleRecipientsTest { @Test @Disabled public void sendMessage() { - open(EngineUrl.createProcessUrl("threema-connector-demo/18B1ED116183D822/start.ivp")); + open(EngineUrl.createProcessUrl("threema-connector-demo/18B8EEA3B9A84FAE/SendMessageToMultipleRecipients.ivp")); String message = "Hello World"; String recipients = "validId\ninvalidId"; // Assert empty form diff --git a/threema-connector-webtest/src_test/threema/connector/webtest/MessageSingleRecipientTest.java b/threema-connector-webtest/src_test/threema/connector/webtest/MessageSingleRecipientTest.java index fb96520..941e59b 100644 --- a/threema-connector-webtest/src_test/threema/connector/webtest/MessageSingleRecipientTest.java +++ b/threema-connector-webtest/src_test/threema/connector/webtest/MessageSingleRecipientTest.java @@ -7,9 +7,11 @@ import static com.codeborne.selenide.Selenide.$$; import static com.codeborne.selenide.Selenide.open; import static org.assertj.core.api.Assertions.assertThat; + import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.openqa.selenium.By; + import com.axonivy.ivy.webtest.IvyWebTest; import com.axonivy.ivy.webtest.engine.EngineUrl; import com.axonivy.ivy.webtest.primeui.PrimeUi; @@ -21,7 +23,7 @@ public class MessageSingleRecipientTest { @Test @Disabled public void sendMessage() { - open(EngineUrl.createProcessUrl("threema-connector-demo/18B22F69680901D3/start.ivp")); + open(EngineUrl.createProcessUrl("threema-connector-demo/18B8EEA3B9A84FAE/SendMessageToSingleRecipient.ivp")); String message = "Hello World"; String validId = "validId"; // Assert empty form diff --git a/threema-connector/config/rest-clients.yaml b/threema-connector/config/rest-clients.yaml index 52b6940..0d96434 100644 --- a/threema-connector/config/rest-clients.yaml +++ b/threema-connector/config/rest-clients.yaml @@ -2,5 +2,6 @@ RestClients: ThreemaGateway: UUID: af315689-b538-4142-a823-0632d66754d7 Url: https://msgapi.threema.ch + Icon: res:/webContent/icons/threema-icon_black.png Features: - ch.ivyteam.ivy.rest.client.mapper.JsonFeature diff --git a/threema-connector/config/variables.yaml_back b/threema-connector/config/variables.yaml_back new file mode 100644 index 0000000..e4fd1d0 --- /dev/null +++ b/threema-connector/config/variables.yaml_back @@ -0,0 +1,13 @@ +Variables: + threemaConnector: + + # Your Threema.Gateway ID + threemaId: '' + + # Your Threema.Gateway Secret + # [password] + secret: '' + + # Your private key associated with your Threema.Gateway ID + # [password] + privateKey: '' diff --git a/threema-connector/processes/createKeyPair.p.json b/threema-connector/processes/createKeyPair.p.json deleted file mode 100644 index 9427be7..0000000 --- a/threema-connector/processes/createKeyPair.p.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "format" : "10.0.0", - "id" : "18B67537F65B8CEE", - "config" : { - "data" : "threema.connector.createKeyPairData" - }, - "elements" : [ { - "id" : "f0", - "type" : "RequestStart", - "name" : "start.ivp", - "config" : { - "callSignature" : "start", - "outLink" : "start.ivp" - }, - "visual" : { - "at" : { "x" : 96, "y" : 64 } - }, - "connect" : { "id" : "f4", "to" : "f3" } - }, { - "id" : "f1", - "type" : "TaskEnd", - "visual" : { - "at" : { "x" : 696, "y" : 64 } - } - }, { - "id" : "f3", - "type" : "Script", - "name" : "generateKeyPair", - "config" : { - "output" : { - "code" : [ - "import util.KeyPairGenerator;", - "import util.KeyPairGenerator.KeyPair;", - "", - "KeyPair keys = KeyPairGenerator.generate();", - "", - "out.publicKey = keys.publicKey();", - "out.privateKey = keys.privateKey();" - ] - } - }, - "visual" : { - "at" : { "x" : 320, "y" : 64 } - }, - "connect" : { "id" : "f6", "to" : "f5" } - }, { - "id" : "f5", - "type" : "DialogCall", - "name" : "KeyPair", - "config" : { - "dialogId" : "threema.connector.KeyPair", - "startMethod" : "start(threema.connector.createKeyPairData)", - "call" : { - "params" : [ - { "name" : "createKeyPairData", "type" : "threema.connector.createKeyPairData" } - ], - "map" : { - "param.createKeyPairData" : "in" - } - } - }, - "visual" : { - "at" : { "x" : 508, "y" : 64 } - }, - "connect" : { "id" : "f2", "to" : "f1" } - } ] -} \ No newline at end of file diff --git a/threema-connector/src_hd/threema/connector/KeyPair/KeyPairData.ivyClass b/threema-connector/src_hd/threema/connector/KeyPair/KeyPairData.ivyClass deleted file mode 100644 index b47ddd9..0000000 --- a/threema-connector/src_hd/threema/connector/KeyPair/KeyPairData.ivyClass +++ /dev/null @@ -1,4 +0,0 @@ -KeyPairData #class -threema.connector.KeyPair #namespace -createKeyPairData threema.connector.createKeyPairData #field -createKeyPairData PERSISTENT #fieldModifier From 6833b6339c4985cb125c28cab207879696fab262 Mon Sep 17 00:00:00 2001 From: Fabian Heuberger Date: Thu, 2 Nov 2023 10:29:17 +0100 Subject: [PATCH 50/58] XIVY-12667 Added option to send another message from result screen --- .../demo/sendDemoMessageData.ivyClass | 2 + .../processes/ThreemaDemoProcess.p.json | 56 ++++++++++++++----- .../demo/ResultPage/ResultPage.xhtml | 6 +- .../demo/ResultPage/ResultPageProcess.p.json | 25 ++++++++- .../multipleRecipients.xhtml | 2 +- .../singleRecipient/singleRecipient.xhtml | 2 +- threema-connector-product/README.md | 3 +- 7 files changed, 75 insertions(+), 21 deletions(-) diff --git a/threema-connector-demo/dataclasses/threema/connector/demo/sendDemoMessageData.ivyClass b/threema-connector-demo/dataclasses/threema/connector/demo/sendDemoMessageData.ivyClass index de2de42..43c34d8 100644 --- a/threema-connector-demo/dataclasses/threema/connector/demo/sendDemoMessageData.ivyClass +++ b/threema-connector-demo/dataclasses/threema/connector/demo/sendDemoMessageData.ivyClass @@ -12,3 +12,5 @@ publicKey String #field publicKey PERSISTENT #fieldModifier privatekey String #field privatekey PERSISTENT #fieldModifier +sendAnother Boolean #field +sendAnother PERSISTENT #fieldModifier diff --git a/threema-connector-demo/processes/ThreemaDemoProcess.p.json b/threema-connector-demo/processes/ThreemaDemoProcess.p.json index 99478ce..4deb411 100644 --- a/threema-connector-demo/processes/ThreemaDemoProcess.p.json +++ b/threema-connector-demo/processes/ThreemaDemoProcess.p.json @@ -21,7 +21,7 @@ "id" : "f4", "type" : "TaskEnd", "visual" : { - "at" : { "x" : 768, "y" : 168 } + "at" : { "x" : 936, "y" : 168 } } }, { "id" : "f5", @@ -78,7 +78,7 @@ } }, "visual" : { - "at" : { "x" : 464, "y" : 168 }, + "at" : { "x" : 512, "y" : 168 }, "icon" : "res:/webContent/icons/threema-icon_black.png" }, "connect" : { "id" : "f18", "to" : "f7" } @@ -91,10 +91,10 @@ "startMethod" : "start(threema.connector.demo.sendDemoMessageData)", "output" : { "map" : { - "out" : [ - "in", - "result.sendDemoMessageData" - ] + "out" : "result.sendDemoMessageData", + "out.plainMessage" : "\"\"", + "out.receiver" : "\"\"", + "out.type" : "\"\"" } }, "call" : { @@ -107,9 +107,9 @@ } }, "visual" : { - "at" : { "x" : 640, "y" : 168 } + "at" : { "x" : 688, "y" : 168 } }, - "connect" : { "id" : "f16", "to" : "f4" } + "connect" : { "id" : "f24", "to" : "f23" } }, { "id" : "f8", "type" : "RequestStart", @@ -127,7 +127,7 @@ "id" : "f9", "type" : "TaskEnd", "visual" : { - "at" : { "x" : 768, "y" : 280 } + "at" : { "x" : 936, "y" : 280 } } }, { "id" : "f10", @@ -185,7 +185,7 @@ } }, "visual" : { - "at" : { "x" : 464, "y" : 280 }, + "at" : { "x" : 512, "y" : 280 }, "icon" : "res:/webContent/icons/threema-icon_black.png" }, "connect" : { "id" : "f17", "to" : "f13" } @@ -196,6 +196,14 @@ "config" : { "dialogId" : "threema.connector.demo.ResultPage", "startMethod" : "start(threema.connector.demo.sendDemoMessageData)", + "output" : { + "map" : { + "out" : "in", + "out.plainMessage" : "\"\"", + "out.receiver" : "\"\"", + "out.type" : "\"\"" + } + }, "call" : { "params" : [ { "name" : "sendDemoMessageData", "type" : "threema.connector.demo.sendDemoMessageData" } @@ -206,9 +214,9 @@ } }, "visual" : { - "at" : { "x" : 640, "y" : 280 } + "at" : { "x" : 688, "y" : 280 } }, - "connect" : { "id" : "f14", "to" : "f9" } + "connect" : { "id" : "f27", "to" : "f14" } }, { "id" : "f0", "type" : "RequestStart", @@ -225,7 +233,7 @@ "id" : "f1", "type" : "TaskEnd", "visual" : { - "at" : { "x" : 768, "y" : 368 } + "at" : { "x" : 936, "y" : 368 } } }, { "id" : "f2", @@ -267,8 +275,28 @@ } }, "visual" : { - "at" : { "x" : 464, "y" : 368 } + "at" : { "x" : 520, "y" : 368 } }, "connect" : { "id" : "f21", "to" : "f1" } + }, { + "id" : "f23", + "type" : "Alternative", + "visual" : { + "at" : { "x" : 840, "y" : 168 } + }, + "connect" : [ + { "id" : "f16", "to" : "f5", "via" : [ { "x" : 840, "y" : 104 }, { "x" : 272, "y" : 104 } ], "condition" : "in.sendAnother" }, + { "id" : "f29", "to" : "f4" } + ] + }, { + "id" : "f14", + "type" : "Alternative", + "visual" : { + "at" : { "x" : 840, "y" : 280 } + }, + "connect" : [ + { "id" : "f31", "to" : "f10", "via" : [ { "x" : 840, "y" : 216 }, { "x" : 272, "y" : 216 } ], "condition" : "in.sendAnother" }, + { "id" : "f30", "to" : "f9" } + ] } ] } \ No newline at end of file diff --git a/threema-connector-demo/src_hd/threema/connector/demo/ResultPage/ResultPage.xhtml b/threema-connector-demo/src_hd/threema/connector/demo/ResultPage/ResultPage.xhtml index 1b6ebe4..6755089 100644 --- a/threema-connector-demo/src_hd/threema/connector/demo/ResultPage/ResultPage.xhtml +++ b/threema-connector-demo/src_hd/threema/connector/demo/ResultPage/ResultPage.xhtml @@ -40,10 +40,10 @@
- + + value="Close" update="form" icon="pi pi-times" />
diff --git a/threema-connector-demo/src_hd/threema/connector/demo/ResultPage/ResultPageProcess.p.json b/threema-connector-demo/src_hd/threema/connector/demo/ResultPage/ResultPageProcess.p.json index 7f85581..1a3cf61 100644 --- a/threema-connector-demo/src_hd/threema/connector/demo/ResultPage/ResultPageProcess.p.json +++ b/threema-connector-demo/src_hd/threema/connector/demo/ResultPage/ResultPageProcess.p.json @@ -44,7 +44,13 @@ "type" : "HtmlDialogEventStart", "name" : "close", "config" : { - "guid" : "18B23815CA6B079E" + "guid" : "18B23815CA6B079E", + "output" : { + "map" : { + "out" : "in", + "out.sendDemoMessageData.sendAnother" : "false" + } + } }, "visual" : { "at" : { "x" : 96, "y" : 160 } @@ -80,5 +86,22 @@ "at" : { "x" : 208, "y" : 64 } }, "connect" : { "id" : "f7", "to" : "f1" } + }, { + "id" : "f8", + "type" : "HtmlDialogEventStart", + "name" : "sendAnother", + "config" : { + "guid" : "18B8F438B7519CB7", + "output" : { + "map" : { + "out" : "in", + "out.sendDemoMessageData.sendAnother" : "true" + } + } + }, + "visual" : { + "at" : { "x" : 96, "y" : 224 } + }, + "connect" : { "id" : "f9", "to" : "f4" } } ] } \ No newline at end of file diff --git a/threema-connector-demo/src_hd/threema/connector/demo/multipleRecipients/multipleRecipients.xhtml b/threema-connector-demo/src_hd/threema/connector/demo/multipleRecipients/multipleRecipients.xhtml index 502802a..ee2312a 100644 --- a/threema-connector-demo/src_hd/threema/connector/demo/multipleRecipients/multipleRecipients.xhtml +++ b/threema-connector-demo/src_hd/threema/connector/demo/multipleRecipients/multipleRecipients.xhtml @@ -38,7 +38,7 @@ + value="Send" update="form" icon="pi pi-send" /> diff --git a/threema-connector-demo/src_hd/threema/connector/demo/singleRecipient/singleRecipient.xhtml b/threema-connector-demo/src_hd/threema/connector/demo/singleRecipient/singleRecipient.xhtml index d40793b..125b24d 100644 --- a/threema-connector-demo/src_hd/threema/connector/demo/singleRecipient/singleRecipient.xhtml +++ b/threema-connector-demo/src_hd/threema/connector/demo/singleRecipient/singleRecipient.xhtml @@ -49,7 +49,7 @@ + value="Send" update="form" icon="pi pi-send" /> diff --git a/threema-connector-product/README.md b/threema-connector-product/README.md index b8b02a3..79956a8 100644 --- a/threema-connector-product/README.md +++ b/threema-connector-product/README.md @@ -12,7 +12,8 @@ Credentials and credits are required to send messages. The credentials can be cr ## Setup 1. Generate a new key pair using the "createKeyPair" process. -2. Create "End-to-End Threema ID" at: [Request new ID](https://gateway.threema.ch/en/id-request)
+2. Create "End-to-End Threema ID" at: [Request new ID](https://gateway.threema.ch/en/id-request)
+Free credits for testing purposes can be requestet at [support-gateway@threema.ch](mailto:support-gateway@threema.ch)
3. Add the following variables to your Axon Ivy Project: ``` From e75a5055d5dde055512dc04f28429a3988a13de4 Mon Sep 17 00:00:00 2001 From: Fabian Heuberger Date: Thu, 2 Nov 2023 10:31:30 +0100 Subject: [PATCH 51/58] XIVY-12667 Removed console output --- .../connector/demo/singleRecipient/singleRecipient.xhtml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/threema-connector-demo/src_hd/threema/connector/demo/singleRecipient/singleRecipient.xhtml b/threema-connector-demo/src_hd/threema/connector/demo/singleRecipient/singleRecipient.xhtml index 125b24d..4f6cfe5 100644 --- a/threema-connector-demo/src_hd/threema/connector/demo/singleRecipient/singleRecipient.xhtml +++ b/threema-connector-demo/src_hd/threema/connector/demo/singleRecipient/singleRecipient.xhtml @@ -32,8 +32,7 @@ + layout="lineDirection" required="true"> Date: Thu, 2 Nov 2023 11:13:48 +0100 Subject: [PATCH 52/58] XIVY-12667 Added dynamic placeholder for recipient --- .../multipleRecipients.xhtml | 2 +- .../singleRecipient/singleRecipient.xhtml | 31 +++++++++++++++---- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/threema-connector-demo/src_hd/threema/connector/demo/multipleRecipients/multipleRecipients.xhtml b/threema-connector-demo/src_hd/threema/connector/demo/multipleRecipients/multipleRecipients.xhtml index ee2312a..1496a81 100644 --- a/threema-connector-demo/src_hd/threema/connector/demo/multipleRecipients/multipleRecipients.xhtml +++ b/threema-connector-demo/src_hd/threema/connector/demo/multipleRecipients/multipleRecipients.xhtml @@ -30,7 +30,7 @@ value="Receiver (one per line) ThreemaId / Email / Phone (international format)" /> + cols="50" required="true"/>
diff --git a/threema-connector-demo/src_hd/threema/connector/demo/singleRecipient/singleRecipient.xhtml b/threema-connector-demo/src_hd/threema/connector/demo/singleRecipient/singleRecipient.xhtml index 4f6cfe5..14fcf3d 100644 --- a/threema-connector-demo/src_hd/threema/connector/demo/singleRecipient/singleRecipient.xhtml +++ b/threema-connector-demo/src_hd/threema/connector/demo/singleRecipient/singleRecipient.xhtml @@ -4,7 +4,7 @@ xmlns:ui="http://xmlns.jcp.org/jsf/facelets" xmlns:ic="http://ivyteam.ch/jsf/component" xmlns:p="http://primefaces.org/ui" - xmlns:pe="http://primefaces.org/ui/extensions"> + xmlns:pe="http://primefaces.org/ui/extensions"> singleRecipient @@ -27,12 +27,12 @@ + value="#{data.sendDemoMessageData.receiver}" required="true" placeholder="recipient"> + layout="lineDirection" required="true" onchange="updatePlaceholder(value)"> - -
@@ -51,7 +49,28 @@ value="Send" update="form" icon="pi pi-send" />
- + + +
From 1d01c96f4bc81fde0584e3f14fb8da2412de87b0 Mon Sep 17 00:00:00 2001 From: ivy-fhe <146715063+ivy-fhe@users.noreply.github.com> Date: Thu, 2 Nov 2023 11:21:13 +0100 Subject: [PATCH 53/58] Update README.md XIVY-12667 Spelling error --- threema-connector-product/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/threema-connector-product/README.md b/threema-connector-product/README.md index 79956a8..ce51e47 100644 --- a/threema-connector-product/README.md +++ b/threema-connector-product/README.md @@ -13,7 +13,7 @@ Credentials and credits are required to send messages. The credentials can be cr ## Setup 1. Generate a new key pair using the "createKeyPair" process. 2. Create "End-to-End Threema ID" at: [Request new ID](https://gateway.threema.ch/en/id-request)
-Free credits for testing purposes can be requestet at [support-gateway@threema.ch](mailto:support-gateway@threema.ch)
+Free credits for testing purposes can be requested at [support-gateway@threema.ch](mailto:support-gateway@threema.ch)
3. Add the following variables to your Axon Ivy Project: ``` From 34f2c74c273ac8be7366e4e18015608164bbd576 Mon Sep 17 00:00:00 2001 From: ivy-fhe <146715063+ivy-fhe@users.noreply.github.com> Date: Thu, 2 Nov 2023 11:22:20 +0100 Subject: [PATCH 54/58] Update README.md XIVY-12667 Changed process to match name for key generation --- threema-connector-product/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/threema-connector-product/README.md b/threema-connector-product/README.md index ce51e47..5134c5a 100644 --- a/threema-connector-product/README.md +++ b/threema-connector-product/README.md @@ -11,7 +11,7 @@ Credentials and credits are required to send messages. The credentials can be cr ![Result screen](./images/resultScreen.png) ## Setup -1. Generate a new key pair using the "createKeyPair" process. +1. Generate a new key pair using the "GenerateKeyPair" process. 2. Create "End-to-End Threema ID" at: [Request new ID](https://gateway.threema.ch/en/id-request)
Free credits for testing purposes can be requested at [support-gateway@threema.ch](mailto:support-gateway@threema.ch)
3. Add the following variables to your Axon Ivy Project: From 79d083467f5918ceddbad9ede9b76c7c471a6685 Mon Sep 17 00:00:00 2001 From: Fabian Heuberger Date: Thu, 2 Nov 2023 12:13:42 +0100 Subject: [PATCH 55/58] XIVY-12667 Upgraded buildplugin to 10.0.14 enabled and configured webtests --- threema-connector-demo/pom.xml | 2 +- threema-connector-test/pom.xml | 4 ++-- threema-connector-webtest/pom.xml | 10 ++++++++-- .../webtest/MessageMultipleRecipientsTest.java | 9 ++++++--- .../connector/webtest/MessageSingleRecipientTest.java | 9 ++++++--- threema-connector/pom.xml | 2 +- 6 files changed, 24 insertions(+), 12 deletions(-) diff --git a/threema-connector-demo/pom.xml b/threema-connector-demo/pom.xml index 981dd84..dddf810 100644 --- a/threema-connector-demo/pom.xml +++ b/threema-connector-demo/pom.xml @@ -18,7 +18,7 @@ com.axonivy.ivy.ci project-build-plugin - 10.0.6 + 10.0.14 true diff --git a/threema-connector-test/pom.xml b/threema-connector-test/pom.xml index f614ad4..cac22d0 100644 --- a/threema-connector-test/pom.xml +++ b/threema-connector-test/pom.xml @@ -15,7 +15,7 @@ com.axonivy.ivy.test unit-tester - 10.0.0 + 10.0.14 test
@@ -36,7 +36,7 @@ com.axonivy.ivy.ci project-build-plugin - 10.0.6 + 10.0.14 true diff --git a/threema-connector-webtest/pom.xml b/threema-connector-webtest/pom.xml index fd5ebe5..cfa091a 100644 --- a/threema-connector-webtest/pom.xml +++ b/threema-connector-webtest/pom.xml @@ -12,10 +12,16 @@ ${project.version} iar
+ + com.axonivy.connector.threema + threema-connector-test + ${project.version} + iar + com.axonivy.ivy.webtest web-tester - 10.0.0 + 10.0.14 test
@@ -25,7 +31,7 @@ com.axonivy.ivy.ci project-build-plugin - 10.0.6 + 10.0.14 true diff --git a/threema-connector-webtest/src_test/threema/connector/webtest/MessageMultipleRecipientsTest.java b/threema-connector-webtest/src_test/threema/connector/webtest/MessageMultipleRecipientsTest.java index 44bea27..ed26b67 100644 --- a/threema-connector-webtest/src_test/threema/connector/webtest/MessageMultipleRecipientsTest.java +++ b/threema-connector-webtest/src_test/threema/connector/webtest/MessageMultipleRecipientsTest.java @@ -7,20 +7,23 @@ import static com.codeborne.selenide.Selenide.open; import static org.assertj.core.api.Assertions.assertThat; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.openqa.selenium.By; import com.axonivy.ivy.webtest.IvyWebTest; import com.axonivy.ivy.webtest.engine.EngineUrl; +import com.axonivy.ivy.webtest.engine.WebAppFixture; import com.codeborne.selenide.ElementsCollection; +import ch.ivyteam.threema.mocks.ThreemaServiceMock; + @IvyWebTest public class MessageMultipleRecipientsTest { @Test - @Disabled - public void sendMessage() { + public void sendMessage(WebAppFixture fixture) { + String mockUrl = ThreemaServiceMock.URI.replaceAll("\\{", "%7B").replaceAll("\\}", "%7D").replaceAll("/", "%2F"); + fixture.config("RestClients.ThreemaGateway.Url", mockUrl); open(EngineUrl.createProcessUrl("threema-connector-demo/18B8EEA3B9A84FAE/SendMessageToMultipleRecipients.ivp")); String message = "Hello World"; String recipients = "validId\ninvalidId"; diff --git a/threema-connector-webtest/src_test/threema/connector/webtest/MessageSingleRecipientTest.java b/threema-connector-webtest/src_test/threema/connector/webtest/MessageSingleRecipientTest.java index 941e59b..70c5537 100644 --- a/threema-connector-webtest/src_test/threema/connector/webtest/MessageSingleRecipientTest.java +++ b/threema-connector-webtest/src_test/threema/connector/webtest/MessageSingleRecipientTest.java @@ -8,21 +8,24 @@ import static com.codeborne.selenide.Selenide.open; import static org.assertj.core.api.Assertions.assertThat; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.openqa.selenium.By; import com.axonivy.ivy.webtest.IvyWebTest; import com.axonivy.ivy.webtest.engine.EngineUrl; +import com.axonivy.ivy.webtest.engine.WebAppFixture; import com.axonivy.ivy.webtest.primeui.PrimeUi; import com.codeborne.selenide.ElementsCollection; +import ch.ivyteam.threema.mocks.ThreemaServiceMock; + @IvyWebTest public class MessageSingleRecipientTest { @Test - @Disabled - public void sendMessage() { + public void sendMessage(WebAppFixture fixture) { + String mockUrl = ThreemaServiceMock.URI.replaceAll("\\{", "%7B").replaceAll("\\}", "%7D").replaceAll("/", "%2F"); + fixture.config("RestClients.ThreemaGateway.Url", mockUrl); open(EngineUrl.createProcessUrl("threema-connector-demo/18B8EEA3B9A84FAE/SendMessageToSingleRecipient.ivp")); String message = "Hello World"; String validId = "validId"; diff --git a/threema-connector/pom.xml b/threema-connector/pom.xml index 11ba934..f173cd3 100644 --- a/threema-connector/pom.xml +++ b/threema-connector/pom.xml @@ -11,7 +11,7 @@ com.axonivy.ivy.ci project-build-plugin - 10.0.6 + 10.0.14 true From bf5dbef903066abee2200e7ac0f35b9d6b70f081 Mon Sep 17 00:00:00 2001 From: Fabian Heuberger Date: Thu, 2 Nov 2023 12:22:31 +0100 Subject: [PATCH 56/58] XIVY-12667 removed backup variable file --- threema-connector/config/variables.yaml_back | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 threema-connector/config/variables.yaml_back diff --git a/threema-connector/config/variables.yaml_back b/threema-connector/config/variables.yaml_back deleted file mode 100644 index e4fd1d0..0000000 --- a/threema-connector/config/variables.yaml_back +++ /dev/null @@ -1,13 +0,0 @@ -Variables: - threemaConnector: - - # Your Threema.Gateway ID - threemaId: '' - - # Your Threema.Gateway Secret - # [password] - secret: '' - - # Your private key associated with your Threema.Gateway ID - # [password] - privateKey: '' From a2e60e69869148d4303a459d934e57414ea11310 Mon Sep 17 00:00:00 2001 From: ivy-fhe <146715063+ivy-fhe@users.noreply.github.com> Date: Thu, 2 Nov 2023 12:23:03 +0100 Subject: [PATCH 57/58] Create variables.yaml --- threema-connector/config/variables.yaml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 threema-connector/config/variables.yaml diff --git a/threema-connector/config/variables.yaml b/threema-connector/config/variables.yaml new file mode 100644 index 0000000..e4fd1d0 --- /dev/null +++ b/threema-connector/config/variables.yaml @@ -0,0 +1,13 @@ +Variables: + threemaConnector: + + # Your Threema.Gateway ID + threemaId: '' + + # Your Threema.Gateway Secret + # [password] + secret: '' + + # Your private key associated with your Threema.Gateway ID + # [password] + privateKey: '' From b10869b77adc56679969d60bc278c75270531ff6 Mon Sep 17 00:00:00 2001 From: ivy-fhe <146715063+ivy-fhe@users.noreply.github.com> Date: Thu, 2 Nov 2023 12:30:42 +0100 Subject: [PATCH 58/58] XIVY-12667 Update ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index da54c13..6ad15e6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,4 +11,4 @@ jobs: build: uses: axonivy-market/github-workflows/.github/workflows/ci.yml@v2 with: - mvnArgs: -Dmaven.test.failure.ignore=true -Divy.engine.version=10.0.13 + mvnArgs: -Dmaven.test.failure.ignore=true -Divy.engine.version=10.0.14