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

http://mobicents.googlecode.com/ · Java · 85 lines · 32 code · 10 blank · 43 comment · 0 complexity · c79907f24473d820b889037fed51e320 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:11:34:01 2009-04-24<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.parameter;
  31. import org.mobicents.protocols.ss7.isup.ParameterException;
  32. import org.testng.annotations.Test;
  33. /**
  34. * Start time:11:34:01 2009-04-24<br>
  35. * Project: mobicents-isup-stack<br>
  36. *
  37. * @author <a href="mailto:baranowb@gmail.com">Bartosz Baranowski
  38. * </a>
  39. */
  40. public class EchoControlInformationTest extends ParameterHarness {
  41. public EchoControlInformationTest() {
  42. super();
  43. super.goodBodies.add(new byte[] { 67 });
  44. super.badBodies.add(new byte[2]);
  45. }
  46. private byte[] getBody(int _OUT_E_CDII, int _IN_E_CDII, int _IN_E_CDRI, int _OUT_E_CDRI) {
  47. byte[] b = new byte[1];
  48. int v = _OUT_E_CDII;
  49. v |= _IN_E_CDII << 2;
  50. v |= _OUT_E_CDRI << 4;
  51. v |= _IN_E_CDRI << 6;
  52. b[0] = (byte) v;
  53. return b;
  54. }
  55. @Test(groups = { "functional.encode","functional.decode","parameter"})
  56. public void testBody1EncodedValues() throws ParameterException {
  57. EchoControlInformationImpl eci = new EchoControlInformationImpl(getBody(EchoControlInformationImpl._OUTGOING_ECHO_CDII_NINA, EchoControlInformationImpl._INCOMING_ECHO_CDII_INCLUDED,
  58. EchoControlInformationImpl._INCOMING_ECHO_CDRI_AR, EchoControlInformationImpl._OUTGOING_ECHO_CDRI_NOINFO));
  59. String[] methodNames = { "getOutgoingEchoControlDeviceInformationIndicator", "getIncomingEchoControlDeviceInformationIndicator", "getIncomingEchoControlDeviceInformationRequestIndicator",
  60. "getOutgoingEchoControlDeviceInformationRequestIndicator" };
  61. Object[] expectedValues = { EchoControlInformationImpl._OUTGOING_ECHO_CDII_NINA, EchoControlInformationImpl._INCOMING_ECHO_CDII_INCLUDED, EchoControlInformationImpl._INCOMING_ECHO_CDRI_AR,
  62. EchoControlInformationImpl._OUTGOING_ECHO_CDRI_NOINFO };
  63. super.testValues(eci, methodNames, expectedValues);
  64. }
  65. /*
  66. * (non-Javadoc)
  67. *
  68. * @see
  69. * org.mobicents.isup.messages.parameters.ParameterHarness#getTestedComponent
  70. * ()
  71. */
  72. public AbstractISUPParameter getTestedComponent() throws ParameterException {
  73. return new EchoControlInformationImpl(new byte[1]);
  74. }
  75. }