/protocols/ss7/isup/isup-impl/src/test/java/org/mobicents/protocols/ss7/isup/impl/message/ACMTest.java
Java | 95 lines | 41 code | 16 blank | 38 comment | 0 complexity | 8600151c739845f859c67e5284166f18 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 static org.testng.Assert.*; 34import org.testng.*; 35import org.testng.annotations.*; 36import org.mobicents.protocols.ss7.isup.message.AddressCompleteMessage; 37import org.mobicents.protocols.ss7.isup.message.ISUPMessage; 38import org.mobicents.protocols.ss7.isup.message.parameter.BackwardCallIndicators; 39import org.mobicents.protocols.ss7.isup.message.parameter.CircuitIdentificationCode; 40 41/** 42 * Start time:09:26:46 2009-04-22<br> 43 * Project: mobicents-isup-stack<br> 44 * Test for ACM 45 * 46 * @author <a href="mailto:baranowb@gmail.com"> Bartosz Baranowski </a> 47 */ 48public class ACMTest extends MessageHarness { 49 50 @Test(groups = { "functional.encode","functional.decode","message"}) 51 public void testTwo_Params() throws Exception { 52 53 byte[] message = getDefaultBody(); 54 55 // AddressCompleteMessageImpl acm=new 56 // AddressCompleteMessageImpl(this,message); 57 AddressCompleteMessage acm = super.messageFactory.createACM(); 58 ((AbstractISUPMessage)acm).decode(message,parameterFactory); 59 60 assertNotNull( acm.getBackwardCallIndicators(),"BackwardCallIndicator is null"); 61 assertNotNull( acm.getOptionalBackwardCallIndicators(),"OptionalBackwardCallIndicator is null"); 62 assertNotNull( acm.getCauseIndicators(),"Cause Indicator is null"); 63 64 BackwardCallIndicators bci = acm.getBackwardCallIndicators(); 65 assertEquals( 1, bci.getChargeIndicator(),"BackwardCallIndicator charge indicator does not match"); 66 assertEquals( 0, bci.getCalledPartysStatusIndicator(),"BackwardCallIndicator called party status does not match"); 67 assertEquals( 0, bci.getCalledPartysCategoryIndicator(),"BackwardCallIndicator called party category does not match"); 68 assertFalse(bci.isInterworkingIndicator()); 69 assertFalse(bci.isEndToEndInformationIndicator()); 70 assertFalse(bci.isIsdnAccessIndicator()); 71 assertFalse(bci.isHoldingIndicator()); 72 assertTrue(bci.isEchoControlDeviceIndicator()); 73 assertEquals( 0, bci.getSccpMethodIndicator(),"BackwardCallIndicator sccp method does not match"); 74 75 CircuitIdentificationCode cic = acm.getCircuitIdentificationCode(); 76 assertNotNull( cic,"CircuitIdentificationCode must not be null"); 77 assertEquals( getDefaultCIC(), cic.getCIC(),"CircuitIdentificationCode value does not match"); 78 79 } 80 81 82 protected byte[] getDefaultBody() { 83 byte[] message = { 84 85 0x0C, (byte) 0x0B, 0x06, 0x01, 0x20, 0x01, 0x29, 0x01, 0x01, 0x12, 0x02, (byte) 0x82, (byte) 0x9C, 0x00 86 87 }; 88 return message; 89 } 90 91 92 protected ISUPMessage getDefaultMessage() { 93 return super.messageFactory.createACM(); 94 } 95}