/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. package org.mobicents.protocols.ss7.isup.impl.stack.timers;
  23. import java.util.Properties;
  24. import org.mobicents.protocols.ss7.isup.ISUPTimeoutEvent;
  25. import org.mobicents.protocols.ss7.isup.message.CircuitGroupBlockingAckMessage;
  26. import org.mobicents.protocols.ss7.isup.message.CircuitGroupBlockingMessage;
  27. import org.mobicents.protocols.ss7.isup.message.ISUPMessage;
  28. import org.mobicents.protocols.ss7.isup.message.parameter.CircuitGroupSuperVisionMessageType;
  29. import org.mobicents.protocols.ss7.isup.message.parameter.CircuitIdentificationCode;
  30. import org.mobicents.protocols.ss7.isup.message.parameter.RangeAndStatus;
  31. /**
  32. * @author baranowb
  33. *
  34. */
  35. public class CGBTest extends DoubleTimers {
  36. //thanks to magic of super class, this is whole test :)
  37. /* (non-Javadoc)
  38. * @see org.mobicents.protocols.ss7.isup.impl.stack.DoubleTimers#getSmallerT()
  39. */
  40. protected long getSmallerT() {
  41. return ISUPTimeoutEvent.T18_DEFAULT+3000;
  42. }
  43. /* (non-Javadoc)
  44. * @see org.mobicents.protocols.ss7.isup.impl.stack.DoubleTimers#getBiggerT()
  45. */
  46. protected long getBiggerT() {
  47. return ISUPTimeoutEvent.T19_DEFAULT;
  48. }
  49. /* (non-Javadoc)
  50. * @see org.mobicents.protocols.ss7.isup.impl.stack.DoubleTimers#getSmallerT_ID()
  51. */
  52. protected int getSmallerT_ID() {
  53. return ISUPTimeoutEvent.T18;
  54. }
  55. /* (non-Javadoc)
  56. * @see org.mobicents.protocols.ss7.isup.impl.stack.DoubleTimers#getBiggerT_ID()
  57. */
  58. protected int getBiggerT_ID() {
  59. return ISUPTimeoutEvent.T19;
  60. }
  61. /* (non-Javadoc)
  62. * @see org.mobicents.protocols.ss7.isup.impl.stack.DoubleTimers#getRequest()
  63. */
  64. protected ISUPMessage getRequest() {
  65. CircuitGroupBlockingMessage cgb = super.provider.getMessageFactory().createCGB(1);
  66. RangeAndStatus ras = super.provider.getParameterFactory().createRangeAndStatus();
  67. ras.setRange((byte) 7,true);
  68. ras.setAffected((byte) 1, true);
  69. ras.setAffected((byte) 0, true);
  70. cgb.setRangeAndStatus(ras);
  71. CircuitGroupSuperVisionMessageType cgsvmt = super.provider.getParameterFactory().createCircuitGroupSuperVisionMessageType();
  72. cgsvmt.setCircuitGroupSuperVisionMessageTypeIndicator(cgsvmt._CIRCUIT_GROUP_SMTIHFO);
  73. cgb.setSupervisionType(cgsvmt);
  74. return cgb;
  75. }
  76. /* (non-Javadoc)
  77. * @see org.mobicents.protocols.ss7.isup.impl.stack.DoubleTimers#getAnswer()
  78. */
  79. protected ISUPMessage getAnswer() {
  80. CircuitGroupBlockingAckMessage cgba = super.provider.getMessageFactory().createCGBA();
  81. CircuitIdentificationCode cic = super.provider.getParameterFactory().createCircuitIdentificationCode();
  82. cic.setCIC(1);
  83. cgba.setCircuitIdentificationCode(cic);
  84. RangeAndStatus ras = super.provider.getParameterFactory().createRangeAndStatus();
  85. ras.setRange((byte) 7,true);
  86. ras.setAffected((byte) 1, true);
  87. ras.setAffected((byte) 0, true);
  88. cgba.setRangeAndStatus(ras);
  89. CircuitGroupSuperVisionMessageType cgsvmt = super.provider.getParameterFactory().createCircuitGroupSuperVisionMessageType();
  90. cgsvmt.setCircuitGroupSuperVisionMessageTypeIndicator(cgsvmt._CIRCUIT_GROUP_SMTIHFO);
  91. cgba.setSupervisionType(cgsvmt);
  92. return cgba;
  93. }
  94. /* (non-Javadoc)
  95. * @see org.mobicents.protocols.ss7.isup.impl.stack.EventTestHarness#getSpecificConfig()
  96. */
  97. protected Properties getSpecificConfig() {
  98. //ensure proper values;
  99. Properties p = new Properties();
  100. p.put("t18", getSmallerT()+"");
  101. p.put("t19" , getBiggerT()+"");
  102. p.put("ni", "2");
  103. p.put("localspc", "2");
  104. return p;
  105. }
  106. }