PageRenderTime 26ms CodeModel.GetById 1ms app.highlight 19ms RepoModel.GetById 1ms app.codeStats 1ms

/protocols/ss7/isup/isup-impl/src/test/java/org/mobicents/protocols/ss7/isup/impl/message/IAMTest.java

http://mobicents.googlecode.com/
Java | 174 lines | 122 code | 15 blank | 37 comment | 0 complexity | 46779ff87d3a549d6d9b010cd2b3a95c 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
 23/**
 24 * Start time:15:07:07 2009-07-17<br>
 25 * Project: mobicents-isup-stack<br>
 26 * 
 27 * @author <a href="mailto:baranowb@gmail.com">Bartosz Baranowski </a>
 28 * 
 29 */
 30package org.mobicents.protocols.ss7.isup.impl.message;
 31
 32import org.mobicents.protocols.ss7.isup.message.ISUPMessage;
 33import org.mobicents.protocols.ss7.isup.message.InitialAddressMessage;
 34
 35import static org.testng.Assert.*;
 36import org.testng.*;
 37import org.testng.annotations.*;
 38
 39/**
 40 * Start time:15:07:07 2009-07-17<br>
 41 * Project: mobicents-isup-stack<br>
 42 * 
 43 * @author <a href="mailto:baranowb@gmail.com"> Bartosz Baranowski </a>
 44 */
 45public class IAMTest extends MessageHarness{
 46
 47
 48	@Test(groups = { "functional.encode","functional.decode","message"})
 49	public void testTwo_Parameters() throws Exception
 50	{
 51		byte[] message = getDefaultBody();
 52
 53		//InitialAddressMessageImpl iam=new InitialAddressMessageImpl(this,message);
 54		InitialAddressMessage iam=super.messageFactory.createIAM(0);
 55		((AbstractISUPMessage)iam).decode(message,parameterFactory);
 56		assertNotNull(iam.getNatureOfConnectionIndicators());
 57		assertNotNull(iam.getForwardCallIndicators());
 58		assertNotNull(iam.getCallingPartCategory());
 59		assertNotNull(iam.getTransmissionMediumRequirement());
 60		assertNotNull(iam.getCalledPartyNumber());
 61		assertNotNull(iam.getCallingPartyNumber());
 62
 63	}
 64	public void testThree_Trace() throws Exception
 65	{
 66		
 67		byte[] message = new byte[] { 
 68				0x73, 0x00, //CIC
 69				0x01,       //IAM
 70				0x11,       //M:  natur of connection indicators
 71				0x60,       //M: forward call ind
 72				0x00,       //M: forward call ind
 73				0x0a,       //M: calling party's category
 74				0x03,       //M: transmission medium req
 75				0x02,       //pointer to mandatory var:
 76				0x09,       //pointer to optional
 77				0x07,       //MV: len of called party number
 78		 (byte) 0x83, 
 79		 (byte) 0x90, 
 80		 		0x79, 
 81		 		0x70,
 82		 		0x45, 
 83		 		0x26, 
 84		 		0x09, 
 85		 		0x0a,       //opt, CallingParty Num
 86				0x07, 
 87		 (byte) 0x83, 
 88		 		0x13, 
 89		 		0x59, 
 90		 		0x63, 
 91		 (byte) 0x85, 
 92		 (byte) 0x96, 
 93		 		0x00, 
 94		 		0x3f,       //opt  Location Num
 95		 (byte) 0x07, 
 96		 (byte) 0x83, 
 97		 		0x17, 
 98		 		0x17, 
 99		 		0x50, 
100		 		0x20, 
101		 		0x03, 
102		 		0x00, 
103		 		0x03,      //opt Forward GVNS
104				0x13, 
105				0x28, 
106				0x11, 
107				0x42, 
108				0x45, 
109				0x52, 
110				0x54, 
111				0x48, 
112				0x41, 
113				0x4c, 
114				0x49, 
115				0x4e, 
116				0x20, 
117				0x4a, 
118				0x61, 
119				0x63, 
120				0x71, 
121				0x75, 
122				0x65, 
123				0x73, 
124				0x00 
125				/*,0x1b, 
126				0x1d*/ };
127		InitialAddressMessage iam=super.messageFactory.createIAM(0);
128		((AbstractISUPMessage)iam).decode(message,parameterFactory);
129	}
130	
131	protected byte[] getDefaultBody() {
132		//FIXME: for now we strip MTP part
133		byte[] message={
134
135				0x0C
136				,(byte) 0x0B
137				,0x01,
138				0x10,
139				0x00,
140				0x01,
141				0x0A,
142				0x03,
143				0x02,
144				0x0A,
145				0x08,
146				0x03,
147				0x10,
148				(byte) 0x83,
149				0x60,
150				0x38,
151				0x04,
152				0x10,
153				0x65,
154				0x0A,
155				0x07,
156				0x03,
157				0x13,
158				0x09,
159				0x32,
160				0x36,
161				0x11,
162				0x37,
163				0x00
164
165		};
166
167
168		return message;
169	}
170	
171	protected ISUPMessage getDefaultMessage() {
172		return super.messageFactory.createIAM(0);
173	}
174}