/protocols/ss7/isup/isup-impl/src/test/java/org/mobicents/protocols/ss7/isup/impl/message/ACMTest.java

http://mobicents.googlecode.com/ · Java · 95 lines · 41 code · 16 blank · 38 comment · 0 complexity · 8600151c739845f859c67e5284166f18 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. /**
  23. * Start time:09:26:46 2009-04-22<br>
  24. * Project: mobicents-isup-stack<br>
  25. *
  26. * @author <a href="mailto:baranowb@gmail.com">Bartosz Baranowski
  27. * </a>
  28. *
  29. */
  30. package org.mobicents.protocols.ss7.isup.impl.message;
  31. import static org.testng.Assert.*;
  32. import org.testng.*;
  33. import org.testng.annotations.*;
  34. import org.mobicents.protocols.ss7.isup.message.AddressCompleteMessage;
  35. import org.mobicents.protocols.ss7.isup.message.ISUPMessage;
  36. import org.mobicents.protocols.ss7.isup.message.parameter.BackwardCallIndicators;
  37. import org.mobicents.protocols.ss7.isup.message.parameter.CircuitIdentificationCode;
  38. /**
  39. * Start time:09:26:46 2009-04-22<br>
  40. * Project: mobicents-isup-stack<br>
  41. * Test for ACM
  42. *
  43. * @author <a href="mailto:baranowb@gmail.com"> Bartosz Baranowski </a>
  44. */
  45. public class ACMTest extends MessageHarness {
  46. @Test(groups = { "functional.encode","functional.decode","message"})
  47. public void testTwo_Params() throws Exception {
  48. byte[] message = getDefaultBody();
  49. // AddressCompleteMessageImpl acm=new
  50. // AddressCompleteMessageImpl(this,message);
  51. AddressCompleteMessage acm = super.messageFactory.createACM();
  52. ((AbstractISUPMessage)acm).decode(message,parameterFactory);
  53. assertNotNull( acm.getBackwardCallIndicators(),"BackwardCallIndicator is null");
  54. assertNotNull( acm.getOptionalBackwardCallIndicators(),"OptionalBackwardCallIndicator is null");
  55. assertNotNull( acm.getCauseIndicators(),"Cause Indicator is null");
  56. BackwardCallIndicators bci = acm.getBackwardCallIndicators();
  57. assertEquals( 1, bci.getChargeIndicator(),"BackwardCallIndicator charge indicator does not match");
  58. assertEquals( 0, bci.getCalledPartysStatusIndicator(),"BackwardCallIndicator called party status does not match");
  59. assertEquals( 0, bci.getCalledPartysCategoryIndicator(),"BackwardCallIndicator called party category does not match");
  60. assertFalse(bci.isInterworkingIndicator());
  61. assertFalse(bci.isEndToEndInformationIndicator());
  62. assertFalse(bci.isIsdnAccessIndicator());
  63. assertFalse(bci.isHoldingIndicator());
  64. assertTrue(bci.isEchoControlDeviceIndicator());
  65. assertEquals( 0, bci.getSccpMethodIndicator(),"BackwardCallIndicator sccp method does not match");
  66. CircuitIdentificationCode cic = acm.getCircuitIdentificationCode();
  67. assertNotNull( cic,"CircuitIdentificationCode must not be null");
  68. assertEquals( getDefaultCIC(), cic.getCIC(),"CircuitIdentificationCode value does not match");
  69. }
  70. protected byte[] getDefaultBody() {
  71. byte[] message = {
  72. 0x0C, (byte) 0x0B, 0x06, 0x01, 0x20, 0x01, 0x29, 0x01, 0x01, 0x12, 0x02, (byte) 0x82, (byte) 0x9C, 0x00
  73. };
  74. return message;
  75. }
  76. protected ISUPMessage getDefaultMessage() {
  77. return super.messageFactory.createACM();
  78. }
  79. }