anthill_smpp_ruby 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (154) hide show
  1. data/MIT-LICENSE +21 -0
  2. data/README +30 -0
  3. data/anthill_smpp_ruby.gemspec +18 -0
  4. data/changelog +43 -0
  5. data/data/dumps/random_command.dump +1 -0
  6. data/data/dumps/smpp_alert_notification.dump +1 -0
  7. data/data/dumps/smpp_bind_receiver.dump +1 -0
  8. data/data/dumps/smpp_bind_receiver_resp.dump +1 -0
  9. data/data/dumps/smpp_bind_transceiver.dump +1 -0
  10. data/data/dumps/smpp_bind_transceiver_1.dump +2 -0
  11. data/data/dumps/smpp_bind_transceiver_resp.dump +1 -0
  12. data/data/dumps/smpp_bind_transmitter.dump +1 -0
  13. data/data/dumps/smpp_bind_transmitter_resp.dump +1 -0
  14. data/data/dumps/smpp_broadcast_sm.dump +1 -0
  15. data/data/dumps/smpp_broadcast_sm_resp.dump +1 -0
  16. data/data/dumps/smpp_cancel_broadcast_sm.dump +1 -0
  17. data/data/dumps/smpp_cancel_broadcast_sm_resp.dump +1 -0
  18. data/data/dumps/smpp_cancel_sm.dump +1 -0
  19. data/data/dumps/smpp_cancel_sm_resp.dump +1 -0
  20. data/data/dumps/smpp_data_sm.dump +1 -0
  21. data/data/dumps/smpp_data_sm_resp.dump +1 -0
  22. data/data/dumps/smpp_deliver_sm.dump +1 -0
  23. data/data/dumps/smpp_deliver_sm_resp.dump +1 -0
  24. data/data/dumps/smpp_enquire_link.dump +1 -0
  25. data/data/dumps/smpp_enquire_link_resp.dump +1 -0
  26. data/data/dumps/smpp_generic_nack.dump +1 -0
  27. data/data/dumps/smpp_outbind.dump +1 -0
  28. data/data/dumps/smpp_query_broadcast_sm.dump +1 -0
  29. data/data/dumps/smpp_query_broadcast_sm_resp.dump +1 -0
  30. data/data/dumps/smpp_query_broadcast_sm_resp_1.dump +1 -0
  31. data/data/dumps/smpp_query_sm.dump +1 -0
  32. data/data/dumps/smpp_query_sm_resp.dump +1 -0
  33. data/data/dumps/smpp_replace_sm.dump +1 -0
  34. data/data/dumps/smpp_replace_sm_resp.dump +1 -0
  35. data/data/dumps/smpp_submit_multi.dump +1 -0
  36. data/data/dumps/smpp_submit_multi_resp.dump +1 -0
  37. data/data/dumps/smpp_submit_sm.dump +1 -0
  38. data/data/dumps/smpp_submit_sm_resp.dump +1 -0
  39. data/data/dumps/smpp_unbind.dump +1 -0
  40. data/data/dumps/smpp_unbind_resp.dump +1 -0
  41. data/data/pdus/random_command.xml +35 -0
  42. data/data/pdus/smpp_alert_notification.xml +14 -0
  43. data/data/pdus/smpp_alert_notification_no_optional.xml +13 -0
  44. data/data/pdus/smpp_bind_receiver.xml +17 -0
  45. data/data/pdus/smpp_bind_receiver_resp.xml +12 -0
  46. data/data/pdus/smpp_bind_receiver_resp_no_optional.xml +11 -0
  47. data/data/pdus/smpp_bind_transceiver.xml +17 -0
  48. data/data/pdus/smpp_bind_transceiver_resp.xml +12 -0
  49. data/data/pdus/smpp_bind_transceiver_resp_no_optional.xml +11 -0
  50. data/data/pdus/smpp_bind_transmitter.xml +17 -0
  51. data/data/pdus/smpp_bind_transmitter_resp.xml +12 -0
  52. data/data/pdus/smpp_bind_transmitter_resp_no_optional.xml +11 -0
  53. data/data/pdus/smpp_broadcast_sm.xml +47 -0
  54. data/data/pdus/smpp_broadcast_sm_no_optional.xml +26 -0
  55. data/data/pdus/smpp_broadcast_sm_resp.xml +14 -0
  56. data/data/pdus/smpp_broadcast_sm_resp_no_optional.xml +8 -0
  57. data/data/pdus/smpp_cancel_broadcast_sm.xml +17 -0
  58. data/data/pdus/smpp_cancel_broadcast_sm_no_optional.xml +15 -0
  59. data/data/pdus/smpp_cancel_broadcast_sm_resp.xml +7 -0
  60. data/data/pdus/smpp_cancel_sm.xml +18 -0
  61. data/data/pdus/smpp_cancel_sm_resp.xml +10 -0
  62. data/data/pdus/smpp_commands.xsd +914 -0
  63. data/data/pdus/smpp_data_sm.xml +58 -0
  64. data/data/pdus/smpp_data_sm_no_optional.xml +17 -0
  65. data/data/pdus/smpp_data_sm_resp.xml +15 -0
  66. data/data/pdus/smpp_data_sm_resp_no_optional.xml +8 -0
  67. data/data/pdus/smpp_deliver_sm.xml +46 -0
  68. data/data/pdus/smpp_deliver_sm_no_optional.xml +25 -0
  69. data/data/pdus/smpp_deliver_sm_resp.xml +14 -0
  70. data/data/pdus/smpp_deliver_sm_resp_no_optional.xml +8 -0
  71. data/data/pdus/smpp_enquire_link.xml +10 -0
  72. data/data/pdus/smpp_enquire_link_resp.xml +10 -0
  73. data/data/pdus/smpp_generic_nack.xml +10 -0
  74. data/data/pdus/smpp_outbind.xml +12 -0
  75. data/data/pdus/smpp_query_broadcast_sm.xml +12 -0
  76. data/data/pdus/smpp_query_broadcast_sm_no_optional.xml +11 -0
  77. data/data/pdus/smpp_query_broadcast_sm_resp.xml +17 -0
  78. data/data/pdus/smpp_query_broadcast_sm_resp_no_optional.xml +15 -0
  79. data/data/pdus/smpp_query_sm.xml +11 -0
  80. data/data/pdus/smpp_query_sm_resp.xml +11 -0
  81. data/data/pdus/smpp_replace_sm.xml +18 -0
  82. data/data/pdus/smpp_replace_sm_no_optional.xml +17 -0
  83. data/data/pdus/smpp_replace_sm_resp.xml +7 -0
  84. data/data/pdus/smpp_submit_multi.xml +73 -0
  85. data/data/pdus/smpp_submit_multi_no_optional.xml +51 -0
  86. data/data/pdus/smpp_submit_multi_resp.xml +35 -0
  87. data/data/pdus/smpp_submit_sm.xml +57 -0
  88. data/data/pdus/smpp_submit_sm_no_optional.xml +28 -0
  89. data/data/pdus/smpp_submit_sm_resp.xml +8 -0
  90. data/data/pdus/smpp_unbind.xml +10 -0
  91. data/data/pdus/smpp_unbind_resp.xml +10 -0
  92. data/examples/dump_viewer.rb +298 -0
  93. data/examples/pdu_composer.rb +1331 -0
  94. data/knownbugs +24 -0
  95. data/lib/anthill_smpp_ruby.rb +83 -0
  96. data/lib/i_smpp_outputter.rb +425 -0
  97. data/lib/pdu/smpp_alert_notification.rb +132 -0
  98. data/lib/pdu/smpp_bind.rb +102 -0
  99. data/lib/pdu/smpp_bind_receiver.rb +29 -0
  100. data/lib/pdu/smpp_bind_receiver_resp.rb +30 -0
  101. data/lib/pdu/smpp_bind_resp.rb +100 -0
  102. data/lib/pdu/smpp_bind_transceiver.rb +29 -0
  103. data/lib/pdu/smpp_bind_transceiver_resp.rb +31 -0
  104. data/lib/pdu/smpp_bind_transmitter.rb +29 -0
  105. data/lib/pdu/smpp_bind_transmitter_resp.rb +30 -0
  106. data/lib/pdu/smpp_broadcast_sm.rb +566 -0
  107. data/lib/pdu/smpp_broadcast_sm_resp.rb +130 -0
  108. data/lib/pdu/smpp_cancel_broadcast_sm.rb +143 -0
  109. data/lib/pdu/smpp_cancel_broadcast_sm_resp.rb +60 -0
  110. data/lib/pdu/smpp_cancel_sm.rb +110 -0
  111. data/lib/pdu/smpp_cancel_sm_resp.rb +60 -0
  112. data/lib/pdu/smpp_data_sm.rb +679 -0
  113. data/lib/pdu/smpp_data_sm_resp.rb +148 -0
  114. data/lib/pdu/smpp_deliver_sm.rb +458 -0
  115. data/lib/pdu/smpp_deliver_sm_resp.rb +137 -0
  116. data/lib/pdu/smpp_enquire_link.rb +59 -0
  117. data/lib/pdu/smpp_enquire_link_resp.rb +61 -0
  118. data/lib/pdu/smpp_generic_nack.rb +61 -0
  119. data/lib/pdu/smpp_outbind.rb +71 -0
  120. data/lib/pdu/smpp_pdu.rb +90 -0
  121. data/lib/pdu/smpp_query_broadcast_sm.rb +120 -0
  122. data/lib/pdu/smpp_query_broadcast_sm_resp.rb +192 -0
  123. data/lib/pdu/smpp_query_sm.rb +92 -0
  124. data/lib/pdu/smpp_query_sm_resp.rb +92 -0
  125. data/lib/pdu/smpp_replace_sm.rb +172 -0
  126. data/lib/pdu/smpp_replace_sm_resp.rb +61 -0
  127. data/lib/pdu/smpp_resp.rb +40 -0
  128. data/lib/pdu/smpp_submit_multi.rb +517 -0
  129. data/lib/pdu/smpp_submit_multi_resp.rb +90 -0
  130. data/lib/pdu/smpp_submit_sm.rb +591 -0
  131. data/lib/pdu/smpp_submit_sm_resp.rb +72 -0
  132. data/lib/pdu/smpp_unbind.rb +60 -0
  133. data/lib/pdu/smpp_unbind_resp.rb +61 -0
  134. data/lib/smpp_constants.rb +917 -0
  135. data/lib/smpp_csv_outputter.rb +1601 -0
  136. data/lib/smpp_datatypes.rb +89 -0
  137. data/lib/smpp_decoder.rb +627 -0
  138. data/lib/smpp_encoder.rb +495 -0
  139. data/lib/smpp_hex_outputter.rb +36 -0
  140. data/lib/smpp_outputter_base.rb +315 -0
  141. data/lib/smpp_structures.rb +98 -0
  142. data/lib/smpp_txt_outputter.rb +1895 -0
  143. data/lib/smpp_validator.rb +373 -0
  144. data/lib/smpp_xml_outputter.rb +34 -0
  145. data/roadmap +18 -0
  146. data/setup.rb +1585 -0
  147. data/test/anthill_smpp_test.rb +29 -0
  148. data/test/smpp_codec_test.rb +30 -0
  149. data/test/smpp_datatypes_test.rb +69 -0
  150. data/test/smpp_outputter_test.rb +1261 -0
  151. data/test/smpp_parsing_test.rb +1758 -0
  152. data/test/smpp_rawdump_test.rb +2095 -0
  153. data/test/smpp_validator_test.rb +441 -0
  154. metadata +206 -0
