PageRenderTime 39ms CodeModel.GetById 30ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

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

http://mobicents.googlecode.com/
Java | 119 lines | 51 code | 20 blank | 48 comment | 0 complexity | 9a1c48831d6f6c345eebefe8155367bb 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.CircuitGroupResetAckMessage;
 29import org.mobicents.protocols.ss7.isup.message.CircuitGroupResetMessage;
 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.RangeAndStatus;
 33
 34/**
 35 * @author baranowb
 36 *
 37 */
 38public class GRSTest extends DoubleTimers {
 39	//thanks to magic of super class, this is whole test :)
 40	/* (non-Javadoc)
 41	 * @see org.mobicents.protocols.ss7.isup.impl.stack.DoubleTimers#getSmallerT()
 42	 */
 43	
 44	protected long getSmallerT() {
 45		return ISUPTimeoutEvent.T22_DEFAULT+3000;
 46	}
 47
 48	/* (non-Javadoc)
 49	 * @see org.mobicents.protocols.ss7.isup.impl.stack.DoubleTimers#getBiggerT()
 50	 */
 51	
 52	protected long getBiggerT() {
 53		return ISUPTimeoutEvent.T23_DEFAULT;
 54	}
 55
 56	/* (non-Javadoc)
 57	 * @see org.mobicents.protocols.ss7.isup.impl.stack.DoubleTimers#getSmallerT_ID()
 58	 */
 59	
 60	protected int getSmallerT_ID() {
 61		return ISUPTimeoutEvent.T22;
 62	}
 63
 64	/* (non-Javadoc)
 65	 * @see org.mobicents.protocols.ss7.isup.impl.stack.DoubleTimers#getBiggerT_ID()
 66	 */
 67	
 68	protected int getBiggerT_ID() {
 69		return ISUPTimeoutEvent.T23;
 70	}
 71
 72	/* (non-Javadoc)
 73	 * @see org.mobicents.protocols.ss7.isup.impl.stack.DoubleTimers#getRequest()
 74	 */
 75	
 76	protected ISUPMessage getRequest() {
 77		RangeAndStatus ras = super.provider.getParameterFactory().createRangeAndStatus();
 78		ras.setRange((byte) 7,true);
 79		ras.setAffected((byte)1, true);
 80		ras.setAffected((byte)0, true);
 81		CircuitGroupResetMessage grs = super.provider.getMessageFactory().createGRS(1);
 82		grs.setRangeAndStatus(ras);
 83		return grs;
 84	}
 85
 86	/* (non-Javadoc)
 87	 * @see org.mobicents.protocols.ss7.isup.impl.stack.DoubleTimers#getAnswer()
 88	 */
 89	
 90	protected ISUPMessage getAnswer() {
 91		CircuitGroupResetAckMessage gra = super.provider.getMessageFactory().createGRA();
 92		CircuitIdentificationCode cic = super.provider.getParameterFactory().createCircuitIdentificationCode();
 93		cic.setCIC(1);
 94		gra.setCircuitIdentificationCode(cic);
 95		RangeAndStatus ras = super.provider.getParameterFactory().createRangeAndStatus();
 96		ras.setRange((byte) 7,true);
 97		ras.setAffected((byte)1, true);
 98		ras.setAffected((byte)0, true);
 99		gra.setRangeAndStatus(ras);
100		
101		
102		return gra;
103	}
104
105	/* (non-Javadoc)
106	 * @see org.mobicents.protocols.ss7.isup.impl.stack.EventTestHarness#getSpecificConfig()
107	 */
108	
109	protected Properties getSpecificConfig() {
110		//ensure proper values;
111		Properties p = new Properties();
112		p.put("t22", getSmallerT()+"");
113		p.put("t23" ,  getBiggerT()+"");
114		p.put("ni", "2");
115		p.put("localspc", "2");
116		return p;
117	}
118
119}