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

http://mobicents.googlecode.com/ · Java · 174 lines · 122 code · 15 blank · 37 comment · 0 complexity · 46779ff87d3a549d6d9b010cd2b3a95c 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:15:07:07 2009-07-17<br>
  24. * Project: mobicents-isup-stack<br>
  25. *
  26. * @author <a href="mailto:baranowb@gmail.com">Bartosz Baranowski </a>
  27. *
  28. */
  29. package org.mobicents.protocols.ss7.isup.impl.message;
  30. import org.mobicents.protocols.ss7.isup.message.ISUPMessage;
  31. import org.mobicents.protocols.ss7.isup.message.InitialAddressMessage;
  32. import static org.testng.Assert.*;
  33. import org.testng.*;
  34. import org.testng.annotations.*;
  35. /**
  36. * Start time:15:07:07 2009-07-17<br>
  37. * Project: mobicents-isup-stack<br>
  38. *
  39. * @author <a href="mailto:baranowb@gmail.com"> Bartosz Baranowski </a>
  40. */
  41. public class IAMTest extends MessageHarness{
  42. @Test(groups = { "functional.encode","functional.decode","message"})
  43. public void testTwo_Parameters() throws Exception
  44. {
  45. byte[] message = getDefaultBody();
  46. //InitialAddressMessageImpl iam=new InitialAddressMessageImpl(this,message);
  47. InitialAddressMessage iam=super.messageFactory.createIAM(0);
  48. ((AbstractISUPMessage)iam).decode(message,parameterFactory);
  49. assertNotNull(iam.getNatureOfConnectionIndicators());
  50. assertNotNull(iam.getForwardCallIndicators());
  51. assertNotNull(iam.getCallingPartCategory());
  52. assertNotNull(iam.getTransmissionMediumRequirement());
  53. assertNotNull(iam.getCalledPartyNumber());
  54. assertNotNull(iam.getCallingPartyNumber());
  55. }
  56. public void testThree_Trace() throws Exception
  57. {
  58. byte[] message = new byte[] {
  59. 0x73, 0x00, //CIC
  60. 0x01, //IAM
  61. 0x11, //M: natur of connection indicators
  62. 0x60, //M: forward call ind
  63. 0x00, //M: forward call ind
  64. 0x0a, //M: calling party's category
  65. 0x03, //M: transmission medium req
  66. 0x02, //pointer to mandatory var:
  67. 0x09, //pointer to optional
  68. 0x07, //MV: len of called party number
  69. (byte) 0x83,
  70. (byte) 0x90,
  71. 0x79,
  72. 0x70,
  73. 0x45,
  74. 0x26,
  75. 0x09,
  76. 0x0a, //opt, CallingParty Num
  77. 0x07,
  78. (byte) 0x83,
  79. 0x13,
  80. 0x59,
  81. 0x63,
  82. (byte) 0x85,
  83. (byte) 0x96,
  84. 0x00,
  85. 0x3f, //opt Location Num
  86. (byte) 0x07,
  87. (byte) 0x83,
  88. 0x17,
  89. 0x17,
  90. 0x50,
  91. 0x20,
  92. 0x03,
  93. 0x00,
  94. 0x03, //opt Forward GVNS
  95. 0x13,
  96. 0x28,
  97. 0x11,
  98. 0x42,
  99. 0x45,
  100. 0x52,
  101. 0x54,
  102. 0x48,
  103. 0x41,
  104. 0x4c,
  105. 0x49,
  106. 0x4e,
  107. 0x20,
  108. 0x4a,
  109. 0x61,
  110. 0x63,
  111. 0x71,
  112. 0x75,
  113. 0x65,
  114. 0x73,
  115. 0x00
  116. /*,0x1b,
  117. 0x1d*/ };
  118. InitialAddressMessage iam=super.messageFactory.createIAM(0);
  119. ((AbstractISUPMessage)iam).decode(message,parameterFactory);
  120. }
  121. protected byte[] getDefaultBody() {
  122. //FIXME: for now we strip MTP part
  123. byte[] message={
  124. 0x0C
  125. ,(byte) 0x0B
  126. ,0x01,
  127. 0x10,
  128. 0x00,
  129. 0x01,
  130. 0x0A,
  131. 0x03,
  132. 0x02,
  133. 0x0A,
  134. 0x08,
  135. 0x03,
  136. 0x10,
  137. (byte) 0x83,
  138. 0x60,
  139. 0x38,
  140. 0x04,
  141. 0x10,
  142. 0x65,
  143. 0x0A,
  144. 0x07,
  145. 0x03,
  146. 0x13,
  147. 0x09,
  148. 0x32,
  149. 0x36,
  150. 0x11,
  151. 0x37,
  152. 0x00
  153. };
  154. return message;
  155. }
  156. protected ISUPMessage getDefaultMessage() {
  157. return super.messageFactory.createIAM(0);
  158. }
  159. }