PageRenderTime 14ms CodeModel.GetById 1ms app.highlight 10ms RepoModel.GetById 1ms app.codeStats 0ms

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

http://mobicents.googlecode.com/
Java | 151 lines | 58 code | 25 blank | 68 comment | 0 complexity | 0805017a838ed453269bf3bfd0e92f7a 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.CircuitGroupUnblockingAckMessage;
 29import org.mobicents.protocols.ss7.isup.message.CircuitGroupUnblockingMessage;
 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 CGUTest extends DoubleTimers {
 40	// thanks to magic of super class, this is whole test :)
 41	/*
 42	 * (non-Javadoc)
 43	 * 
 44	 * @see
 45	 * org.mobicents.protocols.ss7.isup.impl.stack.DoubleTimers#getSmallerT()
 46	 */
 47	
 48	protected long getSmallerT() {
 49		return ISUPTimeoutEvent.T20_DEFAULT + 3000;
 50	}
 51
 52	/*
 53	 * (non-Javadoc)
 54	 * 
 55	 * @see
 56	 * org.mobicents.protocols.ss7.isup.impl.stack.DoubleTimers#getBiggerT()
 57	 */
 58	
 59	protected long getBiggerT() {
 60		return ISUPTimeoutEvent.T21_DEFAULT;
 61	}
 62
 63	/*
 64	 * (non-Javadoc)
 65	 * 
 66	 * @see
 67	 * org.mobicents.protocols.ss7.isup.impl.stack.DoubleTimers#getSmallerT_ID()
 68	 */
 69	
 70	protected int getSmallerT_ID() {
 71		return ISUPTimeoutEvent.T20;
 72	}
 73
 74	/*
 75	 * (non-Javadoc)
 76	 * 
 77	 * @see
 78	 * org.mobicents.protocols.ss7.isup.impl.stack.DoubleTimers#getBiggerT_ID()
 79	 */
 80	
 81	protected int getBiggerT_ID() {
 82		return ISUPTimeoutEvent.T21;
 83	}
 84
 85	/*
 86	 * (non-Javadoc)
 87	 * 
 88	 * @see
 89	 * org.mobicents.protocols.ss7.isup.impl.stack.DoubleTimers#getRequest()
 90	 */
 91	
 92	protected ISUPMessage getRequest() {
 93		CircuitGroupUnblockingMessage cgu = super.provider.getMessageFactory().createCGU(1);
 94
 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		cgu.setRangeAndStatus(ras);
100
101		CircuitGroupSuperVisionMessageType cgsvmt = super.provider.getParameterFactory().createCircuitGroupSuperVisionMessageType();
102		cgsvmt.setCircuitGroupSuperVisionMessageTypeIndicator(cgsvmt._CIRCUIT_GROUP_SMTIHFO);
103		cgu.setSupervisionType(cgsvmt);
104
105
106		return cgu;
107	}
108
109	/*
110	 * (non-Javadoc)
111	 * 
112	 * @see org.mobicents.protocols.ss7.isup.impl.stack.DoubleTimers#getAnswer()
113	 */
114	
115	protected ISUPMessage getAnswer() {
116		CircuitGroupUnblockingAckMessage cgua = super.provider.getMessageFactory().createCGUA();
117		CircuitIdentificationCode cic = super.provider.getParameterFactory().createCircuitIdentificationCode();
118		cic.setCIC(1);
119		cgua.setCircuitIdentificationCode(cic);
120		
121		RangeAndStatus ras = super.provider.getParameterFactory().createRangeAndStatus();
122		ras.setRange((byte) 7,true);
123		ras.setAffected((byte) 1, true);
124		ras.setAffected((byte) 0, true);
125		cgua.setRangeAndStatus(ras);
126
127		CircuitGroupSuperVisionMessageType cgsvmt = super.provider.getParameterFactory().createCircuitGroupSuperVisionMessageType();
128		cgsvmt.setCircuitGroupSuperVisionMessageTypeIndicator(cgsvmt._CIRCUIT_GROUP_SMTIHFO);
129		cgua.setSupervisionType(cgsvmt);
130		
131		return cgua;
132	}
133
134	/*
135	 * (non-Javadoc)
136	 * 
137	 * @see org.mobicents.protocols.ss7.isup.impl.stack.EventTestHarness#
138	 * getSpecificConfig()
139	 */
140	
141	protected Properties getSpecificConfig() {
142		// ensure proper values;
143		Properties p = new Properties();
144		p.put("t20", getSmallerT()+"");
145		p.put("t21" ,  getBiggerT()+"");
146		p.put("ni", "2");
147		p.put("localspc", "2");
148		return p;
149	}
150
151}