PageRenderTime 24ms CodeModel.GetById 7ms app.highlight 11ms RepoModel.GetById 1ms app.codeStats 0ms

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

http://mobicents.googlecode.com/
Java | 112 lines | 44 code | 19 blank | 49 comment | 0 complexity | 142868c443dbe507ba4bb7c9f82a3cb8 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:14:11:03 2009-04-23<br>
 25 * Project: mobicents-isup-stack<br>
 26 * 
 27 * @author <a href="mailto:baranowb@gmail.com">Bartosz Baranowski
 28 *         </a>
 29 * 
 30 */
 31package org.mobicents.protocols.ss7.isup.impl.message.parameter;
 32
 33import java.io.IOException;
 34import java.lang.reflect.InvocationTargetException;
 35
 36import org.mobicents.protocols.ss7.isup.ParameterException;
 37import org.testng.annotations.Test;
 38
 39/**
 40 * Start time:14:11:03 2009-04-23<br>
 41 * Project: mobicents-isup-stack<br>
 42 * 
 43 * @author <a href="mailto:baranowb@gmail.com">Bartosz Baranowski
 44 *         </a>
 45 */
 46public class CallReferenceTest extends ParameterHarness {
 47
 48	/**
 49	 * @throws IOException
 50	 */
 51	public CallReferenceTest() throws IOException {
 52		super.badBodies.add(new byte[1]);
 53		super.badBodies.add(new byte[2]);
 54		super.badBodies.add(new byte[3]);
 55		super.badBodies.add(new byte[4]);
 56		super.badBodies.add(new byte[6]);
 57
 58		super.goodBodies.add(getBody2());
 59		
 60	}
 61
 62	private byte[] getBody1() throws IOException {
 63		
 64		// we will use odd number of digits, so we leave zero as MSB
 65		byte[] body = new byte[5];
 66		body[0]=12;
 67		body[1]=73;
 68		body[2]=120;
 69		body[3]=73;
 70		body[4]=120;
 71		
 72		return body;
 73	}
 74	private byte[] getBody2() throws IOException {
 75		
 76		// we will use odd number of digits, so we leave zero as MSB
 77		byte[] body = new byte[5];
 78		body[0]=12;
 79		body[1]=73;
 80		body[2]=120;
 81		body[3]=73;
 82		//one MSB will be ignored.
 83		body[4]=120 & 0x3F;
 84		
 85		return body;
 86	}
 87	@Test(groups = { "functional.encode","functional.decode","parameter"})
 88	public void testBody1EncodedValues() throws SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException, IOException, ParameterException {
 89		CallReferenceImpl cr = new CallReferenceImpl();
 90		cr.decode(getBody1());
 91		String[] methodNames = { "getCallIdentity","getSignalingPointCode"};
 92		Object[] expectedValues = { 805240,14409};
 93		super.testValues(cr, methodNames, expectedValues);
 94	}
 95
 96	
 97
 98	/*
 99	 * (non-Javadoc)
100	 * 
101	 * @see
102	 * org.mobicents.isup.messages.parameters.ParameterHarness#getTestedComponent
103	 * ()
104	 */
105	
106	public AbstractISUPParameter getTestedComponent() throws ParameterException {
107		return new CallReferenceImpl();
108	}
109
110	
111	
112}