PageRenderTime 71ms CodeModel.GetById 10ms app.highlight 52ms RepoModel.GetById 1ms app.codeStats 0ms

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