/protocols/ss7/isup/isup-impl/src/test/java/org/mobicents/protocols/ss7/isup/impl/stack/timers/CQMTest.java
Java | 127 lines | 54 code | 17 blank | 56 comment | 0 complexity | 844cd4ac52d5bd37021ec39577b6e5da 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 23package org.mobicents.protocols.ss7.isup.impl.stack.timers; 24 25import java.util.Properties; 26 27import org.mobicents.protocols.ss7.isup.ISUPTimeoutEvent; 28import org.mobicents.protocols.ss7.isup.message.CircuitGroupQueryMessage; 29import org.mobicents.protocols.ss7.isup.message.CircuitGroupQueryResponseMessage; 30import org.mobicents.protocols.ss7.isup.message.ISUPMessage; 31import org.mobicents.protocols.ss7.isup.message.parameter.CircuitIdentificationCode; 32import org.mobicents.protocols.ss7.isup.message.parameter.CircuitStateIndicator; 33import org.mobicents.protocols.ss7.isup.message.parameter.RangeAndStatus; 34 35/** 36 * @author baranowb 37 * 38 */ 39public class CQMTest extends SingleTimers { 40 41 /* 42 * (non-Javadoc) 43 * 44 * @see 45 * org.mobicents.protocols.ss7.isup.impl.stack.timers.SingleTimers#getT() 46 */ 47 48 protected long getT() { 49 return ISUPTimeoutEvent.T28_DEFAULT; 50 } 51 52 /* 53 * (non-Javadoc) 54 * 55 * @see 56 * org.mobicents.protocols.ss7.isup.impl.stack.timers.SingleTimers#getT_ID() 57 */ 58 59 protected int getT_ID() { 60 return ISUPTimeoutEvent.T28; 61 } 62 63 /* 64 * (non-Javadoc) 65 * 66 * @see org.mobicents.protocols.ss7.isup.impl.stack.timers.EventTestHarness# 67 * getRequest() 68 */ 69 70 protected ISUPMessage getRequest() { 71 CircuitGroupQueryMessage msg = super.provider.getMessageFactory().createCQM(1); 72 RangeAndStatus ras = super.provider.getParameterFactory().createRangeAndStatus(); 73 ras.setRange((byte) 7, true); 74 ras.setAffected((byte) 1, true); 75 ras.setAffected((byte) 0, true); 76 msg.setRangeAndStatus(ras); 77 return msg; 78 } 79 80 protected ISUPMessage getAfterTRequest() { 81 return null; 82 } 83 84 /* 85 * (non-Javadoc) 86 * 87 * @see 88 * org.mobicents.protocols.ss7.isup.impl.stack.timers.EventTestHarness#getAnswer 89 * () 90 */ 91 protected ISUPMessage getAnswer() { 92 CircuitGroupQueryResponseMessage ans = super.provider.getMessageFactory().createCQR(); 93 CircuitIdentificationCode cic = super.provider.getParameterFactory().createCircuitIdentificationCode(); 94 cic.setCIC(1); 95 ans.setCircuitIdentificationCode(cic); 96 97 RangeAndStatus ras = super.provider.getParameterFactory().createRangeAndStatus(); 98 ras.setRange((byte) 7, true); 99 ras.setAffected((byte) 1, true); 100 ras.setAffected((byte) 0, true); 101 ans.setRangeAndStatus(ras); 102 103 CircuitStateIndicator ci = super.provider.getParameterFactory().createCircuitStateIndicator(); 104 byte[] state = new byte[2]; 105 state[0] = ci.createCircuitState(ci._MBS_LAR_BLOCKED, ci._CPS_CIB, ci._HBS_LAR_BLOCKED); 106 state[1] = ci.createCircuitState(ci._MBS_LAR_BLOCKED, ci._CPS_COB, ci._HBS_LAR_BLOCKED); 107 ci.setCircuitState(state); 108 ans.setCircuitStateIndicator(ci); 109 return ans; 110 } 111 112 /* 113 * (non-Javadoc) 114 * 115 * @see org.mobicents.protocols.ss7.isup.impl.stack.timers.EventTestHarness# 116 * getSpecificConfig() 117 */ 118 119 protected Properties getSpecificConfig() { 120 Properties p = new Properties(); 121 p.put("t28", getT() + ""); 122 p.put("ni", "2"); 123 p.put("localspc", "2"); 124 return p; 125 } 126 127}