PageRenderTime 124ms CodeModel.GetById 116ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

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

http://mobicents.googlecode.com/
Java | 102 lines | 45 code | 17 blank | 40 comment | 2 complexity | ecd299098b5e7490054b2ff20701f309 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.CircuitGroupQueryMessage;
 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 CQM
 45 * 
 46 * @author <a href="mailto:baranowb@gmail.com"> Bartosz Baranowski </a>
 47 */
 48public class CQMTest 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		//CircuitGroupQueryMessage grs=new CircuitGroupQueryMessageImpl(this,message);
 57		CircuitGroupQueryMessage grs=super.messageFactory.createCQM(0);
 58		((AbstractISUPMessage)grs).decode(message,parameterFactory);
 59
 60		
 61		try{
 62			RangeAndStatus RS = (RangeAndStatus) grs.getParameter(RangeAndStatus._PARAMETER_CODE);
 63			assertNotNull(RS,"Range And Status retrun is null, it shoul not be");
 64			if(RS == null)
 65				return;
 66			byte range = RS.getRange();
 67			assertEquals(range,0x01,"Range is wrong,");
 68			byte[] b=RS.getStatus();
 69			assertNull(b,"RangeAndStatus.getRange() is not null");
 70		
 71			
 72		}catch(Exception e)
 73		{
 74			e.printStackTrace();
 75			fail("Failed on get parameter["+CallReference._PARAMETER_CODE+"]:"+e);
 76		}
 77	
 78	}
 79	
 80	protected byte[] getDefaultBody() {
 81		//FIXME: for now we strip MTP part
 82		byte[] message={
 83
 84				0x0C
 85				,(byte) 0x0B
 86				,CircuitGroupQueryMessage.MESSAGE_CODE
 87
 88				,0x01 // ptr to variable part
 89				//no optional, so no pointer
 90				//RangeAndStatus._PARAMETER_CODE
 91				,0x01
 92				,0x01
 93				
 94		};
 95
 96		return message;
 97	}
 98	
 99	protected ISUPMessage getDefaultMessage() {
100		return super.messageFactory.createCQM(0);
101	}
102}