From 42a6b5b65fc71ace4ed13798dcddffb4aef20a09 Mon Sep 17 00:00:00 2001 From: Fabrice Date: Mon, 29 Apr 2024 12:34:00 -0500 Subject: [PATCH] cleanups --- .../io/twentysixty/sa/client/jms/AbstractProducer.java | 7 ++++--- .../io/twentysixty/sa/client/jms/ProducerInterface.java | 6 +++--- .../sa/client/model/event/DidExchangeState.java | 2 ++ .../java/io/twentysixty/sa/client/model/event/Event.java | 4 +++- .../twentysixty/sa/client/model/event/MessageReceived.java | 1 + .../client/model/message/TerminateConnectionMessage.java | 1 + .../sa/client/res/c/CredentialTypeInterface.java | 1 - .../io/twentysixty/sa/client/res/c/MessageInterface.java | 1 - .../sa/client/res/s/ConnectionEventInterface.java | 1 - .../twentysixty/sa/client/res/s/MessageEventInterface.java | 1 - .../java/io/twentysixty/sa/client/util/testing/Tryme.java | 3 ++- 11 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/main/java/io/twentysixty/sa/client/jms/AbstractProducer.java b/src/main/java/io/twentysixty/sa/client/jms/AbstractProducer.java index d57ceb3..a560813 100644 --- a/src/main/java/io/twentysixty/sa/client/jms/AbstractProducer.java +++ b/src/main/java/io/twentysixty/sa/client/jms/AbstractProducer.java @@ -1,5 +1,6 @@ package io.twentysixty.sa.client.jms; +import java.io.Serializable; import java.util.HashMap; import java.util.Map; import java.util.UUID; @@ -20,7 +21,7 @@ import io.twentysixty.sa.client.util.JsonUtil; -public abstract class AbstractProducer implements ProducerInterface { +public abstract class AbstractProducer implements ProducerInterface { private Integer producerId = 0; private Integer producerCount = 8; @@ -108,7 +109,7 @@ public void setProducerCount(Integer producerCount) { this.producerCount = producerCount; } - public void spool(BaseMessage sms, int attempt) throws Exception { + public void spool(M sms, int attempt) throws Exception { JMSProducer producer = null; JMSContext context = null; @@ -194,7 +195,7 @@ public void setDebug(Boolean debug) { } @Override - public void sendMessage(BaseMessage message) throws Exception { + public void sendMessage(M message) throws Exception { // TODO Auto-generated method stub } diff --git a/src/main/java/io/twentysixty/sa/client/jms/ProducerInterface.java b/src/main/java/io/twentysixty/sa/client/jms/ProducerInterface.java index 37611d9..1e21a68 100644 --- a/src/main/java/io/twentysixty/sa/client/jms/ProducerInterface.java +++ b/src/main/java/io/twentysixty/sa/client/jms/ProducerInterface.java @@ -1,8 +1,8 @@ package io.twentysixty.sa.client.jms; -import io.twentysixty.sa.client.model.message.BaseMessage; +import java.io.Serializable; -public interface ProducerInterface { +public interface ProducerInterface { public void setExDelay(Long exDelay); @@ -10,7 +10,7 @@ public interface ProducerInterface { public void setThreads(Integer threads); public void setDebug(Boolean debug); - public void sendMessage(BaseMessage message) throws Exception; + public void sendMessage(M message) throws Exception; diff --git a/src/main/java/io/twentysixty/sa/client/model/event/DidExchangeState.java b/src/main/java/io/twentysixty/sa/client/model/event/DidExchangeState.java index 3d5c0cc..e9057fe 100644 --- a/src/main/java/io/twentysixty/sa/client/model/event/DidExchangeState.java +++ b/src/main/java/io/twentysixty/sa/client/model/event/DidExchangeState.java @@ -31,6 +31,7 @@ export enum DidExchangeState { RESPONSE_RECEIVED("response-received"), ABANDONED("abandoned"), COMPLETED("completed"), + TERMINATED("terminated"), ; @@ -57,6 +58,7 @@ public static DidExchangeState getEnum(String index){ else if (index.equals("response-received")) return RESPONSE_RECEIVED; else if (index.equals("abandoned")) return ABANDONED; else if (index.equals("completed")) return COMPLETED; + else if (index.equals("terminated")) return TERMINATED; else return null; } diff --git a/src/main/java/io/twentysixty/sa/client/model/event/Event.java b/src/main/java/io/twentysixty/sa/client/model/event/Event.java index 4e4ef64..d5ef3e8 100644 --- a/src/main/java/io/twentysixty/sa/client/model/event/Event.java +++ b/src/main/java/io/twentysixty/sa/client/model/event/Event.java @@ -26,8 +26,10 @@ }) -public class Event implements Serializable { +public class Event implements Serializable { + private static final long serialVersionUID = -3403163200817960597L; + private String type; @JsonSerialize(using = InstantSerializer.class) diff --git a/src/main/java/io/twentysixty/sa/client/model/event/MessageReceived.java b/src/main/java/io/twentysixty/sa/client/model/event/MessageReceived.java index f7ed864..bc83b07 100644 --- a/src/main/java/io/twentysixty/sa/client/model/event/MessageReceived.java +++ b/src/main/java/io/twentysixty/sa/client/model/event/MessageReceived.java @@ -13,6 +13,7 @@ public class MessageReceived extends Event implements Serializable { + private static final long serialVersionUID = 8579005132408573827L; private BaseMessage message; public BaseMessage getMessage() { diff --git a/src/main/java/io/twentysixty/sa/client/model/message/TerminateConnectionMessage.java b/src/main/java/io/twentysixty/sa/client/model/message/TerminateConnectionMessage.java index e67ad71..8627f22 100644 --- a/src/main/java/io/twentysixty/sa/client/model/message/TerminateConnectionMessage.java +++ b/src/main/java/io/twentysixty/sa/client/model/message/TerminateConnectionMessage.java @@ -8,6 +8,7 @@ @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) +@Deprecated public class TerminateConnectionMessage extends BaseMessage implements Serializable { private static final long serialVersionUID = -2840211856886973672L; diff --git a/src/main/java/io/twentysixty/sa/client/res/c/CredentialTypeInterface.java b/src/main/java/io/twentysixty/sa/client/res/c/CredentialTypeInterface.java index 60632e7..e72b764 100644 --- a/src/main/java/io/twentysixty/sa/client/res/c/CredentialTypeInterface.java +++ b/src/main/java/io/twentysixty/sa/client/res/c/CredentialTypeInterface.java @@ -9,7 +9,6 @@ import io.twentysixty.sa.client.model.credential.CredentialType; -@Path("/v1") public interface CredentialTypeInterface { @POST diff --git a/src/main/java/io/twentysixty/sa/client/res/c/MessageInterface.java b/src/main/java/io/twentysixty/sa/client/res/c/MessageInterface.java index 865fd24..e51f8e5 100644 --- a/src/main/java/io/twentysixty/sa/client/res/c/MessageInterface.java +++ b/src/main/java/io/twentysixty/sa/client/res/c/MessageInterface.java @@ -7,7 +7,6 @@ import io.twentysixty.sa.client.model.message.BaseMessage; import io.twentysixty.sa.client.model.message.IdMessage; -@Path("/v1") public interface MessageInterface { //cambiar void @POST diff --git a/src/main/java/io/twentysixty/sa/client/res/s/ConnectionEventInterface.java b/src/main/java/io/twentysixty/sa/client/res/s/ConnectionEventInterface.java index 43fa3bf..f968f71 100644 --- a/src/main/java/io/twentysixty/sa/client/res/s/ConnectionEventInterface.java +++ b/src/main/java/io/twentysixty/sa/client/res/s/ConnectionEventInterface.java @@ -8,7 +8,6 @@ import io.twentysixty.sa.client.model.event.ConnectionStateUpdated; -@Path("/v1") public interface ConnectionEventInterface { @POST diff --git a/src/main/java/io/twentysixty/sa/client/res/s/MessageEventInterface.java b/src/main/java/io/twentysixty/sa/client/res/s/MessageEventInterface.java index 6d183b2..7109231 100644 --- a/src/main/java/io/twentysixty/sa/client/res/s/MessageEventInterface.java +++ b/src/main/java/io/twentysixty/sa/client/res/s/MessageEventInterface.java @@ -9,7 +9,6 @@ import io.twentysixty.sa.client.model.event.MessageReceived; import io.twentysixty.sa.client.model.event.MessageStateUpdated; -@Path("/v1") public interface MessageEventInterface { @POST diff --git a/src/main/java/io/twentysixty/sa/client/util/testing/Tryme.java b/src/main/java/io/twentysixty/sa/client/util/testing/Tryme.java index 5d51265..2d50c23 100644 --- a/src/main/java/io/twentysixty/sa/client/util/testing/Tryme.java +++ b/src/main/java/io/twentysixty/sa/client/util/testing/Tryme.java @@ -5,6 +5,7 @@ import com.fasterxml.jackson.core.JsonProcessingException; +import io.twentysixty.sa.client.model.message.BaseMessage; import io.twentysixty.sa.client.model.message.TextMessage; import io.twentysixty.sa.client.util.JsonUtil; @@ -17,7 +18,7 @@ public static void main(String[] args) throws JsonProcessingException { textMessage.setId(UUID.randomUUID()); textMessage.setThreadId(UUID.randomUUID()); textMessage.setTimestamp(Instant.now()); - System.out.println(JsonUtil.serialize(textMessage, false)); + System.out.println(JsonUtil.serialize((BaseMessage)textMessage, true)); }