rubywmq 0.3.0-i386-mswin32-mq6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. data/LICENSE +13 -0
  2. data/README +73 -0
  3. data/doc/classes/WMQ.html +6300 -0
  4. data/doc/classes/WMQ/Message.html +376 -0
  5. data/doc/classes/WMQ/Message.src/M000001.html +77 -0
  6. data/doc/classes/WMQ/Message.src/M000002.html +27 -0
  7. data/doc/classes/WMQ/Queue.html +1459 -0
  8. data/doc/classes/WMQ/Queue.src/M000003.html +205 -0
  9. data/doc/classes/WMQ/Queue.src/M000004.html +107 -0
  10. data/doc/classes/WMQ/Queue.src/M000005.html +198 -0
  11. data/doc/classes/WMQ/Queue.src/M000006.html +66 -0
  12. data/doc/classes/WMQ/Queue.src/M000007.html +203 -0
  13. data/doc/classes/WMQ/Queue.src/M000008.html +265 -0
  14. data/doc/classes/WMQ/Queue.src/M000009.html +120 -0
  15. data/doc/classes/WMQ/Queue.src/M000010.html +28 -0
  16. data/doc/classes/WMQ/Queue.src/M000011.html +30 -0
  17. data/doc/classes/WMQ/Queue.src/M000012.html +31 -0
  18. data/doc/classes/WMQ/Queue.src/M000013.html +31 -0
  19. data/doc/classes/WMQ/Queue.src/M000014.html +31 -0
  20. data/doc/classes/WMQ/QueueManager.html +1529 -0
  21. data/doc/classes/WMQ/QueueManager.src/M000015.html +182 -0
  22. data/doc/classes/WMQ/QueueManager.src/M000016.html +194 -0
  23. data/doc/classes/WMQ/QueueManager.src/M000017.html +92 -0
  24. data/doc/classes/WMQ/QueueManager.src/M000018.html +70 -0
  25. data/doc/classes/WMQ/QueueManager.src/M000019.html +49 -0
  26. data/doc/classes/WMQ/QueueManager.src/M000020.html +49 -0
  27. data/doc/classes/WMQ/QueueManager.src/M000021.html +63 -0
  28. data/doc/classes/WMQ/QueueManager.src/M000022.html +61 -0
  29. data/doc/classes/WMQ/QueueManager.src/M000023.html +65 -0
  30. data/doc/classes/WMQ/QueueManager.src/M000024.html +232 -0
  31. data/doc/classes/WMQ/QueueManager.src/M000025.html +30 -0
  32. data/doc/classes/WMQ/QueueManager.src/M000026.html +31 -0
  33. data/doc/classes/WMQ/QueueManager.src/M000027.html +31 -0
  34. data/doc/classes/WMQ/QueueManager.src/M000028.html +38 -0
  35. data/doc/classes/WMQ/QueueManager.src/M000029.html +33 -0
  36. data/doc/classes/WMQ/QueueManager.src/M000030.html +21 -0
  37. data/doc/classes/WMQ/QueueManager.src/M000031.html +284 -0
  38. data/doc/classes/WMQ/QueueManager.src/M000032.html +24 -0
  39. data/doc/classes/WMQ/QueueManager.src/M000033.html +18 -0
  40. data/doc/classes/WMQ/QueueManager.src/M000034.html +46 -0
  41. data/doc/classes/WMQ/QueueManager.src/M000035.html +27 -0
  42. data/doc/classes/WMQ/WMQException.html +111 -0
  43. data/doc/created.rid +1 -0
  44. data/doc/files/ext/lib/wmq_const_admin_rb.html +128 -0
  45. data/doc/files/ext/lib/wmq_const_rb.html +128 -0
  46. data/doc/files/ext/lib/wmq_temp_rb.html +122 -0
  47. data/doc/files/ext/wmq_c.html +101 -0
  48. data/doc/files/ext/wmq_message_c.html +101 -0
  49. data/doc/files/ext/wmq_queue_c.html +101 -0
  50. data/doc/files/ext/wmq_queue_manager_c.html +101 -0
  51. data/doc/fr_class_index.html +31 -0
  52. data/doc/fr_file_index.html +33 -0
  53. data/doc/fr_method_index.html +61 -0
  54. data/doc/index.html +24 -0
  55. data/doc/rdoc-style.css +208 -0
  56. data/examples/each_a.rb +31 -0
  57. data/examples/each_b.rb +40 -0
  58. data/examples/each_header.rb +37 -0
  59. data/examples/files_to_q.cfg +24 -0
  60. data/examples/files_to_q.rb +46 -0
  61. data/examples/get_a.rb +34 -0
  62. data/examples/get_client.rb +50 -0
  63. data/examples/put1_a.rb +24 -0
  64. data/examples/put1_b.rb +32 -0
  65. data/examples/put1_c.rb +31 -0
  66. data/examples/put_a.rb +34 -0
  67. data/examples/put_b.rb +42 -0
  68. data/examples/put_dlh.rb +40 -0
  69. data/examples/put_dynamic_q.rb +37 -0
  70. data/examples/put_rfh.rb +66 -0
  71. data/examples/put_rfh2_a.rb +42 -0
  72. data/examples/put_rfh2_b.rb +42 -0
  73. data/examples/put_xmit_q.rb +32 -0
  74. data/examples/q_to_files.cfg +17 -0
  75. data/examples/q_to_files.rb +47 -0
  76. data/examples/request.rb +59 -0
  77. data/examples/server.rb +96 -0
  78. data/lib/wmq.rb +25 -0
  79. data/lib/wmq/wmq.so +0 -0
  80. data/lib/wmq/wmq_const.rb +745 -0
  81. data/lib/wmq/wmq_const_admin.rb +555 -0
  82. data/lib/wmq/wmq_temp.rb +197 -0
  83. data/tests/test.rb +299 -0
  84. metadata +131 -0
