PageRenderTime 29ms CodeModel.GetById 14ms RepoModel.GetById 1ms app.codeStats 0ms

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

http://mobicents.googlecode.com/
Java | 127 lines | 54 code | 17 blank | 56 comment | 0 complexity | 844cd4ac52d5bd37021ec39577b6e5da MD5 | raw file
Possible License(s): LGPL-3.0, GPL-3.0, LGPL-2.1, GPL-2.0, CC-BY-SA-3.0, CC0-1.0, Apache-2.0, BSD-3-Clause
  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.CircuitGroupQueryMessage;
  26. import org.mobicents.protocols.ss7.isup.message.CircuitGroupQueryResponseMessage;
  27. import org.mobicents.protocols.ss7.isup.message.ISUPMessage;
  28. import org.mobicents.protocols.ss7.isup.message.parameter.CircuitIdentificationCode;
  29. import org.mobicents.protocols.ss7.isup.message.parameter.CircuitStateIndicator;
  30. import org.mobicents.protocols.ss7.isup.message.parameter.RangeAndStatus;
  31. /**
  32. * @author baranowb
  33. *
  34. */
  35. public class CQMTest extends SingleTimers {
  36. /*
  37. * (non-Javadoc)
  38. *
  39. * @see
  40. * org.mobicents.protocols.ss7.isup.impl.stack.timers.SingleTimers#getT()
  41. */
  42. protected long getT() {
  43. return ISUPTimeoutEvent.T28_DEFAULT;
  44. }
  45. /*
  46. * (non-Javadoc)
  47. *
  48. * @see
  49. * org.mobicents.protocols.ss7.isup.impl.stack.timers.SingleTimers#getT_ID()
  50. */
  51. protected int getT_ID() {
  52. return ISUPTimeoutEvent.T28;
  53. }
  54. /*
  55. * (non-Javadoc)
  56. *
  57. * @see org.mobicents.protocols.ss7.isup.impl.stack.timers.EventTestHarness#
  58. * getRequest()
  59. */
  60. protected ISUPMessage getRequest() {
  61. CircuitGroupQueryMessage msg = super.provider.getMessageFactory().createCQM(1);
  62. RangeAndStatus ras = super.provider.getParameterFactory().createRangeAndStatus();
  63. ras.setRange((byte) 7, true);
  64. ras.setAffected((byte) 1, true);
  65. ras.setAffected((byte) 0, true);
  66. msg.setRangeAndStatus(ras);
  67. return msg;
  68. }
  69. protected ISUPMessage getAfterTRequest() {
  70. return null;
  71. }
  72. /*
  73. * (non-Javadoc)
  74. *
  75. * @see
  76. * org.mobicents.protocols.ss7.isup.impl.stack.timers.EventTestHarness#getAnswer
  77. * ()
  78. */
  79. protected ISUPMessage getAnswer() {
  80. CircuitGroupQueryResponseMessage ans = super.provider.getMessageFactory().createCQR();
  81. CircuitIdentificationCode cic = super.provider.getParameterFactory().createCircuitIdentificationCode();
  82. cic.setCIC(1);
  83. ans.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. ans.setRangeAndStatus(ras);
  89. CircuitStateIndicator ci = super.provider.getParameterFactory().createCircuitStateIndicator();
  90. byte[] state = new byte[2];
  91. state[0] = ci.createCircuitState(ci._MBS_LAR_BLOCKED, ci._CPS_CIB, ci._HBS_LAR_BLOCKED);
  92. state[1] = ci.createCircuitState(ci._MBS_LAR_BLOCKED, ci._CPS_COB, ci._HBS_LAR_BLOCKED);
  93. ci.setCircuitState(state);
  94. ans.setCircuitStateIndicator(ci);
  95. return ans;
  96. }
  97. /*
  98. * (non-Javadoc)
  99. *
  100. * @see org.mobicents.protocols.ss7.isup.impl.stack.timers.EventTestHarness#
  101. * getSpecificConfig()
  102. */
  103. protected Properties getSpecificConfig() {
  104. Properties p = new Properties();
  105. p.put("t28", getT() + "");
  106. p.put("ni", "2");
  107. p.put("localspc", "2");
  108. return p;
  109. }
  110. }