Skip to content

Commit

Permalink
issue #218: removing redundant code
Browse files Browse the repository at this point in the history
  • Loading branch information
satanatoly committed Jun 27, 2017
1 parent c44b582 commit b99f2df
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@
import org.mobicents.protocols.ss7.map.datacoding.Gsm7EncodingStyle;
import org.mobicents.protocols.ss7.map.smstpdu.DataCodingSchemeImpl;
import org.mobicents.smsc.library.ErrorCode;
import org.mobicents.smsc.library.MessageState;
import org.mobicents.smsc.library.MessageUtil;
import org.mobicents.smsc.tools.smppsimulator.SmppSimulatorParameters.DeliveryResponseGenerating;
import org.mobicents.smsc.tools.smppsimulator.SmppSimulatorParameters.TlvMessageStateCode;

import com.cloudhopper.commons.util.windowing.WindowFuture;
import com.cloudhopper.smpp.PduAsyncResponse;
Expand Down Expand Up @@ -212,18 +212,18 @@ public PduResponse firePduRequestReceived(PduRequest pduRequest) {
msgId2 = msgId2 + "XYZ";
msgId3 = null;
}
TlvMessageStateCode msgState = null;
MessageState msgState = null;

if (this.testingForm.getSmppSimulatorParameters().isIdResponseTlvMessageState()) {
if (this.testingForm.getSmppSimulatorParameters().isRejectIncomingDeliveryMessage())
//message will have message_state set to REJECTED (value 8)
msgState = TlvMessageStateCode.REJECTED;
msgState = MessageState.REJECTED;
else if (this.testingForm.getSmppSimulatorParameters().getDeliveryResponseGenerating().equals(DeliveryResponseGenerating.Error8)) {
//message will have message_state set to UNDELIVERABLE (value 5)
msgState = TlvMessageStateCode.UNDELIVERABLE;
msgState = MessageState.UNDELIVERABLE;
} else {
//message should have message_state set to DELIVERED (value 2)
msgState = TlvMessageStateCode.DELIVERED;
msgState = MessageState.DELIVERED;
}
}

Expand Down Expand Up @@ -318,10 +318,10 @@ public class DeliveryReceiptSender implements Runnable {
private Date submitDate;
private String messageId;
private String messageIdTlv;
private TlvMessageStateCode messageStateTlv;
private MessageState messageStateTlv;

public DeliveryReceiptSender(DeliveryResponseGenerating deliveryResponseGenerating, Date submitDate, String messageId,
String messageIdTlv, TlvMessageStateCode messageStateTlv) {
String messageIdTlv, MessageState messageStateTlv) {
this.deliveryResponseGenerating = deliveryResponseGenerating;
this.submitDate = submitDate;
this.messageId = messageId;
Expand Down Expand Up @@ -390,7 +390,7 @@ public void run() {

if (messageStateTlv != null) {
byte[] data = new byte[1];
data[0] = messageStateTlv.getValue();
data[0] = (byte)messageStateTlv.getCode();
Tlv tlv = new Tlv(SmppConstants.TAG_MSG_STATE, data, "msg_state");
pdu.addOptionalParameter(tlv);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -504,28 +504,5 @@ public int getCode() {
public enum DeliveryResponseGenerating {
No, Success, Error8;
}


public enum TlvMessageStateCode {
ENROUTE((byte)1),
DELIVERED((byte)2),
EXPIRED((byte)3),
DELETED((byte)4),
UNDELIVERABLE((byte)5),
ACCEPTED((byte)6),
UNKNOWN((byte)7),
REJECTED((byte)8);

private byte value;

private TlvMessageStateCode(byte value) {
this.value = value;
}

public byte getValue() {
return value;
}

}
}

0 comments on commit b99f2df

Please sign in to comment.