@@ -0,0 +1,29 @@
1
+ #
2
+ # Copyright 2007 Majoron.com (developers@majoron.com)
3
+ # Original sources are available at www.majoron.com
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+ #
17
+
18
+ $:.unshift File.dirname(__FILE__) + '/../lib/'
19
+ $:.unshift File.dirname(__FILE__) + '/../lib/' + '/../../../AntHill/0.5/lib/'
20
+
21
+ require "test/unit"
22
+ require "anthill"
23
+ require "anthill_smpp"
24
+ require "smpp_codec_test"
25
+ require "smpp_datatypes_test"
26
+ require "smpp_validator_test"
27
+ require "smpp_outputter_test"
28
+ require "smpp_parsing_test"
29
+ require "smpp_rawdump_test"
@@ -0,0 +1,30 @@
1
+ #
2
+ # Copyright 2007 Majoron.com (developers@majoron.com)
3
+ # Original sources are available at www.majoron.com
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+ #
17
+
18
+ $:.unshift File.dirname(__FILE__) + '/../lib/'
19
+ $:.unshift File.dirname(__FILE__) + '/../lib/' + '/../../../AntHill/0.5/lib/'
20
+
21
+ require "test/unit"
22
+ require "anthill"
23
+ require "anthill_smpp"
24
+
25
+ class SMPPDecoderTest < Test::Unit::TestCase
26
+ def test_decode_header
27
+ # Add test from SMPPCodecTests AntHill CPP
28
+ end
29
+
30
+ end
@@ -0,0 +1,69 @@
1
+ #
2
+ # Copyright 2007 Majoron.com (developers@majoron.com)
3
+ # Original sources are available at www.majoron.com
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+ #
17
+
18
+ $:.unshift File.dirname(__FILE__) + '/../lib/'
19
+ $:.unshift File.dirname(__FILE__) + '/../lib/' + '/../../../AntHill/0.5/lib/'
20
+
21
+ require "test/unit"
22
+ require "anthill"
23
+ require "anthill_smpp"
24
+
25
+
26
+ class SMPPDecoderTest < Test::Unit::TestCase
27
+ def test_broadcast_area_identifier_alias
28
+ identifier = Majoron::AntHill::SMPP::BroadcastAreaIdentifier.new()
29
+ identifier.value << Majoron::AntHill::SMPP::BroadcastAreaFormat::ALIAS
30
+ identifier.value << 2
31
+ assert_equal true, identifier.alias?
32
+ assert_equal false, identifier.ellipsoid?
33
+ assert_equal false, identifier.polygon?
34
+
35
+ end
36
+
37
+ def test_broadcast_area_identifier_ellipsoid
38
+ identifier = Majoron::AntHill::SMPP::BroadcastAreaIdentifier.new()
39
+ identifier.value << Majoron::AntHill::SMPP::BroadcastAreaFormat::ELLIPSOID
40
+ identifier.value << 2
41
+ assert_equal true, identifier.ellipsoid?
42
+ assert_equal false, identifier.alias?
43
+ assert_equal false, identifier.polygon?
44
+
45
+ end
46
+
47
+ def test_broadcast_area_identifier_polygon
48
+ identifier = Majoron::AntHill::SMPP::BroadcastAreaIdentifier.new()
49
+ identifier.value << Majoron::AntHill::SMPP::BroadcastAreaFormat::POLYGON
50
+ identifier.value << 2
51
+ assert_equal true, identifier.polygon?
52
+ assert_equal false, identifier.alias?
53
+ assert_equal false, identifier.ellipsoid?
54
+ end
55
+
56
+ def test_broadcast_area_identifier_unknowns
57
+ identifier = Majoron::AntHill::SMPP::BroadcastAreaIdentifier.new()
58
+ identifier.value << Majoron::AntHill::SMPP::BroadcastAreaFormat::UNKNOWN
59
+ identifier.value << 2
60
+ assert_equal false, identifier.polygon?
61
+ assert_equal false, identifier.alias?
62
+ assert_equal false, identifier.ellipsoid?
63
+
64
+
65
+ end
66
+
67
+ end
68
+
69
+
@@ -0,0 +1,1261 @@
1
+ #
2
+ # Copyright 2007 Majoron.com (developers@majoron.com)
3
+ # Original sources are available at www.majoron.com
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+ #
17
+
18
+ $:.unshift File.dirname(__FILE__) + '/../lib/'
19
+ $:.unshift File.dirname(__FILE__) + '/../lib/' + '/../../../AntHill/0.5/lib/'
20
+
21
+ require "test/unit"
22
+ require "anthill"
23
+ require "anthill_smpp"
24
+
25
+
26
+ class SMPPOutputterTest < Test::Unit::TestCase
27
+ def test_smpp_bind_transceiver
28
+ dump = String.new()
29
+ # read and decode package based on hex dump
30
+ dump << "00 00 00 2E 00 00 00 09 00 00 00 00 00 00 00 0B 53 79 73 74 65 6D 49 "
31
+ dump << "64 00 70 61 73 73 77 6F 72 64 00 53 4D 53 43 00 50 01 01 31 32 33 00 "
32
+ buffer = Majoron::AntHill::ByteBuffer.decode_hex(dump)
33
+
34
+ # declare variables
35
+ decoder = Majoron::AntHill::SMPP::SMPPDecoder.new()
36
+ validator = Majoron::AntHill::SMPP::SMPPValidator.new()
37
+
38
+ # decode package
39
+ decoder.append_buffer(buffer)
40
+ pdu = decoder.get_packet()
41
+ pdu.decode_packet(decoder)
42
+ pdu.validate_packet(validator)
43
+
44
+ # Check txt outputter
45
+ ostreamtxt = String.new()
46
+ pdu.output_packet(Majoron::AntHill::SMPP::SMPPTxtOutputter.new(ostreamtxt))
47
+ assert_not_equal 0, ostreamtxt.size()
48
+
49
+ # Check csv outputter
50
+ ostreamcsv = String.new()
51
+ pdu.output_packet(Majoron::AntHill::SMPP::SMPPCSVOutputter.new(ostreamcsv))
52
+ assert_not_equal 0, ostreamcsv.size()
53
+
54
+ # Others outputter are not impelemented yet
55
+
56
+ # Check hex outputter
57
+ #ostreamhex = String.new()
58
+ #pdu.output_packet(Majoron::AntHill::SMPP::SMPPHexOutputter.new(ostreamhex))
59
+ #assert_not_equal 0, ostreamhex.size()
60
+
61
+ # Check xml outputter
62
+ #ostreamxml = String.new()
63
+ #pdu.output_packet(Majoron::AntHill::SMPP::SMPPXMLOutputter.new(ostreamxml))
64
+ #assert_not_equal 0, ostreamxml.size()
65
+
66
+ end
67
+
68
+ def test_smpp_submit_sm
69
+ dump = String.new()
70
+ # read and decode package based on hex dump
71
+ dump << "00 00 00 C8 00 00 00 04 00 00 00 00 00 00 00 0C 53 4D 53 00 01 02 31 "
72
+ dump << "32 33 00 04 05 33 32 31 00 06 07 08 00 00 09 0A 0B 0C 00 02 04 00 02 "
73
+ dump << "00 01 02 0A 00 02 00 02 00 0D 00 01 03 02 0B 00 02 00 04 00 05 00 01 "
74
+ dump << "05 02 0C 00 02 00 06 02 0E 00 01 07 02 0F 00 01 08 04 26 00 01 09 00 "
75
+ dump << "19 00 01 0A 04 24 00 01 10 02 01 00 01 0B 03 81 00 04 01 02 AA FF 03 "
76
+ dump << "02 00 01 0C 03 03 00 04 01 02 AA FF 02 02 00 04 01 02 AA FF 02 03 00 "
77
+ dump << "04 01 02 AA FF 02 05 00 01 0D 12 01 00 01 0E 12 03 00 02 00 0F 12 04 "
78
+ dump << "00 01 10 00 30 00 01 11 03 04 00 01 12 13 0C 00 01 13 02 0D 00 01 14 "
79
+ dump << "13 80 00 01 15 13 83 00 02 00 16 05 01 00 01 17"
80
+ buffer = Majoron::AntHill::ByteBuffer.decode_hex(dump)
81
+
82
+ # declare variables
83
+ decoder = Majoron::AntHill::SMPP::SMPPDecoder.new()
84
+ validator = Majoron::AntHill::SMPP::SMPPValidator.new()
85
+
86
+ # decode package
87
+ decoder.append_buffer(buffer)
88
+ pdu = decoder.get_packet()
89
+ pdu.decode_packet(decoder)
90
+ pdu.validate_packet(validator)
91
+
92
+ # Check txt outputter
93
+ ostreamtxt = String.new()
94
+ pdu.output_packet(Majoron::AntHill::SMPP::SMPPTxtOutputter.new(ostreamtxt))
95
+ assert_not_equal 0, ostreamtxt.size()
96
+
97
+ # Check csv outputter
98
+ ostreamcsv = String.new()
99
+ pdu.output_packet(Majoron::AntHill::SMPP::SMPPCSVOutputter.new(ostreamcsv))
100
+ assert_not_equal 0, ostreamcsv.size()
101
+
102
+ # Others outputter are not impelemented yet
103
+
104
+ # Check hex outputter
105
+ #ostreamhex = String.new()
106
+ #pdu.output_packet(Majoron::AntHill::SMPP::SMPPHexOutputter.new(ostreamhex))
107
+ #assert_not_equal 0, ostreamhex.size()
108
+
109
+ # Check xml outputter
110
+ #ostreamxml = String.new()
111
+ #pdu.output_packet(Majoron::AntHill::SMPP::SMPPXMLOutputter.new(ostreamxml))
112
+ #assert_not_equal 0, ostreamxml.size()
113
+
114
+ end
115
+
116
+ def test_smpp_submit_sm_resp
117
+ dump = String.new()
118
+ # read and decode package based on hex dump
119
+ dump << "00 00 00 14 80 00 00 04 00 00 00 00 00 00 00 0C 31 32 33 00"
120
+ buffer = Majoron::AntHill::ByteBuffer.decode_hex(dump)
121
+
122
+ # declare variables
123
+ decoder = Majoron::AntHill::SMPP::SMPPDecoder.new()
124
+ validator = Majoron::AntHill::SMPP::SMPPValidator.new()
125
+
126
+ # decode package
127
+ decoder.append_buffer(buffer)
128
+ pdu = decoder.get_packet()
129
+ pdu.decode_packet(decoder)
130
+ pdu.validate_packet(validator)
131
+
132
+ # Check txt outputter
133
+ ostreamtxt = String.new()
134
+ pdu.output_packet(Majoron::AntHill::SMPP::SMPPTxtOutputter.new(ostreamtxt))
135
+ assert_not_equal 0, ostreamtxt.size()
136
+
137
+ # Check csv outputter
138
+ ostreamcsv = String.new()
139
+ pdu.output_packet(Majoron::AntHill::SMPP::SMPPCSVOutputter.new(ostreamcsv))
140
+ assert_not_equal 0, ostreamcsv.size()
141
+
142
+ # Others outputter are not impelemented yet
143
+
144
+ # Check hex outputter
145
+ #ostreamhex = String.new()
146
+ #pdu.output_packet(Majoron::AntHill::SMPP::SMPPHexOutputter.new(ostreamhex))
147
+ #assert_not_equal 0, ostreamhex.size()
148
+
149
+ # Check xml outputter
150
+ #ostreamxml = String.new()
151
+ #pdu.output_packet(Majoron::AntHill::SMPP::SMPPXMLOutputter.new(ostreamxml))
152
+ #assert_not_equal 0, ostreamxml.size()
153
+
154
+ end
155
+
156
+ def test_smpp_submit_multi_resp
157
+ dump = String.new()
158
+ # read and decode package based on hex dump
159
+ dump << "00 00 00 33 80 00 00 21 00 00 00 00 00 00 00 0C 31 32 33 00 03 "
160
+ dump << "01 02 31 32 33 00 00 00 00 01 03 04 33 32 31 00 00 00 00 03 05 "
161
+ dump << "06 32 31 33 00 00 00 00 03"
162
+ buffer = Majoron::AntHill::ByteBuffer.decode_hex(dump)
163
+
164
+ # declare variables
165
+ decoder = Majoron::AntHill::SMPP::SMPPDecoder.new()
166
+ validator = Majoron::AntHill::SMPP::SMPPValidator.new()
167
+
168
+ # decode package
169
+ decoder.append_buffer(buffer)
170
+ pdu = decoder.get_packet()
171
+ pdu.decode_packet(decoder)
172
+ pdu.validate_packet(validator)
173
+
174
+ # Check txt outputter
175
+ ostreamtxt = String.new()
176
+ pdu.output_packet(Majoron::AntHill::SMPP::SMPPTxtOutputter.new(ostreamtxt))
177
+ assert_not_equal 0, ostreamtxt.size()
178
+
179
+ # Check csv outputter
180
+ ostreamcsv = String.new()
181
+ pdu.output_packet(Majoron::AntHill::SMPP::SMPPCSVOutputter.new(ostreamcsv))
182
+ assert_not_equal 0, ostreamcsv.size()
183
+
184
+ # Others outputter are not impelemented yet
185
+
186
+ # Check hex outputter
187
+ #ostreamhex = String.new()
188
+ #pdu.output_packet(Majoron::AntHill::SMPP::SMPPHexOutputter.new(ostreamhex))
189
+ #assert_not_equal 0, ostreamhex.size()
190
+
191
+ # Check xml outputter
192
+ #ostreamxml = String.new()
193
+ #pdu.output_packet(Majoron::AntHill::SMPP::SMPPXMLOutputter.new(ostreamxml))
194
+ #assert_not_equal 0, ostreamxml.size()
195
+
196
+ end
197
+
198
+
199
+
200
+
201
+
202
+ def test_smpp_cancel_sm
203
+ dump = String.new()
204
+ # read and decode package based on hex dump
205
+ dump << "00 00 00 26 00 00 00 08 00 00 00 00 00 00 00 0C 73 72 76 74 70 00 "
206
+ dump << "31 32 33 00 01 02 31 32 33 00 04 05 33 32 31 00"
207
+ buffer = Majoron::AntHill::ByteBuffer.decode_hex(dump)
208
+
209
+ # declare variables
210
+ decoder = Majoron::AntHill::SMPP::SMPPDecoder.new()
211
+ validator = Majoron::AntHill::SMPP::SMPPValidator.new()
212
+
213
+ # decode package
214
+ decoder.append_buffer(buffer)
215
+ pdu = decoder.get_packet()
216
+ pdu.decode_packet(decoder)
217
+ pdu.validate_packet(validator)
218
+
219
+ # Check txt outputter
220
+ ostreamtxt = String.new()
221
+ pdu.output_packet(Majoron::AntHill::SMPP::SMPPTxtOutputter.new(ostreamtxt))
222
+ assert_not_equal 0, ostreamtxt.size()
223
+
224
+ # Check csv outputter
225
+ ostreamcsv = String.new()
226
+ pdu.output_packet(Majoron::AntHill::SMPP::SMPPCSVOutputter.new(ostreamcsv))
227
+ assert_not_equal 0, ostreamcsv.size()
228
+
229
+ # Others outputter are not impelemented yet
230
+
231
+ # Check hex outputter
232
+ #ostreamhex = String.new()
233
+ #pdu.output_packet(Majoron::AntHill::SMPP::SMPPHexOutputter.new(ostreamhex))
234
+ #assert_not_equal 0, ostreamhex.size()
235
+
236
+ # Check xml outputter
237
+ #ostreamxml = String.new()
238
+ #pdu.output_packet(Majoron::AntHill::SMPP::SMPPXMLOutputter.new(ostreamxml))
239
+ #assert_not_equal 0, ostreamxml.size()
240
+
241
+ end
242
+
243
+
244
+ def test_smpp_cancel_sm_resp
245
+ dump = String.new()
246
+ # read and decode package based on hex dump
247
+ dump << "00 00 00 10 80 00 00 08 00 00 00 00 00 00 00 0C"
248
+ buffer = Majoron::AntHill::ByteBuffer.decode_hex(dump)
249
+
250
+ # declare variables
251
+ decoder = Majoron::AntHill::SMPP::SMPPDecoder.new()
252
+ validator = Majoron::AntHill::SMPP::SMPPValidator.new()
253
+
254
+ # decode package
255
+ decoder.append_buffer(buffer)
256
+ pdu = decoder.get_packet()
257
+ pdu.decode_packet(decoder)
258
+ pdu.validate_packet(validator)
259
+
260
+ # Check txt outputter
261
+ ostreamtxt = String.new()
262
+ pdu.output_packet(Majoron::AntHill::SMPP::SMPPTxtOutputter.new(ostreamtxt))
263
+ assert_not_equal 0, ostreamtxt.size()
264
+
265
+ # Check csv outputter
266
+ ostreamcsv = String.new()
267
+ pdu.output_packet(Majoron::AntHill::SMPP::SMPPCSVOutputter.new(ostreamcsv))
268
+ assert_not_equal 0, ostreamcsv.size()
269
+
270
+ # Others outputter are not impelemented yet
271
+
272
+ # Check hex outputter
273
+ #ostreamhex = String.new()
274
+ #pdu.output_packet(Majoron::AntHill::SMPP::SMPPHexOutputter.new(ostreamhex))
275
+ #assert_not_equal 0, ostreamhex.size()
276
+
277
+ # Check xml outputter
278
+ #ostreamxml = String.new()
279
+ #pdu.output_packet(Majoron::AntHill::SMPP::SMPPXMLOutputter.new(ostreamxml))
280
+ #assert_not_equal 0, ostreamxml.size()
281
+
282
+ end
283
+
284
+ def test_smpp_query_sm
285
+ dump = String.new()
286
+ # read and decode package based on hex dump
287
+ dump << "00 00 00 1A 00 00 00 03 00 00 00 00 00 00 00 0C 31 32 33 00 01 02 33 32 31 00"
288
+ buffer = Majoron::AntHill::ByteBuffer.decode_hex(dump)
289
+
290
+ # declare variables
291
+ decoder = Majoron::AntHill::SMPP::SMPPDecoder.new()
292
+ validator = Majoron::AntHill::SMPP::SMPPValidator.new()
293
+
294
+ # decode package
295
+ decoder.append_buffer(buffer)
296
+ pdu = decoder.get_packet()
297
+ pdu.decode_packet(decoder)
298
+ pdu.validate_packet(validator)
299
+
300
+ # Check txt outputter
301
+ ostreamtxt = String.new()
302
+ pdu.output_packet(Majoron::AntHill::SMPP::SMPPTxtOutputter.new(ostreamtxt))
303
+ assert_not_equal 0, ostreamtxt.size()
304
+
305
+ # Check csv outputter
306
+ ostreamcsv = String.new()
307
+ pdu.output_packet(Majoron::AntHill::SMPP::SMPPCSVOutputter.new(ostreamcsv))
308
+ assert_not_equal 0, ostreamcsv.size()
309
+
310
+ # Others outputter are not impelemented yet
311
+
312
+ # Check hex outputter
313
+ #ostreamhex = String.new()
314
+ #pdu.output_packet(Majoron::AntHill::SMPP::SMPPHexOutputter.new(ostreamhex))
315
+ #assert_not_equal 0, ostreamhex.size()
316
+
317
+ # Check xml outputter
318
+ #ostreamxml = String.new()
319
+ #pdu.output_packet(Majoron::AntHill::SMPP::SMPPXMLOutputter.new(ostreamxml))
320
+ #assert_not_equal 0, ostreamxml.size()
321
+
322
+ end
323
+
324
+ def test_smpp_query_sm_resp
325
+ dump = String.new()
326
+ # read and decode package based on hex dump
327
+ dump << "00 00 00 17 80 00 00 03 00 00 00 00 00 00 00 0C 31 32 33 00 00 01 02"
328
+ buffer = Majoron::AntHill::ByteBuffer.decode_hex(dump)
329
+
330
+ # declare variables
331
+ decoder = Majoron::AntHill::SMPP::SMPPDecoder.new()
332
+ validator = Majoron::AntHill::SMPP::SMPPValidator.new()
333
+
334
+ # decode package
335
+ decoder.append_buffer(buffer)
336
+ pdu = decoder.get_packet()
337
+ pdu.decode_packet(decoder)
338
+ pdu.validate_packet(validator)
339
+
340
+ # Check txt outputter
341
+ ostreamtxt = String.new()
342
+ pdu.output_packet(Majoron::AntHill::SMPP::SMPPTxtOutputter.new(ostreamtxt))
343
+ assert_not_equal 0, ostreamtxt.size()
344
+
345
+ # Check csv outputter
346
+ ostreamcsv = String.new()
347
+ pdu.output_packet(Majoron::AntHill::SMPP::SMPPCSVOutputter.new(ostreamcsv))
348
+ assert_not_equal 0, ostreamcsv.size()
349
+
350
+ # Others outputter are not impelemented yet
351
+
352
+ # Check hex outputter
353
+ #ostreamhex = String.new()
354
+ #pdu.output_packet(Majoron::AntHill::SMPP::SMPPHexOutputter.new(ostreamhex))
355
+ #assert_not_equal 0, ostreamhex.size()
356
+
357
+ # Check xml outputter
358
+ #ostreamxml = String.new()
359
+ #pdu.output_packet(Majoron::AntHill::SMPP::SMPPXMLOutputter.new(ostreamxml))
360
+ #assert_not_equal 0, ostreamxml.size()
361
+
362
+ end
363
+
364
+ def test_smpp_replace_sm
365
+ dump = String.new()
366
+ # read and decode package based on hex dump
367
+ dump << "00 00 00 26 00 00 00 07 00 00 00 00 00 00 00 0C 33 34 35 00 01 02 "
368
+ dump << "31 32 33 00 00 00 01 07 00 04 24 00 03 01 FF AA"
369
+ buffer = Majoron::AntHill::ByteBuffer.decode_hex(dump)
370
+
371
+ # declare variables
372
+ decoder = Majoron::AntHill::SMPP::SMPPDecoder.new()
373
+ validator = Majoron::AntHill::SMPP::SMPPValidator.new()
374
+
375
+ # decode package
376
+ decoder.append_buffer(buffer)
377
+ pdu = decoder.get_packet()
378
+ pdu.decode_packet(decoder)
379
+ pdu.validate_packet(validator)
380
+
381
+ # Check txt outputter
382
+ ostreamtxt = String.new()
383
+ pdu.output_packet(Majoron::AntHill::SMPP::SMPPTxtOutputter.new(ostreamtxt))
384
+ assert_not_equal 0, ostreamtxt.size()
385
+
386
+ # Check csv outputter
387
+ ostreamcsv = String.new()
388
+ pdu.output_packet(Majoron::AntHill::SMPP::SMPPCSVOutputter.new(ostreamcsv))
389
+ assert_not_equal 0, ostreamcsv.size()
390
+
391
+ # Others outputter are not impelemented yet
392
+
393
+ # Check hex outputter
394
+ #ostreamhex = String.new()
395
+ #pdu.output_packet(Majoron::AntHill::SMPP::SMPPHexOutputter.new(ostreamhex))
396
+ #assert_not_equal 0, ostreamhex.size()
397
+
398
+ # Check xml outputter
399
+ #ostreamxml = String.new()
400
+ #pdu.output_packet(Majoron::AntHill::SMPP::SMPPXMLOutputter.new(ostreamxml))
401
+ #assert_not_equal 0, ostreamxml.size()
402
+
403
+ end
404
+
405
+
406
+ def test_smpp_replace_sm_resp
407
+ dump = String.new()
408
+ # read and decode package based on hex dump
409
+ dump << "00 00 00 10 80 00 00 07 00 00 00 00 00 00 00 0C"
410
+ buffer = Majoron::AntHill::ByteBuffer.decode_hex(dump)
411
+
412
+ # declare variables
413
+ decoder = Majoron::AntHill::SMPP::SMPPDecoder.new()
414
+ validator = Majoron::AntHill::SMPP::SMPPValidator.new()
415
+
416
+ # decode package
417
+ decoder.append_buffer(buffer)
418
+ pdu = decoder.get_packet()
419
+ pdu.decode_packet(decoder)
420
+ pdu.validate_packet(validator)
421
+
422
+ # Check txt outputter
423
+ ostreamtxt = String.new()
424
+ pdu.output_packet(Majoron::AntHill::SMPP::SMPPTxtOutputter.new(ostreamtxt))
425
+ assert_not_equal 0, ostreamtxt.size()
426
+
427
+ # Check csv outputter
428
+ ostreamcsv = String.new()
429
+ pdu.output_packet(Majoron::AntHill::SMPP::SMPPCSVOutputter.new(ostreamcsv))
430
+ assert_not_equal 0, ostreamcsv.size()
431
+
432
+ # Others outputter are not impelemented yet
433
+
434
+ # Check hex outputter
435
+ #ostreamhex = String.new()
436
+ #pdu.output_packet(Majoron::AntHill::SMPP::SMPPHexOutputter.new(ostreamhex))
437
+ #assert_not_equal 0, ostreamhex.size()
438
+
439
+ # Check xml outputter
440
+ #ostreamxml = String.new()
441
+ #pdu.output_packet(Majoron::AntHill::SMPP::SMPPXMLOutputter.new(ostreamxml))
442
+ #assert_not_equal 0, ostreamxml.size()
443
+
444
+ end
445
+
446
+
447
+
448
+
449
+
450
+
451
+
452
+ def test_smpp_unbind
453
+ dump = String.new()
454
+ # read and decode package based on hex dump
455
+ dump << "00 00 00 10 00 00 00 06 00 00 00 00 00 00 00 0C"
456
+ buffer = Majoron::AntHill::ByteBuffer.decode_hex(dump)
457
+
458
+ # declare variables
459
+ decoder = Majoron::AntHill::SMPP::SMPPDecoder.new()
460
+ validator = Majoron::AntHill::SMPP::SMPPValidator.new()
461
+
462
+ # decode package
463
+ decoder.append_buffer(buffer)
464
+ pdu = decoder.get_packet()
465
+ pdu.decode_packet(decoder)
466
+ pdu.validate_packet(validator)
467
+
468
+ # Check txt outputter
469
+ ostreamtxt = String.new()
470
+ pdu.output_packet(Majoron::AntHill::SMPP::SMPPTxtOutputter.new(ostreamtxt))
471
+ assert_not_equal 0, ostreamtxt.size()
472
+
473
+ # Check csv outputter
474
+ ostreamcsv = String.new()
475
+ pdu.output_packet(Majoron::AntHill::SMPP::SMPPCSVOutputter.new(ostreamcsv))
476
+ assert_not_equal 0, ostreamcsv.size()
477
+
478
+ # Others outputter are not impelemented yet
479
+
480
+ # Check hex outputter
481
+ #ostreamhex = String.new()
482
+ #pdu.output_packet(Majoron::AntHill::SMPP::SMPPHexOutputter.new(ostreamhex))
483
+ #assert_not_equal 0, ostreamhex.size()
484
+
485
+ # Check xml outputter
486
+ #ostreamxml = String.new()
487
+ #pdu.output_packet(Majoron::AntHill::SMPP::SMPPXMLOutputter.new(ostreamxml))
488
+ #assert_not_equal 0, ostreamxml.size()
489
+
490
+ end
491
+
492
+ def test_smpp_unbind_resp
493
+ dump = String.new()
494
+ # read and decode package based on hex dump
495
+ dump << "00 00 00 10 80 00 00 06 00 00 00 00 00 00 00 0C"
496
+ buffer = Majoron::AntHill::ByteBuffer.decode_hex(dump)
497
+
498
+ # declare variables
499
+ decoder = Majoron::AntHill::SMPP::SMPPDecoder.new()
500
+ validator = Majoron::AntHill::SMPP::SMPPValidator.new()
501
+
502
+ # decode package
503
+ decoder.append_buffer(buffer)
504
+ pdu = decoder.get_packet()
505
+ pdu.decode_packet(decoder)
506
+ pdu.validate_packet(validator)
507
+
508
+ # Check txt outputter
509
+ ostreamtxt = String.new()
510
+ pdu.output_packet(Majoron::AntHill::SMPP::SMPPTxtOutputter.new(ostreamtxt))
511
+ assert_not_equal 0, ostreamtxt.size()
512
+
513
+ # Check csv outputter
514
+ ostreamcsv = String.new()
515
+ pdu.output_packet(Majoron::AntHill::SMPP::SMPPCSVOutputter.new(ostreamcsv))
516
+ assert_not_equal 0, ostreamcsv.size()
517
+
518
+ # Others outputter are not impelemented yet
519
+
520
+ # Check hex outputter
521
+ #ostreamhex = String.new()
522
+ #pdu.output_packet(Majoron::AntHill::SMPP::SMPPHexOutputter.new(ostreamhex))
523
+ #assert_not_equal 0, ostreamhex.size()
524
+
525
+ # Check xml outputter
526
+ #ostreamxml = String.new()
527
+ #pdu.output_packet(Majoron::AntHill::SMPP::SMPPXMLOutputter.new(ostreamxml))
528
+ #assert_not_equal 0, ostreamxml.size()
529
+
530
+ end
531
+
532
+ def test_smpp_outbind
533
+ dump = String.new()
534
+ # read and decode package based on hex dump
535
+ dump << "00 00 00 19 00 00 00 0B 00 00 00 00 00 00 00 0C 73 74 6D 31 00 70 77 64 00"
536
+ buffer = Majoron::AntHill::ByteBuffer.decode_hex(dump)
537
+
538
+ # declare variables
539
+ decoder = Majoron::AntHill::SMPP::SMPPDecoder.new()
540
+ validator = Majoron::AntHill::SMPP::SMPPValidator.new()
541
+
542
+ # decode package
543
+ decoder.append_buffer(buffer)
544
+ pdu = decoder.get_packet()
545
+ pdu.decode_packet(decoder)
546
+ pdu.validate_packet(validator)
547
+
548
+ # Check txt outputter
549
+ ostreamtxt = String.new()
550
+ pdu.output_packet(Majoron::AntHill::SMPP::SMPPTxtOutputter.new(ostreamtxt))
551
+ assert_not_equal 0, ostreamtxt.size()
552
+
553
+ # Check csv outputter
554
+ ostreamcsv = String.new()
555
+ pdu.output_packet(Majoron::AntHill::SMPP::SMPPCSVOutputter.new(ostreamcsv))
556
+ assert_not_equal 0, ostreamcsv.size()
557
+
558
+ # Others outputter are not impelemented yet
559
+
560
+ # Check hex outputter
561
+ #ostreamhex = String.new()
562
+ #pdu.output_packet(Majoron::AntHill::SMPP::SMPPHexOutputter.new(ostreamhex))
563
+ #assert_not_equal 0, ostreamhex.size()
564
+
565
+ # Check xml outputter
566
+ #ostreamxml = String.new()
567
+ #pdu.output_packet(Majoron::AntHill::SMPP::SMPPXMLOutputter.new(ostreamxml))
568
+ #assert_not_equal 0, ostreamxml.size()
569
+
570
+ end
571
+
572
+ def test_smpp_submit_sm
573
+ dump = String.new()
574
+ # read and decode package based on hex dump
575
+ dump << "00 00 00 E2 00 00 00 21 00 00 00 00 00 00 00 0C 73 72 76 74 70 00 01 "
576
+ dump << "02 31 32 33 00 06 02 64 69 73 74 72 5F 6C 69 73 74 31 00 02 64 69 73 "
577
+ dump << "74 72 5F 6C 69 73 74 32 00 01 31 31 31 32 33 00 01 32 32 32 32 33 00 "
578
+ dump << "02 64 69 73 74 72 5F 6C 69 73 74 31 00 02 64 69 73 74 72 5F 6C 69 73 "
579
+ dump << "74 32 00 01 02 03 00 00 04 05 06 07 00 02 0A 00 02 00 02 00 0D 00 01 "
580
+ dump << "03 02 0B 00 02 00 04 00 05 00 01 05 02 0C 00 02 00 06 02 0E 00 01 07 "
581
+ dump << "02 0F 00 01 08 00 19 00 01 09 04 24 00 01 09 02 01 00 01 0A 03 81 00 "
582
+ dump << "04 01 02 AA FF 03 02 00 01 0B 03 03 00 04 01 02 AA FF 02 02 00 04 01 "
583
+ dump << "02 AA FF 02 03 00 04 01 02 AA FF 12 01 00 01 0C 12 03 00 02 00 0D 12 "
584
+ dump << "04 00 01 0E 00 30 00 01 0F 13 0C 00 01 10 02 0D 00 01 11"
585
+ buffer = Majoron::AntHill::ByteBuffer.decode_hex(dump)
586
+
587
+ # declare variables
588
+ decoder = Majoron::AntHill::SMPP::SMPPDecoder.new()
589
+ validator = Majoron::AntHill::SMPP::SMPPValidator.new()
590
+
591
+ # decode package
592
+ decoder.append_buffer(buffer)
593
+ pdu = decoder.get_packet()
594
+ pdu.decode_packet(decoder)
595
+ pdu.validate_packet(validator)
596
+
597
+ # Check txt outputter
598
+ ostreamtxt = String.new()
599
+ pdu.output_packet(Majoron::AntHill::SMPP::SMPPTxtOutputter.new(ostreamtxt))
600
+ assert_not_equal 0, ostreamtxt.size()
601
+
602
+ # Check csv outputter
603
+ ostreamcsv = String.new()
604
+ pdu.output_packet(Majoron::AntHill::SMPP::SMPPCSVOutputter.new(ostreamcsv))
605
+ assert_not_equal 0, ostreamcsv.size()
606
+
607
+ # Others outputter are not impelemented yet
608
+
609
+ # Check hex outputter
610
+ #ostreamhex = String.new()
611
+ #pdu.output_packet(Majoron::AntHill::SMPP::SMPPHexOutputter.new(ostreamhex))
612
+ #assert_not_equal 0, ostreamhex.size()
613
+
614
+ # Check xml outputter
615
+ #ostreamxml = String.new()
616
+ #pdu.output_packet(Majoron::AntHill::SMPP::SMPPXMLOutputter.new(ostreamxml))
617
+ #assert_not_equal 0, ostreamxml.size()
618
+
619
+ end
620
+
621
+ def test_smpp_data_sm
622
+ dump = String.new()
623
+ # read and decode package based on hex dump
624
+ dump << "00 00 00 FF 00 00 01 03 00 00 00 00 00 00 00 0C 73 72 76 74 70 00 01 "
625
+ dump << "02 31 32 33 00 03 04 33 32 31 00 00 01 08 02 0A 00 02 00 01 00 0D 00 "
626
+ dump << "01 02 00 0E 00 01 03 00 0F 00 01 04 00 10 00 01 05 02 0B 00 02 00 06 "
627
+ dump << "00 05 00 01 07 00 06 00 01 08 00 07 00 01 09 00 08 00 01 0A 02 0C 00 "
628
+ dump << "02 00 0B 02 0E 00 01 0C 02 0F 00 01 0D 04 26 00 01 01 00 17 00 04 00 "
629
+ dump << "00 00 0E 00 19 00 01 0F 04 24 00 05 01 02 03 AF FF 04 21 00 01 10 00 "
630
+ dump << "1E 00 06 31 32 33 32 31 00 04 27 00 01 01 04 23 00 03 01 00 01 02 04 "
631
+ dump << "00 02 00 7B 02 01 00 01 01 03 81 00 01 01 03 02 00 01 01 03 03 00 02 "
632
+ dump << "AA FF 02 02 00 02 AA FF 02 03 00 02 AA FF 02 05 00 01 01 12 01 00 01 "
633
+ dump << "02 12 03 00 02 00 03 12 04 00 01 04 00 30 00 01 05 03 04 00 01 06 03 "
634
+ dump << "04 00 01 06 13 0C 00 01 07 02 0D 00 01 08 13 80 00 01 09 13 83 00 02 "
635
+ dump << "00 0A"
636
+ buffer = Majoron::AntHill::ByteBuffer.decode_hex(dump)
637
+
638
+ # declare variables
639
+ decoder = Majoron::AntHill::SMPP::SMPPDecoder.new()
640
+ validator = Majoron::AntHill::SMPP::SMPPValidator.new()
641
+
642
+ # decode package
643
+ decoder.append_buffer(buffer)
644
+ pdu = decoder.get_packet()
645
+ pdu.decode_packet(decoder)
646
+ pdu.validate_packet(validator)
647
+
648
+ # Check txt outputter
649
+ ostreamtxt = String.new()
650
+ pdu.output_packet(Majoron::AntHill::SMPP::SMPPTxtOutputter.new(ostreamtxt))
651
+ assert_not_equal 0, ostreamtxt.size()
652
+
653
+ # Check csv outputter
654
+ ostreamcsv = String.new()
655
+ pdu.output_packet(Majoron::AntHill::SMPP::SMPPCSVOutputter.new(ostreamcsv))
656
+ assert_not_equal 0, ostreamcsv.size()
657
+
658
+ # Others outputter are not impelemented yet
659
+
660
+ # Check hex outputter
661
+ #ostreamhex = String.new()
662
+ #pdu.output_packet(Majoron::AntHill::SMPP::SMPPHexOutputter.new(ostreamhex))
663
+ #assert_not_equal 0, ostreamhex.size()
664
+
665
+ # Check xml outputter
666
+ #ostreamxml = String.new()
667
+ #pdu.output_packet(Majoron::AntHill::SMPP::SMPPXMLOutputter.new(ostreamxml))
668
+ #assert_not_equal 0, ostreamxml.size()
669
+
670
+ end
671
+
672
+
673
+ def test_smpp_data_sm_resp
674
+ dump = String.new()
675
+ # read and decode package based on hex dump
676
+ dump << "00 00 00 29 80 00 01 03 00 00 00 00 00 00 00 0C 00 04 25 00 01 01 04 "
677
+ dump << "23 00 03 03 00 01 00 1D 00 03 01 FF AA 04 20 00 01 17 "
678
+ buffer = Majoron::AntHill::ByteBuffer.decode_hex(dump)
679
+
680
+ # declare variables
681
+ decoder = Majoron::AntHill::SMPP::SMPPDecoder.new()
682
+ validator = Majoron::AntHill::SMPP::SMPPValidator.new()
683
+
684
+ # decode package
685
+ decoder.append_buffer(buffer)
686
+ pdu = decoder.get_packet()
687
+ pdu.decode_packet(decoder)
688
+ pdu.validate_packet(validator)
689
+
690
+ # Check txt outputter
691
+ ostreamtxt = String.new()
692
+ pdu.output_packet(Majoron::AntHill::SMPP::SMPPTxtOutputter.new(ostreamtxt))
693
+ assert_not_equal 0, ostreamtxt.size()
694
+
695
+ # Check csv outputter
696
+ ostreamcsv = String.new()
697
+ pdu.output_packet(Majoron::AntHill::SMPP::SMPPCSVOutputter.new(ostreamcsv))
698
+ assert_not_equal 0, ostreamcsv.size()
699
+
700
+ # Others outputter are not impelemented yet
701
+
702
+ # Check hex outputter
703
+ #ostreamhex = String.new()
704
+ #pdu.output_packet(Majoron::AntHill::SMPP::SMPPHexOutputter.new(ostreamhex))
705
+ #assert_not_equal 0, ostreamhex.size()
706
+
707
+ # Check xml outputter
708
+ #ostreamxml = String.new()
709
+ #pdu.output_packet(Majoron::AntHill::SMPP::SMPPXMLOutputter.new(ostreamxml))
710
+ #assert_not_equal 0, ostreamxml.size()
711
+
712
+ end
713
+
714
+
715
+ def test_smpp_deliver_sm
716
+ dump = String.new()
717
+ # read and decode package based on hex dump
718
+ dump << "00 00 00 96 00 00 00 05 00 00 00 00 00 00 00 0C 53 4D 53 00 01 02 31 "
719
+ dump << "32 33 00 04 05 33 32 31 00 06 07 08 00 00 09 0A 0B 0C 00 02 04 00 02 "
720
+ dump << "00 01 02 0A 00 02 00 02 02 0B 00 02 00 03 02 0C 00 02 00 04 02 0E 00 "
721
+ dump << "01 05 02 0F 00 01 06 02 05 00 01 07 02 01 00 01 08 00 19 00 01 09 04 "
722
+ dump << "24 00 03 01 FF AA 03 81 00 03 01 FF AA 02 02 00 03 01 FF AA 02 03 00 "
723
+ dump << "03 01 FF AA 02 0D 00 01 0A 13 83 00 02 00 0A 04 23 00 03 03 00 0C 04 "
724
+ dump << "27 00 01 03 00 1E 00 04 31 32 33 00 "
725
+ buffer = Majoron::AntHill::ByteBuffer.decode_hex(dump)
726
+
727
+ # declare variables
728
+ decoder = Majoron::AntHill::SMPP::SMPPDecoder.new()
729
+ validator = Majoron::AntHill::SMPP::SMPPValidator.new()
730
+
731
+ # decode package
732
+ decoder.append_buffer(buffer)
733
+ pdu = decoder.get_packet()
734
+ pdu.decode_packet(decoder)
735
+ pdu.validate_packet(validator)
736
+
737
+ # Check txt outputter
738
+ ostreamtxt = String.new()
739
+ pdu.output_packet(Majoron::AntHill::SMPP::SMPPTxtOutputter.new(ostreamtxt))
740
+ assert_not_equal 0, ostreamtxt.size()
741
+
742
+ # Check csv outputter
743
+ ostreamcsv = String.new()
744
+ pdu.output_packet(Majoron::AntHill::SMPP::SMPPCSVOutputter.new(ostreamcsv))
745
+ assert_not_equal 0, ostreamcsv.size()
746
+
747
+ # Others outputter are not impelemented yet
748
+
749
+ # Check hex outputter
750
+ #ostreamhex = String.new()
751
+ #pdu.output_packet(Majoron::AntHill::SMPP::SMPPHexOutputter.new(ostreamhex))
752
+ #assert_not_equal 0, ostreamhex.size()
753
+
754
+ # Check xml outputter
755
+ #ostreamxml = String.new()
756
+ #pdu.output_packet(Majoron::AntHill::SMPP::SMPPXMLOutputter.new(ostreamxml))
757
+ #assert_not_equal 0, ostreamxml.size()
758
+
759
+ end
760
+
761
+
762
+ def test_smpp_deliver_sm_resp
763
+ dump = String.new()
764
+ # read and decode package based on hex dump
765
+ dump << "00 00 00 24 80 00 00 05 00 00 00 00 00 00 00 0C 00 00 1D 00 03 01 FF "
766
+ dump << "AA 04 25 00 01 01 04 23 00 03 01 00 02"
767
+ buffer = Majoron::AntHill::ByteBuffer.decode_hex(dump)
768
+
769
+ # declare variables
770
+ decoder = Majoron::AntHill::SMPP::SMPPDecoder.new()
771
+ validator = Majoron::AntHill::SMPP::SMPPValidator.new()
772
+
773
+ # decode package
774
+ decoder.append_buffer(buffer)
775
+ pdu = decoder.get_packet()
776
+ pdu.decode_packet(decoder)
777
+ pdu.validate_packet(validator)
778
+
779
+ # Check txt outputter
780
+ ostreamtxt = String.new()
781
+ pdu.output_packet(Majoron::AntHill::SMPP::SMPPTxtOutputter.new(ostreamtxt))
782
+ assert_not_equal 0, ostreamtxt.size()
783
+
784
+ # Check csv outputter
785
+ ostreamcsv = String.new()
786
+ pdu.output_packet(Majoron::AntHill::SMPP::SMPPCSVOutputter.new(ostreamcsv))
787
+ assert_not_equal 0, ostreamcsv.size()
788
+
789
+ # Others outputter are not impelemented yet
790
+
791
+ # Check hex outputter
792
+ #ostreamhex = String.new()
793
+ #pdu.output_packet(Majoron::AntHill::SMPP::SMPPHexOutputter.new(ostreamhex))
794
+ #assert_not_equal 0, ostreamhex.size()
795
+
796
+ # Check xml outputter
797
+ #ostreamxml = String.new()
798
+ #pdu.output_packet(Majoron::AntHill::SMPP::SMPPXMLOutputter.new(ostreamxml))
799
+ #assert_not_equal 0, ostreamxml.size()
800
+
801
+ end
802
+
803
+
804
+ def test_smpp_broadcast_sm
805
+ dump = String.new()
806
+ # read and decode package based on hex dump
807
+ dump << "00 00 00 C5 00 00 01 11 00 00 00 00 00 00 00 0C 73 72 76 74 70 00 01 "
808
+ dump << "02 31 32 33 00 33 34 35 00 01 00 00 03 04 05 06 06 00 02 01 FF 06 06 "
809
+ dump << "00 02 01 AF 06 06 00 02 01 DF 06 01 00 03 01 02 FF 06 04 00 02 00 0A "
810
+ dump << "06 05 00 03 01 02 FF 13 0C 00 01 01 06 00 00 01 02 06 02 00 03 01 FF "
811
+ dump << "AA 06 03 00 01 03 06 0A 00 03 01 FF AA 03 81 00 01 10 03 03 00 03 01 "
812
+ dump << "FF AA 03 02 00 01 04 02 03 00 03 01 FF AA 02 0B 00 02 00 05 12 01 00 "
813
+ dump << "01 06 02 0D 00 01 07 04 24 00 03 01 FF AA 12 04 00 01 08 00 19 00 01 "
814
+ dump << "09 02 01 00 01 0A 12 03 00 02 00 0B 00 0D 00 01 0C 02 0A 00 02 00 0D "
815
+ dump << "02 02 00 03 01 FF AA 02 04 00 02 00 16"
816
+ buffer = Majoron::AntHill::ByteBuffer.decode_hex(dump)
817
+
818
+ # declare variables
819
+ decoder = Majoron::AntHill::SMPP::SMPPDecoder.new()
820
+ validator = Majoron::AntHill::SMPP::SMPPValidator.new()
821
+
822
+ # decode package
823
+ decoder.append_buffer(buffer)
824
+ pdu = decoder.get_packet()
825
+ pdu.decode_packet(decoder)
826
+ pdu.validate_packet(validator)
827
+
828
+ # Check txt outputter
829
+ ostreamtxt = String.new()
830
+ pdu.output_packet(Majoron::AntHill::SMPP::SMPPTxtOutputter.new(ostreamtxt))
831
+ assert_not_equal 0, ostreamtxt.size()
832
+
833
+ # Check csv outputter
834
+ ostreamcsv = String.new()
835
+ pdu.output_packet(Majoron::AntHill::SMPP::SMPPCSVOutputter.new(ostreamcsv))
836
+ assert_not_equal 0, ostreamcsv.size()
837
+
838
+ # Others outputter are not impelemented yet
839
+
840
+ # Check hex outputter
841
+ #ostreamhex = String.new()
842
+ #pdu.output_packet(Majoron::AntHill::SMPP::SMPPHexOutputter.new(ostreamhex))
843
+ #assert_not_equal 0, ostreamhex.size()
844
+
845
+ # Check xml outputter
846
+ #ostreamxml = String.new()
847
+ #pdu.output_packet(Majoron::AntHill::SMPP::SMPPXMLOutputter.new(ostreamxml))
848
+ #assert_not_equal 0, ostreamxml.size()
849
+
850
+ end
851
+
852
+ def test_smpp_broadcast_sm_resp
853
+ dump = String.new()
854
+ # read and decode package based on hex dump
855
+ dump << "00 00 00 2E 80 00 01 11 00 00 00 00 00 00 00 0C 31 32 33 00 06 07 00 "
856
+ dump << "04 00 00 00 01 06 06 00 02 01 FF 06 06 00 02 01 AF 06 06 00 02 01 DF"
857
+ buffer = Majoron::AntHill::ByteBuffer.decode_hex(dump)
858
+
859
+ # declare variables
860
+ decoder = Majoron::AntHill::SMPP::SMPPDecoder.new()
861
+ validator = Majoron::AntHill::SMPP::SMPPValidator.new()
862
+
863
+ # decode package
864
+ decoder.append_buffer(buffer)
865
+ pdu = decoder.get_packet()
866
+ pdu.decode_packet(decoder)
867
+ pdu.validate_packet(validator)
868
+
869
+ # Check txt outputter
870
+ ostreamtxt = String.new()
871
+ pdu.output_packet(Majoron::AntHill::SMPP::SMPPTxtOutputter.new(ostreamtxt))
872
+ assert_not_equal 0, ostreamtxt.size()
873
+
874
+ # Check csv outputter
875
+ ostreamcsv = String.new()
876
+ pdu.output_packet(Majoron::AntHill::SMPP::SMPPCSVOutputter.new(ostreamcsv))
877
+ assert_not_equal 0, ostreamcsv.size()
878
+
879
+ # Others outputter are not impelemented yet
880
+
881
+ # Check hex outputter
882
+ #ostreamhex = String.new()
883
+ #pdu.output_packet(Majoron::AntHill::SMPP::SMPPHexOutputter.new(ostreamhex))
884
+ #assert_not_equal 0, ostreamhex.size()
885
+
886
+ # Check xml outputter
887
+ #ostreamxml = String.new()
888
+ #pdu.output_packet(Majoron::AntHill::SMPP::SMPPXMLOutputter.new(ostreamxml))
889
+ #assert_not_equal 0, ostreamxml.size()
890
+
891
+ end
892
+
893
+ def test_smpp_cancel_broadcast_sm
894
+ dump = String.new()
895
+ # read and decode package based on hex dump
896
+ dump << "00 00 00 2C 00 00 01 13 00 00 00 00 00 00 00 0C 73 72 76 74 70 00 31 "
897
+ dump << "32 33 00 01 01 31 32 33 00 06 01 00 02 01 FF 02 04 00 02 00 0A"
898
+ buffer = Majoron::AntHill::ByteBuffer.decode_hex(dump)
899
+
900
+ # declare variables
901
+ decoder = Majoron::AntHill::SMPP::SMPPDecoder.new()
902
+ validator = Majoron::AntHill::SMPP::SMPPValidator.new()
903
+
904
+ # decode package
905
+ decoder.append_buffer(buffer)
906
+ pdu = decoder.get_packet()
907
+ pdu.decode_packet(decoder)
908
+ pdu.validate_packet(validator)
909
+
910
+ # Check txt outputter
911
+ ostreamtxt = String.new()
912
+ pdu.output_packet(Majoron::AntHill::SMPP::SMPPTxtOutputter.new(ostreamtxt))
913
+ assert_not_equal 0, ostreamtxt.size()
914
+
915
+ # Check csv outputter
916
+ ostreamcsv = String.new()
917
+ pdu.output_packet(Majoron::AntHill::SMPP::SMPPCSVOutputter.new(ostreamcsv))
918
+ assert_not_equal 0, ostreamcsv.size()
919
+
920
+ # Others outputter are not impelemented yet
921
+
922
+ # Check hex outputter
923
+ #ostreamhex = String.new()
924
+ #pdu.output_packet(Majoron::AntHill::SMPP::SMPPHexOutputter.new(ostreamhex))
925
+ #assert_not_equal 0, ostreamhex.size()
926
+
927
+ # Check xml outputter
928
+ #ostreamxml = String.new()
929
+ #pdu.output_packet(Majoron::AntHill::SMPP::SMPPXMLOutputter.new(ostreamxml))
930
+ #assert_not_equal 0, ostreamxml.size()
931
+
932
+ end
933
+
934
+ def test_smpp_cancel_broadcast_sm_resp
935
+ dump = String.new()
936
+ # read and decode package based on hex dump
937
+ dump << "00 00 00 10 80 00 01 13 00 00 00 00 00 00 00 0C"
938
+ buffer = Majoron::AntHill::ByteBuffer.decode_hex(dump)
939
+
940
+ # declare variables
941
+ decoder = Majoron::AntHill::SMPP::SMPPDecoder.new()
942
+ validator = Majoron::AntHill::SMPP::SMPPValidator.new()
943
+
944
+ # decode package
945
+ decoder.append_buffer(buffer)
946
+ pdu = decoder.get_packet()
947
+ pdu.decode_packet(decoder)
948
+ pdu.validate_packet(validator)
949
+
950
+ # Check txt outputter
951
+ ostreamtxt = String.new()
952
+ pdu.output_packet(Majoron::AntHill::SMPP::SMPPTxtOutputter.new(ostreamtxt))
953
+ assert_not_equal 0, ostreamtxt.size()
954
+
955
+ # Check csv outputter
956
+ ostreamcsv = String.new()
957
+ pdu.output_packet(Majoron::AntHill::SMPP::SMPPCSVOutputter.new(ostreamcsv))
958
+ assert_not_equal 0, ostreamcsv.size()
959
+
960
+ # Others outputter are not impelemented yet
961
+
962
+ # Check hex outputter
963
+ #ostreamhex = String.new()
964
+ #pdu.output_packet(Majoron::AntHill::SMPP::SMPPHexOutputter.new(ostreamhex))
965
+ #assert_not_equal 0, ostreamhex.size()
966
+
967
+ # Check xml outputter
968
+ #ostreamxml = String.new()
969
+ #pdu.output_packet(Majoron::AntHill::SMPP::SMPPXMLOutputter.new(ostreamxml))
970
+ #assert_not_equal 0, ostreamxml.size()
971
+
972
+ end
973
+
974
+
975
+ def test_smpp_query_broadcast_sm
976
+ dump = String.new()
977
+ # read and decode package based on hex dump
978
+ dump << "00 00 00 20 00 00 01 12 00 00 00 00 00 00 00 0C 31 32 33 00 01 02 33 34 35 00 02 04 00 02 00 02"
979
+ buffer = Majoron::AntHill::ByteBuffer.decode_hex(dump)
980
+
981
+ # declare variables
982
+ decoder = Majoron::AntHill::SMPP::SMPPDecoder.new()
983
+ validator = Majoron::AntHill::SMPP::SMPPValidator.new()
984
+
985
+ # decode package
986
+ decoder.append_buffer(buffer)
987
+ pdu = decoder.get_packet()
988
+ pdu.decode_packet(decoder)
989
+ pdu.validate_packet(validator)
990
+
991
+ # Check txt outputter
992
+ ostreamtxt = String.new()
993
+ pdu.output_packet(Majoron::AntHill::SMPP::SMPPTxtOutputter.new(ostreamtxt))
994
+ assert_not_equal 0, ostreamtxt.size()
995
+
996
+ # Check csv outputter
997
+ ostreamcsv = String.new()
998
+ pdu.output_packet(Majoron::AntHill::SMPP::SMPPCSVOutputter.new(ostreamcsv))
999
+ assert_not_equal 0, ostreamcsv.size()
1000
+
1001
+ # Others outputter are not impelemented yet
1002
+
1003
+ # Check hex outputter
1004
+ #ostreamhex = String.new()
1005
+ #pdu.output_packet(Majoron::AntHill::SMPP::SMPPHexOutputter.new(ostreamhex))
1006
+ #assert_not_equal 0, ostreamhex.size()
1007
+
1008
+ # Check xml outputter
1009
+ #ostreamxml = String.new()
1010
+ #pdu.output_packet(Majoron::AntHill::SMPP::SMPPXMLOutputter.new(ostreamxml))
1011
+ #assert_not_equal 0, ostreamxml.size()
1012
+
1013
+ end
1014
+
1015
+ def test_smpp_query_broadcast_sm_resp
1016
+ dump = String.new()
1017
+ # read and decode package based on hex dump
1018
+ dump << "00 00 00 36 80 00 01 12 00 00 00 00 00 00 00 0C 31 32 33 00 04 27 00 01 02 06 06 00 02 01 FF "
1019
+ dump << "06 06 00 02 01 AF 06 06 00 02 01 DF 06 08 00 01 66 02 04 00 02 00 7B"
1020
+ buffer = Majoron::AntHill::ByteBuffer.decode_hex(dump)
1021
+
1022
+ # declare variables
1023
+ decoder = Majoron::AntHill::SMPP::SMPPDecoder.new()
1024
+ validator = Majoron::AntHill::SMPP::SMPPValidator.new()
1025
+
1026
+ # decode package
1027
+ decoder.append_buffer(buffer)
1028
+ pdu = decoder.get_packet()
1029
+ pdu.decode_packet(decoder)
1030
+ pdu.validate_packet(validator)
1031
+
1032
+ # Check txt outputter
1033
+ ostreamtxt = String.new()
1034
+ pdu.output_packet(Majoron::AntHill::SMPP::SMPPTxtOutputter.new(ostreamtxt))
1035
+ assert_not_equal 0, ostreamtxt.size()
1036
+
1037
+ # Check csv outputter
1038
+ ostreamcsv = String.new()
1039
+ pdu.output_packet(Majoron::AntHill::SMPP::SMPPCSVOutputter.new(ostreamcsv))
1040
+ assert_not_equal 0, ostreamcsv.size()
1041
+
1042
+ # Others outputter are not impelemented yet
1043
+
1044
+ # Check hex outputter
1045
+ #ostreamhex = String.new()
1046
+ #pdu.output_packet(Majoron::AntHill::SMPP::SMPPHexOutputter.new(ostreamhex))
1047
+ #assert_not_equal 0, ostreamhex.size()
1048
+
1049
+ # Check xml outputter
1050
+ #ostreamxml = String.new()
1051
+ #pdu.output_packet(Majoron::AntHill::SMPP::SMPPXMLOutputter.new(ostreamxml))
1052
+ #assert_not_equal 0, ostreamxml.size()
1053
+
1054
+ end
1055
+
1056
+ def test_smpp_query_broadcast_sm_resp_1
1057
+ dump = String.new()
1058
+ # read and decode package based on hex dump
1059
+ dump << "00 00 00 3B 80 00 01 12 00 00 00 00 00 00 00 0C 31 32 33 00 04 27 00 01 02 06 06 00 02 01 FF "
1060
+ dump << "06 06 00 02 01 AF 06 06 00 02 01 DF 06 08 00 01 66 02 04 00 02 00 7B 06 09 00 01 00"
1061
+ buffer = Majoron::AntHill::ByteBuffer.decode_hex(dump)
1062
+
1063
+ # declare variables
1064
+ decoder = Majoron::AntHill::SMPP::SMPPDecoder.new()
1065
+ validator = Majoron::AntHill::SMPP::SMPPValidator.new()
1066
+
1067
+ # decode package
1068
+ decoder.append_buffer(buffer)
1069
+ pdu = decoder.get_packet()
1070
+ pdu.decode_packet(decoder)
1071
+ pdu.validate_packet(validator)
1072
+
1073
+ # Check txt outputter
1074
+ ostreamtxt = String.new()
1075
+ pdu.output_packet(Majoron::AntHill::SMPP::SMPPTxtOutputter.new(ostreamtxt))
1076
+ assert_not_equal 0, ostreamtxt.size()
1077
+
1078
+ # Check csv outputter
1079
+ ostreamcsv = String.new()
1080
+ pdu.output_packet(Majoron::AntHill::SMPP::SMPPCSVOutputter.new(ostreamcsv))
1081
+ assert_not_equal 0, ostreamcsv.size()
1082
+
1083
+ # Others outputter are not impelemented yet
1084
+
1085
+ # Check hex outputter
1086
+ #ostreamhex = String.new()
1087
+ #pdu.output_packet(Majoron::AntHill::SMPP::SMPPHexOutputter.new(ostreamhex))
1088
+ #assert_not_equal 0, ostreamhex.size()
1089
+
1090
+ # Check xml outputter
1091
+ #ostreamxml = String.new()
1092
+ #pdu.output_packet(Majoron::AntHill::SMPP::SMPPXMLOutputter.new(ostreamxml))
1093
+ #assert_not_equal 0, ostreamxml.size()
1094
+
1095
+ end
1096
+
1097
+
1098
+ def test_smpp_alert_notification
1099
+ dump = String.new()
1100
+ # read and decode package based on hex dump
1101
+ dump << "00 00 00 21 00 00 01 02 00 00 00 00 00 00 00 0C 01 01 31 32 33 00 02 "
1102
+ dump << "02 33 32 31 00 04 22 00 01 01"
1103
+ buffer = Majoron::AntHill::ByteBuffer.decode_hex(dump)
1104
+
1105
+ # declare variables
1106
+ decoder = Majoron::AntHill::SMPP::SMPPDecoder.new()
1107
+ validator = Majoron::AntHill::SMPP::SMPPValidator.new()
1108
+
1109
+ # decode package
1110
+ decoder.append_buffer(buffer)
1111
+ pdu = decoder.get_packet()
1112
+ pdu.decode_packet(decoder)
1113
+ pdu.validate_packet(validator)
1114
+
1115
+ # Check txt outputter
1116
+ ostreamtxt = String.new()
1117
+ pdu.output_packet(Majoron::AntHill::SMPP::SMPPTxtOutputter.new(ostreamtxt))
1118
+ assert_not_equal 0, ostreamtxt.size()
1119
+
1120
+ # Check csv outputter
1121
+ ostreamcsv = String.new()
1122
+ pdu.output_packet(Majoron::AntHill::SMPP::SMPPCSVOutputter.new(ostreamcsv))
1123
+ assert_not_equal 0, ostreamcsv.size()
1124
+
1125
+ # Others outputter are not impelemented yet
1126
+
1127
+ # Check hex outputter
1128
+ #ostreamhex = String.new()
1129
+ #pdu.output_packet(Majoron::AntHill::SMPP::SMPPHexOutputter.new(ostreamhex))
1130
+ #assert_not_equal 0, ostreamhex.size()
1131
+
1132
+ # Check xml outputter
1133
+ #ostreamxml = String.new()
1134
+ #pdu.output_packet(Majoron::AntHill::SMPP::SMPPXMLOutputter.new(ostreamxml))
1135
+ #assert_not_equal 0, ostreamxml.size()
1136
+
1137
+ end
1138
+
1139
+ def test_smpp_enquire_link
1140
+ dump = String.new()
1141
+ # read and decode package based on hex dump
1142
+ dump << "00 00 00 10 00 00 00 15 00 00 00 00 00 00 00 0C"
1143
+ buffer = Majoron::AntHill::ByteBuffer.decode_hex(dump)
1144
+
1145
+ # declare variables
1146
+ decoder = Majoron::AntHill::SMPP::SMPPDecoder.new()
1147
+ validator = Majoron::AntHill::SMPP::SMPPValidator.new()
1148
+
1149
+ # decode package
1150
+ decoder.append_buffer(buffer)
1151
+ pdu = decoder.get_packet()
1152
+ pdu.decode_packet(decoder)
1153
+ pdu.validate_packet(validator)
1154
+
1155
+ # Check txt outputter
1156
+ ostreamtxt = String.new()
1157
+ pdu.output_packet(Majoron::AntHill::SMPP::SMPPTxtOutputter.new(ostreamtxt))
1158
+ assert_not_equal 0, ostreamtxt.size()
1159
+
1160
+ # Check csv outputter
1161
+ ostreamcsv = String.new()
1162
+ pdu.output_packet(Majoron::AntHill::SMPP::SMPPCSVOutputter.new(ostreamcsv))
1163
+ assert_not_equal 0, ostreamcsv.size()
1164
+
1165
+ # Others outputter are not impelemented yet
1166
+
1167
+ # Check hex outputter
1168
+ #ostreamhex = String.new()
1169
+ #pdu.output_packet(Majoron::AntHill::SMPP::SMPPHexOutputter.new(ostreamhex))
1170
+ #assert_not_equal 0, ostreamhex.size()
1171
+
1172
+ # Check xml outputter
1173
+ #ostreamxml = String.new()
1174
+ #pdu.output_packet(Majoron::AntHill::SMPP::SMPPXMLOutputter.new(ostreamxml))
1175
+ #assert_not_equal 0, ostreamxml.size()
1176
+
1177
+ end
1178
+
1179
+ def test_smpp_enquire_link_resp
1180
+ dump = String.new()
1181
+ # read and decode package based on hex dump
1182
+ dump << "00 00 00 10 80 00 00 15 00 00 00 00 00 00 00 0C"
1183
+ buffer = Majoron::AntHill::ByteBuffer.decode_hex(dump)
1184
+
1185
+ # declare variables
1186
+ decoder = Majoron::AntHill::SMPP::SMPPDecoder.new()
1187
+ validator = Majoron::AntHill::SMPP::SMPPValidator.new()
1188
+
1189
+ # decode package
1190
+ decoder.append_buffer(buffer)
1191
+ pdu = decoder.get_packet()
1192
+ pdu.decode_packet(decoder)
1193
+ pdu.validate_packet(validator)
1194
+
1195
+ # Check txt outputter
1196
+ ostreamtxt = String.new()
1197
+ pdu.output_packet(Majoron::AntHill::SMPP::SMPPTxtOutputter.new(ostreamtxt))
1198
+ assert_not_equal 0, ostreamtxt.size()
1199
+
1200
+ # Check csv outputter
1201
+ ostreamcsv = String.new()
1202
+ pdu.output_packet(Majoron::AntHill::SMPP::SMPPCSVOutputter.new(ostreamcsv))
1203
+ assert_not_equal 0, ostreamcsv.size()
1204
+
1205
+ # Others outputter are not impelemented yet
1206
+
1207
+ # Check hex outputter
1208
+ #ostreamhex = String.new()
1209
+ #pdu.output_packet(Majoron::AntHill::SMPP::SMPPHexOutputter.new(ostreamhex))
1210
+ #assert_not_equal 0, ostreamhex.size()
1211
+
1212
+ # Check xml outputter
1213
+ #ostreamxml = String.new()
1214
+ #pdu.output_packet(Majoron::AntHill::SMPP::SMPPXMLOutputter.new(ostreamxml))
1215
+ #assert_not_equal 0, ostreamxml.size()
1216
+
1217
+ end
1218
+
1219
+ def test_smpp_generic_nack
1220
+ dump = String.new()
1221
+ # read and decode package based on hex dump
1222
+ dump << "00 00 00 10 80 00 00 00 00 00 00 00 00 00 00 0C"
1223
+ buffer = Majoron::AntHill::ByteBuffer.decode_hex(dump)
1224
+
1225
+ # declare variables
1226
+ decoder = Majoron::AntHill::SMPP::SMPPDecoder.new()
1227
+ validator = Majoron::AntHill::SMPP::SMPPValidator.new()
1228
+
1229
+ # decode package
1230
+ decoder.append_buffer(buffer)
1231
+ pdu = decoder.get_packet()
1232
+ pdu.decode_packet(decoder)
1233
+ pdu.validate_packet(validator)
1234
+
1235
+ # Check txt outputter
1236
+ ostreamtxt = String.new()
1237
+ pdu.output_packet(Majoron::AntHill::SMPP::SMPPTxtOutputter.new(ostreamtxt))
1238
+ assert_not_equal 0, ostreamtxt.size()
1239
+
1240
+ # Check csv outputter
1241
+ ostreamcsv = String.new()
1242
+ pdu.output_packet(Majoron::AntHill::SMPP::SMPPCSVOutputter.new(ostreamcsv))
1243
+ assert_not_equal 0, ostreamcsv.size()
1244
+
1245
+ # Others outputter are not impelemented yet
1246
+
1247
+ # Check hex outputter
1248
+ #ostreamhex = String.new()
1249
+ #pdu.output_packet(Majoron::AntHill::SMPP::SMPPHexOutputter.new(ostreamhex))
1250
+ #assert_not_equal 0, ostreamhex.size()
1251
+
1252
+ # Check xml outputter
1253
+ #ostreamxml = String.new()
1254
+ #pdu.output_packet(Majoron::AntHill::SMPP::SMPPXMLOutputter.new(ostreamxml))
1255
+ #assert_not_equal 0, ostreamxml.size()
1256
+
1257
+ end
1258
+
1259
+
1260
+
1261
+ end