PageRenderTime 48ms CodeModel.GetById 15ms RepoModel.GetById 1ms app.codeStats 0ms

/protocols/ss7/map/map-impl/src/test/java/org/mobicents/protocols/ss7/map/functional/Client.java

http://mobicents.googlecode.com/
Java | 1161 lines | 891 code | 204 blank | 66 comment | 59 complexity | be87ea874f87b3a94d11e8f9d575234a MD5 | raw file
Possible License(s): LGPL-3.0, GPL-3.0, LGPL-2.1, GPL-2.0, CC-BY-SA-3.0, CC0-1.0, Apache-2.0, BSD-3-Clause
  1. /*
  2. * JBoss, Home of Professional Open Source
  3. * Copyright 2011, Red Hat, Inc. and individual contributors
  4. * by the @authors tag. See the copyright.txt in the distribution for a
  5. * full listing of individual contributors.
  6. *
  7. * This is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU Lesser General Public License as
  9. * published by the Free Software Foundation; either version 2.1 of
  10. * the License, or (at your option) any later version.
  11. *
  12. * This software is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with this software; if not, write to the Free
  19. * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  20. * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  21. */
  22. package org.mobicents.protocols.ss7.map.functional;
  23. import java.nio.charset.Charset;
  24. import java.util.Arrays;
  25. import junit.framework.Assert;
  26. import org.apache.log4j.Logger;
  27. import org.mobicents.protocols.asn.AsnOutputStream;
  28. import org.mobicents.protocols.ss7.map.MAPDialogImpl;
  29. import org.mobicents.protocols.ss7.map.MAPProviderImpl;
  30. import org.mobicents.protocols.ss7.map.api.MAPApplicationContext;
  31. import org.mobicents.protocols.ss7.map.api.MAPApplicationContextName;
  32. import org.mobicents.protocols.ss7.map.api.MAPApplicationContextVersion;
  33. import org.mobicents.protocols.ss7.map.api.MAPDialog;
  34. import org.mobicents.protocols.ss7.map.api.MAPDialogListener;
  35. import org.mobicents.protocols.ss7.map.api.MAPException;
  36. import org.mobicents.protocols.ss7.map.api.MAPMessage;
  37. import org.mobicents.protocols.ss7.map.api.MAPProvider;
  38. import org.mobicents.protocols.ss7.map.api.MAPStack;
  39. import org.mobicents.protocols.ss7.map.api.MAPParameterFactory;
  40. import org.mobicents.protocols.ss7.map.api.dialog.MAPAbortProviderReason;
  41. import org.mobicents.protocols.ss7.map.api.dialog.MAPAbortSource;
  42. import org.mobicents.protocols.ss7.map.api.dialog.MAPNoticeProblemDiagnostic;
  43. import org.mobicents.protocols.ss7.map.api.dialog.MAPProviderError;
  44. import org.mobicents.protocols.ss7.map.api.dialog.MAPRefuseReason;
  45. import org.mobicents.protocols.ss7.map.api.dialog.MAPUserAbortChoice;
  46. import org.mobicents.protocols.ss7.map.api.dialog.ProcedureCancellationReason;
  47. import org.mobicents.protocols.ss7.map.api.errors.MAPErrorMessage;
  48. import org.mobicents.protocols.ss7.map.api.errors.MAPErrorMessageSMDeliveryFailure;
  49. import org.mobicents.protocols.ss7.map.api.errors.MAPErrorMessageSystemFailure;
  50. import org.mobicents.protocols.ss7.map.api.errors.SMEnumeratedDeliveryFailureCause;
  51. import org.mobicents.protocols.ss7.map.api.primitives.AdditionalNumberType;
  52. import org.mobicents.protocols.ss7.map.api.primitives.AddressNature;
  53. import org.mobicents.protocols.ss7.map.api.primitives.AddressString;
  54. import org.mobicents.protocols.ss7.map.api.primitives.IMSI;
  55. import org.mobicents.protocols.ss7.map.api.primitives.ISDNAddressString;
  56. import org.mobicents.protocols.ss7.map.api.primitives.LMSI;
  57. import org.mobicents.protocols.ss7.map.api.primitives.MAPExtensionContainer;
  58. import org.mobicents.protocols.ss7.map.api.primitives.NumberingPlan;
  59. import org.mobicents.protocols.ss7.map.api.primitives.USSDString;
  60. import org.mobicents.protocols.ss7.map.api.service.sms.AlertServiceCentreRequestIndication;
  61. import org.mobicents.protocols.ss7.map.api.service.sms.AlertServiceCentreResponseIndication;
  62. import org.mobicents.protocols.ss7.map.api.service.sms.ForwardShortMessageRequestIndication;
  63. import org.mobicents.protocols.ss7.map.api.service.sms.ForwardShortMessageResponseIndication;
  64. import org.mobicents.protocols.ss7.map.api.service.sms.InformServiceCentreRequestIndication;
  65. import org.mobicents.protocols.ss7.map.api.service.sms.LocationInfoWithLMSI;
  66. import org.mobicents.protocols.ss7.map.api.service.sms.MAPDialogSms;
  67. import org.mobicents.protocols.ss7.map.api.service.sms.MAPServiceSmsListener;
  68. import org.mobicents.protocols.ss7.map.api.service.sms.MWStatus;
  69. import org.mobicents.protocols.ss7.map.api.service.sms.MoForwardShortMessageRequestIndication;
  70. import org.mobicents.protocols.ss7.map.api.service.sms.MoForwardShortMessageResponseIndication;
  71. import org.mobicents.protocols.ss7.map.api.service.sms.MtForwardShortMessageRequestIndication;
  72. import org.mobicents.protocols.ss7.map.api.service.sms.MtForwardShortMessageResponseIndication;
  73. import org.mobicents.protocols.ss7.map.api.service.sms.ReportSMDeliveryStatusRequestIndication;
  74. import org.mobicents.protocols.ss7.map.api.service.sms.ReportSMDeliveryStatusResponseIndication;
  75. import org.mobicents.protocols.ss7.map.api.service.sms.SMDeliveryOutcome;
  76. import org.mobicents.protocols.ss7.map.api.service.sms.SM_RP_DA;
  77. import org.mobicents.protocols.ss7.map.api.service.sms.SM_RP_MTI;
  78. import org.mobicents.protocols.ss7.map.api.service.sms.SM_RP_OA;
  79. import org.mobicents.protocols.ss7.map.api.service.sms.SendRoutingInfoForSMRequestIndication;
  80. import org.mobicents.protocols.ss7.map.api.service.sms.SendRoutingInfoForSMResponseIndication;
  81. import org.mobicents.protocols.ss7.map.api.service.sms.SmsSignalInfo;
  82. import org.mobicents.protocols.ss7.map.api.service.supplementary.MAPDialogSupplementary;
  83. import org.mobicents.protocols.ss7.map.api.service.supplementary.MAPServiceSupplementaryListener;
  84. import org.mobicents.protocols.ss7.map.api.service.supplementary.ProcessUnstructuredSSRequestIndication;
  85. import org.mobicents.protocols.ss7.map.api.service.supplementary.ProcessUnstructuredSSResponseIndication;
  86. import org.mobicents.protocols.ss7.map.api.service.supplementary.UnstructuredSSNotifyRequestIndication;
  87. import org.mobicents.protocols.ss7.map.api.service.supplementary.UnstructuredSSNotifyResponseIndication;
  88. import org.mobicents.protocols.ss7.map.api.service.supplementary.UnstructuredSSRequestIndication;
  89. import org.mobicents.protocols.ss7.map.api.service.supplementary.UnstructuredSSResponseIndication;
  90. import org.mobicents.protocols.ss7.map.api.smstpdu.AddressField;
  91. import org.mobicents.protocols.ss7.map.api.smstpdu.DataCodingScheme;
  92. import org.mobicents.protocols.ss7.map.api.smstpdu.NumberingPlanIdentification;
  93. import org.mobicents.protocols.ss7.map.api.smstpdu.ProtocolIdentifier;
  94. import org.mobicents.protocols.ss7.map.api.smstpdu.TypeOfNumber;
  95. import org.mobicents.protocols.ss7.map.api.smstpdu.UserData;
  96. import org.mobicents.protocols.ss7.map.api.smstpdu.UserDataHeader;
  97. import org.mobicents.protocols.ss7.map.api.smstpdu.ValidityPeriod;
  98. import org.mobicents.protocols.ss7.map.primitives.MAPExtensionContainerTest;
  99. import org.mobicents.protocols.ss7.map.service.sms.AlertServiceCentreRequestIndicationImpl;
  100. import org.mobicents.protocols.ss7.map.service.sms.SM_RP_SMEAImpl;
  101. import org.mobicents.protocols.ss7.map.service.sms.SmsSignalInfoImpl;
  102. import org.mobicents.protocols.ss7.map.smstpdu.AddressFieldImpl;
  103. import org.mobicents.protocols.ss7.map.smstpdu.DataCodingSchemeImpl;
  104. import org.mobicents.protocols.ss7.map.smstpdu.ProtocolIdentifierImpl;
  105. import org.mobicents.protocols.ss7.map.smstpdu.SmsSubmitTpduImpl;
  106. import org.mobicents.protocols.ss7.map.smstpdu.UserDataImpl;
  107. import org.mobicents.protocols.ss7.map.smstpdu.ValidityPeriodImpl;
  108. import org.mobicents.protocols.ss7.sccp.parameter.SccpAddress;
  109. import org.mobicents.protocols.ss7.tcap.asn.ApplicationContextName;
  110. import org.mobicents.protocols.ss7.tcap.asn.comp.Invoke;
  111. import org.mobicents.protocols.ss7.tcap.asn.comp.OperationCode;
  112. import org.mobicents.protocols.ss7.tcap.asn.comp.Parameter;
  113. import org.mobicents.protocols.ss7.tcap.asn.comp.Problem;
  114. /**
  115. *
  116. * @author amit bhayani
  117. * @author sergey vetyutnev
  118. *
  119. */
  120. public class Client implements MAPDialogListener, MAPServiceSupplementaryListener, MAPServiceSmsListener {
  121. private static Logger logger = Logger.getLogger(Client.class);
  122. private MAPFunctionalTest runningTestCase;
  123. private SccpAddress thisAddress;
  124. private SccpAddress remoteAddress;
  125. private MAPStack mapStack;
  126. private MAPProvider mapProvider;
  127. private MAPParameterFactory MAPParameterFactory;
  128. // private boolean finished = true;
  129. private String unexpected = "";
  130. private boolean _S_receivedUnstructuredSSIndication, _S_sentEnd;
  131. private boolean _S_receivedMAPOpenInfoExtentionContainer;
  132. private boolean _S_receivedAbortInfo;
  133. private boolean _S_receivedEndInfo;
  134. private boolean _S_receivedContinueInfo;
  135. private boolean _S_recievedSmsRespIndication;
  136. private boolean _S_recievedInformSC;
  137. private boolean _S_receivedError;
  138. private boolean _S_receivedResult;
  139. private boolean _S_receivedResult2;
  140. private MAPDialogSupplementary clientDialog;
  141. private MAPDialogSms clientDialogSms;
  142. private FunctionalTestScenario step;
  143. private long savedInvokeId;
  144. Client(MAPStack mapStack, MAPFunctionalTest runningTestCase, SccpAddress thisAddress, SccpAddress remoteAddress) {
  145. super();
  146. this.mapStack = mapStack;
  147. this.runningTestCase = runningTestCase;
  148. this.thisAddress = thisAddress;
  149. this.remoteAddress = remoteAddress;
  150. this.mapProvider = this.mapStack.getMAPProvider();
  151. this.MAPParameterFactory = this.mapProvider.getMAPParameterFactory();
  152. this.mapProvider.addMAPDialogListener(this);
  153. this.mapProvider.getMAPServiceSupplementary().addMAPServiceListener(this);
  154. this.mapProvider.getMAPServiceSms().addMAPServiceListener(this);
  155. }
  156. public void start() throws MAPException {
  157. this.mapProvider.getMAPServiceSupplementary().acivate();
  158. MAPApplicationContext appCnt = MAPApplicationContext.getInstance(MAPApplicationContextName.networkUnstructuredSsContext,
  159. MAPApplicationContextVersion.version2);
  160. AddressString orgiReference = this.MAPParameterFactory.createAddressString(AddressNature.international_number, NumberingPlan.ISDN, "31628968300");
  161. AddressString destReference = this.MAPParameterFactory.createAddressString(AddressNature.international_number, NumberingPlan.land_mobile,
  162. "204208300008002");
  163. ISDNAddressString msisdn = this.MAPParameterFactory.createISDNAddressString(AddressNature.international_number, NumberingPlan.ISDN, "31628838002");
  164. clientDialog = this.mapProvider.getMAPServiceSupplementary()
  165. .createNewDialog(appCnt, this.thisAddress, orgiReference, this.remoteAddress, destReference);
  166. USSDString ussdString = this.MAPParameterFactory.createUSSDString(MAPFunctionalTest.USSD_STRING);
  167. clientDialog.addProcessUnstructuredSSRequest((byte) 0x0F, ussdString, null, msisdn);
  168. logger.debug("Sending USSDString" + MAPFunctionalTest.USSD_STRING);
  169. clientDialog.send();
  170. }
  171. public void actionA() throws MAPException {
  172. this.mapProvider.getMAPServiceSupplementary().acivate();
  173. MAPApplicationContext appCnt = MAPApplicationContext.getInstance(MAPApplicationContextName.networkUnstructuredSsContext,
  174. MAPApplicationContextVersion.version2);
  175. AddressString orgiReference = this.MAPParameterFactory.createAddressString(AddressNature.international_number, NumberingPlan.ISDN, "31628968300");
  176. AddressString destReference = this.MAPParameterFactory.createAddressString(AddressNature.international_number, NumberingPlan.land_mobile,
  177. "204208300008002");
  178. ISDNAddressString msisdn = this.MAPParameterFactory.createISDNAddressString(AddressNature.international_number, NumberingPlan.ISDN, "31628838002");
  179. // clientDialog =
  180. // this.mapProvider.getMAPServiceSupplementary().createNewDialog(appCnt,
  181. // this.thisAddress, null, this.remoteAddress,
  182. // null);
  183. clientDialog = this.mapProvider.getMAPServiceSupplementary()
  184. .createNewDialog(appCnt, this.thisAddress, orgiReference, this.remoteAddress, destReference);
  185. clientDialog.setExtentionContainer(MAPExtensionContainerTest.GetTestExtensionContainer());
  186. USSDString ussdString = this.MAPParameterFactory.createUSSDString(MAPFunctionalTest.USSD_STRING);
  187. clientDialog.addProcessUnstructuredSSRequest((byte) 0x0F, ussdString, null, msisdn);
  188. logger.debug("Sending USSDString" + MAPFunctionalTest.USSD_STRING);
  189. clientDialog.send();
  190. }
  191. public void actionB() throws MAPException {
  192. this.mapProvider.getMAPServiceSupplementary().acivate();
  193. MAPApplicationContext appCnt = MAPApplicationContext.getInstance(MAPApplicationContextName.networkUnstructuredSsContext,
  194. MAPApplicationContextVersion.version2);
  195. AddressString orgiReference = this.MAPParameterFactory.createAddressString(AddressNature.international_number, NumberingPlan.ISDN, "31628968300");
  196. AddressString destReference = this.MAPParameterFactory.createAddressString(AddressNature.international_number, NumberingPlan.land_mobile,
  197. "204208300008002");
  198. ISDNAddressString msisdn = this.MAPParameterFactory.createISDNAddressString(AddressNature.international_number, NumberingPlan.ISDN, "31628838002");
  199. clientDialog = this.mapProvider.getMAPServiceSupplementary()
  200. .createNewDialog(appCnt, this.thisAddress, orgiReference, this.remoteAddress, destReference);
  201. USSDString ussdString = this.MAPParameterFactory.createUSSDString(MAPFunctionalTest.USSD_STRING);
  202. savedInvokeId = clientDialog.addProcessUnstructuredSSRequest((byte) 0x0F, ussdString, null, msisdn);
  203. logger.debug("Sending USSDString" + MAPFunctionalTest.USSD_STRING);
  204. clientDialog.send();
  205. }
  206. public void actionBB() throws MAPException {
  207. this.mapProvider.getMAPServiceSupplementary().acivate();
  208. MAPApplicationContext appCnt = MAPApplicationContext.getInstance(MAPApplicationContextName.networkUnstructuredSsContext,
  209. MAPApplicationContextVersion.version2);
  210. AddressString orgiReference = this.MAPParameterFactory.createAddressString(AddressNature.international_number, NumberingPlan.ISDN, "1115550000");
  211. AddressString destReference = this.MAPParameterFactory.createAddressString(AddressNature.international_number, NumberingPlan.land_mobile, "888777");
  212. IMSI eriImsi = this.MAPParameterFactory.createIMSI("12345");
  213. AddressString eriVlrNo = this.MAPParameterFactory.createAddressString(AddressNature.international_number, NumberingPlan.land_mobile, "556677");
  214. ISDNAddressString msisdn = this.MAPParameterFactory.createISDNAddressString(AddressNature.international_number, NumberingPlan.ISDN, "31628838002");
  215. clientDialog = this.mapProvider.getMAPServiceSupplementary()
  216. .createNewDialog(appCnt, this.thisAddress, orgiReference, this.remoteAddress, destReference);
  217. clientDialog.addEricssonData(eriImsi, eriVlrNo);
  218. USSDString ussdString = this.MAPParameterFactory.createUSSDString(MAPFunctionalTest.USSD_STRING);
  219. savedInvokeId = clientDialog.addProcessUnstructuredSSRequest((byte) 0x0F, ussdString, null, msisdn);
  220. logger.debug("Sending USSDString" + MAPFunctionalTest.USSD_STRING);
  221. clientDialog.send();
  222. }
  223. public void actionC() throws Exception {
  224. this.mapProvider.getMAPServiceSms().acivate();
  225. MAPApplicationContext appCnt = null;
  226. switch (this.step) {
  227. case Action_Sms_MoForwardSM:
  228. appCnt = MAPApplicationContext.getInstance(MAPApplicationContextName.shortMsgMORelayContext, MAPApplicationContextVersion.version3);
  229. break;
  230. case Action_Sms_MtForwardSM:
  231. appCnt = MAPApplicationContext.getInstance(MAPApplicationContextName.shortMsgMTRelayContext, MAPApplicationContextVersion.version3);
  232. break;
  233. case Action_Sms_SendRoutingInfoForSM:
  234. case Action_Sms_ReportSMDeliveryStatus:
  235. appCnt = MAPApplicationContext.getInstance(MAPApplicationContextName.shortMsgGatewayContext, MAPApplicationContextVersion.version3);
  236. break;
  237. case Action_Sms_AlertServiceCentre:
  238. appCnt = MAPApplicationContext.getInstance(MAPApplicationContextName.shortMsgAlertContext, MAPApplicationContextVersion.version2);
  239. break;
  240. case Action_Sms_ForwardSM:
  241. appCnt = MAPApplicationContext.getInstance(MAPApplicationContextName.shortMsgMORelayContext, MAPApplicationContextVersion.version2);
  242. break;
  243. }
  244. AddressString orgiReference = this.MAPParameterFactory.createAddressString(AddressNature.international_number, NumberingPlan.ISDN, "31628968300");
  245. AddressString destReference = this.MAPParameterFactory.createAddressString(AddressNature.international_number, NumberingPlan.land_mobile,
  246. "204208300008002");
  247. clientDialogSms = this.mapProvider.getMAPServiceSms().createNewDialog(appCnt, this.thisAddress, orgiReference, this.remoteAddress, destReference);
  248. clientDialogSms.setExtentionContainer(MAPExtensionContainerTest.GetTestExtensionContainer());
  249. switch (this.step) {
  250. case Action_Sms_AlertServiceCentre: {
  251. ISDNAddressString msisdn = this.MAPParameterFactory.createISDNAddressString(AddressNature.international_number, NumberingPlan.ISDN, "111222333");
  252. AddressString serviceCentreAddress = this.MAPParameterFactory.createAddressString(AddressNature.subscriber_number, NumberingPlan.national, "0011");
  253. clientDialogSms.addAlertServiceCentreRequest(msisdn, serviceCentreAddress);
  254. }
  255. break;
  256. case Action_Sms_MoForwardSM: {
  257. IMSI imsi1 = this.MAPParameterFactory.createIMSI("250991357999");
  258. SM_RP_DA sm_RP_DA = this.MAPParameterFactory.createSM_RP_DA(imsi1);
  259. ISDNAddressString msisdn1 = this.MAPParameterFactory.createISDNAddressString(AddressNature.international_number, NumberingPlan.ISDN, "111222333");
  260. SM_RP_OA sm_RP_OA = this.MAPParameterFactory.createSM_RP_OA_Msisdn(msisdn1);
  261. AddressFieldImpl da = new AddressFieldImpl(TypeOfNumber.InternationalNumber, NumberingPlanIdentification.ISDNTelephoneNumberingPlan, "700007");
  262. ProtocolIdentifierImpl pi = new ProtocolIdentifierImpl(0);
  263. ValidityPeriodImpl vp = new ValidityPeriodImpl(100);
  264. DataCodingSchemeImpl dcs = new DataCodingSchemeImpl(0);
  265. UserDataImpl ud = new UserDataImpl("Hello, world !!!", dcs, null, null);
  266. SmsSubmitTpduImpl tpdu = new SmsSubmitTpduImpl(false, true, false, 55, da, pi, vp, ud);
  267. SmsSignalInfo sm_RP_UI = new SmsSignalInfoImpl(tpdu, null);
  268. IMSI imsi2 = this.MAPParameterFactory.createIMSI("25007123456789");
  269. clientDialogSms.addMoForwardShortMessageRequest(sm_RP_DA, sm_RP_OA, sm_RP_UI, MAPExtensionContainerTest.GetTestExtensionContainer(), imsi2);
  270. }
  271. break;
  272. case Action_Sms_MtForwardSM: {
  273. LMSI lmsi1 = this.MAPParameterFactory.createLMSI(new byte[] { 49, 48, 47, 46 });
  274. SM_RP_DA sm_RP_DA = this.MAPParameterFactory.createSM_RP_DA(lmsi1);
  275. AddressString msisdn1 = this.MAPParameterFactory.createAddressString(AddressNature.international_number, NumberingPlan.ISDN, "111222333");
  276. SM_RP_OA sm_RP_OA = this.MAPParameterFactory.createSM_RP_OA_ServiceCentreAddressOA(msisdn1);
  277. SmsSignalInfo sm_RP_UI = new SmsSignalInfoImpl(new byte[] { 21, 22, 23, 24, 25 }, null);
  278. clientDialogSms.addMtForwardShortMessageRequest(sm_RP_DA, sm_RP_OA, sm_RP_UI, true, MAPExtensionContainerTest.GetTestExtensionContainer());
  279. }
  280. break;
  281. case Action_Sms_ForwardSM: {
  282. IMSI imsi1 = this.MAPParameterFactory.createIMSI("250991357999");
  283. SM_RP_DA sm_RP_DA = this.MAPParameterFactory.createSM_RP_DA(imsi1);
  284. ISDNAddressString msisdn1 = this.MAPParameterFactory.createISDNAddressString(AddressNature.international_number, NumberingPlan.ISDN, "111222333");
  285. SM_RP_OA sm_RP_OA = this.MAPParameterFactory.createSM_RP_OA_Msisdn(msisdn1);
  286. SmsSignalInfo sm_RP_UI = new SmsSignalInfoImpl(new byte[] { 21, 22, 23, 24, 25 }, null);
  287. clientDialogSms.addForwardShortMessageRequest(sm_RP_DA, sm_RP_OA, sm_RP_UI, true);
  288. }
  289. break;
  290. case Action_Sms_SendRoutingInfoForSM: {
  291. ISDNAddressString msisdn1 = this.MAPParameterFactory.createISDNAddressString(AddressNature.international_number, NumberingPlan.ISDN, "111222333");
  292. AddressString servCenAddr1 = this.MAPParameterFactory.createAddressString(AddressNature.network_specific_number, NumberingPlan.national, "999000");
  293. clientDialogSms.addSendRoutingInfoForSMRequest(msisdn1, false, servCenAddr1, MAPExtensionContainerTest.GetTestExtensionContainer(), true,
  294. SM_RP_MTI.SMS_Status_Report, new SM_RP_SMEAImpl(new byte[] { 90, 91 }));
  295. }
  296. break;
  297. case Action_Sms_ReportSMDeliveryStatus: {
  298. ISDNAddressString msisdn1 = this.MAPParameterFactory.createISDNAddressString(AddressNature.international_number, NumberingPlan.ISDN, "111222333");
  299. AddressString serviceCentreAddress = this.MAPParameterFactory.createAddressString(AddressNature.network_specific_number, NumberingPlan.national,
  300. "999000");
  301. SMDeliveryOutcome sMDeliveryOutcome = SMDeliveryOutcome.absentSubscriber;
  302. Integer sbsentSubscriberDiagnosticSM = 555;
  303. Boolean gprsSupportIndicator = true;
  304. Boolean deliveryOutcomeIndicator = true;
  305. SMDeliveryOutcome additionalSMDeliveryOutcome = SMDeliveryOutcome.successfulTransfer;
  306. Integer additionalAbsentSubscriberDiagnosticSM = 444;
  307. clientDialogSms.addReportSMDeliveryStatusRequest(msisdn1, serviceCentreAddress, sMDeliveryOutcome, sbsentSubscriberDiagnosticSM,
  308. MAPExtensionContainerTest.GetTestExtensionContainer(), gprsSupportIndicator, deliveryOutcomeIndicator, additionalSMDeliveryOutcome,
  309. additionalAbsentSubscriberDiagnosticSM);
  310. }
  311. break;
  312. }
  313. clientDialogSms.send();
  314. }
  315. public void actionD() throws Exception {
  316. this.mapProvider.getMAPServiceSms().acivate();
  317. MAPApplicationContext appCnt = null;
  318. switch (this.step) {
  319. case Action_V1_A:
  320. appCnt = MAPApplicationContext.getInstance(MAPApplicationContextName.shortMsgGatewayContext, MAPApplicationContextVersion.version1);
  321. break;
  322. case Action_V1_B:
  323. case Action_V1_C:
  324. case Action_V1_D:
  325. appCnt = MAPApplicationContext.getInstance(MAPApplicationContextName.shortMsgAlertContext, MAPApplicationContextVersion.version1);
  326. break;
  327. case Action_V1_E:
  328. appCnt = MAPApplicationContext.getInstance(MAPApplicationContextName.shortMsgMORelayContext, MAPApplicationContextVersion.version1);
  329. break;
  330. }
  331. AddressString orgiReference = this.MAPParameterFactory.createAddressString(AddressNature.international_number, NumberingPlan.ISDN, "31628968300");
  332. AddressString destReference = this.MAPParameterFactory.createAddressString(AddressNature.international_number, NumberingPlan.land_mobile,
  333. "204208300008002");
  334. clientDialogSms = this.mapProvider.getMAPServiceSms().createNewDialog(appCnt, this.thisAddress, orgiReference, this.remoteAddress, destReference);
  335. switch (this.step) {
  336. case Action_V1_A: {
  337. ISDNAddressString msisdn1 = this.MAPParameterFactory.createISDNAddressString(AddressNature.international_number, NumberingPlan.ISDN, "111222333");
  338. AddressString serviceCentreAddress = this.MAPParameterFactory.createAddressString(AddressNature.network_specific_number, NumberingPlan.national,
  339. "999000");
  340. SMDeliveryOutcome sMDeliveryOutcome = SMDeliveryOutcome.absentSubscriber;
  341. clientDialogSms.addReportSMDeliveryStatusRequest(msisdn1, serviceCentreAddress, sMDeliveryOutcome, null, null, false, false, null, null);
  342. }
  343. break;
  344. case Action_V1_B: {
  345. ISDNAddressString msisdn = this.MAPParameterFactory.createISDNAddressString(AddressNature.international_number, NumberingPlan.ISDN, "111222333");
  346. AddressString serviceCentreAddress = this.MAPParameterFactory.createAddressString(AddressNature.subscriber_number, NumberingPlan.national, "0011");
  347. clientDialogSms.addAlertServiceCentreRequest(msisdn, serviceCentreAddress);
  348. }
  349. break;
  350. case Action_V1_D: {
  351. Invoke invoke = ((MAPProviderImpl) this.mapProvider).getTCAPProvider().getComponentPrimitiveFactory().createTCInvokeRequest();
  352. // Operation Code - setting wrong code
  353. OperationCode oc = ((MAPProviderImpl) this.mapProvider).getTCAPProvider().getComponentPrimitiveFactory().createOperationCode();
  354. oc.setLocalOperationCode(999L);
  355. ISDNAddressString msisdn = this.MAPParameterFactory.createISDNAddressString(AddressNature.international_number, NumberingPlan.ISDN, "111222333");
  356. AddressString serviceCentreAddress = this.MAPParameterFactory.createAddressString(AddressNature.subscriber_number, NumberingPlan.national, "0011");
  357. AlertServiceCentreRequestIndicationImpl req = new AlertServiceCentreRequestIndicationImpl(msisdn, serviceCentreAddress);
  358. AsnOutputStream aos = new AsnOutputStream();
  359. req.encodeData(aos);
  360. Parameter p = ((MAPProviderImpl) this.mapProvider).getTCAPProvider().getComponentPrimitiveFactory().createParameter();
  361. p.setTagClass(req.getTagClass());
  362. p.setPrimitive(req.getIsPrimitive());
  363. p.setTag(req.getTag());
  364. p.setData(aos.toByteArray());
  365. invoke.setParameter(p);
  366. invoke.setOperationCode(oc);
  367. Long invokeId = ((MAPDialogImpl) clientDialogSms).getTcapDialog().getNewInvokeId();
  368. invoke.setInvokeId(invokeId);
  369. clientDialogSms.sendInvokeComponent(invoke);
  370. }
  371. break;
  372. case Action_V1_E: {
  373. IMSI imsi1 = this.MAPParameterFactory.createIMSI("250991357999");
  374. SM_RP_DA sm_RP_DA = this.MAPParameterFactory.createSM_RP_DA(imsi1);
  375. ISDNAddressString msisdn1 = this.MAPParameterFactory.createISDNAddressString(AddressNature.international_number, NumberingPlan.ISDN, "111222333");
  376. SM_RP_OA sm_RP_OA = this.MAPParameterFactory.createSM_RP_OA_Msisdn(msisdn1);
  377. SmsSignalInfo sm_RP_UI = new SmsSignalInfoImpl(new byte[] { 21, 22, 23, 24, 25 }, null);
  378. clientDialogSms.addForwardShortMessageRequest(sm_RP_DA, sm_RP_OA, sm_RP_UI, false);
  379. }
  380. break;
  381. }
  382. clientDialogSms.send();
  383. if (this.step == FunctionalTestScenario.Action_V1_B) {
  384. clientDialogSms.release();
  385. }
  386. }
  387. public void actionE() throws Exception {
  388. this.mapProvider.getMAPServiceSms().acivate();
  389. MAPApplicationContext appCnt = null;
  390. appCnt = MAPApplicationContext.getInstance(MAPApplicationContextName.shortMsgMORelayContext, MAPApplicationContextVersion.version3);
  391. AddressString orgiReference = this.MAPParameterFactory.createAddressString(AddressNature.international_number, NumberingPlan.ISDN, "31628968300");
  392. AddressString destReference = this.MAPParameterFactory.createAddressString(AddressNature.international_number, NumberingPlan.land_mobile,
  393. "204208300008002");
  394. clientDialogSms = this.mapProvider.getMAPServiceSms().createNewDialog(appCnt, this.thisAddress, orgiReference, this.remoteAddress, destReference);
  395. clientDialogSms.setExtentionContainer(MAPExtensionContainerTest.GetTestExtensionContainer());
  396. SmsSignalInfo sm_RP_UI;
  397. if (this.step == FunctionalTestScenario.Action_TestMsgLength_A) {
  398. sm_RP_UI = new SmsSignalInfoImpl(new byte[20], null);
  399. Arrays.fill(sm_RP_UI.getData(), (byte) 11);
  400. } else {
  401. sm_RP_UI = new SmsSignalInfoImpl(new byte[170], null);
  402. Arrays.fill(sm_RP_UI.getData(), (byte) 22);
  403. }
  404. IMSI imsi1 = this.MAPParameterFactory.createIMSI("250991357999");
  405. SM_RP_DA sm_RP_DA = this.MAPParameterFactory.createSM_RP_DA(imsi1);
  406. ISDNAddressString msisdn1 = this.MAPParameterFactory.createISDNAddressString(AddressNature.international_number, NumberingPlan.ISDN, "111222333");
  407. SM_RP_OA sm_RP_OA = this.MAPParameterFactory.createSM_RP_OA_Msisdn(msisdn1);
  408. IMSI imsi2 = this.MAPParameterFactory.createIMSI("25007123456789");
  409. Long invokeId = clientDialogSms.addMoForwardShortMessageRequest(sm_RP_DA, sm_RP_OA, sm_RP_UI, null, imsi2);
  410. int maxMsgLen = clientDialogSms.getMaxUserDataLength();
  411. int curMsgLen = clientDialogSms.getMessageUserDataLengthOnSend();
  412. if (curMsgLen > maxMsgLen)
  413. clientDialogSms.cancelInvocation(invokeId);
  414. clientDialogSms.send();
  415. }
  416. public boolean isFinished() {
  417. // return this.finished && _S_receivedUnstructuredSSIndication
  418. // && _S_sentEnd && _S_recievedMAPOpenInfoExtentionContainer;
  419. switch (this.step) {
  420. case Action_Dialog_A:
  421. return _S_receivedUnstructuredSSIndication && _S_sentEnd && _S_receivedMAPOpenInfoExtentionContainer;
  422. case Action_Dialog_B:
  423. return _S_receivedAbortInfo && _S_receivedMAPOpenInfoExtentionContainer;
  424. case Action_Dialog_C:
  425. return _S_receivedAbortInfo;
  426. case Action_Dialog_D:
  427. return _S_receivedUnstructuredSSIndication && _S_receivedEndInfo && _S_receivedMAPOpenInfoExtentionContainer;
  428. case Action_Dialog_E:
  429. return _S_receivedUnstructuredSSIndication && _S_sentEnd;
  430. case Action_Dialog_F:
  431. return _S_receivedAbortInfo;
  432. case Action_Dialog_Eri:
  433. return _S_receivedEndInfo;
  434. case Action_Sms_AlertServiceCentre:
  435. case Action_Sms_ForwardSM:
  436. case Action_Sms_MoForwardSM:
  437. case Action_Sms_MtForwardSM:
  438. case Action_Sms_ReportSMDeliveryStatus:
  439. case Action_TestMsgLength_A:
  440. case Action_TestMsgLength_B:
  441. return _S_recievedSmsRespIndication && _S_receivedEndInfo;
  442. case Action_Sms_SendRoutingInfoForSM:
  443. return _S_recievedSmsRespIndication && _S_recievedInformSC && _S_receivedEndInfo;
  444. case Action_V1_A:
  445. return _S_recievedSmsRespIndication && _S_receivedEndInfo;
  446. case Action_V1_B:
  447. return true;
  448. case Action_V1_C:
  449. case Action_V1_D:
  450. return _S_receivedAbortInfo;
  451. case Action_V1_E:
  452. return _S_receivedContinueInfo;
  453. case Action_Component_A:
  454. case Action_Component_B:
  455. case Action_Component_E:
  456. case Action_Component_G:
  457. return _S_receivedEndInfo && _S_receivedError;
  458. case Action_Component_D:
  459. return _S_receivedEndInfo && _S_receivedResult && _S_receivedResult2;
  460. case Action_Component_F:
  461. return _S_receivedEndInfo && !_S_receivedError;
  462. }
  463. return false;
  464. }
  465. public String getStatus() {
  466. String status = "Scenario: " + this.step + "\n";
  467. switch (this.step) {
  468. case Action_Dialog_A:
  469. status += "_S_receivedUnstructuredSSIndication[" + _S_receivedUnstructuredSSIndication + "]" + "\n";
  470. status += "_S_recievedMAPOpenInfoExtentionContainer[" + _S_receivedMAPOpenInfoExtentionContainer + "]" + "\n";
  471. status += "_S_sentEnd[" + _S_sentEnd + "]" + "\n";
  472. break;
  473. case Action_Dialog_B:
  474. status += "_S_receivedAbortInfo[" + _S_receivedAbortInfo + "]" + "\n";
  475. status += "_S_recievedMAPOpenInfoExtentionContainer[" + _S_receivedMAPOpenInfoExtentionContainer + "]" + "\n";
  476. break;
  477. case Action_Dialog_C:
  478. status += "_S_receivedAbortInfo[" + _S_receivedAbortInfo + "]" + "\n";
  479. break;
  480. case Action_Dialog_D:
  481. status += "_S_receivedUnstructuredSSIndication[" + _S_receivedUnstructuredSSIndication + "]" + "\n";
  482. status += "_S_recievedMAPOpenInfoExtentionContainer[" + _S_receivedMAPOpenInfoExtentionContainer + "]" + "\n";
  483. status += "_S_receivedEndInfo[" + _S_receivedEndInfo + "]" + "\n";
  484. break;
  485. case Action_Dialog_E:
  486. status += "_S_receivedUnstructuredSSIndication[" + _S_receivedUnstructuredSSIndication + "]" + "\n";
  487. status += "_S_sentEnd[" + _S_sentEnd + "]" + "\n";
  488. break;
  489. case Action_Dialog_F:
  490. status += "_S_receivedAbortInfo[" + _S_receivedAbortInfo + "]" + "\n";
  491. break;
  492. case Action_Dialog_Eri:
  493. status += "_S_receivedEndInfo[" + _S_receivedEndInfo + "]" + "\n";
  494. break;
  495. case Action_Sms_AlertServiceCentre:
  496. case Action_Sms_ForwardSM:
  497. case Action_Sms_MoForwardSM:
  498. case Action_Sms_MtForwardSM:
  499. case Action_Sms_ReportSMDeliveryStatus:
  500. case Action_TestMsgLength_A:
  501. case Action_TestMsgLength_B:
  502. status += "_S_recievedSmsRespIndication[" + _S_recievedSmsRespIndication + "]" + "\n";
  503. status += "_S_receivedEndInfo[" + _S_receivedEndInfo + "]" + "\n";
  504. break;
  505. case Action_Sms_SendRoutingInfoForSM:
  506. status += "_S_recievedSmsRespIndication[" + _S_recievedSmsRespIndication + "]" + "_S_recievedInformSC[" + _S_recievedInformSC + "]" + "\n";
  507. status += "_S_receivedEndInfo[" + _S_receivedEndInfo + "]" + "\n";
  508. break;
  509. case Action_V1_A:
  510. status += "_S_recievedSmsRespIndication[" + _S_recievedSmsRespIndication + "]" + "\n";
  511. status += "_S_receivedEndInfo[" + _S_receivedEndInfo + "]" + "\n";
  512. break;
  513. case Action_V1_B:
  514. status += "OK" + "\n";
  515. break;
  516. case Action_V1_C:
  517. case Action_V1_D:
  518. status += "_S_receivedAbortInfo[" + _S_receivedAbortInfo + "]" + "\n";
  519. break;
  520. case Action_V1_E:
  521. status += "_S_receivedContinueInfo[" + _S_receivedContinueInfo + "]" + "\n";
  522. break;
  523. case Action_Component_A:
  524. case Action_Component_B:
  525. case Action_Component_E:
  526. case Action_Component_F:
  527. case Action_Component_G:
  528. status += "_S_receivedEndInfo[" + _S_receivedEndInfo + "]" + "\n";
  529. status += "_S_receivedError[" + _S_receivedError + "]" + "\n";
  530. break;
  531. case Action_Component_D:
  532. status += "_S_receivedEndInfo[" + _S_receivedEndInfo + "]" + "\n";
  533. status += "_S_receivedResult[" + _S_receivedResult + "]" + "\n";
  534. status += "_S_receivedResult2[" + _S_receivedResult2 + "]" + "\n";
  535. break;
  536. }
  537. return status + unexpected;
  538. }
  539. public void reset() {
  540. // this.finished = true;
  541. this._S_receivedUnstructuredSSIndication = false;
  542. this._S_sentEnd = false;
  543. this._S_receivedMAPOpenInfoExtentionContainer = false;
  544. this._S_receivedAbortInfo = false;
  545. this._S_receivedEndInfo = false;
  546. this._S_recievedSmsRespIndication = false;
  547. this._S_recievedInformSC = false;
  548. this._S_receivedContinueInfo = false;
  549. this._S_receivedError = false;
  550. this._S_receivedResult = false;
  551. this._S_receivedResult2 = false;
  552. }
  553. public void setStep(FunctionalTestScenario step) {
  554. this.step = step;
  555. }
  556. public MAPDialog getMapDialog() {
  557. return this.clientDialog;
  558. }
  559. /**
  560. * MAPDialog Listener's
  561. */
  562. @Override
  563. public void onDialogDelimiter(MAPDialog mapDialog) {
  564. switch (this.step) {
  565. case Action_Dialog_A:
  566. logger.debug("Calling Client.end()");
  567. try {
  568. mapDialog.close(true);
  569. _S_sentEnd = true;
  570. } catch (MAPException e) {
  571. logger.error(e);
  572. throw new RuntimeException(e);
  573. }
  574. break;
  575. case Action_Dialog_E:
  576. logger.debug("Sending MAPUserAbortInfo ");
  577. try {
  578. _S_sentEnd = true;
  579. mapDialog.setExtentionContainer(MAPExtensionContainerTest.GetTestExtensionContainer());
  580. MAPUserAbortChoice choice = this.MAPParameterFactory.createMAPUserAbortChoice();
  581. choice.setProcedureCancellationReason(ProcedureCancellationReason.handoverCancellation);
  582. mapDialog.abort(choice);
  583. } catch (MAPException e) {
  584. logger.error(e);
  585. throw new RuntimeException(e);
  586. }
  587. break;
  588. case Action_V1_E:
  589. logger.debug("Sending MAPUserAbortInfo "); // MAP V1 - Test blocking of sending user info in TC-ABORT
  590. try {
  591. MAPUserAbortChoice choice = this.MAPParameterFactory.createMAPUserAbortChoice();
  592. choice.setProcedureCancellationReason(ProcedureCancellationReason.handoverCancellation);
  593. mapDialog.abort(choice);
  594. } catch (MAPException e) {
  595. logger.error(e);
  596. throw new RuntimeException(e);
  597. }
  598. break;
  599. case Action_Component_D:
  600. try {
  601. mapDialog.send();
  602. } catch (MAPException e) {
  603. logger.error(e);
  604. throw new RuntimeException(e);
  605. }
  606. break;
  607. case Action_TestMsgLength_A:
  608. case Action_TestMsgLength_B:
  609. try {
  610. if (!_S_recievedSmsRespIndication) {
  611. SmsSignalInfo sm_RP_UI;
  612. if (this.step == FunctionalTestScenario.Action_TestMsgLength_A) {
  613. sm_RP_UI = new SmsSignalInfoImpl(new byte[20], null);
  614. Arrays.fill(sm_RP_UI.getData(), (byte) 11);
  615. } else {
  616. sm_RP_UI = new SmsSignalInfoImpl(new byte[170], null);
  617. Arrays.fill(sm_RP_UI.getData(), (byte) 22);
  618. }
  619. IMSI imsi1 = this.MAPParameterFactory.createIMSI("250991357999");
  620. SM_RP_DA sm_RP_DA = this.MAPParameterFactory.createSM_RP_DA(imsi1);
  621. ISDNAddressString msisdn1 = this.MAPParameterFactory.createISDNAddressString(AddressNature.international_number, NumberingPlan.ISDN,
  622. "111222333");
  623. SM_RP_OA sm_RP_OA = this.MAPParameterFactory.createSM_RP_OA_Msisdn(msisdn1);
  624. IMSI imsi2 = this.MAPParameterFactory.createIMSI("25007123456789");
  625. Long invokeId = clientDialogSms.addMoForwardShortMessageRequest(sm_RP_DA, sm_RP_OA, sm_RP_UI, null, imsi2);
  626. int maxMsgLen = clientDialogSms.getMaxUserDataLength();
  627. int curMsgLen = clientDialogSms.getMessageUserDataLengthOnSend();
  628. Assert.assertTrue(curMsgLen <= maxMsgLen);
  629. mapDialog.send();
  630. }
  631. } catch (MAPException e) {
  632. logger.error(e);
  633. throw new RuntimeException(e);
  634. }
  635. break;
  636. }
  637. }
  638. @Override
  639. public void onDialogRequest(MAPDialog mapDialog, AddressString destReference, AddressString origReference, MAPExtensionContainer extensionContainer) {
  640. }
  641. @Override
  642. public void onDialogAccept(MAPDialog mapDialog, MAPExtensionContainer extensionContainer) {
  643. switch (this.step) {
  644. case Action_Dialog_A:
  645. if (MAPExtensionContainerTest.CheckTestExtensionContainer(extensionContainer))
  646. _S_receivedMAPOpenInfoExtentionContainer = true;
  647. logger.debug("Received onMAPAcceptInfo ");
  648. break;
  649. case Action_Dialog_D:
  650. case Action_Dialog_Eri:
  651. if (MAPExtensionContainerTest.CheckTestExtensionContainer(extensionContainer))
  652. _S_receivedMAPOpenInfoExtentionContainer = true;
  653. this._S_receivedEndInfo = true;
  654. logger.debug("Received onMAPAcceptInfo ");
  655. break;
  656. case Action_Dialog_E:
  657. logger.debug("Received onMAPAcceptInfo ");
  658. break;
  659. case Action_Sms_AlertServiceCentre:
  660. case Action_Sms_MoForwardSM:
  661. case Action_Sms_MtForwardSM:
  662. case Action_Sms_SendRoutingInfoForSM:
  663. case Action_Sms_ReportSMDeliveryStatus:
  664. case Action_Sms_ForwardSM:
  665. case Action_TestMsgLength_A:
  666. case Action_TestMsgLength_B:
  667. case Action_V1_A:
  668. case Action_Component_A:
  669. case Action_Component_B:
  670. case Action_Component_D:
  671. case Action_Component_E:
  672. case Action_Component_F:
  673. case Action_Component_G:
  674. this._S_receivedEndInfo = true;
  675. break;
  676. case Action_V1_E:
  677. _S_receivedContinueInfo = true;
  678. break;
  679. }
  680. }
  681. @Override
  682. public void onDialogReject(MAPDialog mapDialog, MAPRefuseReason refuseReason, MAPProviderError providerError,
  683. ApplicationContextName alternativeApplicationContext, MAPExtensionContainer extensionContainer) {
  684. switch (this.step) {
  685. case Action_Dialog_B:
  686. if (refuseReason == MAPRefuseReason.InvalidDestinationReference) {
  687. logger.debug("Received InvalidDestinationReference");
  688. _S_receivedAbortInfo = true;
  689. if (MAPExtensionContainerTest.CheckTestExtensionContainer(extensionContainer))
  690. _S_receivedMAPOpenInfoExtentionContainer = true;
  691. }
  692. break;
  693. case Action_Dialog_C:
  694. if (refuseReason == MAPRefuseReason.ApplicationContextNotSupported) {
  695. logger.debug("Received ApplicationContextNotSupported");
  696. if (alternativeApplicationContext != null && Arrays.equals(alternativeApplicationContext.getOid(), new long[] { 1, 2, 3 })) {
  697. _S_receivedAbortInfo = true;
  698. }
  699. }
  700. break;
  701. case Action_V1_C:
  702. case Action_V1_D:
  703. if (refuseReason == MAPRefuseReason.PotentialVersionIncompatibility) {
  704. logger.debug("Received InvalidDestinationReference");
  705. _S_receivedAbortInfo = true;
  706. }
  707. break;
  708. }
  709. }
  710. @Override
  711. public void onDialogUserAbort(MAPDialog mapDialog, MAPUserAbortChoice userReason, MAPExtensionContainer extensionContainer) {
  712. }
  713. @Override
  714. public void onDialogProviderAbort(MAPDialog mapDialog, MAPAbortProviderReason abortProviderReason, MAPAbortSource abortSource,
  715. MAPExtensionContainer extensionContainer) {
  716. switch (this.step) {
  717. case Action_Dialog_F:
  718. logger.debug("Received DialogProviderAbort " + abortProviderReason.toString());
  719. if (abortProviderReason == MAPAbortProviderReason.InvalidPDU)
  720. _S_receivedAbortInfo = true;
  721. if (MAPExtensionContainerTest.CheckTestExtensionContainer(extensionContainer))
  722. _S_receivedMAPOpenInfoExtentionContainer = true;
  723. break;
  724. }
  725. }
  726. @Override
  727. public void onDialogClose(MAPDialog mapDialog) {
  728. int fff = 0;
  729. fff++;
  730. }
  731. @Override
  732. public void onDialogNotice(MAPDialog mapDialog, MAPNoticeProblemDiagnostic noticeProblemDiagnostic) {
  733. }
  734. public void onDialogRelease(MAPDialog mapDialog) {
  735. int i1 = 0;
  736. i1 = 1;
  737. }
  738. @Override
  739. public void onDialogTimeout(MAPDialog mapDialog) {
  740. // TODO Auto-generated method stub
  741. }
  742. @Override
  743. public void onErrorComponent(MAPDialog mapDialog, Long invokeId, MAPErrorMessage mapErrorMessage) {
  744. switch (this.step) {
  745. case Action_Component_A:
  746. case Action_Component_E: {
  747. Assert.assertTrue(mapErrorMessage.isEmSystemFailure());
  748. MAPErrorMessageSystemFailure mes = mapErrorMessage.getEmSystemFailure();
  749. Assert.assertNull(mes.getAdditionalNetworkResource());
  750. Assert.assertNull(mes.getNetworkResource());
  751. _S_receivedError = true;
  752. }
  753. break;
  754. case Action_Component_B: {
  755. Assert.assertTrue(mapErrorMessage.isEmSMDeliveryFailure());
  756. MAPErrorMessageSMDeliveryFailure mes = mapErrorMessage.getEmSMDeliveryFailure();
  757. Assert.assertEquals(mes.getSMEnumeratedDeliveryFailureCause(), SMEnumeratedDeliveryFailureCause.scCongestion);
  758. Assert.assertNull(mes.getSignalInfo());
  759. _S_receivedError = true;
  760. }
  761. break;
  762. }
  763. }
  764. @Override
  765. public void onProviderErrorComponent(MAPDialog mapDialog, Long invokeId, MAPProviderError providerError) {
  766. // TODO Auto-generated method stub
  767. }
  768. @Override
  769. public void onRejectComponent(MAPDialog mapDialog, Long invokeId, Problem problem) {
  770. switch (this.step) {
  771. case Action_Component_E:
  772. case Action_Component_G:
  773. _S_receivedError = true;
  774. break;
  775. }
  776. }
  777. @Override
  778. public void onInvokeTimeout(MAPDialog mapDialog, Long invoke) {
  779. // TODO Auto-generated method stub
  780. }
  781. /**
  782. * Supplementary Service Listeners
  783. */
  784. public void onProcessUnstructuredSSRequestIndication(ProcessUnstructuredSSRequestIndication procUnstrReqInd) {
  785. }
  786. public void onUnstructuredSSResponseIndication(UnstructuredSSResponseIndication unstrResInd) {
  787. switch (this.step) {
  788. case Action_Dialog_A:
  789. case Action_Dialog_D:
  790. case Action_Dialog_E:
  791. logger.debug("Received UnstructuredSSIndication " + unstrResInd.getUSSDString().getString());
  792. _S_receivedUnstructuredSSIndication = true;
  793. }
  794. }
  795. /**
  796. * Supplementary Service Listeners
  797. */
  798. @Override
  799. public void onMoForwardShortMessageIndication(MoForwardShortMessageRequestIndication moForwSmInd) {
  800. // TODO Auto-generated method stub
  801. }
  802. @Override
  803. public void onMoForwardShortMessageRespIndication(MoForwardShortMessageResponseIndication moForwSmRespInd) {
  804. SmsSignalInfo sm_RP_UI = moForwSmRespInd.getSM_RP_UI();
  805. MAPExtensionContainer extensionContainer = moForwSmRespInd.getExtensionContainer();
  806. Assert.assertNotNull(sm_RP_UI);
  807. Assert.assertTrue(Arrays.equals(sm_RP_UI.getData(), new byte[] { 21, 22, 23, 24, 25 }));
  808. Assert.assertTrue(MAPExtensionContainerTest.CheckTestExtensionContainer(extensionContainer));
  809. this._S_recievedSmsRespIndication = true;
  810. }
  811. @Override
  812. public void onMtForwardShortMessageIndication(MtForwardShortMessageRequestIndication mtForwSmInd) {
  813. // TODO Auto-generated method stub
  814. }
  815. @Override
  816. public void onMtForwardShortMessageRespIndication(MtForwardShortMessageResponseIndication mtForwSmRespInd) {
  817. SmsSignalInfo sm_RP_UI = mtForwSmRespInd.getSM_RP_UI();
  818. MAPExtensionContainer extensionContainer = mtForwSmRespInd.getExtensionContainer();
  819. Assert.assertNotNull(sm_RP_UI);
  820. Assert.assertTrue(Arrays.equals(sm_RP_UI.getData(), new byte[] { 21, 22, 23, 24, 25 }));
  821. Assert.assertTrue(MAPExtensionContainerTest.CheckTestExtensionContainer(extensionContainer));
  822. this._S_recievedSmsRespIndication = true;
  823. }
  824. @Override
  825. public void onProcessUnstructuredSSResponseIndication(ProcessUnstructuredSSResponseIndication procUnstrResInd) {
  826. if (this.step == FunctionalTestScenario.Action_Component_D) {
  827. if (_S_receivedResult)
  828. _S_receivedResult2 = true;
  829. else
  830. _S_receivedResult = true;
  831. }
  832. }
  833. @Override
  834. public void onUnstructuredSSRequestIndication(UnstructuredSSRequestIndication unstrReqInd) {
  835. switch (this.step) {
  836. case Action_Dialog_A:
  837. case Action_Dialog_D:
  838. case Action_Dialog_E:
  839. logger.debug("Received UnstructuredSSIndication " + unstrReqInd.getUSSDString().getString());
  840. _S_receivedUnstructuredSSIndication = true;
  841. }
  842. }
  843. @Override
  844. public void onSendRoutingInfoForSMIndication(SendRoutingInfoForSMRequestIndication sendRoutingInfoForSMInd) {
  845. // TODO Auto-generated method stub
  846. }
  847. @Override
  848. public void onSendRoutingInfoForSMRespIndication(SendRoutingInfoForSMResponseIndication sendRoutingInfoForSMRespInd) {
  849. IMSI imsi = sendRoutingInfoForSMRespInd.getIMSI();
  850. MAPExtensionContainer extensionContainer = sendRoutingInfoForSMRespInd.getExtensionContainer();
  851. LocationInfoWithLMSI locationInfoWithLMSI = sendRoutingInfoForSMRespInd.getLocationInfoWithLMSI();
  852. ISDNAddressString networkNodeNumber = locationInfoWithLMSI.getNetworkNodeNumber();
  853. LMSI lmsi = locationInfoWithLMSI.getLMSI();
  854. MAPExtensionContainer extensionContainer2 = locationInfoWithLMSI.getExtensionContainer();
  855. AdditionalNumberType additionalNumberType = locationInfoWithLMSI.getAdditionalNumberType();
  856. ISDNAddressString additionalNumber = locationInfoWithLMSI.getAdditionalNumber();
  857. Assert.assertNotNull(imsi);
  858. // Assert.assertEquals((long) (imsi.getMCC()), 250);
  859. // Assert.assertEquals((long) (imsi.getMNC()), 99);
  860. Assert.assertEquals(imsi.getData(), "25099777000");
  861. Assert.assertNotNull(networkNodeNumber);
  862. Assert.assertEquals(networkNodeNumber.getAddressNature(), AddressNature.network_specific_number);
  863. Assert.assertEquals(networkNodeNumber.getNumberingPlan(), NumberingPlan.national);
  864. Assert.assertEquals(networkNodeNumber.getAddress(), "111000111");
  865. Assert.assertTrue(MAPExtensionContainerTest.CheckTestExtensionContainer(extensionContainer2));
  866. Assert.assertNotNull(lmsi);
  867. Assert.assertTrue(Arrays.equals(lmsi.getData(), new byte[] { 75, 74, 73, 72 }));
  868. Assert.assertEquals(additionalNumberType, AdditionalNumberType.sgsn);
  869. Assert.assertNotNull(additionalNumber);
  870. Assert.assertEquals(additionalNumber.getAddressNature(), AddressNature.subscriber_number);
  871. Assert.assertEquals(additionalNumber.getNumberingPlan(), NumberingPlan.private_plan);
  872. Assert.assertEquals(additionalNumber.getAddress(), "000111000");
  873. Assert.assertTrue(MAPExtensionContainerTest.CheckTestExtensionContainer(extensionContainer));
  874. this._S_recievedSmsRespIndication = true;
  875. }
  876. @Override
  877. public void onReportSMDeliveryStatusIndication(ReportSMDeliveryStatusRequestIndication reportSMDeliveryStatusInd) {
  878. // TODO Auto-generated method stub
  879. }
  880. @Override
  881. public void onReportSMDeliveryStatusRespIndication(ReportSMDeliveryStatusResponseIndication reportSMDeliveryStatusRespInd) {
  882. ISDNAddressString storedMSISDN = reportSMDeliveryStatusRespInd.getStoredMSISDN();
  883. MAPExtensionContainer extensionContainer = reportSMDeliveryStatusRespInd.getExtensionContainer();
  884. if (this.step == FunctionalTestScenario.Action_V1_A) {
  885. Assert.assertNull(storedMSISDN);
  886. Assert.assertNull(extensionContainer);
  887. } else {
  888. Assert.assertNotNull(storedMSISDN);
  889. Assert.assertEquals(storedMSISDN.getAddressNature(), AddressNature.network_specific_number);
  890. Assert.assertEquals(storedMSISDN.getNumberingPlan(), NumberingPlan.national);
  891. Assert.assertEquals(storedMSISDN.getAddress(), "111000111");
  892. Assert.assertTrue(MAPExtensionContainerTest.CheckTestExtensionContainer(extensionContainer));
  893. }
  894. this._S_recievedSmsRespIndication = true;
  895. }
  896. @Override
  897. public void onInformServiceCentreIndication(InformServiceCentreRequestIndication informServiceCentreInd) {
  898. MAPExtensionContainer extensionContainer = informServiceCentreInd.getExtensionContainer();
  899. ISDNAddressString storedMSISDN = informServiceCentreInd.getStoredMSISDN();
  900. MWStatus mwStatus = informServiceCentreInd.getMwStatus();
  901. int absentSubscriberDiagnosticSM = informServiceCentreInd.getAbsentSubscriberDiagnosticSM();
  902. int additionalAbsentSubscriberDiagnosticSM = informServiceCentreInd.getAdditionalAbsentSubscriberDiagnosticSM();
  903. Assert.assertNotNull(storedMSISDN);
  904. Assert.assertEquals(storedMSISDN.getAddressNature(), AddressNature.international_number);
  905. Assert.assertEquals(storedMSISDN.getNumberingPlan(), NumberingPlan.ISDN);
  906. Assert.assertEquals(storedMSISDN.getAddress(), "111222333");
  907. Assert.assertNotNull(mwStatus);
  908. Assert.assertFalse(mwStatus.getScAddressNotIncluded());
  909. Assert.assertTrue(mwStatus.getMnrfSet());
  910. Assert.assertFalse(mwStatus.getMcefSet());
  911. Assert.assertTrue(mwStatus.getMnrgSet());
  912. Assert.assertNotNull(absentSubscriberDiagnosticSM);
  913. Assert.assertEquals((int) absentSubscriberDiagnosticSM, 555);
  914. Assert.assertNotNull(additionalAbsentSubscriberDiagnosticSM);
  915. Assert.assertEquals((int) additionalAbsentSubscriberDiagnosticSM, 444);
  916. Assert.assertTrue(MAPExtensionContainerTest.CheckTestExtensionContainer(extensionContainer));
  917. this._S_recievedInformSC = true;
  918. }
  919. @Override
  920. public void onAlertServiceCentreIndication(AlertServiceCentreRequestIndication alertServiceCentreInd) {
  921. // TODO Auto-generated method stub
  922. }
  923. @Override
  924. public void onAlertServiceCentreRespIndication(AlertServiceCentreResponseIndication alertServiceCentreInd) {
  925. this._S_recievedSmsRespIndication = true;
  926. }
  927. /* (non-Javadoc)
  928. * @see org.mobicents.protocols.ss7.map.api.service.supplementary.MAPServiceSupplementaryListener#onUnstructuredSSNotifyIndication(org.mobicents.protocols.ss7.map.api.service.supplementary.UnstructuredSSNotifyIndication)
  929. */
  930. @Override
  931. public void onUnstructuredSSNotifyRequestIndication(UnstructuredSSNotifyRequestIndication unstrNotifyInd) {
  932. // TODO Auto-generated method stub
  933. }
  934. @Override
  935. public void onForwardShortMessageIndication(ForwardShortMessageRequestIndication forwSmInd) {
  936. // TODO Auto-generated method stub
  937. }
  938. @Override
  939. public void onForwardShortMessageRespIndication(ForwardShortMessageResponseIndication forwSmRespInd) {
  940. this._S_recievedSmsRespIndication = true;
  941. }
  942. @Override
  943. public void onDialogRequestEricsson(MAPDialog mapDialog, AddressString destReference, AddressString origReference, IMSI eriImsi, AddressString eriVlrNo) {
  944. // TODO Auto-generated method stub
  945. }
  946. /* (non-Javadoc)
  947. * @see org.mobicents.protocols.ss7.map.api.service.supplementary.MAPServiceSupplementaryListener#onUnstructuredSSNotifyResponseIndication(org.mobicents.protocols.ss7.map.api.service.supplementary.UnstructuredSSNotifyResponseIndication)
  948. */
  949. @Override
  950. public void onUnstructuredSSNotifyResponseIndication(UnstructuredSSNotifyResponseIndication unstrNotifyInd) {
  951. // TODO Auto-generated method stub
  952. }
  953. @Override
  954. public void onMAPMessage(MAPMessage mapMessage) {
  955. // TODO Auto-generated method stub
  956. }
  957. }