/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. 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.CircuitGroupUnblockingAckMessage;
  26. import org.mobicents.protocols.ss7.isup.message.CircuitGroupUnblockingMessage;
  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 CGUTest extends DoubleTimers {
  36. // thanks to magic of super class, this is whole test :)
  37. /*
  38. * (non-Javadoc)
  39. *
  40. * @see
  41. * org.mobicents.protocols.ss7.isup.impl.stack.DoubleTimers#getSmallerT()
  42. */
  43. protected long getSmallerT() {
  44. return ISUPTimeoutEvent.T20_DEFAULT + 3000;
  45. }
  46. /*
  47. * (non-Javadoc)
  48. *
  49. * @see
  50. * org.mobicents.protocols.ss7.isup.impl.stack.DoubleTimers#getBiggerT()
  51. */
  52. protected long getBiggerT() {
  53. return ISUPTimeoutEvent.T21_DEFAULT;
  54. }
  55. /*
  56. * (non-Javadoc)
  57. *
  58. * @see
  59. * org.mobicents.protocols.ss7.isup.impl.stack.DoubleTimers#getSmallerT_ID()
  60. */
  61. protected int getSmallerT_ID() {
  62. return ISUPTimeoutEvent.T20;
  63. }
  64. /*
  65. * (non-Javadoc)
  66. *
  67. * @see
  68. * org.mobicents.protocols.ss7.isup.impl.stack.DoubleTimers#getBiggerT_ID()
  69. */
  70. protected int getBiggerT_ID() {
  71. return ISUPTimeoutEvent.T21;
  72. }
  73. /*
  74. * (non-Javadoc)
  75. *
  76. * @see
  77. * org.mobicents.protocols.ss7.isup.impl.stack.DoubleTimers#getRequest()
  78. */
  79. protected ISUPMessage getRequest() {
  80. CircuitGroupUnblockingMessage cgu = super.provider.getMessageFactory().createCGU(1);
  81. RangeAndStatus ras = super.provider.getParameterFactory().createRangeAndStatus();
  82. ras.setRange((byte) 7,true);
  83. ras.setAffected((byte) 1, true);
  84. ras.setAffected((byte) 0, true);
  85. cgu.setRangeAndStatus(ras);
  86. CircuitGroupSuperVisionMessageType cgsvmt = super.provider.getParameterFactory().createCircuitGroupSuperVisionMessageType();
  87. cgsvmt.setCircuitGroupSuperVisionMessageTypeIndicator(cgsvmt._CIRCUIT_GROUP_SMTIHFO);
  88. cgu.setSupervisionType(cgsvmt);
  89. return cgu;
  90. }
  91. /*
  92. * (non-Javadoc)
  93. *
  94. * @see org.mobicents.protocols.ss7.isup.impl.stack.DoubleTimers#getAnswer()
  95. */
  96. protected ISUPMessage getAnswer() {
  97. CircuitGroupUnblockingAckMessage cgua = super.provider.getMessageFactory().createCGUA();
  98. CircuitIdentificationCode cic = super.provider.getParameterFactory().createCircuitIdentificationCode();
  99. cic.setCIC(1);
  100. cgua.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. cgua.setRangeAndStatus(ras);
  106. CircuitGroupSuperVisionMessageType cgsvmt = super.provider.getParameterFactory().createCircuitGroupSuperVisionMessageType();
  107. cgsvmt.setCircuitGroupSuperVisionMessageTypeIndicator(cgsvmt._CIRCUIT_GROUP_SMTIHFO);
  108. cgua.setSupervisionType(cgsvmt);
  109. return cgua;
  110. }
  111. /*
  112. * (non-Javadoc)
  113. *
  114. * @see org.mobicents.protocols.ss7.isup.impl.stack.EventTestHarness#
  115. * getSpecificConfig()
  116. */
  117. protected Properties getSpecificConfig() {
  118. // ensure proper values;
  119. Properties p = new Properties();
  120. p.put("t20", getSmallerT()+"");
  121. p.put("t21" , getBiggerT()+"");
  122. p.put("ni", "2");
  123. p.put("localspc", "2");
  124. return p;
  125. }
  126. }