PageRenderTime 62ms CodeModel.GetById 55ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

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

http://mobicents.googlecode.com/
Java | 101 lines | 45 code | 16 blank | 40 comment | 2 complexity | e73ce32a38ec9dd30f7d0a36fe632eb0 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:09:26:46 2009-04-22<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;
 32
 33import org.mobicents.protocols.ss7.isup.message.CircuitGroupResetMessage;
 34import org.mobicents.protocols.ss7.isup.message.ISUPMessage;
 35import org.mobicents.protocols.ss7.isup.message.parameter.CallReference;
 36import org.mobicents.protocols.ss7.isup.message.parameter.RangeAndStatus;
 37
 38import static org.testng.Assert.*;
 39import org.testng.*;
 40import org.testng.annotations.*;
 41/**
 42 * Start time:09:26:46 2009-04-22<br>
 43 * Project: mobicents-isup-stack<br>
 44 * Test for GRA
 45 * 
 46 * @author <a href="mailto:baranowb@gmail.com"> Bartosz Baranowski </a>
 47 */
 48public class GRSTest extends MessageHarness {
 49	
 50	
 51	@Test(groups = { "functional.encode","functional.decode","message"})
 52	public void testTwo_Params() throws Exception
 53	{
 54		byte[] message = getDefaultBody();
 55
 56		//CircuitGroupResetMessage grs=new CircuitGroupResetMessageImpl(this,message);
 57		CircuitGroupResetMessage grs=super.messageFactory.createGRS(0);
 58		((AbstractISUPMessage)grs).decode(message,parameterFactory);
 59		
 60		try{
 61			RangeAndStatus RS = (RangeAndStatus) grs.getParameter(RangeAndStatus._PARAMETER_CODE);
 62			assertNotNull(RS,"Range And Status retrun is null, it shoul not be");
 63			if(RS == null)
 64				return;
 65			byte range = RS.getRange();
 66			assertEquals(range,0x01,"Range is wrong,");
 67			byte[] b=RS.getStatus();
 68			assertNull(b,"RangeAndStatus.getRange() is not null");
 69		
 70			
 71		}catch(Exception e)
 72		{
 73			e.printStackTrace();
 74			fail("Failed on get parameter["+CallReference._PARAMETER_CODE+"]:"+e);
 75		}
 76		
 77	}
 78	
 79	protected byte[] getDefaultBody() {
 80		//FIXME: for now we strip MTP part
 81		byte[] message={
 82
 83				0x0C
 84				,(byte) 0x0B
 85				,CircuitGroupResetMessage.MESSAGE_CODE
 86
 87				,0x01 // ptr to variable part
 88				//no optional, so no pointer
 89				//RangeAndStatus._PARAMETER_CODE
 90				,0x01
 91				,0x01
 92				
 93		};
 94
 95		return message;
 96	}
 97	
 98	protected ISUPMessage getDefaultMessage() {
 99		return super.messageFactory.createGRS(0);
100	}
101}