@@ -0,0 +1,197 @@
1
+ ################################################################################
2
+ # Copyright 2006 J. Reid Morrison. Dimension Solutions, Inc.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ ################################################################################
16
+
17
+ module WMQ
18
+
19
+ # Temporary placeholder until the following code is moved to 'C'
20
+
21
+ #
22
+ class QueueManager
23
+ def method_missing(name, *args)
24
+ if args.size == 1
25
+ self.execute({:command=>name}.merge(args[0]))
26
+ elsif args.size == 0
27
+ self.execute({:command=>name})
28
+ else
29
+ raise("Invalid arguments supplied to QueueManager#:#{name}, args:#{args}")
30
+ end
31
+ end
32
+
33
+ # Execute any MQSC command against the queue manager
34
+ #
35
+ # Example
36
+ # require 'wmq/wmq'
37
+ # require 'wmq/wmq_const_admin'
38
+ # WMQ::QueueManager.connect(:q_mgr_name=>'REID', :connection_name=>'localhost(1414)') do |qmgr|
39
+ # qmgr.mqsc('dis ql(*)').each {|item| p item }
40
+ # end
41
+ def mqsc(mqsc_text)
42
+ self.execute(:command=>:escape, :escape_type=>WMQ::MQET_MQSC, :escape_text=>mqsc_text).collect {|item| item[:escape_text] }
43
+ end
44
+
45
+ # Put a reply message back to the sender
46
+ #
47
+ # The :message is sent to the queue and queue manager specified in the
48
+ # :reply_to_q and :reply_to_q_mgr propoerties of the :request_message.
49
+ #
50
+ # The following rules are followed before sending the reply:
51
+ # - Only send replies to Request messages. No reply for Datagrams
52
+ # - Set the message type to Reply when replying to a request message
53
+ # - Reply with:
54
+ # - Remaining Expiry (Ideally deduct any processing time since get)
55
+ # - Same priority as received message
56
+ # - Same persistence as received message
57
+ # - Adhere to the Report options supplied for message and correlation id's
58
+ # in reply message
59
+ # - All headers must be returned on reply messages
60
+ # - This allows the calling application to store state information
61
+ # in these headers
62
+ # - Unless of course if the relevant header is input only and used
63
+ # for completing the request
64
+ # - In this case any remaining headers should be returned
65
+ # to the caller
66
+ #
67
+ # Parameters:
68
+ # * :request_message The message originally received
69
+ # * All the other parameters are the same as QueueManager#put
70
+ #
71
+ def put_to_reply_q(parms)
72
+ # Send replies only if message type is request
73
+ if parms[:request_message].descriptor[:msg_type] == WMQ::MQMT_REQUEST
74
+ request = parms.delete(:request_message)
75
+
76
+ reply = parms[:message] ||= Message.new(:data=>parms[:data])
77
+ reply.descriptor[:msg_type] = WMQ::MQMT_REPLY
78
+ reply.descriptor[:expiry] = request.descriptor[:expiry]
79
+ reply.descriptor[:priority] = request.descriptor[:priority]
80
+ reply.descriptor[:persistence]= request.descriptor[:persistence]
81
+ reply.descriptor[:format] = request.descriptor[:format]
82
+
83
+ # Set Correlation Id based on report options supplied
84
+ if request.descriptor[:report] & WMQ::MQRO_PASS_CORREL_ID != 0
85
+ reply.descriptor[:correl_id] = request.descriptor[:correl_id]
86
+ else
87
+ reply.descriptor[:correl_id] = request.descriptor[:msg_id]
88
+ end
89
+
90
+ # Set Message Id based on report options supplied
91
+ if request.descriptor[:report] & WMQ::MQRO_PASS_MSG_ID != 0
92
+ reply.descriptor[:msg_id] = request.descriptor[:msg_id]
93
+ end
94
+
95
+ parms[:q_name] = request.descriptor[:reply_to_q]
96
+ parms[:q_mgr_name]= request.descriptor[:reply_to_q_mgr]
97
+ return put(parms)
98
+ else
99
+ return false
100
+ end
101
+ end
102
+
103
+ # Put a message to the Dead Letter Queue
104
+ #
105
+ # If an error occurs when processing a datagram message
106
+ # it is necessary to move the message to the dead letter queue.
107
+ # I.e. An error message cannot be sent back to the sender because
108
+ # the original message was not a request message.
109
+ # I.e. msg_type != WMQ::MQMT_REQUEST
110
+ #
111
+ # All existing message data, message descriptor and message headers
112
+ # are retained.
113
+ #
114
+ def put_to_dead_letter_q(parms)
115
+ message = parms[:message] ||= Message.new(:data=>parms[:data])
116
+ dlh = {
117
+ :header_type =>:dead_letter_header,
118
+ :reason =>parms.delete(:reason),
119
+ :dest_q_name =>parms.delete(:q_name),
120
+ :dest_q_mgr_name =>self.name}
121
+
122
+ message.headers.unshift(dlh)
123
+ parms[:q_name]='SYSTEM.DEAD.LETTER.QUEUE' #TODO Should be obtained from QMGR config
124
+ return self.put(parms)
125
+ end
126
+
127
+ end
128
+
129
+ # Message contains the message descriptor (MQMD), data
130
+ # and any headers.
131
+ #
132
+ # Note:
133
+ # * The format in the descriptor applies only to the format of the data portion,
134
+ # not the format of any included headers
135
+ # * The message format can ONLY be supplied in the descriptor.
136
+ # * I.e. It is the format of the data, Not the headers.
137
+ # * On the wire formats are determined automatically by the :header_type key for
138
+ # each header
139
+ # * Other WebSphere MQ interfaces require that the formats be "daisy-chained"
140
+ # * I.e. The MQMD.Format is actually the format of the first header
141
+ # * Ruby WMQ removes this tedious requirement and performs this
142
+ # requirement automatically under the covers
143
+ # * The format of any header should not be supplied in the descriptor or any header
144
+ #
145
+ # Message has the following attributes:
146
+ # * descriptor = {
147
+ # # WebSphere MQ Equivalent
148
+ # :format => WMQ::MQFMT_STRING, # MQMD.Format - Format of data only
149
+ # WMQ::MQFMT_NONE # Do not supply header formats here
150
+ # :original_length => Number # MQMD.OriginalLength
151
+ # :priority => 0 .. 9 # MQMD.Priority
152
+ # :put_time => String # MQMD.PutTime
153
+ # :msg_id => String ...
154
+ # :expiry => Number
155
+ # :persistence => Number
156
+ # :reply_to_q => String
157
+ # :correl_id => String
158
+ # :feedback => Number
159
+ # :offset => Number
160
+ # :report => Number
161
+ # :msg_flags => Number
162
+ # :reply_to_q_mgr => String
163
+ # :appl_identity_data => String
164
+ # :put_appl_name => String
165
+ # :user_identifier => String
166
+ # :msg_seq_number => Number
167
+ # :appl_origin_data => String
168
+ # :accounting_token => String
169
+ # :backout_count => Number
170
+ # :coded_char_set_id => Number
171
+ # :put_appl_type => Number
172
+ # :msg_type => Number
173
+ # :group_id => String
174
+ # :put_date => String
175
+ # :encoding => Number
176
+ # }
177
+ # * data => String
178
+ # * headers => Array of Hashes
179
+ # * Note: Do not supply the format of any header. Ruby WMQ does this for you.
180
+ #
181
+ # The following headers are supported:
182
+ # * Rules And Formatting Header (RFH)
183
+ # :header_type => :rf_header
184
+ # :....
185
+ # * Rules and Formatting V2 Header (RFH2)
186
+ # ....
187
+ # * Dead Letter Header
188
+ # * CICS Header
189
+ # * IMS Header
190
+ # * Transmission Queue Header
191
+ # * ...
192
+ class Message
193
+ attr_reader :data, :descriptor, :headers
194
+ attr_writer :data, :descriptor, :headers
195
+ end
196
+
197
+ end
@@ -0,0 +1,299 @@
1
+ # Shift include path to use locally built copy of rubywmq - For testing dev builds only
2
+ #$:.unshift '../lib'
3
+
4
+ require 'wmq/wmq'
5
+ require 'wmq/wmq_const_admin'
6
+ require 'test/unit'
7
+ class TestTest < Test::Unit::TestCase
8
+
9
+ def setup
10
+ puts '****** setup: start ******'
11
+ @queue_manager = WMQ::QueueManager.new(:q_mgr_name => 'REID') #, :connection_name=>'localhost(1414)')
12
+ @queue_manager.connect
13
+
14
+ # Create Queue and clear any messages from the queue
15
+ @in_queue = WMQ::Queue.new(:queue_manager=>@queue_manager,
16
+ :mode=>:input,
17
+ :dynamic_q_name=>'UNIT.TEST.*',
18
+ :q_name=>'SYSTEM.DEFAULT.MODEL.QUEUE',
19
+ :fail_if_exists=>false)
20
+ @in_queue.open
21
+ @in_queue.each { |message| }
22
+
23
+ # Open same queue for Output. Queue should be created by now
24
+ @out_queue = WMQ::Queue.new(:queue_manager=>@queue_manager,
25
+ :mode=>:output,
26
+ :q_name=>@in_queue.name)
27
+ @out_queue.open
28
+ puts '****** setup: end ******'
29
+ end
30
+
31
+ def teardown
32
+ puts '****** teardown: start ******'
33
+ @out_queue.close
34
+ @in_queue.close
35
+ @queue_manager.disconnect
36
+ puts '****** teardown: end ******'
37
+ end
38
+
39
+ def test_exceptions
40
+ puts '****** test_exceptions: start ******'
41
+ assert_raise(TypeError) { WMQ::QueueManager.new(1) }
42
+ assert_nothing_raised { WMQ::QueueManager.new(:exception_on_error=>nil) }
43
+ assert_raise(TypeError) { WMQ::QueueManager.new(:exception_on_error=>1) }
44
+ assert_raise(TypeError) { WMQ::QueueManager.new(:q_mgr_name=>2).connect }
45
+ assert_raise(WMQ::WMQException) { WMQ::QueueManager.new(:q_mgr_name=>'bad').connect }
46
+ puts '****** test_exceptions: end ******'
47
+ end
48
+
49
+ def test_queue_manager
50
+ puts '****** test_queue_manager ******'
51
+ assert_equal(Object, WMQ::QueueManager.superclass)
52
+ assert_equal(WMQ::QueueManager, @queue_manager.class)
53
+ end
54
+
55
+ def test_1
56
+ puts '****** test_1 ******'
57
+ assert_equal(@out_queue.put(:data=>'Hello World'), true)
58
+ message = WMQ::Message.new
59
+ assert_equal(@in_queue.get(:message=>message), true)
60
+ assert_equal(message.data, 'Hello World')
61
+ end
62
+
63
+ def test_dynamic_buffer
64
+ puts '****** test_dynamic_buffer ******'
65
+ # Clear out queue of any messages
66
+ @in_queue.each { |message| }
67
+
68
+ test_sizes = [0, 1, 100, 101, 102, 500, 65534, 65535, 65536, 65537, 1*1024*1024, 4*1024*1024]
69
+ test_sizes.each do |size|
70
+ str = '0123456789ABCDEF' * (size/16) + '0123456789ABCDEF'[0,size%16]
71
+ assert_equal(str.length, size)
72
+ assert_equal(@out_queue.put(:data=>str), true)
73
+ end
74
+
75
+ # First test the browse mechanism
76
+ counter = 0
77
+ @queue_manager.open_queue(:mode=>:browse, :q_name=>@in_queue.name) do |browse_queue|
78
+ browse_queue.each do |message|
79
+ size = test_sizes[counter]
80
+ assert_equal(size, message.data.length)
81
+ str = '0123456789ABCDEF' * (size/16) + '0123456789ABCDEF'[0,size%16]
82
+ assert_equal(str, message.data)
83
+ counter = counter + 1
84
+ end
85
+ end
86
+ assert_equal(test_sizes.size, counter)
87
+
88
+ # Now retrieve the messages destructively
89
+ message = WMQ::Message.new
90
+ test_sizes.each do |size|
91
+ assert_equal(true, @in_queue.get(:message=>message, :match=>WMQ::MQMO_NONE))
92
+ assert_equal(size, message.data.length)
93
+ str = '0123456789ABCDEF' * (size/16) + '0123456789ABCDEF'[0,size%16]
94
+ assert_equal(str, message.data)
95
+ end
96
+ end
97
+
98
+ def test_q_name_hash
99
+ puts '****** test_q_name_hash ******'
100
+ @queue_manager.open_queue(:mode=>:output,
101
+ :q_name=>{:q_name=>@in_queue.name,
102
+ :q_mgr_name=>@queue_manager.name}
103
+ ) do |test_queue|
104
+ assert_equal(true, test_queue.put(:data=>'Hello World'))
105
+ message = WMQ::Message.new
106
+ assert_equal(true, @in_queue.get(:message=>message))
107
+ assert_equal('Hello World', message.data)
108
+ end
109
+ end
110
+
111
+ def test_execute
112
+ puts '****** test_execute ******'
113
+ array = @queue_manager.inquire_q(:q_name=>@in_queue.name, :q_type=>WMQ::MQQT_LOCAL, :current_q_depth=>nil)
114
+ assert_equal(1, array.size)
115
+ assert_equal(@in_queue.name, array[0][:q_name])
116
+
117
+ assert_equal(true, @queue_manager.inquire_process(:process_name=>'*').size>0)
118
+ assert_raise(WMQ::WMQException) { @queue_manager.inquire_q(:q_name=>'BADQUEUENAME*') }
119
+ assert_equal(1, @queue_manager.ping_q_mgr.size)
120
+ end
121
+
122
+ def test_mqsc
123
+ puts '****** test_mqsc ******'
124
+ array = @queue_manager.mqsc("dis ql(#{@in_queue.name})")
125
+ assert_equal(1, array.size)
126
+ assert_equal(true, array[0].include?("QUEUE(#{@in_queue.name})"))
127
+ end
128
+
129
+ def test_put1
130
+ puts '****** test_put1 ******'
131
+ data = 'Some Test Data'
132
+ assert_equal(true,@queue_manager.put(:q_name=>@in_queue.name, :data=>data))
133
+
134
+ message = WMQ::Message.new
135
+ assert_equal(true, @in_queue.get(:message=>message))
136
+ assert_equal(data, message.data)
137
+ end
138
+
139
+ def verify_header(header, format)
140
+ verify_multiple_headers([header], format)
141
+ end
142
+
143
+ def verify_multiple_headers(headers, format)
144
+ data = 'Some Test Data'
145
+ message = WMQ::Message.new
146
+ message.data = data
147
+ message.descriptor[:format] = format
148
+ message.headers = headers
149
+ #assert_equal(true,@queue_manager.put(:q_name=>@in_queue.name, :message=>message))
150
+ assert_equal(true,@out_queue.put(:message=>message))
151
+
152
+ message = WMQ::Message.new
153
+ assert_equal(true, @in_queue.get(:message=>message))
154
+ assert_equal(data, message.data)
155
+ assert_equal(headers.size, message.headers.size)
156
+ count = 0
157
+ headers.each do |header|
158
+ reply_header = message.headers[count]
159
+ header.each_pair{|key, value| assert_equal(value, reply_header[key])}
160
+ count = count + 1
161
+ end
162
+ end
163
+
164
+ def test_dlh
165
+ puts '****** test_dlh ******'
166
+ dlh = {:header_type =>:dead_letter_header,
167
+ :reason => WMQ::MQRC_UNKNOWN_REMOTE_Q_MGR,
168
+ :dest_q_name =>'ORIGINAL_QUEUE_NAME',
169
+ :dest_q_mgr_name =>'BAD_Q_MGR',
170
+ :put_appl_name =>'TestApp.exe',
171
+ }
172
+
173
+ verify_header(dlh, WMQ::MQFMT_DEAD_LETTER_HEADER)
174
+ # Untested keys:
175
+ #:put_date=>"",
176
+ #:put_time=>"",
177
+ #:encoding=>0,
178
+ #:coded_char_set_id=>437,
179
+ #:put_appl_type=>0,
180
+
181
+ # Test again, but use QueueManager#put this time
182
+ data = 'Some Test Data'
183
+ message = WMQ::Message.new
184
+ message.data = data
185
+ message.descriptor[:format] = WMQ::MQFMT_STRING
186
+ message.headers << dlh
187
+ assert_equal(true,@queue_manager.put(:q_name=>@in_queue.name, :message=>message))
188
+
189
+ message = WMQ::Message.new
190
+ assert_equal(true, @in_queue.get(:message=>message))
191
+ assert_equal(data, message.data)
192
+ assert_equal(1, message.headers.size)
193
+ reply_header = message.headers[0]
194
+
195
+ dlh.each_pair{|key, value| assert_equal(value, reply_header[key])}
196
+ end
197
+
198
+ def test_cics
199
+ puts '****** test_cics ******'
200
+ cics = {:header_type =>:cics,
201
+ :reason =>WMQ::MQRC_UNKNOWN_REMOTE_Q_MGR,
202
+ :facility =>'TOKEN123',
203
+ :reply_to_format =>WMQ::MQFMT_STRING,
204
+ }
205
+ verify_header(cics, WMQ::MQFMT_NONE)
206
+ end
207
+
208
+ def test_ims
209
+ puts '****** test_ims ******'
210
+ ims = {:header_type =>:ims,
211
+ :l_term_override =>'LTERM',
212
+ :reply_to_format =>WMQ::MQFMT_STRING,
213
+ }
214
+ verify_header(ims, WMQ::MQFMT_STRING)
215
+ end
216
+
217
+ def test_transmission_header
218
+ puts '****** test_transmission_header ******'
219
+ xqh = {:header_type =>:xmit_q_header,
220
+ :remote_q_name =>'SOME_REMOTE_QUEUE',
221
+ :remote_q_mgr_name=>'SOME_REMOTE_Q_MGR',
222
+ :msg_type =>WMQ::MQMT_REQUEST,
223
+ :msg_id =>'my message Id',
224
+ }
225
+ verify_header(xqh, WMQ::MQFMT_STRING)
226
+ end
227
+
228
+ def test_rf_header
229
+ puts '****** test_rf_header ******'
230
+ rfh = {:header_type =>:rf_header,
231
+ :name_value => {' name s' => ' v a "l" u e 1 ',
232
+ 'n a m e 2 ' => 'v a l u e 2',
233
+ '' => ['"', '""', '"""', '""""', ''],
234
+ 'name3'=>['"value3"', '', '"',' value 43"']},
235
+ }
236
+ verify_header(rfh, WMQ::MQFMT_STRING)
237
+ end
238
+
239
+ def test_rf_header_2
240
+ puts '****** test_rf_header_2 ******'
241
+ rfh2 = {:header_type =>:rf_header_2,
242
+ :xml => ['<hello>to the world</hello>',
243
+ '<another>xml like string</another>'],
244
+ }
245
+ verify_header(rfh2, WMQ::MQFMT_STRING)
246
+ end
247
+
248
+ def test_multiple_headers
249
+ puts '****** test_multiple_headers ******'
250
+ headers = [{:header_type => :rf_header_2,
251
+ :xml => ['<hello>to the world</hello>',
252
+ '<another>xml like string</another>'],},
253
+
254
+ {:header_type => :rf_header,
255
+ :name_value => {' name s' => ' v a l u e 1 ',
256
+ 'n a m e 2 ' => 'v a l u e 2',
257
+ 'name3'=>['value3', '', 'value 43']} },
258
+
259
+ {:header_type => :ims,
260
+ :l_term_override => 'LTERM',
261
+ :reply_to_format => WMQ::MQFMT_STRING},
262
+
263
+ {:header_type => :rf_header,
264
+ :name_value => {' name s' => ' v a l u e 1 ',
265
+ 'n a m e 2 ' => 'v a l u e 2',
266
+ 'name3'=>['value3', '', 'value 43']} },
267
+
268
+ {:header_type => :cics,
269
+ :reason => WMQ::MQRC_UNKNOWN_REMOTE_Q_MGR,
270
+ :facility => 'TOKEN123',
271
+ :reply_to_format => WMQ::MQFMT_STRING},
272
+
273
+ {:header_type => :rf_header_2,
274
+ :xml => ['<hello>to the world</hello>', '<another>xml like string</another>'],},
275
+
276
+ {:header_type => :xmit_q_header,
277
+ :remote_q_name => 'SOME_REMOTE_QUEUE',
278
+ :remote_q_mgr_name=> 'SOME_REMOTE_Q_MGR',
279
+ :msg_type => WMQ::MQMT_REQUEST,
280
+ :msg_id => 'my message Id'},
281
+ ]
282
+ verify_multiple_headers(headers, WMQ::MQFMT_STRING)
283
+ end
284
+
285
+ def test_xmit_multiple_headers
286
+ puts '****** test_xmit_q_header with ims header ******'
287
+ headers = [{:header_type => :xmit_q_header,
288
+ :remote_q_name => 'SOME_REMOTE_QUEUE',
289
+ :remote_q_mgr_name=> 'SOME_REMOTE_Q_MGR',
290
+ :msg_type => WMQ::MQMT_REQUEST,
291
+ :msg_id => 'my message Id'},
292
+
293
+ {:header_type => :ims,
294
+ :l_term_override => 'LTERM',
295
+ :reply_to_format => WMQ::MQFMT_STRING},
296
+ ]
297
+ verify_multiple_headers(headers, WMQ::MQFMT_STRING)
298
+ end
299
+ end