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

http://mobicents.googlecode.com/ · Java · 119 lines · 51 code · 20 blank · 48 comment · 0 complexity · 9f53fde7c6f12194bc0449c69664658a 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.ISUPMessage;
  26. import org.mobicents.protocols.ss7.isup.message.ReleaseCompleteMessage;
  27. import org.mobicents.protocols.ss7.isup.message.ReleaseMessage;
  28. import org.mobicents.protocols.ss7.isup.message.ResetCircuitMessage;
  29. import org.mobicents.protocols.ss7.isup.message.parameter.CauseIndicators;
  30. import org.mobicents.protocols.ss7.isup.message.parameter.CircuitIdentificationCode;
  31. /**
  32. * @author baranowb
  33. *
  34. */
  35. public class RELTest 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.T1_DEFAULT+2000;
  42. }
  43. /* (non-Javadoc)
  44. * @see org.mobicents.protocols.ss7.isup.impl.stack.DoubleTimers#getBiggerT()
  45. */
  46. protected long getBiggerT() {
  47. return ISUPTimeoutEvent.T5_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.T1;
  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.T5;
  60. }
  61. /* (non-Javadoc)
  62. * @see org.mobicents.protocols.ss7.isup.impl.stack.DoubleTimers#getRequest()
  63. */
  64. protected ISUPMessage getRequest() {
  65. ReleaseMessage rel = super.provider.getMessageFactory().createREL(1);
  66. CauseIndicators ci = super.provider.getParameterFactory().createCauseIndicators();
  67. ci.setCauseValue(0);
  68. ci.setCodingStandard(ci._CODING_STANDARD_NATIONAL);
  69. rel.setCauseIndicators(ci);
  70. return rel;
  71. }
  72. /* (non-Javadoc)
  73. * @see org.mobicents.protocols.ss7.isup.impl.stack.DoubleTimers#getAnswer()
  74. */
  75. protected ISUPMessage getAnswer() {
  76. ReleaseCompleteMessage rlc = super.provider.getMessageFactory().createRLC();
  77. CircuitIdentificationCode cic = super.provider.getParameterFactory().createCircuitIdentificationCode();
  78. cic.setCIC(1);
  79. rlc.setCircuitIdentificationCode(cic);
  80. return rlc; //asnwer to RSC is... RLC :P
  81. }
  82. protected ISUPMessage getAfterBigTRequest()
  83. {
  84. ResetCircuitMessage rsc = super.provider.getMessageFactory().createRSC(1);
  85. return rsc;
  86. }
  87. /* (non-Javadoc)
  88. * @see org.mobicents.protocols.ss7.isup.impl.stack.EventTestHarness#getSpecificConfig()
  89. */
  90. protected Properties getSpecificConfig() {
  91. //ensure proper values;
  92. Properties p = new Properties();
  93. p.put("t1", getSmallerT()+"");
  94. p.put("t5" , getBiggerT()+"");
  95. p.put("ni", "2");
  96. p.put("localspc", "2");
  97. return p;
  98. }
  99. }