/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
- /*
- * JBoss, Home of Professional Open Source
- * Copyright 2011, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
- package org.mobicents.protocols.ss7.isup.impl.stack.timers;
-
- import java.util.Properties;
-
- import org.mobicents.protocols.ss7.isup.ISUPTimeoutEvent;
- import org.mobicents.protocols.ss7.isup.message.CircuitGroupBlockingAckMessage;
- import org.mobicents.protocols.ss7.isup.message.CircuitGroupBlockingMessage;
- import org.mobicents.protocols.ss7.isup.message.ISUPMessage;
- import org.mobicents.protocols.ss7.isup.message.parameter.CircuitGroupSuperVisionMessageType;
- import org.mobicents.protocols.ss7.isup.message.parameter.CircuitIdentificationCode;
- import org.mobicents.protocols.ss7.isup.message.parameter.RangeAndStatus;
-
- /**
- * @author baranowb
- *
- */
- public class CGBTest extends DoubleTimers {
- //thanks to magic of super class, this is whole test :)
- /* (non-Javadoc)
- * @see org.mobicents.protocols.ss7.isup.impl.stack.DoubleTimers#getSmallerT()
- */
- protected long getSmallerT() {
- return ISUPTimeoutEvent.T18_DEFAULT+3000;
- }
-
- /* (non-Javadoc)
- * @see org.mobicents.protocols.ss7.isup.impl.stack.DoubleTimers#getBiggerT()
- */
-
- protected long getBiggerT() {
- return ISUPTimeoutEvent.T19_DEFAULT;
- }
-
- /* (non-Javadoc)
- * @see org.mobicents.protocols.ss7.isup.impl.stack.DoubleTimers#getSmallerT_ID()
- */
-
- protected int getSmallerT_ID() {
- return ISUPTimeoutEvent.T18;
- }
-
- /* (non-Javadoc)
- * @see org.mobicents.protocols.ss7.isup.impl.stack.DoubleTimers#getBiggerT_ID()
- */
-
- protected int getBiggerT_ID() {
- return ISUPTimeoutEvent.T19;
- }
-
- /* (non-Javadoc)
- * @see org.mobicents.protocols.ss7.isup.impl.stack.DoubleTimers#getRequest()
- */
-
- protected ISUPMessage getRequest() {
- CircuitGroupBlockingMessage cgb = super.provider.getMessageFactory().createCGB(1);
-
- RangeAndStatus ras = super.provider.getParameterFactory().createRangeAndStatus();
- ras.setRange((byte) 7,true);
- ras.setAffected((byte) 1, true);
- ras.setAffected((byte) 0, true);
- cgb.setRangeAndStatus(ras);
-
- CircuitGroupSuperVisionMessageType cgsvmt = super.provider.getParameterFactory().createCircuitGroupSuperVisionMessageType();
- cgsvmt.setCircuitGroupSuperVisionMessageTypeIndicator(cgsvmt._CIRCUIT_GROUP_SMTIHFO);
- cgb.setSupervisionType(cgsvmt);
-
- return cgb;
- }
-
- /* (non-Javadoc)
- * @see org.mobicents.protocols.ss7.isup.impl.stack.DoubleTimers#getAnswer()
- */
-
- protected ISUPMessage getAnswer() {
- CircuitGroupBlockingAckMessage cgba = super.provider.getMessageFactory().createCGBA();
- CircuitIdentificationCode cic = super.provider.getParameterFactory().createCircuitIdentificationCode();
- cic.setCIC(1);
- cgba.setCircuitIdentificationCode(cic);
- RangeAndStatus ras = super.provider.getParameterFactory().createRangeAndStatus();
- ras.setRange((byte) 7,true);
- ras.setAffected((byte) 1, true);
- ras.setAffected((byte) 0, true);
- cgba.setRangeAndStatus(ras);
-
- CircuitGroupSuperVisionMessageType cgsvmt = super.provider.getParameterFactory().createCircuitGroupSuperVisionMessageType();
- cgsvmt.setCircuitGroupSuperVisionMessageTypeIndicator(cgsvmt._CIRCUIT_GROUP_SMTIHFO);
- cgba.setSupervisionType(cgsvmt);
- return cgba;
- }
-
- /* (non-Javadoc)
- * @see org.mobicents.protocols.ss7.isup.impl.stack.EventTestHarness#getSpecificConfig()
- */
-
- protected Properties getSpecificConfig() {
- //ensure proper values;
- Properties p = new Properties();
- p.put("t18", getSmallerT()+"");
- p.put("t19" , getBiggerT()+"");
- p.put("ni", "2");
- p.put("localspc", "2");
- return p;
- }
-
- }