From edabdc9a8580bcd41a2ecb2aa17217fa3f5926d1 Mon Sep 17 00:00:00 2001 From: Vadim Mykhailiuk Date: Tue, 13 Jun 2017 17:02:30 +0300 Subject: [PATCH] Added comments to message interfaces, updated MessageFactory methods --- .../ss7/sccp/message/MessageFactory.java | 23 ++++++++ .../ss7/sccp/message/SccpConnAkMessage.java | 5 ++ .../ss7/sccp/message/SccpConnCcMessage.java | 5 ++ .../ss7/sccp/message/SccpConnCrMessage.java | 5 ++ .../ss7/sccp/message/SccpConnCrefMessage.java | 5 ++ .../ss7/sccp/message/SccpConnDt1Message.java | 5 ++ .../ss7/sccp/message/SccpConnDt2Message.java | 5 ++ .../ss7/sccp/message/SccpConnErrMessage.java | 5 ++ .../ss7/sccp/message/SccpConnItMessage.java | 5 ++ .../ss7/sccp/message/SccpConnRlcMessage.java | 5 ++ .../ss7/sccp/message/SccpConnRlsdMessage.java | 5 ++ .../ss7/sccp/message/SccpConnRscMessage.java | 5 ++ .../ss7/sccp/message/SccpConnRsrMessage.java | 5 ++ .../sccp/impl/message/MessageFactoryImpl.java | 54 ++++++++++++------- .../impl/message/SccpConnAkMessageImpl.java | 8 +-- .../impl/message/SccpConnCcMessageImpl.java | 8 +-- .../impl/message/SccpConnCrMessageImpl.java | 8 +-- .../impl/message/SccpConnCrefMessageImpl.java | 8 +-- .../impl/message/SccpConnErrMessageImpl.java | 8 +-- .../impl/message/SccpConnItMessageImpl.java | 8 +-- .../impl/message/SccpConnRlcMessageImpl.java | 8 +-- .../impl/message/SccpConnRlsdMessageImpl.java | 8 +-- .../impl/message/SccpConnRscMessageImpl.java | 8 +-- .../impl/message/SccpConnRsrMessageImpl.java | 8 +-- .../impl/message/SccpConnAkMessageTest.java | 3 +- .../impl/message/SccpConnCcMessageTest.java | 7 ++- .../impl/message/SccpConnCrMessageTest.java | 26 ++++----- .../impl/message/SccpConnCrefMessageTest.java | 9 ++-- .../impl/message/SccpConnDt1MessageTest.java | 3 +- .../impl/message/SccpConnDt2MessageTest.java | 4 +- .../impl/message/SccpConnErrMessageTest.java | 3 +- .../impl/message/SccpConnItMessageTest.java | 3 +- .../impl/message/SccpConnRlcMessageTest.java | 3 +- .../impl/message/SccpConnRlsdMessageTest.java | 7 ++- .../impl/message/SccpConnRscMessageTest.java | 3 +- .../impl/message/SccpConnRsrMessageTest.java | 3 +- 36 files changed, 185 insertions(+), 106 deletions(-) diff --git a/sccp/sccp-api/src/main/java/org/mobicents/protocols/ss7/sccp/message/MessageFactory.java b/sccp/sccp-api/src/main/java/org/mobicents/protocols/ss7/sccp/message/MessageFactory.java index b9dbee6031..a72b70c3c2 100644 --- a/sccp/sccp-api/src/main/java/org/mobicents/protocols/ss7/sccp/message/MessageFactory.java +++ b/sccp/sccp-api/src/main/java/org/mobicents/protocols/ss7/sccp/message/MessageFactory.java @@ -24,6 +24,7 @@ import java.io.Serializable; +import org.mobicents.protocols.ss7.sccp.parameter.Credit; import org.mobicents.protocols.ss7.sccp.parameter.HopCounter; import org.mobicents.protocols.ss7.sccp.parameter.Importance; import org.mobicents.protocols.ss7.sccp.parameter.SccpAddress; @@ -73,4 +74,26 @@ SccpDataMessage createDataMessageClass1(SccpAddress calledParty, SccpAddress cal // SccpAddress callingParty, byte[] data, // HopCounter hopCounter, Importance importance); + /** + * Create a SCCP connection request message (class 2) + * + * @param calledParty + * @param callingParty This parameter is optional + * @param data This parameter is optional + * @param importance This parameter is optional + * @return + */ + SccpConnCrMessage createConnectMessageClass2(int localSsn, SccpAddress calledParty, SccpAddress callingParty, byte[] data, Importance importance); + + /** + * Create a SCCP connection request message (class 3) + * + * @param calledParty + * @param callingParty This parameter is optional + * @param credit + * @param data This parameter is optional + * @param importance This parameter is optional + * @return + */ + SccpConnCrMessage createConnectMessageClass3(int localSsn, SccpAddress calledParty, SccpAddress callingParty, Credit credit, byte[] data, Importance importance); } diff --git a/sccp/sccp-api/src/main/java/org/mobicents/protocols/ss7/sccp/message/SccpConnAkMessage.java b/sccp/sccp-api/src/main/java/org/mobicents/protocols/ss7/sccp/message/SccpConnAkMessage.java index d8310f20d9..1f1a170bb6 100644 --- a/sccp/sccp-api/src/main/java/org/mobicents/protocols/ss7/sccp/message/SccpConnAkMessage.java +++ b/sccp/sccp-api/src/main/java/org/mobicents/protocols/ss7/sccp/message/SccpConnAkMessage.java @@ -26,6 +26,11 @@ import org.mobicents.protocols.ss7.sccp.parameter.LocalReference; import org.mobicents.protocols.ss7.sccp.parameter.ReceiveSequenceNumber; +/** + * + * This interface represents a SCCP data acknowledgement message for connection-oriented protocol class 3. + * + */ public interface SccpConnAkMessage extends SccpMessage { LocalReference getDestinationLocalReferenceNumber(); void setDestinationLocalReferenceNumber(LocalReference number); diff --git a/sccp/sccp-api/src/main/java/org/mobicents/protocols/ss7/sccp/message/SccpConnCcMessage.java b/sccp/sccp-api/src/main/java/org/mobicents/protocols/ss7/sccp/message/SccpConnCcMessage.java index 0ed1dd74d1..28c92f84e1 100644 --- a/sccp/sccp-api/src/main/java/org/mobicents/protocols/ss7/sccp/message/SccpConnCcMessage.java +++ b/sccp/sccp-api/src/main/java/org/mobicents/protocols/ss7/sccp/message/SccpConnCcMessage.java @@ -28,6 +28,11 @@ import org.mobicents.protocols.ss7.sccp.parameter.ProtocolClass; import org.mobicents.protocols.ss7.sccp.parameter.SccpAddress; +/** + * + * This interface represents a SCCP connection confirm message for connection-oriented protocol classes 2 and 3. + * + */ public interface SccpConnCcMessage extends SccpMessage { LocalReference getDestinationLocalReferenceNumber(); void setDestinationLocalReferenceNumber(LocalReference number); diff --git a/sccp/sccp-api/src/main/java/org/mobicents/protocols/ss7/sccp/message/SccpConnCrMessage.java b/sccp/sccp-api/src/main/java/org/mobicents/protocols/ss7/sccp/message/SccpConnCrMessage.java index 600f350ae8..3bc695366d 100644 --- a/sccp/sccp-api/src/main/java/org/mobicents/protocols/ss7/sccp/message/SccpConnCrMessage.java +++ b/sccp/sccp-api/src/main/java/org/mobicents/protocols/ss7/sccp/message/SccpConnCrMessage.java @@ -29,6 +29,11 @@ import org.mobicents.protocols.ss7.sccp.parameter.ProtocolClass; import org.mobicents.protocols.ss7.sccp.parameter.SccpAddress; +/** + * + * This interface represents a SCCP connection request message for connection-oriented protocol classes 2 and 3. + * + */ public interface SccpConnCrMessage extends SccpMessage { LocalReference getSourceLocalReferenceNumber(); diff --git a/sccp/sccp-api/src/main/java/org/mobicents/protocols/ss7/sccp/message/SccpConnCrefMessage.java b/sccp/sccp-api/src/main/java/org/mobicents/protocols/ss7/sccp/message/SccpConnCrefMessage.java index 8212af1312..bb934bec29 100644 --- a/sccp/sccp-api/src/main/java/org/mobicents/protocols/ss7/sccp/message/SccpConnCrefMessage.java +++ b/sccp/sccp-api/src/main/java/org/mobicents/protocols/ss7/sccp/message/SccpConnCrefMessage.java @@ -27,6 +27,11 @@ import org.mobicents.protocols.ss7.sccp.parameter.RefusalCause; import org.mobicents.protocols.ss7.sccp.parameter.SccpAddress; +/** + * + * This interface represents a SCCP connection refused message for connection-oriented protocol classes 2 and 3. + * + */ public interface SccpConnCrefMessage extends SccpMessage { LocalReference getDestinationLocalReferenceNumber(); void setDestinationLocalReferenceNumber(LocalReference number); diff --git a/sccp/sccp-api/src/main/java/org/mobicents/protocols/ss7/sccp/message/SccpConnDt1Message.java b/sccp/sccp-api/src/main/java/org/mobicents/protocols/ss7/sccp/message/SccpConnDt1Message.java index 8349600ec4..7cf0f74639 100644 --- a/sccp/sccp-api/src/main/java/org/mobicents/protocols/ss7/sccp/message/SccpConnDt1Message.java +++ b/sccp/sccp-api/src/main/java/org/mobicents/protocols/ss7/sccp/message/SccpConnDt1Message.java @@ -25,6 +25,11 @@ import org.mobicents.protocols.ss7.sccp.parameter.LocalReference; import org.mobicents.protocols.ss7.sccp.parameter.SegmentingReassembling; +/** + * + * This interface represents a SCCP data form 1 message for connection-oriented protocol class 2. + * + */ public interface SccpConnDt1Message extends SccpMessage { LocalReference getDestinationLocalReferenceNumber(); void setDestinationLocalReferenceNumber(LocalReference number); diff --git a/sccp/sccp-api/src/main/java/org/mobicents/protocols/ss7/sccp/message/SccpConnDt2Message.java b/sccp/sccp-api/src/main/java/org/mobicents/protocols/ss7/sccp/message/SccpConnDt2Message.java index 346b7f51f4..aa6b1103ad 100644 --- a/sccp/sccp-api/src/main/java/org/mobicents/protocols/ss7/sccp/message/SccpConnDt2Message.java +++ b/sccp/sccp-api/src/main/java/org/mobicents/protocols/ss7/sccp/message/SccpConnDt2Message.java @@ -25,6 +25,11 @@ import org.mobicents.protocols.ss7.sccp.parameter.LocalReference; import org.mobicents.protocols.ss7.sccp.parameter.SequencingSegmenting; +/** + * + * This interface represents a SCCP data form 2 message for connection-oriented protocol class 3. + * + */ public interface SccpConnDt2Message extends SccpMessage { LocalReference getDestinationLocalReferenceNumber(); void setDestinationLocalReferenceNumber(LocalReference number); diff --git a/sccp/sccp-api/src/main/java/org/mobicents/protocols/ss7/sccp/message/SccpConnErrMessage.java b/sccp/sccp-api/src/main/java/org/mobicents/protocols/ss7/sccp/message/SccpConnErrMessage.java index 9ed00619f4..d5c7c482b9 100644 --- a/sccp/sccp-api/src/main/java/org/mobicents/protocols/ss7/sccp/message/SccpConnErrMessage.java +++ b/sccp/sccp-api/src/main/java/org/mobicents/protocols/ss7/sccp/message/SccpConnErrMessage.java @@ -25,6 +25,11 @@ import org.mobicents.protocols.ss7.sccp.parameter.ErrorCause; import org.mobicents.protocols.ss7.sccp.parameter.LocalReference; +/** + * + * This interface represents a SCCP protocol data unit error message for connection-oriented protocol classes 2 and 3. + * + */ public interface SccpConnErrMessage extends SccpMessage { LocalReference getDestinationLocalReferenceNumber(); void setDestinationLocalReferenceNumber(LocalReference number); diff --git a/sccp/sccp-api/src/main/java/org/mobicents/protocols/ss7/sccp/message/SccpConnItMessage.java b/sccp/sccp-api/src/main/java/org/mobicents/protocols/ss7/sccp/message/SccpConnItMessage.java index f09828c384..4a40f4b256 100644 --- a/sccp/sccp-api/src/main/java/org/mobicents/protocols/ss7/sccp/message/SccpConnItMessage.java +++ b/sccp/sccp-api/src/main/java/org/mobicents/protocols/ss7/sccp/message/SccpConnItMessage.java @@ -27,6 +27,11 @@ import org.mobicents.protocols.ss7.sccp.parameter.ProtocolClass; import org.mobicents.protocols.ss7.sccp.parameter.SequencingSegmenting; +/** + * + * This interface represents a SCCP inactivity test message for connection-oriented protocol classes 2 and 3. + * + */ public interface SccpConnItMessage extends SccpMessage { LocalReference getDestinationLocalReferenceNumber(); void setDestinationLocalReferenceNumber(LocalReference number); diff --git a/sccp/sccp-api/src/main/java/org/mobicents/protocols/ss7/sccp/message/SccpConnRlcMessage.java b/sccp/sccp-api/src/main/java/org/mobicents/protocols/ss7/sccp/message/SccpConnRlcMessage.java index 00ce558f5a..521514dfb5 100644 --- a/sccp/sccp-api/src/main/java/org/mobicents/protocols/ss7/sccp/message/SccpConnRlcMessage.java +++ b/sccp/sccp-api/src/main/java/org/mobicents/protocols/ss7/sccp/message/SccpConnRlcMessage.java @@ -24,6 +24,11 @@ import org.mobicents.protocols.ss7.sccp.parameter.LocalReference; +/** + * + * This interface represents a SCCP release complete message for connection-oriented protocol classes 2 and 3. + * + */ public interface SccpConnRlcMessage extends SccpMessage { LocalReference getDestinationLocalReferenceNumber(); void setDestinationLocalReferenceNumber(LocalReference number); diff --git a/sccp/sccp-api/src/main/java/org/mobicents/protocols/ss7/sccp/message/SccpConnRlsdMessage.java b/sccp/sccp-api/src/main/java/org/mobicents/protocols/ss7/sccp/message/SccpConnRlsdMessage.java index 328279fc35..9422db05c5 100644 --- a/sccp/sccp-api/src/main/java/org/mobicents/protocols/ss7/sccp/message/SccpConnRlsdMessage.java +++ b/sccp/sccp-api/src/main/java/org/mobicents/protocols/ss7/sccp/message/SccpConnRlsdMessage.java @@ -26,6 +26,11 @@ import org.mobicents.protocols.ss7.sccp.parameter.LocalReference; import org.mobicents.protocols.ss7.sccp.parameter.ReleaseCause; +/** + * + * This interface represents a SCCP released message for connection-oriented protocol classes 2 and 3. + * + */ public interface SccpConnRlsdMessage extends SccpMessage { LocalReference getDestinationLocalReferenceNumber(); void setDestinationLocalReferenceNumber(LocalReference number); diff --git a/sccp/sccp-api/src/main/java/org/mobicents/protocols/ss7/sccp/message/SccpConnRscMessage.java b/sccp/sccp-api/src/main/java/org/mobicents/protocols/ss7/sccp/message/SccpConnRscMessage.java index 69a06aec63..005e3310f9 100644 --- a/sccp/sccp-api/src/main/java/org/mobicents/protocols/ss7/sccp/message/SccpConnRscMessage.java +++ b/sccp/sccp-api/src/main/java/org/mobicents/protocols/ss7/sccp/message/SccpConnRscMessage.java @@ -24,6 +24,11 @@ import org.mobicents.protocols.ss7.sccp.parameter.LocalReference; +/** + * + * This interface represents a SCCP reset confirmation message for connection-oriented protocol class 3. + * + */ public interface SccpConnRscMessage extends SccpMessage { LocalReference getDestinationLocalReferenceNumber(); void setDestinationLocalReferenceNumber(LocalReference number); diff --git a/sccp/sccp-api/src/main/java/org/mobicents/protocols/ss7/sccp/message/SccpConnRsrMessage.java b/sccp/sccp-api/src/main/java/org/mobicents/protocols/ss7/sccp/message/SccpConnRsrMessage.java index e5b4b75ac5..0fbad44525 100644 --- a/sccp/sccp-api/src/main/java/org/mobicents/protocols/ss7/sccp/message/SccpConnRsrMessage.java +++ b/sccp/sccp-api/src/main/java/org/mobicents/protocols/ss7/sccp/message/SccpConnRsrMessage.java @@ -25,6 +25,11 @@ import org.mobicents.protocols.ss7.sccp.parameter.LocalReference; import org.mobicents.protocols.ss7.sccp.parameter.ResetCause; +/** + * + * This interface represents a SCCP reset request message for connection-oriented protocol class 3. + * + */ public interface SccpConnRsrMessage extends SccpMessage { LocalReference getDestinationLocalReferenceNumber(); void setDestinationLocalReferenceNumber(LocalReference number); diff --git a/sccp/sccp-impl/src/main/java/org/mobicents/protocols/ss7/sccp/impl/message/MessageFactoryImpl.java b/sccp/sccp-impl/src/main/java/org/mobicents/protocols/ss7/sccp/impl/message/MessageFactoryImpl.java index 2c4c36363d..65de8daccb 100644 --- a/sccp/sccp-impl/src/main/java/org/mobicents/protocols/ss7/sccp/impl/message/MessageFactoryImpl.java +++ b/sccp/sccp-impl/src/main/java/org/mobicents/protocols/ss7/sccp/impl/message/MessageFactoryImpl.java @@ -22,8 +22,6 @@ package org.mobicents.protocols.ss7.sccp.impl.message; -import java.io.InputStream; - import org.apache.log4j.Level; import org.apache.log4j.Logger; import org.mobicents.protocols.ss7.sccp.SccpProtocolVersion; @@ -31,14 +29,18 @@ import org.mobicents.protocols.ss7.sccp.impl.parameter.ProtocolClassImpl; import org.mobicents.protocols.ss7.sccp.message.MessageFactory; import org.mobicents.protocols.ss7.sccp.message.ParseException; +import org.mobicents.protocols.ss7.sccp.message.SccpConnCrMessage; import org.mobicents.protocols.ss7.sccp.message.SccpDataMessage; import org.mobicents.protocols.ss7.sccp.message.SccpMessage; import org.mobicents.protocols.ss7.sccp.message.SccpNoticeMessage; +import org.mobicents.protocols.ss7.sccp.parameter.Credit; import org.mobicents.protocols.ss7.sccp.parameter.HopCounter; import org.mobicents.protocols.ss7.sccp.parameter.Importance; import org.mobicents.protocols.ss7.sccp.parameter.ReturnCause; import org.mobicents.protocols.ss7.sccp.parameter.SccpAddress; +import java.io.InputStream; + /** * * @author kulikov @@ -85,7 +87,28 @@ public SccpNoticeMessage createNoticeMessage(int origMsgType, ReturnCause return importance); } - public SccpMessageImpl createMessage(int type, int opc, int dpc, int sls, int networkId) + public SccpConnCrMessage createConnectMessageClass2(int localSsn, SccpAddress calledAddress, SccpAddress callingAddress, byte[] data, Importance importance) { + SccpConnCrMessageImpl message = new SccpConnCrMessageImpl(sccpStackImpl.newSls(), localSsn); + message.setCalledPartyAddress(calledAddress); + message.setCallingPartyAddress(callingAddress); + message.setProtocolClass(new ProtocolClassImpl(2)); + message.setUserData(data); + message.setImportance(importance); + return message; + } + + public SccpConnCrMessage createConnectMessageClass3(int localSsn, SccpAddress calledAddress, SccpAddress callingAddress, Credit credit, byte[] data, Importance importance) { + SccpConnCrMessageImpl message = new SccpConnCrMessageImpl(sccpStackImpl.newSls(), localSsn); + message.setCalledPartyAddress(calledAddress); + message.setCallingPartyAddress(callingAddress); + message.setProtocolClass(new ProtocolClassImpl(3)); + message.setCredit(credit); + message.setUserData(data); + message.setImportance(importance); + return message; + } + + public SccpMessageImpl createMessage(int type, int opc, int dpc, int sls, InputStream in, final SccpProtocolVersion sccpProtocolVersion, int networkId) throws ParseException { SccpMessageImpl msg = null; switch (type) { @@ -102,23 +125,23 @@ public SccpMessageImpl createMessage(int type, int opc, int dpc, int sls, int ne break; case SccpMessage.MESSAGE_TYPE_CR: - msg = new SccpConnCrMessageImpl(this.sccpStackImpl.getMaxDataMessage(), opc, dpc, sls, networkId); + msg = new SccpConnCrMessageImpl(opc, dpc, sls, networkId); break; case SccpMessage.MESSAGE_TYPE_CC: - msg = new SccpConnCcMessageImpl(this.sccpStackImpl.getMaxDataMessage(), opc, dpc, sls, networkId); + msg = new SccpConnCcMessageImpl(opc, dpc, sls, networkId); break; case SccpMessage.MESSAGE_TYPE_CREF: - msg = new SccpConnCrefMessageImpl(this.sccpStackImpl.getMaxDataMessage(), opc, dpc, sls, networkId); + msg = new SccpConnCrefMessageImpl(opc, dpc, sls, networkId); break; case SccpMessage.MESSAGE_TYPE_RLSD: - msg = new SccpConnRlsdMessageImpl(this.sccpStackImpl.getMaxDataMessage(), opc, dpc, sls, networkId); + msg = new SccpConnRlsdMessageImpl(opc, dpc, sls, networkId); break; case SccpMessage.MESSAGE_TYPE_RLC: - msg = new SccpConnRlcMessageImpl(this.sccpStackImpl.getMaxDataMessage(), opc, dpc, sls, networkId); + msg = new SccpConnRlcMessageImpl(opc, dpc, sls, networkId); break; case SccpMessage.MESSAGE_TYPE_DT1: @@ -130,31 +153,26 @@ public SccpMessageImpl createMessage(int type, int opc, int dpc, int sls, int ne break; case SccpMessage.MESSAGE_TYPE_AK: - msg = new SccpConnAkMessageImpl(this.sccpStackImpl.getMaxDataMessage(), opc, dpc, sls, networkId); + msg = new SccpConnAkMessageImpl(opc, dpc, sls, networkId); break; case SccpMessage.MESSAGE_TYPE_RSR: - msg = new SccpConnRsrMessageImpl(this.sccpStackImpl.getMaxDataMessage(), opc, dpc, sls, networkId); + msg = new SccpConnRsrMessageImpl(opc, dpc, sls, networkId); break; case SccpMessage.MESSAGE_TYPE_RSC: - msg = new SccpConnRscMessageImpl(this.sccpStackImpl.getMaxDataMessage(), opc, dpc, sls, networkId); + msg = new SccpConnRscMessageImpl(opc, dpc, sls, networkId); break; case SccpMessage.MESSAGE_TYPE_ERR: - msg = new SccpConnErrMessageImpl(this.sccpStackImpl.getMaxDataMessage(), opc, dpc, sls, networkId); + msg = new SccpConnErrMessageImpl(opc, dpc, sls, networkId); break; case SccpMessage.MESSAGE_TYPE_IT: - msg = new SccpConnItMessageImpl(this.sccpStackImpl.getMaxDataMessage(), opc, dpc, sls, networkId); + msg = new SccpConnItMessageImpl(opc, dpc, sls, networkId); break; } - return msg; - } - public SccpMessageImpl createMessage(int type, int opc, int dpc, int sls, InputStream in, final SccpProtocolVersion sccpProtocolVersion, int networkId) - throws ParseException { - SccpMessageImpl msg = createMessage(type, opc, dpc, sls, networkId); if (msg != null) { msg.decode(in, sccpStackImpl.getSccpProvider().getParameterFactory(), sccpProtocolVersion); } else if (logger.isEnabledFor(Level.WARN)) { diff --git a/sccp/sccp-impl/src/main/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnAkMessageImpl.java b/sccp/sccp-impl/src/main/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnAkMessageImpl.java index df73dacd41..fe8787ed5c 100644 --- a/sccp/sccp-impl/src/main/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnAkMessageImpl.java +++ b/sccp/sccp-impl/src/main/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnAkMessageImpl.java @@ -45,12 +45,12 @@ public class SccpConnAkMessageImpl extends SccpMessageImpl implements SccpConnAk protected ReceiveSequenceNumber receiveSequenceNumber; protected Credit credit; - protected SccpConnAkMessageImpl(int maxDataLen, int sls, int localSsn) { - super(maxDataLen, MESSAGE_TYPE_AK, sls, localSsn); + protected SccpConnAkMessageImpl(int sls, int localSsn) { + super(0, MESSAGE_TYPE_AK, sls, localSsn); } - protected SccpConnAkMessageImpl(int maxDataLen, int incomingOpc, int incomingDpc, int incomingSls, int networkId) { - super(maxDataLen, MESSAGE_TYPE_AK, incomingOpc, incomingDpc, incomingSls, networkId); + protected SccpConnAkMessageImpl(int incomingOpc, int incomingDpc, int incomingSls, int networkId) { + super(0, MESSAGE_TYPE_AK, incomingOpc, incomingDpc, incomingSls, networkId); } @Override diff --git a/sccp/sccp-impl/src/main/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnCcMessageImpl.java b/sccp/sccp-impl/src/main/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnCcMessageImpl.java index 5fb22a01fc..c8c6559fbe 100644 --- a/sccp/sccp-impl/src/main/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnCcMessageImpl.java +++ b/sccp/sccp-impl/src/main/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnCcMessageImpl.java @@ -56,12 +56,12 @@ public class SccpConnCcMessageImpl extends SccpMessageImpl implements SccpConnCc protected byte[] userData; protected Importance importance; - protected SccpConnCcMessageImpl(int maxDataLen, int sls, int localSsn) { - super(maxDataLen, MESSAGE_TYPE_CC, sls, localSsn); + protected SccpConnCcMessageImpl(int sls, int localSsn) { + super(130, MESSAGE_TYPE_CC, sls, localSsn); } - protected SccpConnCcMessageImpl(int maxDataLen, int incomingOpc, int incomingDpc, int incomingSls, int networkId) { - super(maxDataLen, MESSAGE_TYPE_CC, incomingOpc, incomingDpc, incomingSls, networkId); + protected SccpConnCcMessageImpl(int incomingOpc, int incomingDpc, int incomingSls, int networkId) { + super(130, MESSAGE_TYPE_CC, incomingOpc, incomingDpc, incomingSls, networkId); } @Override diff --git a/sccp/sccp-impl/src/main/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnCrMessageImpl.java b/sccp/sccp-impl/src/main/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnCrMessageImpl.java index 66d222a00d..c177c8b669 100644 --- a/sccp/sccp-impl/src/main/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnCrMessageImpl.java +++ b/sccp/sccp-impl/src/main/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnCrMessageImpl.java @@ -58,12 +58,12 @@ public class SccpConnCrMessageImpl extends SccpMessageImpl implements SccpConnCr protected HopCounter hopCounter; protected Importance importance; - protected SccpConnCrMessageImpl(int maxDataLen, int sls, int localSsn) { - super(maxDataLen, MESSAGE_TYPE_CR, sls, localSsn); + protected SccpConnCrMessageImpl(int sls, int localSsn) { + super(130, MESSAGE_TYPE_CR, sls, localSsn); } - protected SccpConnCrMessageImpl(int maxDataLen, int incomingOpc, int incomingDpc, int incomingSls, int networkId) { - super(maxDataLen, MESSAGE_TYPE_CR, incomingOpc, incomingDpc, incomingSls, networkId); + protected SccpConnCrMessageImpl(int incomingOpc, int incomingDpc, int incomingSls, int networkId) { + super(130, MESSAGE_TYPE_CR, incomingOpc, incomingDpc, incomingSls, networkId); } @Override diff --git a/sccp/sccp-impl/src/main/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnCrefMessageImpl.java b/sccp/sccp-impl/src/main/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnCrefMessageImpl.java index 3c3c777fae..47efdb390e 100644 --- a/sccp/sccp-impl/src/main/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnCrefMessageImpl.java +++ b/sccp/sccp-impl/src/main/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnCrefMessageImpl.java @@ -52,12 +52,12 @@ public class SccpConnCrefMessageImpl extends SccpMessageImpl implements SccpConn protected RefusalCause refusalCause; protected Importance importance; - protected SccpConnCrefMessageImpl(int maxDataLen, int sls, int localSsn) { - super(maxDataLen, MESSAGE_TYPE_CREF, sls, localSsn); + protected SccpConnCrefMessageImpl(int sls, int localSsn) { + super(130, MESSAGE_TYPE_CREF, sls, localSsn); } - protected SccpConnCrefMessageImpl(int maxDataLen, int incomingOpc, int incomingDpc, int incomingSls, int networkId) { - super(maxDataLen, MESSAGE_TYPE_CREF, incomingOpc, incomingDpc, incomingSls, networkId); + protected SccpConnCrefMessageImpl(int incomingOpc, int incomingDpc, int incomingSls, int networkId) { + super(130, MESSAGE_TYPE_CREF, incomingOpc, incomingDpc, incomingSls, networkId); } @Override diff --git a/sccp/sccp-impl/src/main/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnErrMessageImpl.java b/sccp/sccp-impl/src/main/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnErrMessageImpl.java index 93fdd94e98..e9e59f56df 100644 --- a/sccp/sccp-impl/src/main/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnErrMessageImpl.java +++ b/sccp/sccp-impl/src/main/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnErrMessageImpl.java @@ -42,12 +42,12 @@ public class SccpConnErrMessageImpl extends SccpMessageImpl implements SccpConnE protected LocalReference destinationLocalReferenceNumber; protected ErrorCause errorCause; - protected SccpConnErrMessageImpl(int maxDataLen, int sls, int localSsn) { - super(maxDataLen, MESSAGE_TYPE_ERR, sls, localSsn); + protected SccpConnErrMessageImpl(int sls, int localSsn) { + super(0, MESSAGE_TYPE_ERR, sls, localSsn); } - protected SccpConnErrMessageImpl(int maxDataLen, int incomingOpc, int incomingDpc, int incomingSls, int networkId) { - super(maxDataLen, MESSAGE_TYPE_ERR, incomingOpc, incomingDpc, incomingSls, networkId); + protected SccpConnErrMessageImpl(int incomingOpc, int incomingDpc, int incomingSls, int networkId) { + super(0, MESSAGE_TYPE_ERR, incomingOpc, incomingDpc, incomingSls, networkId); } @Override diff --git a/sccp/sccp-impl/src/main/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnItMessageImpl.java b/sccp/sccp-impl/src/main/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnItMessageImpl.java index 18f6966606..239fa354da 100644 --- a/sccp/sccp-impl/src/main/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnItMessageImpl.java +++ b/sccp/sccp-impl/src/main/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnItMessageImpl.java @@ -49,12 +49,12 @@ public class SccpConnItMessageImpl extends SccpMessageImpl implements SccpConnIt protected SequencingSegmenting sequencingSegmenting; protected Credit credit; - protected SccpConnItMessageImpl(int maxDataLen, int sls, int localSsn) { - super(maxDataLen, MESSAGE_TYPE_IT, sls, localSsn); + protected SccpConnItMessageImpl(int sls, int localSsn) { + super(0, MESSAGE_TYPE_IT, sls, localSsn); } - protected SccpConnItMessageImpl(int maxDataLen, int incomingOpc, int incomingDpc, int incomingSls, int networkId) { - super(maxDataLen, MESSAGE_TYPE_IT, incomingOpc, incomingDpc, incomingSls, networkId); + protected SccpConnItMessageImpl(int incomingOpc, int incomingDpc, int incomingSls, int networkId) { + super(0, MESSAGE_TYPE_IT, incomingOpc, incomingDpc, incomingSls, networkId); } @Override diff --git a/sccp/sccp-impl/src/main/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnRlcMessageImpl.java b/sccp/sccp-impl/src/main/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnRlcMessageImpl.java index ddc39cecf5..3ca974f4b0 100644 --- a/sccp/sccp-impl/src/main/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnRlcMessageImpl.java +++ b/sccp/sccp-impl/src/main/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnRlcMessageImpl.java @@ -40,12 +40,12 @@ public class SccpConnRlcMessageImpl extends SccpMessageImpl implements SccpConnR protected LocalReference destinationLocalReferenceNumber; protected LocalReference sourceLocalReferenceNumber; - protected SccpConnRlcMessageImpl(int maxDataLen, int sls, int localSsn) { - super(maxDataLen, MESSAGE_TYPE_RLC, sls, localSsn); + protected SccpConnRlcMessageImpl(int sls, int localSsn) { + super(0, MESSAGE_TYPE_RLC, sls, localSsn); } - protected SccpConnRlcMessageImpl(int maxDataLen, int incomingOpc, int incomingDpc, int incomingSls, int networkId) { - super(maxDataLen, MESSAGE_TYPE_RLC, incomingOpc, incomingDpc, incomingSls, networkId); + protected SccpConnRlcMessageImpl(int incomingOpc, int incomingDpc, int incomingSls, int networkId) { + super(0, MESSAGE_TYPE_RLC, incomingOpc, incomingDpc, incomingSls, networkId); } @Override diff --git a/sccp/sccp-impl/src/main/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnRlsdMessageImpl.java b/sccp/sccp-impl/src/main/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnRlsdMessageImpl.java index 21fdeba652..0ba2f9fade 100644 --- a/sccp/sccp-impl/src/main/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnRlsdMessageImpl.java +++ b/sccp/sccp-impl/src/main/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnRlsdMessageImpl.java @@ -52,12 +52,12 @@ public class SccpConnRlsdMessageImpl extends SccpMessageImpl implements SccpConn protected byte[] userData; protected Importance importance; - protected SccpConnRlsdMessageImpl(int maxDataLen, int sls, int localSsn) { - super(maxDataLen, MESSAGE_TYPE_RLSD, sls, localSsn); + protected SccpConnRlsdMessageImpl(int sls, int localSsn) { + super(130, MESSAGE_TYPE_RLSD, sls, localSsn); } - protected SccpConnRlsdMessageImpl(int maxDataLen, int incomingOpc, int incomingDpc, int incomingSls, int networkId) { - super(maxDataLen, MESSAGE_TYPE_RLSD, incomingOpc, incomingDpc, incomingSls, networkId); + protected SccpConnRlsdMessageImpl(int incomingOpc, int incomingDpc, int incomingSls, int networkId) { + super(130, MESSAGE_TYPE_RLSD, incomingOpc, incomingDpc, incomingSls, networkId); } @Override diff --git a/sccp/sccp-impl/src/main/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnRscMessageImpl.java b/sccp/sccp-impl/src/main/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnRscMessageImpl.java index baafa8560a..47f712fa41 100644 --- a/sccp/sccp-impl/src/main/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnRscMessageImpl.java +++ b/sccp/sccp-impl/src/main/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnRscMessageImpl.java @@ -40,12 +40,12 @@ public class SccpConnRscMessageImpl extends SccpMessageImpl implements SccpConnR protected LocalReference destinationLocalReferenceNumber; protected LocalReference sourceLocalReferenceNumber; - protected SccpConnRscMessageImpl(int maxDataLen, int sls, int localSsn) { - super(maxDataLen, MESSAGE_TYPE_RSC, sls, localSsn); + protected SccpConnRscMessageImpl(int sls, int localSsn) { + super(0, MESSAGE_TYPE_RSC, sls, localSsn); } - protected SccpConnRscMessageImpl(int maxDataLen, int incomingOpc, int incomingDpc, int incomingSls, int networkId) { - super(maxDataLen, MESSAGE_TYPE_RSC, incomingOpc, incomingDpc, incomingSls, networkId); + protected SccpConnRscMessageImpl(int incomingOpc, int incomingDpc, int incomingSls, int networkId) { + super(0, MESSAGE_TYPE_RSC, incomingOpc, incomingDpc, incomingSls, networkId); } @Override diff --git a/sccp/sccp-impl/src/main/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnRsrMessageImpl.java b/sccp/sccp-impl/src/main/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnRsrMessageImpl.java index d6eb879c1b..e5a29ab5bd 100644 --- a/sccp/sccp-impl/src/main/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnRsrMessageImpl.java +++ b/sccp/sccp-impl/src/main/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnRsrMessageImpl.java @@ -43,12 +43,12 @@ public class SccpConnRsrMessageImpl extends SccpMessageImpl implements SccpConnR protected LocalReference sourceLocalReferenceNumber; protected ResetCause resetCause; - protected SccpConnRsrMessageImpl(int maxDataLen, int sls, int localSsn) { - super(maxDataLen, MESSAGE_TYPE_RSR, sls, localSsn); + protected SccpConnRsrMessageImpl(int sls, int localSsn) { + super(0, MESSAGE_TYPE_RSR, sls, localSsn); } - protected SccpConnRsrMessageImpl(int maxDataLen, int incomingOpc, int incomingDpc, int incomingSls, int networkId) { - super(maxDataLen, MESSAGE_TYPE_RSR, incomingOpc, incomingDpc, incomingSls, networkId); + protected SccpConnRsrMessageImpl(int incomingOpc, int incomingDpc, int incomingSls, int networkId) { + super(0, MESSAGE_TYPE_RSR, incomingOpc, incomingDpc, incomingSls, networkId); } @Override diff --git a/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnAkMessageTest.java b/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnAkMessageTest.java index a62f856664..4e842c93c3 100644 --- a/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnAkMessageTest.java +++ b/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnAkMessageTest.java @@ -30,7 +30,6 @@ import org.mobicents.protocols.ss7.sccp.impl.parameter.CreditImpl; import org.mobicents.protocols.ss7.sccp.impl.parameter.LocalReferenceImpl; import org.mobicents.protocols.ss7.sccp.impl.parameter.ReceiveSequenceNumberImpl; -import org.mobicents.protocols.ss7.sccp.message.SccpMessage; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; @@ -75,7 +74,7 @@ public void testDecode() throws Exception { @Test(groups = { "SccpMessage", "functional.encode" }) public void testEncode() throws Exception { - SccpConnAkMessageImpl original = (SccpConnAkMessageImpl) messageFactory.createMessage(SccpMessage.MESSAGE_TYPE_AK, 1, 2, 0, 0); + SccpConnAkMessageImpl original = new SccpConnAkMessageImpl(0, 0); original.setDestinationLocalReferenceNumber(new LocalReferenceImpl(1)); original.setReceiveSequenceNumber(new ReceiveSequenceNumberImpl((byte)0)); original.setCredit(new CreditImpl(100)); diff --git a/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnCcMessageTest.java b/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnCcMessageTest.java index f4e6eda070..789325d65f 100644 --- a/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnCcMessageTest.java +++ b/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnCcMessageTest.java @@ -32,7 +32,6 @@ import org.mobicents.protocols.ss7.sccp.impl.parameter.ImportanceImpl; import org.mobicents.protocols.ss7.sccp.impl.parameter.LocalReferenceImpl; import org.mobicents.protocols.ss7.sccp.impl.parameter.ProtocolClassImpl; -import org.mobicents.protocols.ss7.sccp.message.SccpMessage; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; @@ -123,7 +122,7 @@ public void testDecode() throws Exception { @Test(groups = { "SccpMessage", "functional.encode" }) public void testEncode() throws Exception { // ---- no optional params - SccpConnCcMessageImpl original = (SccpConnCcMessageImpl) messageFactory.createMessage(SccpMessage.MESSAGE_TYPE_CC, 1, 2, 0, 0); + SccpConnCcMessageImpl original = new SccpConnCcMessageImpl(0, 0); original.setDestinationLocalReferenceNumber(new LocalReferenceImpl(2)); original.setSourceLocalReferenceNumber(new LocalReferenceImpl(1)); original.setProtocolClass(new ProtocolClassImpl(3)); @@ -133,7 +132,7 @@ public void testEncode() throws Exception { assertEquals(encoded.getSolidData(), this.getDataCcNoOptParams()); // ---- one optional param - original = (SccpConnCcMessageImpl) messageFactory.createMessage(SccpMessage.MESSAGE_TYPE_CC, 1, 2, 0, 0); + original = new SccpConnCcMessageImpl(0, 0); original.setDestinationLocalReferenceNumber(new LocalReferenceImpl(2)); original.setSourceLocalReferenceNumber(new LocalReferenceImpl(1)); original.setProtocolClass(new ProtocolClassImpl(3)); @@ -144,7 +143,7 @@ public void testEncode() throws Exception { assertEquals(encoded.getSolidData(), this.getDataCcOneOptParam()); // ---- all param - original = (SccpConnCcMessageImpl) messageFactory.createMessage(SccpMessage.MESSAGE_TYPE_CC, 1, 2, 0, 0); + original = new SccpConnCcMessageImpl(0, 0); original.setDestinationLocalReferenceNumber(new LocalReferenceImpl(2)); original.setSourceLocalReferenceNumber(new LocalReferenceImpl(1)); original.setProtocolClass(new ProtocolClassImpl(3)); diff --git a/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnCrMessageTest.java b/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnCrMessageTest.java index 820dce0460..f510df6373 100644 --- a/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnCrMessageTest.java +++ b/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnCrMessageTest.java @@ -32,8 +32,7 @@ import org.mobicents.protocols.ss7.sccp.impl.parameter.HopCounterImpl; import org.mobicents.protocols.ss7.sccp.impl.parameter.ImportanceImpl; import org.mobicents.protocols.ss7.sccp.impl.parameter.LocalReferenceImpl; -import org.mobicents.protocols.ss7.sccp.impl.parameter.ProtocolClassImpl; -import org.mobicents.protocols.ss7.sccp.message.SccpMessage; +import org.mobicents.protocols.ss7.sccp.parameter.SccpAddress; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; @@ -132,41 +131,34 @@ public void testDecode() throws Exception { @Test(groups = { "SccpMessage", "functional.encode" }) public void testEncode() throws Exception { // ---- no optional params - SccpConnCrMessageImpl original = (SccpConnCrMessageImpl) messageFactory.createMessage(SccpMessage.MESSAGE_TYPE_CR, 1, 2, 0, 0); + SccpAddress calledAddress = stack.getSccpProvider().getParameterFactory().createSccpAddress(RoutingIndicator.ROUTING_BASED_ON_DPC_AND_SSN, null, 0, 8); + SccpConnCrMessageImpl original = (SccpConnCrMessageImpl) messageFactory.createConnectMessageClass3(8, calledAddress, null,null, null, null); original.setSourceLocalReferenceNumber(new LocalReferenceImpl(1)); - original.setProtocolClass(new ProtocolClassImpl(3)); - original.setCalledPartyAddress(stack.getSccpProvider().getParameterFactory().createSccpAddress(RoutingIndicator.ROUTING_BASED_ON_DPC_AND_SSN, null,0, 8)); EncodingResultData encoded = original.encode(stack, LongMessageRuleType.LONG_MESSAGE_FORBBIDEN, 272, logger, false, SccpProtocolVersion.ITU); assertEquals(encoded.getSolidData(), this.getDataCrNoOptParams()); // ---- one optional param - original = (SccpConnCrMessageImpl) messageFactory.createMessage(SccpMessage.MESSAGE_TYPE_CR, 1, 2, 0, 0); + original = (SccpConnCrMessageImpl) messageFactory.createConnectMessageClass3(8, calledAddress, null,null, null, new ImportanceImpl((byte)5)); original.setSourceLocalReferenceNumber(new LocalReferenceImpl(1)); - original.setProtocolClass(new ProtocolClassImpl(3)); - original.setCalledPartyAddress(stack.getSccpProvider().getParameterFactory().createSccpAddress(RoutingIndicator.ROUTING_BASED_ON_DPC_AND_SSN, null,0, 8)); - original.setImportance(new ImportanceImpl((byte)5)); encoded = original.encode(stack, LongMessageRuleType.LONG_MESSAGE_FORBBIDEN, 272, logger, false, SccpProtocolVersion.ITU); assertEquals(encoded.getSolidData(), this.getDataCrOneOptParam()); // ---- all param - original = (SccpConnCrMessageImpl) messageFactory.createMessage(SccpMessage.MESSAGE_TYPE_CR, 1, 2, 0, 0); - original.setSourceLocalReferenceNumber(new LocalReferenceImpl(1)); - original.setProtocolClass(new ProtocolClassImpl(3)); - original.setCalledPartyAddress(stack.getSccpProvider().getParameterFactory().createSccpAddress(RoutingIndicator.ROUTING_BASED_ON_DPC_AND_SSN, null,0, 8)); + SccpAddress callingAddress = stack.getSccpProvider().getParameterFactory().createSccpAddress(RoutingIndicator.ROUTING_BASED_ON_DPC_AND_SSN, null, 1, 8); - original.setCredit(new CreditImpl(10)); - original.setCallingPartyAddress(stack.getSccpProvider().getParameterFactory().createSccpAddress(RoutingIndicator.ROUTING_BASED_ON_DPC_AND_SSN, null,1, 8)); - original.setUserData(new byte[] {1, 2, 3, 4}); + original = (SccpConnCrMessageImpl) messageFactory.createConnectMessageClass3(8, calledAddress, callingAddress, new CreditImpl(10), + new byte[] {1, 2, 3, 4}, new ImportanceImpl((byte)5)); + original.setSourceLocalReferenceNumber(new LocalReferenceImpl(1)); original.setHopCounter(new HopCounterImpl(15)); - original.setImportance(new ImportanceImpl((byte)5)); encoded = original.encode(stack, LongMessageRuleType.LONG_MESSAGE_FORBBIDEN, 272, logger, false, SccpProtocolVersion.ITU); assertEquals(encoded.getSolidData(), this.getDataCrAllParams()); } } + diff --git a/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnCrefMessageTest.java b/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnCrefMessageTest.java index 2aec67f80f..100bc7764d 100644 --- a/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnCrefMessageTest.java +++ b/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnCrefMessageTest.java @@ -31,16 +31,13 @@ import org.mobicents.protocols.ss7.sccp.impl.parameter.ImportanceImpl; import org.mobicents.protocols.ss7.sccp.impl.parameter.LocalReferenceImpl; import org.mobicents.protocols.ss7.sccp.impl.parameter.RefusalCauseImpl; -import org.mobicents.protocols.ss7.sccp.message.SccpMessage; import org.mobicents.protocols.ss7.sccp.parameter.RefusalCauseValue; -import org.mobicents.protocols.ss7.sccp.parameter.SccpAddress; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; import java.io.ByteArrayInputStream; -import static org.mobicents.protocols.ss7.sccp.message.SccpMessage.MESSAGE_TYPE_CREF; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertNull; @@ -121,7 +118,7 @@ public void testDecode() throws Exception { @Test(groups = { "SccpMessage", "functional.encode" }) public void testEncode() throws Exception { // ---- no optional params - SccpConnCrefMessageImpl original = (SccpConnCrefMessageImpl) messageFactory.createMessage(MESSAGE_TYPE_CREF,1,2, 0, 0); + SccpConnCrefMessageImpl original = new SccpConnCrefMessageImpl(0, 0); original.setDestinationLocalReferenceNumber(new LocalReferenceImpl(2)); original.setRefusalCause(new RefusalCauseImpl(RefusalCauseValue.ACCESS_CONGESTION)); @@ -130,7 +127,7 @@ public void testEncode() throws Exception { assertEquals(encoded.getSolidData(), this.getDataCrefNoOptParams()); // ---- one optional param - original = (SccpConnCrefMessageImpl) messageFactory.createMessage(MESSAGE_TYPE_CREF,1, 2, 0, 0); + original = new SccpConnCrefMessageImpl(0, 0); original.setDestinationLocalReferenceNumber(new LocalReferenceImpl(2)); original.setRefusalCause(new RefusalCauseImpl(RefusalCauseValue.ACCESS_CONGESTION)); original.setCalledPartyAddress(stack.getSccpProvider().getParameterFactory().createSccpAddress(RoutingIndicator.ROUTING_BASED_ON_DPC_AND_SSN, null,0, 8)); @@ -140,7 +137,7 @@ public void testEncode() throws Exception { assertEquals(encoded.getSolidData(), this.getDataCrefOneOptParam()); // ---- all param - original = (SccpConnCrefMessageImpl) messageFactory.createMessage( MESSAGE_TYPE_CREF, 1, 2, 0, 0); + original = new SccpConnCrefMessageImpl(0, 0); original.setDestinationLocalReferenceNumber(new LocalReferenceImpl(2)); original.setRefusalCause(new RefusalCauseImpl(RefusalCauseValue.ACCESS_CONGESTION)); original.setCalledPartyAddress(stack.getSccpProvider().getParameterFactory().createSccpAddress(RoutingIndicator.ROUTING_BASED_ON_DPC_AND_SSN, null,0, 8)); diff --git a/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnDt1MessageTest.java b/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnDt1MessageTest.java index b82883b3fc..1a7ec77e8f 100644 --- a/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnDt1MessageTest.java +++ b/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnDt1MessageTest.java @@ -28,7 +28,6 @@ import org.mobicents.protocols.ss7.sccp.SccpProtocolVersion; import org.mobicents.protocols.ss7.sccp.impl.SccpStackImpl; import org.mobicents.protocols.ss7.sccp.impl.parameter.*; -import org.mobicents.protocols.ss7.sccp.message.SccpMessage; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; @@ -73,7 +72,7 @@ public void testDecode() throws Exception { @Test(groups = { "SccpMessage", "functional.encode" }) public void testEncode() throws Exception { - SccpConnDt1MessageImpl original = (SccpConnDt1MessageImpl) messageFactory.createMessage(SccpMessage.MESSAGE_TYPE_DT1, 1, 2, 0, 0); + SccpConnDt1MessageImpl original = new SccpConnDt1MessageImpl(stack.getMaxDataMessage(), 0, 0); original.setDestinationLocalReferenceNumber(new LocalReferenceImpl(1)); original.setSegmentingReassembling(new SegmentingReassemblingImpl(false)); original.setUserData(new byte[] {1, 2, 3, 4, 5}); diff --git a/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnDt2MessageTest.java b/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnDt2MessageTest.java index 46bb62f005..95acbffdbd 100644 --- a/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnDt2MessageTest.java +++ b/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnDt2MessageTest.java @@ -24,12 +24,10 @@ import org.apache.log4j.Logger; import org.mobicents.protocols.ss7.Util; -import org.mobicents.protocols.ss7.indicator.RoutingIndicator; import org.mobicents.protocols.ss7.sccp.LongMessageRuleType; import org.mobicents.protocols.ss7.sccp.SccpProtocolVersion; import org.mobicents.protocols.ss7.sccp.impl.SccpStackImpl; import org.mobicents.protocols.ss7.sccp.impl.parameter.*; -import org.mobicents.protocols.ss7.sccp.message.SccpMessage; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; @@ -74,7 +72,7 @@ public void testDecode() throws Exception { @Test(groups = { "SccpMessage", "functional.encode" }) public void testEncode() throws Exception { - SccpConnDt2MessageImpl original = (SccpConnDt2MessageImpl) messageFactory.createMessage(SccpMessage.MESSAGE_TYPE_DT2, 1, 2, 0, 0); + SccpConnDt2MessageImpl original = new SccpConnDt2MessageImpl(stack.getMaxDataMessage(), 0, 0); original.setDestinationLocalReferenceNumber(new LocalReferenceImpl(1)); original.setSequencingSegmenting(new SequencingSegmentingImpl()); original.setUserData(new byte[] {1, 2, 3, 4, 5}); diff --git a/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnErrMessageTest.java b/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnErrMessageTest.java index c828ab0439..d0fe489393 100644 --- a/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnErrMessageTest.java +++ b/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnErrMessageTest.java @@ -29,7 +29,6 @@ import org.mobicents.protocols.ss7.sccp.impl.SccpStackImpl; import org.mobicents.protocols.ss7.sccp.impl.parameter.ErrorCauseImpl; import org.mobicents.protocols.ss7.sccp.impl.parameter.LocalReferenceImpl; -import org.mobicents.protocols.ss7.sccp.message.SccpMessage; import org.mobicents.protocols.ss7.sccp.parameter.ErrorCauseValue; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; @@ -73,7 +72,7 @@ public void testDecode() throws Exception { @Test(groups = { "SccpMessage", "functional.encode" }) public void testEncode() throws Exception { - SccpConnErrMessageImpl original = (SccpConnErrMessageImpl) messageFactory.createMessage(SccpMessage.MESSAGE_TYPE_ERR, 1, 2, 0, 0); + SccpConnErrMessageImpl original = new SccpConnErrMessageImpl(0, 0); original.setDestinationLocalReferenceNumber(new LocalReferenceImpl(1)); original.setErrorCause(new ErrorCauseImpl(ErrorCauseValue.LRN_MISMATCH_INCONSISTENT_SOURCE_LRN)); diff --git a/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnItMessageTest.java b/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnItMessageTest.java index e965cda558..882e4f8081 100644 --- a/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnItMessageTest.java +++ b/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnItMessageTest.java @@ -31,7 +31,6 @@ import org.mobicents.protocols.ss7.sccp.impl.parameter.LocalReferenceImpl; import org.mobicents.protocols.ss7.sccp.impl.parameter.ProtocolClassImpl; import org.mobicents.protocols.ss7.sccp.impl.parameter.SequencingSegmentingImpl; -import org.mobicents.protocols.ss7.sccp.message.SccpMessage; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; @@ -78,7 +77,7 @@ public void testDecode() throws Exception { @Test(groups = { "SccpMessage", "functional.encode" }) public void testEncode() throws Exception { - SccpConnItMessageImpl original = (SccpConnItMessageImpl) messageFactory.createMessage(SccpMessage.MESSAGE_TYPE_IT, 1, 2, 0, 0); + SccpConnItMessageImpl original = new SccpConnItMessageImpl(0, 0); original.setDestinationLocalReferenceNumber(new LocalReferenceImpl(1)); original.setSourceLocalReferenceNumber(new LocalReferenceImpl(2)); original.setProtocolClass(new ProtocolClassImpl(3)); diff --git a/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnRlcMessageTest.java b/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnRlcMessageTest.java index 4a18c08e94..adc5459984 100644 --- a/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnRlcMessageTest.java +++ b/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnRlcMessageTest.java @@ -28,7 +28,6 @@ import org.mobicents.protocols.ss7.sccp.SccpProtocolVersion; import org.mobicents.protocols.ss7.sccp.impl.SccpStackImpl; import org.mobicents.protocols.ss7.sccp.impl.parameter.LocalReferenceImpl; -import org.mobicents.protocols.ss7.sccp.message.SccpMessage; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; @@ -72,7 +71,7 @@ public void testDecode() throws Exception { @Test(groups = {"SccpMessage", "functional.encode"}) public void testEncode() throws Exception { - SccpConnRlcMessageImpl original = (SccpConnRlcMessageImpl) messageFactory.createMessage(SccpMessage.MESSAGE_TYPE_RLC, 1, 2, 0, 0); + SccpConnRlcMessageImpl original = new SccpConnRlcMessageImpl(0, 0); original.setDestinationLocalReferenceNumber(new LocalReferenceImpl(2)); original.setSourceLocalReferenceNumber(new LocalReferenceImpl(3)); diff --git a/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnRlsdMessageTest.java b/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnRlsdMessageTest.java index 836671ff84..1bd3a3ed0a 100644 --- a/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnRlsdMessageTest.java +++ b/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnRlsdMessageTest.java @@ -30,7 +30,6 @@ import org.mobicents.protocols.ss7.sccp.impl.parameter.ImportanceImpl; import org.mobicents.protocols.ss7.sccp.impl.parameter.LocalReferenceImpl; import org.mobicents.protocols.ss7.sccp.impl.parameter.ReleaseCauseImpl; -import org.mobicents.protocols.ss7.sccp.message.SccpMessage; import org.mobicents.protocols.ss7.sccp.parameter.ReleaseCauseValue; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; @@ -112,7 +111,7 @@ public void testDecode() throws Exception { @Test(groups = { "SccpMessage", "functional.encode" }) public void testEncode() throws Exception { // ---- no optional params - SccpConnRlsdMessageImpl original = (SccpConnRlsdMessageImpl) messageFactory.createMessage(SccpMessage.MESSAGE_TYPE_RLSD, 1, 2, 0, 0); + SccpConnRlsdMessageImpl original = new SccpConnRlsdMessageImpl(0, 0); original.setDestinationLocalReferenceNumber(new LocalReferenceImpl(2)); original.setSourceLocalReferenceNumber(new LocalReferenceImpl(3)); original.setReleaseCause(new ReleaseCauseImpl(ReleaseCauseValue.ACCESS_CONGESTION)); @@ -122,7 +121,7 @@ public void testEncode() throws Exception { assertEquals(encoded.getSolidData(), this.getDataRlsdNoOptParams()); // ---- one optional param - original = (SccpConnRlsdMessageImpl) messageFactory.createMessage(SccpMessage.MESSAGE_TYPE_RLSD, 1, 2, 0, 0); + original = new SccpConnRlsdMessageImpl(0, 0); original.setDestinationLocalReferenceNumber(new LocalReferenceImpl(2)); original.setSourceLocalReferenceNumber(new LocalReferenceImpl(3)); original.setReleaseCause(new ReleaseCauseImpl(ReleaseCauseValue.ACCESS_CONGESTION)); @@ -133,7 +132,7 @@ public void testEncode() throws Exception { assertEquals(encoded.getSolidData(), this.getDataRlsdOneOptParam()); // ---- all param - original = (SccpConnRlsdMessageImpl) messageFactory.createMessage(SccpMessage.MESSAGE_TYPE_RLSD, 1, 2, 0, 0); + original = new SccpConnRlsdMessageImpl(0, 0); original.setDestinationLocalReferenceNumber(new LocalReferenceImpl(2)); original.setSourceLocalReferenceNumber(new LocalReferenceImpl(3)); original.setReleaseCause(new ReleaseCauseImpl(ReleaseCauseValue.ACCESS_CONGESTION)); diff --git a/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnRscMessageTest.java b/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnRscMessageTest.java index 20045e44d3..835bed0500 100644 --- a/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnRscMessageTest.java +++ b/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnRscMessageTest.java @@ -28,7 +28,6 @@ import org.mobicents.protocols.ss7.sccp.SccpProtocolVersion; import org.mobicents.protocols.ss7.sccp.impl.SccpStackImpl; import org.mobicents.protocols.ss7.sccp.impl.parameter.LocalReferenceImpl; -import org.mobicents.protocols.ss7.sccp.message.SccpMessage; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; @@ -72,7 +71,7 @@ public void testDecode() throws Exception { @Test(groups = { "SccpMessage", "functional.encode" }) public void testEncode() throws Exception { - SccpConnRscMessageImpl original = (SccpConnRscMessageImpl) messageFactory.createMessage(SccpMessage.MESSAGE_TYPE_RSC, 1, 2, 0, 0); + SccpConnRscMessageImpl original = new SccpConnRscMessageImpl(0, 0); original.setDestinationLocalReferenceNumber(new LocalReferenceImpl(1)); original.setSourceLocalReferenceNumber(new LocalReferenceImpl(2)); diff --git a/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnRsrMessageTest.java b/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnRsrMessageTest.java index fafffffb06..25f28ae4d2 100644 --- a/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnRsrMessageTest.java +++ b/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/message/SccpConnRsrMessageTest.java @@ -29,7 +29,6 @@ import org.mobicents.protocols.ss7.sccp.impl.SccpStackImpl; import org.mobicents.protocols.ss7.sccp.impl.parameter.LocalReferenceImpl; import org.mobicents.protocols.ss7.sccp.impl.parameter.ResetCauseImpl; -import org.mobicents.protocols.ss7.sccp.message.SccpMessage; import org.mobicents.protocols.ss7.sccp.parameter.ResetCauseValue; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; @@ -76,7 +75,7 @@ public void testDecode() throws Exception { @Test(groups = { "SccpMessage", "functional.encode" }) public void testEncode() throws Exception { - SccpConnRsrMessageImpl original = (SccpConnRsrMessageImpl) messageFactory.createMessage(SccpMessage.MESSAGE_TYPE_RSR, 1, 2, 0, 0); + SccpConnRsrMessageImpl original = new SccpConnRsrMessageImpl(0, 0); original.setDestinationLocalReferenceNumber(new LocalReferenceImpl(1)); original.setSourceLocalReferenceNumber(new LocalReferenceImpl(2)); original.setResetCause(new ResetCauseImpl(ResetCauseValue.ACCESS_OPERATIONAL));