PageRenderTime 84ms CodeModel.GetById 17ms app.highlight 58ms 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

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

Large files files are truncated, but you can click here to view the full file