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

http://mobicents.googlecode.com/ · Java · 1172 lines · 908 code · 184 blank · 80 comment · 65 complexity · 16fb651748c836b5a74ff805f1fcc835 MD5 · raw file

  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.util.Arrays;
  24. import junit.framework.Assert;
  25. import org.apache.log4j.Logger;
  26. import org.mobicents.protocols.asn.AsnOutputStream;
  27. import org.mobicents.protocols.ss7.map.MAPProviderImpl;
  28. import org.mobicents.protocols.ss7.map.api.MAPDialog;
  29. import org.mobicents.protocols.ss7.map.api.MAPDialogListener;
  30. import org.mobicents.protocols.ss7.map.api.MAPException;
  31. import org.mobicents.protocols.ss7.map.api.MAPMessage;
  32. import org.mobicents.protocols.ss7.map.api.MAPOperationCode;
  33. import org.mobicents.protocols.ss7.map.api.MAPProvider;
  34. import org.mobicents.protocols.ss7.map.api.MAPStack;
  35. import org.mobicents.protocols.ss7.map.api.MAPParameterFactory;
  36. import org.mobicents.protocols.ss7.map.api.dialog.MAPAbortProviderReason;
  37. import org.mobicents.protocols.ss7.map.api.dialog.MAPAbortSource;
  38. import org.mobicents.protocols.ss7.map.api.dialog.MAPNoticeProblemDiagnostic;
  39. import org.mobicents.protocols.ss7.map.api.dialog.MAPProviderError;
  40. import org.mobicents.protocols.ss7.map.api.dialog.MAPRefuseReason;
  41. import org.mobicents.protocols.ss7.map.api.dialog.MAPUserAbortChoice;
  42. import org.mobicents.protocols.ss7.map.api.dialog.ProcedureCancellationReason;
  43. import org.mobicents.protocols.ss7.map.api.dialog.Reason;
  44. import org.mobicents.protocols.ss7.map.api.errors.MAPErrorMessage;
  45. import org.mobicents.protocols.ss7.map.api.errors.SMEnumeratedDeliveryFailureCause;
  46. import org.mobicents.protocols.ss7.map.api.primitives.AdditionalNumberType;
  47. import org.mobicents.protocols.ss7.map.api.primitives.AddressNature;
  48. import org.mobicents.protocols.ss7.map.api.primitives.AddressString;
  49. import org.mobicents.protocols.ss7.map.api.primitives.IMSI;
  50. import org.mobicents.protocols.ss7.map.api.primitives.ISDNAddressString;
  51. import org.mobicents.protocols.ss7.map.api.primitives.LMSI;
  52. import org.mobicents.protocols.ss7.map.api.primitives.MAPExtensionContainer;
  53. import org.mobicents.protocols.ss7.map.api.primitives.NumberingPlan;
  54. import org.mobicents.protocols.ss7.map.api.primitives.USSDString;
  55. import org.mobicents.protocols.ss7.map.api.service.sms.AlertServiceCentreRequestIndication;
  56. import org.mobicents.protocols.ss7.map.api.service.sms.AlertServiceCentreResponseIndication;
  57. import org.mobicents.protocols.ss7.map.api.service.sms.ForwardShortMessageRequestIndication;
  58. import org.mobicents.protocols.ss7.map.api.service.sms.ForwardShortMessageResponseIndication;
  59. import org.mobicents.protocols.ss7.map.api.service.sms.InformServiceCentreRequestIndication;
  60. import org.mobicents.protocols.ss7.map.api.service.sms.LocationInfoWithLMSI;
  61. import org.mobicents.protocols.ss7.map.api.service.sms.MAPDialogSms;
  62. import org.mobicents.protocols.ss7.map.api.service.sms.MAPServiceSmsListener;
  63. import org.mobicents.protocols.ss7.map.api.service.sms.MWStatus;
  64. import org.mobicents.protocols.ss7.map.api.service.sms.MoForwardShortMessageRequestIndication;
  65. import org.mobicents.protocols.ss7.map.api.service.sms.MoForwardShortMessageResponseIndication;
  66. import org.mobicents.protocols.ss7.map.api.service.sms.MtForwardShortMessageRequestIndication;
  67. import org.mobicents.protocols.ss7.map.api.service.sms.MtForwardShortMessageResponseIndication;
  68. import org.mobicents.protocols.ss7.map.api.service.sms.ReportSMDeliveryStatusRequestIndication;
  69. import org.mobicents.protocols.ss7.map.api.service.sms.ReportSMDeliveryStatusResponseIndication;
  70. import org.mobicents.protocols.ss7.map.api.service.sms.SMDeliveryOutcome;
  71. import org.mobicents.protocols.ss7.map.api.service.sms.SM_RP_DA;
  72. import org.mobicents.protocols.ss7.map.api.service.sms.SM_RP_MTI;
  73. import org.mobicents.protocols.ss7.map.api.service.sms.SM_RP_OA;
  74. import org.mobicents.protocols.ss7.map.api.service.sms.SM_RP_SMEA;
  75. import org.mobicents.protocols.ss7.map.api.service.sms.SendRoutingInfoForSMRequestIndication;
  76. import org.mobicents.protocols.ss7.map.api.service.sms.SendRoutingInfoForSMResponseIndication;
  77. import org.mobicents.protocols.ss7.map.api.service.sms.SmsSignalInfo;
  78. import org.mobicents.protocols.ss7.map.api.service.supplementary.MAPDialogSupplementary;
  79. import org.mobicents.protocols.ss7.map.api.service.supplementary.MAPServiceSupplementaryListener;
  80. import org.mobicents.protocols.ss7.map.api.service.supplementary.ProcessUnstructuredSSRequestIndication;
  81. import org.mobicents.protocols.ss7.map.api.service.supplementary.ProcessUnstructuredSSResponseIndication;
  82. import org.mobicents.protocols.ss7.map.api.service.supplementary.UnstructuredSSNotifyRequestIndication;
  83. import org.mobicents.protocols.ss7.map.api.service.supplementary.UnstructuredSSNotifyResponseIndication;
  84. import org.mobicents.protocols.ss7.map.api.service.supplementary.UnstructuredSSRequestIndication;
  85. import org.mobicents.protocols.ss7.map.api.service.supplementary.UnstructuredSSResponseIndication;
  86. import org.mobicents.protocols.ss7.map.api.smstpdu.NumberingPlanIdentification;
  87. import org.mobicents.protocols.ss7.map.api.smstpdu.SmsSubmitTpdu;
  88. import org.mobicents.protocols.ss7.map.api.smstpdu.TypeOfNumber;
  89. import org.mobicents.protocols.ss7.map.primitives.MAPExtensionContainerTest;
  90. import org.mobicents.protocols.ss7.map.service.sms.SmsSignalInfoImpl;
  91. import org.mobicents.protocols.ss7.map.service.supplementary.ProcessUnstructuredSSResponseIndicationImpl;
  92. import org.mobicents.protocols.ss7.sccp.parameter.SccpAddress;
  93. import org.mobicents.protocols.ss7.tcap.asn.ApplicationContextName;
  94. import org.mobicents.protocols.ss7.tcap.asn.TcapFactory;
  95. import org.mobicents.protocols.ss7.tcap.asn.comp.GeneralProblemType;
  96. import org.mobicents.protocols.ss7.tcap.asn.comp.InvokeProblemType;
  97. import org.mobicents.protocols.ss7.tcap.asn.comp.OperationCode;
  98. import org.mobicents.protocols.ss7.tcap.asn.comp.Parameter;
  99. import org.mobicents.protocols.ss7.tcap.asn.comp.Problem;
  100. import org.mobicents.protocols.ss7.tcap.asn.comp.ReturnResult;
  101. /**
  102. *
  103. * @author amit bhayani
  104. * @author sergey vetyutnev
  105. *
  106. */
  107. public class Server implements MAPDialogListener, MAPServiceSupplementaryListener, MAPServiceSmsListener {
  108. private static Logger logger = Logger.getLogger(Server.class);
  109. private MAPFunctionalTest runningTestCase;
  110. private SccpAddress thisAddress;
  111. private SccpAddress remoteAddress;
  112. private MAPStack mapStack;
  113. private MAPProvider mapProvider;
  114. private MAPParameterFactory MAPParameterFactory;
  115. private boolean _S_recievedMAPOpenInfo, _S_recievedMAPCloseInfo, _S_eriStyle;
  116. private boolean _S_recievedMAPAbort;
  117. private boolean _S_recievedMAPOpenInfoExtentionContainer;
  118. private boolean _S_recievedProcessUnstructuredSSIndication;
  119. private boolean _S_recievedSmsRequestIndication;
  120. private String unexpected = "";
  121. private int dialogStep;
  122. private long savedInvokeId;
  123. private FunctionalTestScenario step;
  124. Server(MAPStack mapStack, MAPFunctionalTest runningTestCase,
  125. SccpAddress thisAddress, SccpAddress remoteAddress) {
  126. super();
  127. this.mapStack = mapStack;
  128. this.runningTestCase = runningTestCase;
  129. this.thisAddress = thisAddress;
  130. this.remoteAddress = remoteAddress;
  131. this.mapProvider = this.mapStack.getMAPProvider();
  132. this.MAPParameterFactory = this.mapProvider.getMAPParameterFactory();
  133. this.mapProvider.addMAPDialogListener(this);
  134. this.mapProvider.getMAPServiceSupplementary().addMAPServiceListener(this);
  135. this.mapProvider.getMAPServiceSms().addMAPServiceListener(this);
  136. this.mapProvider.getMAPServiceSupplementary().acivate();
  137. this.mapProvider.getMAPServiceSms().acivate();
  138. }
  139. public boolean isFinished() {
  140. switch( this.step ) {
  141. case Action_Dialog_A:
  142. return _S_recievedProcessUnstructuredSSIndication
  143. && _S_recievedMAPOpenInfo && _S_recievedMAPCloseInfo && _S_recievedMAPOpenInfoExtentionContainer;
  144. case Action_Dialog_B:
  145. return _S_recievedMAPOpenInfo;
  146. case Action_Dialog_C:
  147. return true;
  148. case Action_Dialog_D:
  149. return _S_recievedProcessUnstructuredSSIndication
  150. && _S_recievedMAPOpenInfo;
  151. case Action_Dialog_E:
  152. return _S_recievedProcessUnstructuredSSIndication
  153. && _S_recievedMAPOpenInfo && _S_recievedMAPCloseInfo && _S_recievedMAPOpenInfoExtentionContainer;
  154. case Action_Dialog_F:
  155. return true;
  156. case Action_Dialog_Eri:
  157. return _S_recievedProcessUnstructuredSSIndication && _S_recievedMAPOpenInfo && _S_eriStyle;
  158. case Action_Sms_AlertServiceCentre:
  159. case Action_Sms_ForwardSM:
  160. case Action_Sms_MoForwardSM:
  161. case Action_Sms_MtForwardSM:
  162. case Action_Sms_SendRoutingInfoForSM:
  163. case Action_Sms_ReportSMDeliveryStatus:
  164. case Action_TestMsgLength_A:
  165. case Action_TestMsgLength_B:
  166. return _S_recievedSmsRequestIndication && _S_recievedMAPOpenInfo;
  167. case Action_Component_A:
  168. case Action_Component_B:
  169. case Action_Component_E:
  170. case Action_Component_F:
  171. case Action_Component_G:
  172. return _S_recievedProcessUnstructuredSSIndication && _S_recievedMAPOpenInfo;
  173. case Action_Component_D:
  174. return _S_recievedProcessUnstructuredSSIndication && _S_recievedMAPOpenInfo;
  175. case Action_V1_A:
  176. case Action_V1_B:
  177. return _S_recievedSmsRequestIndication && _S_recievedMAPOpenInfo;
  178. case Action_V1_C:
  179. case Action_V1_D:
  180. return true;
  181. case Action_V1_E:
  182. return _S_recievedSmsRequestIndication && _S_recievedMAPOpenInfo && _S_recievedMAPAbort;
  183. }
  184. return false;
  185. }
  186. public String getStatus() {
  187. String status = "Scenario: " + this.step + "\n";
  188. switch( this.step ) {
  189. case Action_Dialog_A:
  190. status += "_S_recievedMAPCloseInfo[" + _S_recievedMAPCloseInfo + "]"
  191. + "\n";
  192. status += "_S_recievedMAPOpenInfo[" + _S_recievedMAPOpenInfo + "]"
  193. + "\n";
  194. status += "_S_recievedProcessUnstructuredSSIndication["
  195. + _S_recievedProcessUnstructuredSSIndication + "]" + "\n";
  196. status += "_S_recievedMAPOpenInfoExtentionContainer["
  197. + _S_recievedMAPOpenInfoExtentionContainer + "]" + "\n";
  198. break;
  199. case Action_Dialog_B:
  200. status += "_S_recievedMAPOpenInfo[" + _S_recievedMAPOpenInfo + "]"
  201. + "\n";
  202. break;
  203. case Action_Dialog_C:
  204. break;
  205. case Action_Dialog_D:
  206. status += "_S_recievedMAPOpenInfo[" + _S_recievedMAPOpenInfo + "]"
  207. + "\n";
  208. status += "_S_recievedProcessUnstructuredSSIndication["
  209. + _S_recievedProcessUnstructuredSSIndication + "]" + "\n";
  210. break;
  211. case Action_Dialog_E:
  212. status += "_S_recievedMAPCloseInfo[" + _S_recievedMAPCloseInfo + "]"
  213. + "\n";
  214. status += "_S_recievedMAPOpenInfo[" + _S_recievedMAPOpenInfo + "]"
  215. + "\n";
  216. status += "_S_recievedProcessUnstructuredSSIndication["
  217. + _S_recievedProcessUnstructuredSSIndication + "]" + "\n";
  218. status += "_S_recievedMAPOpenInfoExtentionContainer["
  219. + _S_recievedMAPOpenInfoExtentionContainer + "]" + "\n";
  220. break;
  221. case Action_Dialog_F:
  222. break;
  223. case Action_Dialog_Eri:
  224. status += "_S_recievedMAPOpenInfo[" + _S_recievedMAPOpenInfo + "]" + "\n";
  225. status += "_S_recievedProcessUnstructuredSSIndication[" + _S_recievedProcessUnstructuredSSIndication + "]" + "\n";
  226. status += "_S_eriStyle[" + _S_eriStyle + "]" + "\n";
  227. break;
  228. case Action_Sms_AlertServiceCentre:
  229. case Action_Sms_ForwardSM:
  230. case Action_Sms_MoForwardSM:
  231. case Action_Sms_MtForwardSM:
  232. case Action_Sms_SendRoutingInfoForSM:
  233. case Action_Sms_ReportSMDeliveryStatus:
  234. case Action_TestMsgLength_A:
  235. case Action_TestMsgLength_B:
  236. status += "_S_recievedMAPOpenInfo[" + _S_recievedMAPOpenInfo + "]"
  237. + "\n";
  238. status += "_S_recievedSmsRequestIndication[" + _S_recievedSmsRequestIndication + "]"
  239. + "\n";
  240. break;
  241. case Action_Component_A:
  242. case Action_Component_B:
  243. case Action_Component_E:
  244. case Action_Component_F:
  245. case Action_Component_G:
  246. status += "_S_recievedProcessUnstructuredSSIndication[" + _S_recievedProcessUnstructuredSSIndication + "]"
  247. + "\n";
  248. status += "_S_recievedMAPOpenInfo[" + _S_recievedMAPOpenInfo + "]"
  249. + "\n";
  250. break;
  251. case Action_Component_D:
  252. status += "_S_recievedProcessUnstructuredSSIndication[" + _S_recievedProcessUnstructuredSSIndication + "]"
  253. + "\n";
  254. status += "_S_recievedMAPOpenInfo[" + _S_recievedMAPOpenInfo + "]"
  255. + "\n";
  256. break;
  257. case Action_V1_A:
  258. case Action_V1_B:
  259. status += "_S_recievedMAPOpenInfo[" + _S_recievedMAPOpenInfo + "]"
  260. + "\n";
  261. status += "_S_recievedSmsRequestIndication[" + _S_recievedSmsRequestIndication + "]"
  262. + "\n";
  263. break;
  264. case Action_V1_C:
  265. case Action_V1_D:
  266. status += "OK" + "\n";
  267. break;
  268. case Action_V1_E:
  269. status += "_S_recievedMAPOpenInfo[" + _S_recievedMAPOpenInfo + "]"
  270. + "\n";
  271. status += "_S_recievedSmsRequestIndication[" + _S_recievedSmsRequestIndication + "]"
  272. + "\n";
  273. status += "_S_recievedMAPAbort[" + _S_recievedMAPAbort + "]"
  274. + "\n";
  275. break;
  276. }
  277. return status + unexpected;
  278. }
  279. public void reset() {
  280. this._S_recievedMAPOpenInfo = false;
  281. this._S_recievedMAPCloseInfo = false;
  282. this._S_eriStyle = false;
  283. this._S_recievedMAPOpenInfoExtentionContainer = false;
  284. this._S_recievedProcessUnstructuredSSIndication = false;
  285. this._S_recievedSmsRequestIndication = false;
  286. this._S_recievedMAPAbort = false;
  287. this.dialogStep = 0;
  288. }
  289. public void setStep (FunctionalTestScenario step) {
  290. this.step = step;
  291. }
  292. /**
  293. * MAPDialog Listener's
  294. */
  295. @Override
  296. public void onDialogDelimiter(MAPDialog mapDialog) {
  297. switch( this.step ) {
  298. case Action_Dialog_A:
  299. logger.debug("Sending MAPAcceptInfo ");
  300. try {
  301. mapDialog.setExtentionContainer(MAPExtensionContainerTest.GetTestExtensionContainer());
  302. mapDialog.send();
  303. } catch (MAPException e) {
  304. logger.error(e);
  305. throw new RuntimeException(e);
  306. }
  307. break;
  308. case Action_Dialog_D:
  309. logger.debug("Sending MAPCloseInfo ");
  310. try {
  311. mapDialog.setExtentionContainer(MAPExtensionContainerTest.GetTestExtensionContainer());
  312. mapDialog.close(false);
  313. } catch (MAPException e) {
  314. logger.error(e);
  315. throw new RuntimeException(e);
  316. }
  317. break;
  318. case Action_Dialog_E:
  319. logger.debug("Sending MAPAcceptInfo ");
  320. try {
  321. mapDialog.send();
  322. } catch (MAPException e) {
  323. logger.error(e);
  324. throw new RuntimeException(e);
  325. }
  326. break;
  327. case Action_Dialog_Eri:
  328. try {
  329. mapDialog.close(false);
  330. } catch (MAPException e) {
  331. logger.error(e);
  332. throw new RuntimeException(e);
  333. }
  334. break;
  335. case Action_Component_A:
  336. case Action_Component_B:
  337. case Action_Component_E:
  338. case Action_Component_G:
  339. try {
  340. mapDialog.close(false);
  341. } catch (MAPException e) {
  342. logger.error(e);
  343. throw new RuntimeException(e);
  344. }
  345. break;
  346. case Action_Component_F:
  347. try {
  348. mapDialog.close(true);
  349. } catch (MAPException e) {
  350. logger.error(e);
  351. throw new RuntimeException(e);
  352. }
  353. break;
  354. case Action_Component_D:
  355. try {
  356. this.dialogStep++;
  357. if (this.dialogStep == 1)
  358. mapDialog.send();
  359. else {
  360. USSDString ussdStrObj = this.mapProvider.getMAPParameterFactory().createUSSDString("Your balance is 500");
  361. byte ussdDataCodingScheme = (byte) 0x0F;
  362. ((MAPDialogSupplementary) mapDialog).addProcessUnstructuredSSResponse(this.savedInvokeId, ussdDataCodingScheme, ussdStrObj);
  363. mapDialog.close(false);
  364. }
  365. } catch (MAPException e) {
  366. logger.error(e);
  367. throw new RuntimeException(e);
  368. }
  369. break;
  370. case Action_Sms_AlertServiceCentre:
  371. case Action_Sms_ForwardSM:
  372. case Action_Sms_MoForwardSM:
  373. case Action_Sms_MtForwardSM:
  374. case Action_Sms_SendRoutingInfoForSM:
  375. case Action_Sms_ReportSMDeliveryStatus:
  376. case Action_V1_A:
  377. try {
  378. mapDialog.close(false);
  379. } catch (MAPException e) {
  380. logger.error(e);
  381. throw new RuntimeException(e);
  382. }
  383. break;
  384. case Action_V1_B:
  385. mapDialog.release();
  386. break;
  387. case Action_V1_E:
  388. try {
  389. mapDialog.send();
  390. } catch (MAPException e) {
  391. // TODO Auto-generated catch block
  392. e.printStackTrace();
  393. }
  394. break;
  395. case Action_TestMsgLength_A:
  396. case Action_TestMsgLength_B:
  397. try {
  398. if (!_S_recievedSmsRequestIndication)
  399. mapDialog.send();
  400. else
  401. mapDialog.close(false);
  402. } catch (MAPException e) {
  403. // TODO Auto-generated catch block
  404. e.printStackTrace();
  405. }
  406. break;
  407. }
  408. }
  409. @Override
  410. public void onDialogRequest(MAPDialog mapDialog,
  411. AddressString destReference, AddressString origReference,
  412. MAPExtensionContainer extensionContainer) {
  413. switch( this.step ) {
  414. case Action_Dialog_A:
  415. case Action_Dialog_D:
  416. case Action_Dialog_E:
  417. if( MAPExtensionContainerTest.CheckTestExtensionContainer(extensionContainer) )
  418. _S_recievedMAPOpenInfoExtentionContainer = true;
  419. this._S_recievedMAPOpenInfo = true;
  420. break;
  421. case Action_Dialog_B:
  422. logger.debug("Received MAPOpenInfo ");
  423. this._S_recievedMAPOpenInfo = true;
  424. logger.debug("Sending MAPRefuseInfo ");
  425. try {
  426. mapDialog.setExtentionContainer(MAPExtensionContainerTest.GetTestExtensionContainer());
  427. mapDialog.refuse(Reason.invalidDestinationReference);
  428. } catch (MAPException e) {
  429. logger.error(e);
  430. throw new RuntimeException(e);
  431. }
  432. break;
  433. case Action_Sms_AlertServiceCentre:
  434. case Action_Sms_ForwardSM:
  435. case Action_Sms_MoForwardSM:
  436. case Action_Sms_MtForwardSM:
  437. case Action_Sms_SendRoutingInfoForSM:
  438. case Action_Sms_ReportSMDeliveryStatus:
  439. case Action_TestMsgLength_A:
  440. case Action_TestMsgLength_B:
  441. case Action_V1_A:
  442. case Action_V1_B:
  443. case Action_V1_E:
  444. case Action_Component_A:
  445. case Action_Component_B:
  446. case Action_Component_D:
  447. case Action_Component_E:
  448. case Action_Component_F:
  449. case Action_Component_G:
  450. this._S_recievedMAPOpenInfo = true;
  451. break;
  452. }
  453. }
  454. @Override
  455. public void onDialogRequestEricsson(MAPDialog mapDialog, AddressString destReference, AddressString origReference, IMSI eriImsi, AddressString eriVlrNo) {
  456. switch (this.step) {
  457. case Action_Dialog_Eri:
  458. this._S_recievedMAPOpenInfo = true;
  459. if (eriImsi != null && eriImsi.getData().equals("12345") && eriVlrNo != null && eriVlrNo.getAddress().equals("556677")
  460. && destReference != null && destReference.getAddress().endsWith("888777") && origReference != null
  461. && origReference.getAddress().endsWith("1115550000")) {
  462. _S_eriStyle = true;
  463. }
  464. break;
  465. }
  466. }
  467. @Override
  468. public void onDialogAccept(MAPDialog mapDialog,
  469. MAPExtensionContainer extensionContainer) {
  470. // TODO Auto-generated method stub
  471. }
  472. @Override
  473. public void onDialogReject(MAPDialog mapDialog,
  474. MAPRefuseReason refuseReason, MAPProviderError providerError,
  475. ApplicationContextName alternativeApplicationContext,
  476. MAPExtensionContainer extensionContainer) {
  477. // TODO Auto-generated method stub
  478. }
  479. @Override
  480. public void onDialogTimeout(MAPDialog mapDialog) {
  481. // TODO Auto-generated method stub
  482. }
  483. @Override
  484. public void onDialogUserAbort(MAPDialog mapDialog,
  485. MAPUserAbortChoice userReason,
  486. MAPExtensionContainer extensionContainer) {
  487. logger.debug("Received MAPUserAbortInfo");
  488. switch( this.step ) {
  489. case Action_Dialog_E:
  490. if( MAPExtensionContainerTest.CheckTestExtensionContainer(extensionContainer) )
  491. _S_recievedMAPOpenInfoExtentionContainer = true;
  492. if (userReason.isProcedureCancellationReason()
  493. && userReason.getProcedureCancellationReason() == ProcedureCancellationReason.handoverCancellation)
  494. this._S_recievedMAPCloseInfo = true;
  495. break;
  496. }
  497. }
  498. @Override
  499. public void onDialogProviderAbort(MAPDialog mapDialog,
  500. MAPAbortProviderReason abortProviderReason,
  501. MAPAbortSource abortSource, MAPExtensionContainer extensionContainer) {
  502. logger.debug("Received MAPProviderAbortInfo");
  503. _S_recievedMAPAbort = true;
  504. }
  505. @Override
  506. public void onDialogClose(MAPDialog mapDialog) {
  507. logger.debug("Received MAPCloseInfo");
  508. this._S_recievedMAPCloseInfo = true;
  509. }
  510. @Override
  511. public void onDialogNotice(MAPDialog mapDialog,
  512. MAPNoticeProblemDiagnostic noticeProblemDiagnostic) {
  513. // TODO Auto-generated method stub
  514. }
  515. public void onDialogRelease(MAPDialog mapDialog) {
  516. int i1=0;
  517. i1 = 1;
  518. }
  519. @Override
  520. public void onProviderErrorComponent(MAPDialog mapDialog, Long invokeId, MAPProviderError providerError) {
  521. // TODO Auto-generated method stub
  522. }
  523. @Override
  524. public void onErrorComponent(MAPDialog mapDialog, Long invokeId, MAPErrorMessage mapErrorMessage) {
  525. // TODO Auto-generated method stub
  526. }
  527. @Override
  528. public void onRejectComponent(MAPDialog mapDialog, Long invokeId, Problem problem) {
  529. // TODO Auto-generated method stub
  530. }
  531. @Override
  532. public void onInvokeTimeout(MAPDialog mapDialog, Long invoke) {
  533. // TODO Auto-generated method stub
  534. }
  535. /**
  536. * MAP Service Supplementary Listeners
  537. */
  538. public void onProcessUnstructuredSSRequestIndication(ProcessUnstructuredSSRequestIndication procUnstrInd) {
  539. switch( this.step ) {
  540. case Action_Dialog_A:
  541. case Action_Dialog_D:
  542. case Action_Dialog_E: {
  543. String ussdString = procUnstrInd.getUSSDString().getString();
  544. AddressString msisdn = procUnstrInd.getMSISDNAddressString();
  545. logger.debug("Received ProcessUnstructuredSSIndication " + ussdString + " from MSISDN " + msisdn.getAddress());
  546. if (!ussdString.equals(MAPFunctionalTest.USSD_STRING)) {
  547. unexpected += " Received USSDString " + ussdString + ". But was expected " + MAPFunctionalTest.USSD_STRING;
  548. } else {
  549. this._S_recievedProcessUnstructuredSSIndication = true;
  550. MAPDialogSupplementary mapDialog = procUnstrInd.getMAPDialog();
  551. Long invokeId = procUnstrInd.getInvokeId();
  552. USSDString ussdStringObj = this.MAPParameterFactory.createUSSDString(MAPFunctionalTest.USSD_MENU);
  553. try {
  554. mapDialog.addUnstructuredSSRequest((byte) 0x0F, ussdStringObj, null, null);
  555. } catch (MAPException e) {
  556. logger.error(e);
  557. throw new RuntimeException(e);
  558. }
  559. logger.debug("InvokeId = " + invokeId);
  560. }
  561. }
  562. break;
  563. case Action_Dialog_Eri: {
  564. String ussdString = procUnstrInd.getUSSDString().getString();
  565. AddressString msisdn = procUnstrInd.getMSISDNAddressString();
  566. logger.debug("Received ProcessUnstructuredSSIndication " + ussdString + " from MSISDN " + msisdn.getAddress());
  567. if (!ussdString.equals(MAPFunctionalTest.USSD_STRING)) {
  568. unexpected += " Received USSDString " + ussdString + ". But was expected " + MAPFunctionalTest.USSD_STRING;
  569. } else {
  570. this._S_recievedProcessUnstructuredSSIndication = true;
  571. }
  572. }
  573. break;
  574. case Action_Component_A:
  575. case Action_Component_B:
  576. case Action_Component_D:
  577. case Action_Component_E:
  578. case Action_Component_F:
  579. case Action_Component_G: {
  580. MAPDialogSupplementary mapDialog = procUnstrInd.getMAPDialog();
  581. Long invokeId = procUnstrInd.getInvokeId();
  582. this._S_recievedProcessUnstructuredSSIndication = true;
  583. switch (this.step) {
  584. case Action_Component_A:
  585. case Action_Component_F: {
  586. MAPErrorMessage msg = this.mapProvider.getMAPErrorMessageFactory().createMAPErrorMessageSystemFailure(2, null, null, null);
  587. try {
  588. mapDialog.sendErrorComponent(invokeId, msg);
  589. } catch (MAPException e) {
  590. e.printStackTrace();
  591. }
  592. }
  593. break;
  594. case Action_Component_B: {
  595. MAPErrorMessage msg = this.mapProvider.getMAPErrorMessageFactory().createMAPErrorMessageSMDeliveryFailure(
  596. SMEnumeratedDeliveryFailureCause.scCongestion, null, null);
  597. try {
  598. mapDialog.sendErrorComponent(invokeId, msg);
  599. } catch (MAPException e) {
  600. e.printStackTrace();
  601. }
  602. }
  603. break;
  604. case Action_Component_D: {
  605. ReturnResult returnResult = ((MAPProviderImpl)this.mapProvider).getTCAPProvider().getComponentPrimitiveFactory().createTCResultRequest();
  606. this.savedInvokeId = invokeId;
  607. returnResult.setInvokeId(invokeId);
  608. // Operation Code
  609. OperationCode oc = TcapFactory.createOperationCode();
  610. oc.setLocalOperationCode((long) MAPOperationCode.processUnstructuredSS_Request);
  611. returnResult.setOperationCode(oc);
  612. USSDString ussdStrObj = this.mapProvider.getMAPParameterFactory().createUSSDString("Your balance is 500");
  613. byte ussdDataCodingScheme = (byte) 0x0F;
  614. ProcessUnstructuredSSResponseIndicationImpl req = new ProcessUnstructuredSSResponseIndicationImpl(ussdDataCodingScheme, ussdStrObj);
  615. AsnOutputStream aos = new AsnOutputStream();
  616. try {
  617. req.encodeData(aos);
  618. Parameter p = ((MAPProviderImpl)this.mapProvider).getTCAPProvider().getComponentPrimitiveFactory().createParameter();
  619. p.setTagClass(req.getTagClass());
  620. p.setPrimitive(req.getIsPrimitive());
  621. p.setTag(req.getTag());
  622. p.setData(aos.toByteArray());
  623. returnResult.setParameter(p);
  624. mapDialog.sendReturnResultComponent(returnResult);
  625. } catch (MAPException e1) {
  626. // TODO Auto-generated catch block
  627. e1.printStackTrace();
  628. }
  629. }
  630. break;
  631. case Action_Component_E: {
  632. Problem problem = this.mapProvider.getMAPParameterFactory().createProblemInvoke(InvokeProblemType.DuplicateInvokeID);
  633. try {
  634. mapDialog.sendRejectComponent(invokeId, problem);
  635. } catch (MAPException e) {
  636. e.printStackTrace();
  637. }
  638. }
  639. break;
  640. case Action_Component_G: {
  641. Problem problem = this.mapProvider.getMAPParameterFactory().createProblemGeneral(GeneralProblemType.MistypedComponent);
  642. try {
  643. mapDialog.sendRejectComponent(null, problem);
  644. } catch (MAPException e) {
  645. e.printStackTrace();
  646. }
  647. }
  648. break;
  649. }
  650. }
  651. break;
  652. }
  653. }
  654. @Override
  655. public void onProcessUnstructuredSSResponseIndication(ProcessUnstructuredSSResponseIndication procUnstrResInd){
  656. }
  657. @Override
  658. public void onUnstructuredSSRequestIndication(UnstructuredSSRequestIndication unstrReqInd){
  659. }
  660. @Override
  661. public void onUnstructuredSSResponseIndication(UnstructuredSSResponseIndication unstrResInd){
  662. }
  663. /**
  664. * MAP Service Sms Listeners
  665. */
  666. @Override
  667. public void onMoForwardShortMessageIndication(MoForwardShortMessageRequestIndication moForwSmInd) {
  668. MAPDialogSms d = moForwSmInd.getMAPDialog();
  669. SM_RP_DA sm_RP_DA = moForwSmInd.getSM_RP_DA();
  670. SM_RP_OA sm_RP_OA = moForwSmInd.getSM_RP_OA();
  671. SmsSignalInfo sm_RP_UI = moForwSmInd.getSM_RP_UI();
  672. MAPExtensionContainer extensionContainer = moForwSmInd.getExtensionContainer();
  673. IMSI imsi2 = moForwSmInd.getIMSI();
  674. if (this.step == FunctionalTestScenario.Action_TestMsgLength_A || this.step == FunctionalTestScenario.Action_TestMsgLength_B) {
  675. Assert.assertNotNull(sm_RP_DA);
  676. Assert.assertNotNull(sm_RP_DA.getIMSI());
  677. // Assert.assertEquals((long) (sm_RP_DA.getIMSI().getMCC()), 250);
  678. // Assert.assertEquals((long) (sm_RP_DA.getIMSI().getMNC()), 99);
  679. Assert.assertEquals(sm_RP_DA.getIMSI().getData(), "250991357999");
  680. Assert.assertNotNull(sm_RP_OA);
  681. Assert.assertNotNull(sm_RP_OA.getMsisdn());
  682. Assert.assertEquals(sm_RP_OA.getMsisdn().getAddressNature(), AddressNature.international_number);
  683. Assert.assertEquals(sm_RP_OA.getMsisdn().getNumberingPlan(), NumberingPlan.ISDN);
  684. Assert.assertEquals(sm_RP_OA.getMsisdn().getAddress(), "111222333");
  685. Assert.assertNotNull(sm_RP_UI);
  686. byte[] testArr;
  687. if (this.step == FunctionalTestScenario.Action_TestMsgLength_A) {
  688. testArr = new byte[20];
  689. Arrays.fill(testArr, (byte) 11);
  690. } else {
  691. testArr = new byte[170];
  692. Arrays.fill(testArr, (byte) 22);
  693. }
  694. Assert.assertTrue(Arrays.equals(sm_RP_UI.getData(), testArr));
  695. Assert.assertNull(extensionContainer);
  696. Assert.assertNotNull(imsi2);
  697. // Assert.assertEquals((long) (imsi2.getMCC()), 250);
  698. // Assert.assertEquals((long) (imsi2.getMNC()), 7);
  699. Assert.assertEquals(imsi2.getData(), "25007123456789");
  700. } else if (this.step == FunctionalTestScenario.Action_Sms_MoForwardSM) {
  701. Assert.assertNotNull(sm_RP_DA);
  702. Assert.assertNotNull(sm_RP_DA.getIMSI());
  703. Assert.assertEquals(sm_RP_DA.getIMSI().getData(), "250991357999");
  704. Assert.assertNotNull(sm_RP_OA);
  705. Assert.assertNotNull(sm_RP_OA.getMsisdn());
  706. Assert.assertEquals(sm_RP_OA.getMsisdn().getAddressNature(), AddressNature.international_number);
  707. Assert.assertEquals(sm_RP_OA.getMsisdn().getNumberingPlan(), NumberingPlan.ISDN);
  708. Assert.assertEquals(sm_RP_OA.getMsisdn().getAddress(), "111222333");
  709. Assert.assertNotNull(sm_RP_UI);
  710. try {
  711. SmsSubmitTpdu tpdu = (SmsSubmitTpdu) sm_RP_UI.decodeTpdu(true);
  712. tpdu.getUserData().decode();
  713. Assert.assertFalse(tpdu.getRejectDuplicates());
  714. Assert.assertTrue(tpdu.getReplyPathExists());
  715. Assert.assertFalse(tpdu.getStatusReportRequest());
  716. Assert.assertEquals(tpdu.getMessageReference(), 55);
  717. Assert.assertEquals(tpdu.getDestinationAddress().getTypeOfNumber(), TypeOfNumber.InternationalNumber);
  718. Assert.assertEquals(tpdu.getDestinationAddress().getNumberingPlanIdentification(), NumberingPlanIdentification.ISDNTelephoneNumberingPlan);
  719. Assert.assertTrue(tpdu.getDestinationAddress().getAddressValue().equals("700007"));
  720. Assert.assertEquals(tpdu.getProtocolIdentifier().getCode(), 0);
  721. Assert.assertEquals((int) tpdu.getValidityPeriod().getRelativeFormatValue(), 100);
  722. Assert.assertEquals(tpdu.getUserData().getDataCodingScheme().getCode(), 0);
  723. Assert.assertTrue(tpdu.getUserData().getDecodedMessage().equals("Hello, world !!!"));
  724. } catch (MAPException e) {
  725. // TODO Auto-generated catch block
  726. e.printStackTrace();
  727. }
  728. Assert.assertTrue(MAPExtensionContainerTest.CheckTestExtensionContainer(extensionContainer));
  729. Assert.assertNotNull(imsi2);
  730. Assert.assertEquals(imsi2.getData(), "25007123456789");
  731. } else {
  732. Assert.assertNotNull(sm_RP_DA);
  733. Assert.assertNotNull(sm_RP_DA.getIMSI());
  734. // Assert.assertEquals((long) (sm_RP_DA.getIMSI().getMCC()), 250);
  735. // Assert.assertEquals((long) (sm_RP_DA.getIMSI().getMNC()), 99);
  736. Assert.assertEquals(sm_RP_DA.getIMSI().getData(), "250991357999");
  737. Assert.assertNotNull(sm_RP_OA);
  738. Assert.assertNotNull(sm_RP_OA.getMsisdn());
  739. Assert.assertEquals(sm_RP_OA.getMsisdn().getAddressNature(), AddressNature.international_number);
  740. Assert.assertEquals(sm_RP_OA.getMsisdn().getNumberingPlan(), NumberingPlan.ISDN);
  741. Assert.assertEquals(sm_RP_OA.getMsisdn().getAddress(), "111222333");
  742. Assert.assertNotNull(sm_RP_UI);
  743. Assert.assertTrue(Arrays.equals(sm_RP_UI.getData(), new byte[] { 21, 22, 23, 24, 25 }));
  744. Assert.assertTrue(MAPExtensionContainerTest.CheckTestExtensionContainer(extensionContainer));
  745. Assert.assertNotNull(imsi2);
  746. // Assert.assertEquals((long) (imsi2.getMCC()), 250);
  747. // Assert.assertEquals((long) (imsi2.getMNC()), 7);
  748. Assert.assertEquals(imsi2.getData(), "25007123456789");
  749. }
  750. this._S_recievedSmsRequestIndication = true;
  751. SmsSignalInfo sm_RP_UI2 = new SmsSignalInfoImpl(new byte[] { 21, 22, 23, 24, 25 }, null);
  752. try {
  753. d.addMoForwardShortMessageResponse(moForwSmInd.getInvokeId(), sm_RP_UI2, MAPExtensionContainerTest.GetTestExtensionContainer());
  754. } catch (MAPException e) {
  755. // TODO Auto-generated catch block
  756. e.printStackTrace();
  757. }
  758. }
  759. @Override
  760. public void onMoForwardShortMessageRespIndication(MoForwardShortMessageResponseIndication moForwSmRespInd) {
  761. // TODO Auto-generated method stub
  762. }
  763. @Override
  764. public void onMtForwardShortMessageIndication(MtForwardShortMessageRequestIndication mtForwSmInd) {
  765. MAPDialogSms d = mtForwSmInd.getMAPDialog();
  766. SM_RP_DA sm_RP_DA = mtForwSmInd.getSM_RP_DA();
  767. SM_RP_OA sm_RP_OA = mtForwSmInd.getSM_RP_OA();
  768. SmsSignalInfo sm_RP_UI = mtForwSmInd.getSM_RP_UI();
  769. MAPExtensionContainer extensionContainer = mtForwSmInd.getExtensionContainer();
  770. Boolean moreMessagesToSend = mtForwSmInd.getMoreMessagesToSend();
  771. Assert.assertNotNull(sm_RP_DA);
  772. Assert.assertNotNull(sm_RP_DA.getLMSI());
  773. Assert.assertTrue(Arrays.equals(sm_RP_DA.getLMSI().getData(), new byte[] { 49, 48, 47, 46 }));
  774. Assert.assertNotNull(sm_RP_OA);
  775. Assert.assertNotNull(sm_RP_OA.getServiceCentreAddressOA());
  776. Assert.assertEquals(sm_RP_OA.getServiceCentreAddressOA().getAddressNature(), AddressNature.international_number);
  777. Assert.assertEquals(sm_RP_OA.getServiceCentreAddressOA().getNumberingPlan(), NumberingPlan.ISDN);
  778. Assert.assertEquals(sm_RP_OA.getServiceCentreAddressOA().getAddress(), "111222333");
  779. Assert.assertNotNull(sm_RP_UI);
  780. Assert.assertTrue(Arrays.equals(sm_RP_UI.getData(), new byte[] { 21, 22, 23, 24, 25 }));
  781. Assert.assertTrue(MAPExtensionContainerTest.CheckTestExtensionContainer(extensionContainer));
  782. Assert.assertTrue(moreMessagesToSend);
  783. this._S_recievedSmsRequestIndication = true;
  784. SmsSignalInfo sm_RP_UI2 = new SmsSignalInfoImpl(new byte[] { 21, 22, 23, 24, 25 }, null);
  785. try {
  786. d.addMtForwardShortMessageResponse(mtForwSmInd.getInvokeId(), sm_RP_UI2, MAPExtensionContainerTest.GetTestExtensionContainer());
  787. } catch (MAPException e) {
  788. // TODO Auto-generated catch block
  789. e.printStackTrace();
  790. }
  791. }
  792. @Override
  793. public void onMtForwardShortMessageRespIndication(MtForwardShortMessageResponseIndication mtForwSmRespInd) {
  794. // TODO Auto-generated method stub
  795. }
  796. @Override
  797. public void onSendRoutingInfoForSMIndication(SendRoutingInfoForSMRequestIndication sendRoutingInfoForSMInd) {
  798. MAPDialogSms d = sendRoutingInfoForSMInd.getMAPDialog();
  799. ISDNAddressString msisdn = sendRoutingInfoForSMInd.getMsisdn();
  800. Boolean sm_RP_PRI = sendRoutingInfoForSMInd.getSm_RP_PRI();
  801. AddressString sca = sendRoutingInfoForSMInd.getServiceCentreAddress();
  802. MAPExtensionContainer extensionContainer = sendRoutingInfoForSMInd.getExtensionContainer();
  803. Boolean gprsSupportIndicator = sendRoutingInfoForSMInd.getGprsSupportIndicator();
  804. SM_RP_MTI sM_RP_MTI = sendRoutingInfoForSMInd.getSM_RP_MTI();
  805. SM_RP_SMEA sM_RP_SMEA = sendRoutingInfoForSMInd.getSM_RP_SMEA();
  806. Assert.assertNotNull(msisdn);
  807. Assert.assertEquals(msisdn.getAddressNature(), AddressNature.international_number);
  808. Assert.assertEquals(msisdn.getNumberingPlan(), NumberingPlan.ISDN);
  809. Assert.assertEquals(msisdn.getAddress(), "111222333");
  810. Assert.assertFalse(sm_RP_PRI);
  811. Assert.assertNotNull(sca);
  812. Assert.assertEquals(sca.getAddressNature(), AddressNature.network_specific_number);
  813. Assert.assertEquals(sca.getNumberingPlan(), NumberingPlan.national);
  814. Assert.assertEquals(sca.getAddress(), "999000");
  815. Assert.assertTrue(MAPExtensionContainerTest.CheckTestExtensionContainer(extensionContainer));
  816. Assert.assertTrue(gprsSupportIndicator);
  817. Assert.assertEquals(sM_RP_MTI, SM_RP_MTI.SMS_Status_Report);
  818. Assert.assertTrue(Arrays.equals(sM_RP_SMEA.getData(), new byte[] { 90, 91 }));
  819. this._S_recievedSmsRequestIndication = true;
  820. IMSI imsi = this.MAPParameterFactory.createIMSI("25099777000");
  821. ISDNAddressString networkNodeNumber = this.MAPParameterFactory.createISDNAddressString(AddressNature.network_specific_number, NumberingPlan.national,
  822. "111000111");
  823. LMSI lmsi = this.MAPParameterFactory.createLMSI(new byte[] { 75, 74, 73, 72 });
  824. AdditionalNumberType additionalNumberType = AdditionalNumberType.sgsn;
  825. ISDNAddressString additionalNumber = this.MAPParameterFactory.createISDNAddressString(AddressNature.subscriber_number, NumberingPlan.private_plan,
  826. "000111000");
  827. LocationInfoWithLMSI locationInfoWithLMSI = this.MAPParameterFactory.createLocationInfoWithLMSI(networkNodeNumber, lmsi,
  828. MAPExtensionContainerTest.GetTestExtensionContainer(), additionalNumberType, additionalNumber);
  829. ISDNAddressString storedMSISDN = this.MAPParameterFactory.createISDNAddressString(AddressNature.international_number, NumberingPlan.ISDN, "111222333");
  830. MWStatus mwStatus = this.MAPParameterFactory.createMWStatus(false, true, false, true);
  831. Integer absentSubscriberDiagnosticSM = 555;
  832. Integer additionalAbsentSubscriberDiagnosticSM = 444;
  833. try {
  834. d.addSendRoutingInfoForSMResponse(sendRoutingInfoForSMInd.getInvokeId(), imsi, locationInfoWithLMSI,
  835. MAPExtensionContainerTest.GetTestExtensionContainer());
  836. d.addInformServiceCentreRequest(storedMSISDN, mwStatus, MAPExtensionContainerTest.GetTestExtensionContainer(),
  837. absentSubscriberDiagnosticSM, additionalAbsentSubscriberDiagnosticSM);
  838. } catch (MAPException e) {
  839. // TODO Auto-generated catch block
  840. e.printStackTrace();
  841. }
  842. }
  843. @Override
  844. public void onSendRoutingInfoForSMRespIndication(SendRoutingInfoForSMResponseIndication sendRoutingInfoForSMRespInd) {
  845. // TODO Auto-generated method stub
  846. }
  847. @Override
  848. public void onReportSMDeliveryStatusIndication(ReportSMDeliveryStatusRequestIndication reportSMDeliveryStatusInd) {
  849. MAPDialogSms d = reportSMDeliveryStatusInd.getMAPDialog();
  850. ISDNAddressString msisdn = reportSMDeliveryStatusInd.getMsisdn();
  851. AddressString sca = reportSMDeliveryStatusInd.getServiceCentreAddress();
  852. SMDeliveryOutcome sMDeliveryOutcome = reportSMDeliveryStatusInd.getSMDeliveryOutcome();
  853. Integer absentSubscriberDiagnosticSM = reportSMDeliveryStatusInd.getAbsentSubscriberDiagnosticSM();
  854. MAPExtensionContainer extensionContainer = reportSMDeliveryStatusInd.getExtensionContainer();
  855. Boolean gprsSupportIndicator = reportSMDeliveryStatusInd.getGprsSupportIndicator();
  856. Boolean deliveryOutcomeIndicator = reportSMDeliveryStatusInd.getDeliveryOutcomeIndicator();
  857. SMDeliveryOutcome additionalSMDeliveryOutcome = reportSMDeliveryStatusInd.getAdditionalSMDeliveryOutcome();
  858. Integer additionalAbsentSubscriberDiagnosticSM = reportSMDeliveryStatusInd.getAdditionalAbsentSubscriberDiagnosticSM();
  859. Assert.assertNotNull(msisdn);
  860. Assert.assertEquals(msisdn.getAddressNature(), AddressNature.international_number);
  861. Assert.assertEquals(msisdn.getNumberingPlan(), NumberingPlan.ISDN);
  862. Assert.assertEquals(msisdn.getAddress(), "111222333");
  863. Assert.assertNotNull(sca);
  864. Assert.assertEquals(sca.getAddressNature(), AddressNature.network_specific_number);
  865. Assert.assertEquals(sca.getNumberingPlan(), NumberingPlan.national);
  866. Assert.assertEquals(sca.getAddress(), "999000");
  867. Assert.assertEquals(sMDeliveryOutcome, SMDeliveryOutcome.absentSubscriber);
  868. if (this.step == FunctionalTestScenario.Action_V1_A) {
  869. Assert.assertNull(absentSubscriberDiagnosticSM);
  870. Assert.assertFalse(gprsSupportIndicator);
  871. Assert.assertFalse(deliveryOutcomeIndicator);
  872. Assert.assertNull(additionalSMDeliveryOutcome);
  873. Assert.assertNull(additionalAbsentSubscriberDiagnosticSM);
  874. Assert.assertNull(extensionContainer);
  875. } else {
  876. Assert.assertNotNull(absentSubscriberDiagnosticSM);
  877. Assert.assertEquals((int) absentSubscriberDiagnosticSM, 555);
  878. Assert.assertTrue(gprsSupportIndicator);
  879. Assert.assertTrue(deliveryOutcomeIndicator);
  880. Assert.assertEquals(additionalSMDeliveryOutcome, SMDeliveryOutcome.successfulTransfer);
  881. Assert.assertNotNull(additionalAbsentSubscriberDiagnosticSM);
  882. Assert.assertEquals((int) additionalAbsentSubscriberDiagnosticSM, 444);
  883. Assert.assertTrue(MAPExtensionContainerTest.CheckTestExtensionContainer(extensionContainer));
  884. }
  885. this._S_recievedSmsRequestIndication = true;
  886. ISDNAddressString storedMSISDN = this.MAPParameterFactory.createISDNAddressString(AddressNature.network_specific_number, NumberingPlan.national,
  887. "111000111");
  888. try {
  889. if (this.step == FunctionalTestScenario.Action_V1_A) {
  890. d.addReportSMDeliveryStatusResponse(reportSMDeliveryStatusInd.getInvokeId(), null, null);
  891. } else {
  892. d.addReportSMDeliveryStatusResponse(reportSMDeliveryStatusInd.getInvokeId(), storedMSISDN,
  893. MAPExtensionContainerTest.GetTestExtensionContainer());
  894. }
  895. } catch (MAPException e) {
  896. // TODO Auto-generated catch block
  897. e.printStackTrace();
  898. }
  899. }
  900. @Override
  901. public void onReportSMDeliveryStatusRespIndication(ReportSMDeliveryStatusResponseIndication reportSMDeliveryStatusRespInd) {
  902. // TODO Auto-generated method stub
  903. }
  904. @Override
  905. public void onInformServiceCentreIndication(InformServiceCentreRequestIndication informServiceCentreInd) {
  906. }
  907. @Override
  908. public void onAlertServiceCentreIndication(AlertServiceCentreRequestIndication alertServiceCentreInd) {
  909. MAPDialogSms d = alertServiceCentreInd.getMAPDialog();
  910. ISDNAddressString msisdn = alertServiceCentreInd.getMsisdn();
  911. AddressString serviceCentreAddress = alertServiceCentreInd.getServiceCentreAddress();
  912. Assert.assertNotNull(msisdn);
  913. Assert.assertEquals(msisdn.getAddressNature(), AddressNature.international_number);
  914. Assert.assertEquals(msisdn.getNumberingPlan(), NumberingPlan.ISDN);
  915. Assert.assertEquals(msisdn.getAddress(), "111222333");
  916. Assert.assertNotNull(serviceCentreAddress);
  917. Assert.assertEquals(serviceCentreAddress.getAddressNature(), AddressNature.subscriber_number);
  918. Assert.assertEquals(serviceCentreAddress.getNumberingPlan(), NumberingPlan.national);
  919. Assert.assertEquals(serviceCentreAddress.getAddress(), "0011");
  920. this._S_recievedSmsRequestIndication = true;
  921. if (this.step != FunctionalTestScenario.Action_V1_B) {
  922. try {
  923. d.addAlertServiceCentreResponse(alertServiceCentreInd.getInvokeId());
  924. } catch (MAPException e) {
  925. // TODO Auto-generated catch block
  926. e.printStackTrace();
  927. }
  928. }
  929. }
  930. @Override
  931. public void onAlertServiceCentreRespIndication(AlertServiceCentreResponseIndication alertServiceCentreInd) {
  932. // TODO Auto-generated method stub
  933. }
  934. /* (non-Javadoc)
  935. * @see org.mobicents.protocols.ss7.map.api.service.supplementary.MAPServiceSupplementaryListener#onUnstructuredSSNotifyIndication(org.mobicents.protocols.ss7.map.api.service.supplementary.UnstructuredSSNotifyIndication)
  936. */
  937. @Override
  938. public void onUnstructuredSSNotifyRequestIndication(UnstructuredSSNotifyRequestIndication unstrNotifyInd) {
  939. // TODO Auto-generated method stub
  940. }
  941. @Override
  942. public void onForwardShortMessageIndication(ForwardShortMessageRequestIndication forwSmInd) {
  943. MAPDialogSms d = forwSmInd.getMAPDialog();
  944. SM_RP_DA sm_RP_DA = forwSmInd.getSM_RP_DA();
  945. SM_RP_OA sm_RP_OA = forwSmInd.getSM_RP_OA();
  946. SmsSignalInfo sm_RP_UI = forwSmInd.getSM_RP_UI();
  947. Assert.assertNotNull(sm_RP_DA);
  948. Assert.assertNotNull(sm_RP_DA.getIMSI());
  949. // Assert.assertEquals((long) (sm_RP_DA.getIMSI().getMCC()), 250);
  950. // Assert.assertEquals((long) (sm_RP_DA.getIMSI().getMNC()), 99);
  951. Assert.assertEquals(sm_RP_DA.getIMSI().getData(), "250991357999");
  952. Assert.assertNotNull(sm_RP_OA);
  953. Assert.assertNotNull(sm_RP_OA.getMsisdn());
  954. Assert.assertEquals(sm_RP_OA.getMsisdn().getAddressNature(), AddressNature.international_number);
  955. Assert.assertEquals(sm_RP_OA.getMsisdn().getNumberingPlan(), NumberingPlan.ISDN);
  956. Assert.assertEquals(sm_RP_OA.getMsisdn().getAddress(), "111222333");
  957. Assert.assertNotNull(sm_RP_UI);
  958. Assert.assertTrue(Arrays.equals(sm_RP_UI.getData(), new byte[] { 21, 22, 23, 24, 25 }));
  959. if (this.step == FunctionalTestScenario.Action_V1_E)
  960. Assert.assertFalse(forwSmInd.getMoreMessagesToSend());
  961. else
  962. Assert.assertTrue(forwSmInd.getMoreMessagesToSend());
  963. this._S_recievedSmsRequestIndication = true;
  964. if (this.step != FunctionalTestScenario.Action_V1_E) {
  965. try {
  966. d.addForwardShortMessageResponse(forwSmInd.getInvokeId());
  967. } catch (MAPException e) {
  968. // TODO Auto-generated catch block
  969. e.printStackTrace();
  970. }
  971. }
  972. }
  973. @Override
  974. public void onForwardShortMessageRespIndication(ForwardShortMessageResponseIndication forwSmRespInd) {
  975. // TODO Auto-generated method stub
  976. }
  977. /* (non-Javadoc)
  978. * @see org.mobicents.protocols.ss7.map.api.service.supplementary.MAPServiceSupplementaryListener#onUnstructuredSSNotifyResponseIndication(org.mobicents.protocols.ss7.map.api.service.supplementary.UnstructuredSSNotifyResponseIndication)
  979. */
  980. @Override
  981. public void onUnstructuredSSNotifyResponseIndication(UnstructuredSSNotifyResponseIndication unstrNotifyInd) {
  982. // TODO Auto-generated method stub
  983. }
  984. @Override
  985. public void onMAPMessage(MAPMessage mapMessage) {
  986. // TODO Auto-generated method stub
  987. }
  988. }