PageRenderTime 8ms CodeModel.GetById 2ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

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

http://mobicents.googlecode.com/
Java | 127 lines | 58 code | 21 blank | 48 comment | 0 complexity | 3bad31bb28d796be59987dd66c0a8237 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.CircuitGroupBlockingAckMessage;
 29import org.mobicents.protocols.ss7.isup.message.CircuitGroupBlockingMessage;
 30import org.mobicents.protocols.ss7.isup.message.ISUPMessage;
 31import org.mobicents.protocols.ss7.isup.message.parameter.CircuitGroupSuperVisionMessageType;
 32import org.mobicents.protocols.ss7.isup.message.parameter.CircuitIdentificationCode;
 33import org.mobicents.protocols.ss7.isup.message.parameter.RangeAndStatus;
 34
 35/**
 36 * @author baranowb
 37 *
 38 */
 39public class CGBTest extends DoubleTimers {
 40	//thanks to magic of super class, this is whole test :)
 41	/* (non-Javadoc)
 42	 * @see org.mobicents.protocols.ss7.isup.impl.stack.DoubleTimers#getSmallerT()
 43	 */
 44	protected long getSmallerT() {
 45		return ISUPTimeoutEvent.T18_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.T19_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.T18;
 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.T19;
 70	}
 71
 72	/* (non-Javadoc)
 73	 * @see org.mobicents.protocols.ss7.isup.impl.stack.DoubleTimers#getRequest()
 74	 */
 75	
 76	protected ISUPMessage getRequest() {
 77		CircuitGroupBlockingMessage cgb = super.provider.getMessageFactory().createCGB(1); 
 78		
 79		RangeAndStatus ras = super.provider.getParameterFactory().createRangeAndStatus();
 80		ras.setRange((byte) 7,true);
 81		ras.setAffected((byte) 1, true);
 82		ras.setAffected((byte) 0, true);
 83		cgb.setRangeAndStatus(ras);
 84
 85		CircuitGroupSuperVisionMessageType cgsvmt = super.provider.getParameterFactory().createCircuitGroupSuperVisionMessageType();
 86		cgsvmt.setCircuitGroupSuperVisionMessageTypeIndicator(cgsvmt._CIRCUIT_GROUP_SMTIHFO);
 87		cgb.setSupervisionType(cgsvmt);
 88		
 89		return cgb;
 90	}
 91
 92	/* (non-Javadoc)
 93	 * @see org.mobicents.protocols.ss7.isup.impl.stack.DoubleTimers#getAnswer()
 94	 */
 95	
 96	protected ISUPMessage getAnswer() {
 97		CircuitGroupBlockingAckMessage cgba = super.provider.getMessageFactory().createCGBA();
 98		CircuitIdentificationCode cic = super.provider.getParameterFactory().createCircuitIdentificationCode();
 99		cic.setCIC(1);
100		cgba.setCircuitIdentificationCode(cic);
101		RangeAndStatus ras = super.provider.getParameterFactory().createRangeAndStatus();
102		ras.setRange((byte) 7,true);
103		ras.setAffected((byte) 1, true);
104		ras.setAffected((byte) 0, true);
105		cgba.setRangeAndStatus(ras);
106
107		CircuitGroupSuperVisionMessageType cgsvmt = super.provider.getParameterFactory().createCircuitGroupSuperVisionMessageType();
108		cgsvmt.setCircuitGroupSuperVisionMessageTypeIndicator(cgsvmt._CIRCUIT_GROUP_SMTIHFO);
109		cgba.setSupervisionType(cgsvmt);
110		return cgba;
111	}
112
113	/* (non-Javadoc)
114	 * @see org.mobicents.protocols.ss7.isup.impl.stack.EventTestHarness#getSpecificConfig()
115	 */
116	
117	protected Properties getSpecificConfig() {
118		//ensure proper values;
119		Properties p = new Properties();
120		p.put("t18", getSmallerT()+"");
121		p.put("t19" ,  getBiggerT()+"");
122		p.put("ni", "2");
123		p.put("localspc", "2");
124		return p;
125	}
126
127}