r2corba 1.6.1-x64-mingw-ucrt

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (237) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGES +173 -0
  3. data/LICENSE +59 -0
  4. data/README.rdoc +62 -0
  5. data/THANKS +54 -0
  6. data/bin/r2corba +8 -0
  7. data/bin/r2corba.bat +20 -0
  8. data/bin/ridlc +11 -0
  9. data/bin/ridlc.bat +23 -0
  10. data/bin/rins +7 -0
  11. data/bin/rins.bat +19 -0
  12. data/ext/.keep +0 -0
  13. data/lib/corba/cbase/IORMap.rb +32 -0
  14. data/lib/corba/cbase/ORB.rb +239 -0
  15. data/lib/corba/cbase/Request.rb +133 -0
  16. data/lib/corba/cbase/Streams.rb +128 -0
  17. data/lib/corba/cbase/Stub.rb +18 -0
  18. data/lib/corba/cbase/Typecode.rb +440 -0
  19. data/lib/corba/cbase/Values.rb +130 -0
  20. data/lib/corba/cbase/exception.rb +67 -0
  21. data/lib/corba/cbase/poa.rb +22 -0
  22. data/lib/corba/cbase/policies.rb +77 -0
  23. data/lib/corba/cbase/post_require.rb +13 -0
  24. data/lib/corba/cbase/require.rb +36 -0
  25. data/lib/corba/cmds/base.rb +84 -0
  26. data/lib/corba/cmds/test.rb +29 -0
  27. data/lib/corba/common/Any.rb +91 -0
  28. data/lib/corba/common/IDL.rb +100 -0
  29. data/lib/corba/common/ORB.rb +367 -0
  30. data/lib/corba/common/Object.rb +211 -0
  31. data/lib/corba/common/Request.rb +19 -0
  32. data/lib/corba/common/Servant.rb +107 -0
  33. data/lib/corba/common/Struct.rb +21 -0
  34. data/lib/corba/common/Stub.rb +78 -0
  35. data/lib/corba/common/Typecode.rb +1147 -0
  36. data/lib/corba/common/Union.rb +60 -0
  37. data/lib/corba/common/Values.rb +92 -0
  38. data/lib/corba/common/const.rb +21 -0
  39. data/lib/corba/common/exception.rb +68 -0
  40. data/lib/corba/common/require.rb +34 -0
  41. data/lib/corba/common/version.rb +21 -0
  42. data/lib/corba/idl/BiDirPolicyC.rb +62 -0
  43. data/lib/corba/idl/CosNamingC.rb +460 -0
  44. data/lib/corba/idl/CosNamingS.rb +308 -0
  45. data/lib/corba/idl/IDL.rb +20 -0
  46. data/lib/corba/idl/IORTable.pidl +61 -0
  47. data/lib/corba/idl/IORTableC.rb +116 -0
  48. data/lib/corba/idl/MessagingC.rb +903 -0
  49. data/lib/corba/idl/POAC.rb +929 -0
  50. data/lib/corba/idl/TAO_Ext.pidl +45 -0
  51. data/lib/corba/idl/TAO_ExtC.rb +178 -0
  52. data/lib/corba/idl/r2c_orb.rb +571 -0
  53. data/lib/corba/idl/require.rb +19 -0
  54. data/lib/corba/jbase/Any.rb +274 -0
  55. data/lib/corba/jbase/IORMap.rb +35 -0
  56. data/lib/corba/jbase/ORB.rb +111 -0
  57. data/lib/corba/jbase/Object.rb +98 -0
  58. data/lib/corba/jbase/Request.rb +225 -0
  59. data/lib/corba/jbase/Servant.rb +247 -0
  60. data/lib/corba/jbase/ServerRequest.rb +127 -0
  61. data/lib/corba/jbase/Streams.rb +734 -0
  62. data/lib/corba/jbase/Stub.rb +37 -0
  63. data/lib/corba/jbase/Typecode.rb +520 -0
  64. data/lib/corba/jbase/Values.rb +174 -0
  65. data/lib/corba/jbase/exception.rb +106 -0
  66. data/lib/corba/jbase/poa.rb +228 -0
  67. data/lib/corba/jbase/policies.rb +299 -0
  68. data/lib/corba/jbase/post_require.rb +13 -0
  69. data/lib/corba/jbase/require.rb +92 -0
  70. data/lib/corba/naming.rb +13 -0
  71. data/lib/corba/naming_service.rb +14 -0
  72. data/lib/corba/poa.rb +14 -0
  73. data/lib/corba/policies.rb +17 -0
  74. data/lib/corba/require.rb +16 -0
  75. data/lib/corba/svcs/ins/cos_naming.rb +432 -0
  76. data/lib/corba/svcs/ins/ins.rb +525 -0
  77. data/lib/corba/svcs/ins/naming_service.rb +118 -0
  78. data/lib/corba.rb +15 -0
  79. data/lib/ridlbe/ruby/config.rb +340 -0
  80. data/lib/ridlbe/ruby/orb.pidlc +0 -0
  81. data/lib/ridlbe/ruby/require.rb +15 -0
  82. data/lib/ridlbe/ruby/walker.rb +1605 -0
  83. data/mkrf_conf_bingem.rb +149 -0
  84. data/rakelib/bin.rake +79 -0
  85. data/rakelib/bin.rb +145 -0
  86. data/rakelib/build.rake +87 -0
  87. data/rakelib/config.rake +51 -0
  88. data/rakelib/config.rb +542 -0
  89. data/rakelib/ext.rake +183 -0
  90. data/rakelib/ext.rb +277 -0
  91. data/rakelib/ext_r2tao.rb +208 -0
  92. data/rakelib/gem.rake +251 -0
  93. data/rakelib/gem.rb +145 -0
  94. data/rakelib/package.rake +25 -0
  95. data/rakelib/test.rake +22 -0
  96. data/test/BiDirectional/Test.idl +33 -0
  97. data/test/BiDirectional/client.rb +131 -0
  98. data/test/BiDirectional/run_test.rb +67 -0
  99. data/test/BiDirectional/server.rb +167 -0
  100. data/test/CORBA_Services/Naming/BindingIterator/Test.idl +26 -0
  101. data/test/CORBA_Services/Naming/BindingIterator/client.rb +120 -0
  102. data/test/CORBA_Services/Naming/BindingIterator/run_test.rb +81 -0
  103. data/test/CORBA_Services/Naming/BindingIterator/server.rb +108 -0
  104. data/test/CORBA_Services/Naming/Corbaname/Test.idl +26 -0
  105. data/test/CORBA_Services/Naming/Corbaname/client.rb +84 -0
  106. data/test/CORBA_Services/Naming/Corbaname/run_test.rb +87 -0
  107. data/test/CORBA_Services/Naming/Corbaname/server.rb +134 -0
  108. data/test/CORBA_Services/Naming/Simple/Test.idl +26 -0
  109. data/test/CORBA_Services/Naming/Simple/client.rb +83 -0
  110. data/test/CORBA_Services/Naming/Simple/run_test.rb +81 -0
  111. data/test/CORBA_Services/Naming/Simple/server.rb +108 -0
  112. data/test/Collocation/Diamond.idl +38 -0
  113. data/test/Collocation/run_test.rb +51 -0
  114. data/test/Collocation/test.rb +201 -0
  115. data/test/Connect_Timeout/Test.idl +26 -0
  116. data/test/Connect_Timeout/client.rb +109 -0
  117. data/test/Connect_Timeout/run_test.rb +51 -0
  118. data/test/DII/Test.idl +26 -0
  119. data/test/DII/client.rb +114 -0
  120. data/test/DII/run_test.rb +68 -0
  121. data/test/DII/server.rb +94 -0
  122. data/test/DSI/Test.idl +26 -0
  123. data/test/DSI/client.rb +65 -0
  124. data/test/DSI/run_test.rb +68 -0
  125. data/test/DSI/server.rb +105 -0
  126. data/test/Exceptions/Test.idl +47 -0
  127. data/test/Exceptions/client.rb +117 -0
  128. data/test/Exceptions/run_test.rb +68 -0
  129. data/test/Exceptions/server.rb +130 -0
  130. data/test/Hello/Test.idl +26 -0
  131. data/test/Hello/client.rb +77 -0
  132. data/test/Hello/run_test.rb +70 -0
  133. data/test/Hello/server.rb +94 -0
  134. data/test/IDL_Test/Test.idl +116 -0
  135. data/test/IDL_Test/Test_inc.idl +17 -0
  136. data/test/IDL_Test/client.rb +103 -0
  137. data/test/IDL_Test/run_test.rb +68 -0
  138. data/test/IDL_Test/server.rb +103 -0
  139. data/test/IORMap/Test.idl +26 -0
  140. data/test/IORMap/client.rb +72 -0
  141. data/test/IORMap/run_test.rb +68 -0
  142. data/test/IORMap/server.rb +113 -0
  143. data/test/IORTable/Test.idl +26 -0
  144. data/test/IORTable/client.rb +74 -0
  145. data/test/IORTable/run_test.rb +68 -0
  146. data/test/IORTable/server.rb +129 -0
  147. data/test/Implicit_Conversion/Test.idl +30 -0
  148. data/test/Implicit_Conversion/client.rb +112 -0
  149. data/test/Implicit_Conversion/run_test.rb +68 -0
  150. data/test/Implicit_Conversion/server.rb +98 -0
  151. data/test/Multi_Threading/Multiple_ORB/Test.idl +26 -0
  152. data/test/Multi_Threading/Multiple_ORB/client.rb +81 -0
  153. data/test/Multi_Threading/Multiple_ORB/run_test.rb +70 -0
  154. data/test/Multi_Threading/Multiple_ORB/server.rb +107 -0
  155. data/test/Multi_Threading/Simple/Test.idl +26 -0
  156. data/test/Multi_Threading/Simple/client.rb +92 -0
  157. data/test/Multi_Threading/Simple/run_test.rb +68 -0
  158. data/test/Multi_Threading/Simple/server.rb +117 -0
  159. data/test/Multi_Threading/Threads/Test.idl +27 -0
  160. data/test/Multi_Threading/Threads/client.rb +77 -0
  161. data/test/Multi_Threading/Threads/run_test.rb +75 -0
  162. data/test/Multi_Threading/Threads/server.rb +116 -0
  163. data/test/Multi_Threading/Threads/watchdog.rb +87 -0
  164. data/test/Multiple_Servant_Interfaces/Test.idl +33 -0
  165. data/test/Multiple_Servant_Interfaces/client.rb +69 -0
  166. data/test/Multiple_Servant_Interfaces/run_test.rb +68 -0
  167. data/test/Multiple_Servant_Interfaces/server.rb +101 -0
  168. data/test/Nil/Test.idl +26 -0
  169. data/test/Nil/run_test.rb +51 -0
  170. data/test/Nil/test.rb +80 -0
  171. data/test/OBV/AbstractInterface/client.rb +178 -0
  172. data/test/OBV/AbstractInterface/run_test.rb +68 -0
  173. data/test/OBV/AbstractInterface/server.rb +149 -0
  174. data/test/OBV/AbstractInterface/test.idl +52 -0
  175. data/test/OBV/Custom/OBV.idl +18 -0
  176. data/test/OBV/Custom/OBV_impl.rb +41 -0
  177. data/test/OBV/Custom/client.rb +85 -0
  178. data/test/OBV/Custom/run_test.rb +68 -0
  179. data/test/OBV/Custom/server.rb +99 -0
  180. data/test/OBV/Simple/OBV.idl +15 -0
  181. data/test/OBV/Simple/OBV_impl.rb +26 -0
  182. data/test/OBV/Simple/client.rb +85 -0
  183. data/test/OBV/Simple/run_test.rb +68 -0
  184. data/test/OBV/Simple/server.rb +99 -0
  185. data/test/OBV/Simple_Event/Event.idl +15 -0
  186. data/test/OBV/Simple_Event/Event_impl.rb +26 -0
  187. data/test/OBV/Simple_Event/client.rb +85 -0
  188. data/test/OBV/Simple_Event/run_test.rb +68 -0
  189. data/test/OBV/Simple_Event/server.rb +99 -0
  190. data/test/OBV/Supports/client.rb +115 -0
  191. data/test/OBV/Supports/run_test.rb +68 -0
  192. data/test/OBV/Supports/server.rb +102 -0
  193. data/test/OBV/Supports/supports.idl +32 -0
  194. data/test/OBV/Supports/supports_impl.rb +59 -0
  195. data/test/OBV/Tree/client.rb +115 -0
  196. data/test/OBV/Tree/run_test.rb +68 -0
  197. data/test/OBV/Tree/server.rb +116 -0
  198. data/test/OBV/Tree/test.idl +31 -0
  199. data/test/OBV/Truncatable/Extra.idl +26 -0
  200. data/test/OBV/Truncatable/Truncatable.idl +105 -0
  201. data/test/OBV/Truncatable/Truncatable_impl.rb +85 -0
  202. data/test/OBV/Truncatable/client.rb +278 -0
  203. data/test/OBV/Truncatable/run_test.rb +68 -0
  204. data/test/OBV/Truncatable/server.rb +88 -0
  205. data/test/OBV/ValueBox/client.rb +497 -0
  206. data/test/OBV/ValueBox/run_test.rb +68 -0
  207. data/test/OBV/ValueBox/server.rb +271 -0
  208. data/test/OBV/ValueBox/valuebox.idl +101 -0
  209. data/test/OBV/ValueBox/vb_basic.idl +75 -0
  210. data/test/OBV/ValueBox/vb_struct.idl +68 -0
  211. data/test/OBV/ValueBox/vb_union.idl +21 -0
  212. data/test/Object/Test.idl +26 -0
  213. data/test/Object/client.rb +111 -0
  214. data/test/Object/run_test.rb +68 -0
  215. data/test/Object/server.rb +125 -0
  216. data/test/POA/Test.idl +27 -0
  217. data/test/POA/run_test.rb +51 -0
  218. data/test/POA/test.rb +111 -0
  219. data/test/Param_Test/Test.idl +182 -0
  220. data/test/Param_Test/client.rb +276 -0
  221. data/test/Param_Test/run_test.rb +68 -0
  222. data/test/Param_Test/server.rb +295 -0
  223. data/test/Performance/Simple/Test.idl +26 -0
  224. data/test/Performance/Simple/client.rb +89 -0
  225. data/test/Performance/Simple/run_test.rb +68 -0
  226. data/test/Performance/Simple/server.rb +94 -0
  227. data/test/Policies/Test.idl +26 -0
  228. data/test/Policies/run_test.rb +51 -0
  229. data/test/Policies/test.rb +142 -0
  230. data/test/Timeout/client.rb +206 -0
  231. data/test/Timeout/run_test.rb +68 -0
  232. data/test/Timeout/server.rb +108 -0
  233. data/test/Timeout/test.idl +18 -0
  234. data/test/lib/assert.rb +41 -0
  235. data/test/lib/test.rb +546 -0
  236. data/test/test_runner.rb +191 -0
  237. metadata +318 -0
@@ -0,0 +1,276 @@
1
+ #--------------------------------------------------------------------
2
+ #
3
+ # Author: Martin Corino
4
+ #
5
+ # This program is free software; you can redistribute it and/or
6
+ # modify it under the terms of the R2CORBA LICENSE which is
7
+ # included with this program.
8
+ #
9
+ # Copyright (c) Remedy IT Expertise BV
10
+ #--------------------------------------------------------------------
11
+
12
+ require 'optparse'
13
+ require 'lib/assert.rb'
14
+ include TestUtil::Assertions
15
+
16
+ OPTIONS = {
17
+ :use_implement => false,
18
+ :orb_debuglevel => 0,
19
+ :iorfile => 'file://server.ior'
20
+ }
21
+
22
+ ARGV.options do |opts|
23
+ script_name = File.basename($0)
24
+ opts.banner = "Usage: ruby #{script_name} [options]"
25
+
26
+ opts.separator ''
27
+
28
+ opts.on('--k IORFILE',
29
+ 'Set IOR.',
30
+ "Default: 'file://server.ior'") { |v| OPTIONS[:iorfile] = v }
31
+ opts.on('--d LVL',
32
+ 'Set ORBDebugLevel value.',
33
+ 'Default: 0') { |v| OPTIONS[:orb_debuglevel] = v }
34
+ opts.on('--use-implement',
35
+ 'Load IDL through CORBA.implement() instead of precompiled code.',
36
+ 'Default: off') { |v| OPTIONS[:use_implement] = v }
37
+
38
+ opts.separator ''
39
+
40
+ opts.on('-h', '--help',
41
+ 'Show this help message.') { puts opts; exit }
42
+
43
+ opts.parse!
44
+ end
45
+
46
+ if OPTIONS[:use_implement]
47
+ require 'corba'
48
+ CORBA.implement('Test.idl', OPTIONS)
49
+ else
50
+ require 'TestC.rb'
51
+ end
52
+
53
+ orb = CORBA.ORB_init(['-ORBDebugLevel', OPTIONS[:orb_debuglevel]], 'myORB')
54
+
55
+ begin
56
+
57
+ obj = orb.string_to_object(OPTIONS[:iorfile])
58
+
59
+ hello_obj = Test::Hello._narrow(obj)
60
+
61
+ ## integer max/min values test
62
+
63
+ [:max_LongLong,
64
+ :min_LongLong,
65
+ :max_ULongLong,
66
+ :min_ULongLong,
67
+ :max_Long,
68
+ :min_Long,
69
+ :max_ULong,
70
+ :min_ULong,
71
+ :max_Short,
72
+ :min_Short,
73
+ :max_UShort,
74
+ :min_UShort,
75
+ :max_Octet,
76
+ :min_Octet].each do |att|
77
+ att_val = hello_obj.send(att)
78
+ assert "ERROR: value of attribute #{att} (#{att_val}) does not match expected value #{Test.const_get(att.to_s.capitalize)}", Test.const_get(att.to_s.capitalize) == att_val
79
+ end
80
+
81
+ ## string test
82
+
83
+ str = hello_obj.get_string()
84
+
85
+ msg = hello_obj.message
86
+
87
+ hello_obj.message = str
88
+
89
+ assert 'ERROR setting message attribute', str == hello_obj.message
90
+
91
+ ## sequence test
92
+
93
+ nums = hello_obj.numbers
94
+
95
+ begin
96
+ hello_obj.numbers = (0...11).to_a.collect { |i| i * 3 }
97
+ rescue CORBA::MARSHAL => ex
98
+ ## expected exception since sequence can hold max. 10 elements
99
+ end
100
+
101
+ assert "ERROR numbers attribute changed while it shouldn't", nums == hello_obj.numbers
102
+
103
+ hello_obj.numbers = nums.collect { |i| i * 3 }
104
+
105
+ assert_not 'ERROR numbers attribute did not change while it should have', nums == hello_obj.numbers
106
+
107
+ doubles_list = hello_obj.list_of_doubles
108
+
109
+ puts doubles_list.inspect
110
+
111
+ ## (sequence of) struct test
112
+
113
+ svseq = hello_obj.structSeq
114
+
115
+ svseq.each { |sv|
116
+ sv.m_one += 1
117
+ sv.m_two += 1.03
118
+ sv.m_three.upcase!
119
+ sv.m_four.m_b = true
120
+ sv.m_five = Test::TE_FIRST
121
+ }
122
+
123
+ hello_obj.structSeq = svseq
124
+
125
+ ix = 0
126
+ assert_not 'ERROR setting attribute structSeq' do
127
+ hello_obj.structSeq.any? { |sv|
128
+ sv2 = svseq[ix]
129
+ ix += 1
130
+ sv.m_one != sv2.m_one ||
131
+ sv.m_two != sv2.m_two ||
132
+ sv.m_three != sv2.m_three ||
133
+ sv.m_four.m_b != sv2.m_four.m_b ||
134
+ sv.m_five != sv2.m_five
135
+ }
136
+ end
137
+
138
+ ## array test
139
+
140
+ cube = hello_obj.theCube
141
+
142
+ cube2 = cube.collect { |plane|
143
+ plane.collect { |row|
144
+ row.collect { |elem|
145
+ (elem / 3) + (elem % 3)
146
+ }
147
+ }
148
+ }
149
+
150
+ hello_obj.theCube = cube2
151
+
152
+ assert_not 'ERROR setting attribute theCube' do
153
+ cube2 != hello_obj.theCube || cube == hello_obj.theCube
154
+ end
155
+
156
+ ## objref test
157
+
158
+ self_obj = hello_obj.selfref
159
+
160
+ assert 'ERROR with attribute selfref', self_obj.message == hello_obj.message
161
+
162
+ ## Any test
163
+
164
+ any = hello_obj.anyValue
165
+
166
+ hello_obj.anyValue = 1
167
+
168
+ assert_not 'ERROR with attribute anyValue' do
169
+ any == hello_obj.anyValue || 1 == hello_obj.anyValue
170
+ end
171
+
172
+ hello_obj.anyValue = 2
173
+
174
+ assert_not 'ERROR with attribute anyValue' do
175
+ any == hello_obj.anyValue || 2 == hello_obj.anyValue
176
+ end
177
+
178
+ hello_obj.anyValue = 3
179
+
180
+ assert_not 'ERROR with attribute anyValue' do
181
+ any == hello_obj.anyValue || 3 == hello_obj.anyValue
182
+ end
183
+
184
+ ## union test
185
+
186
+ uv1 = hello_obj.unionValue
187
+
188
+ uv2 = uv1.class.new
189
+ uv2.m_l = 1234
190
+
191
+ hello_obj.unionValue = uv2
192
+
193
+ assert_not 'ERROR with attribute unionValue' do
194
+ uv1._disc == hello_obj.unionValue._disc || uv1._value == hello_obj.unionValue._value
195
+ end
196
+
197
+ uv21 = hello_obj.unionValue2
198
+
199
+ uv22 = uv21.class.new
200
+ uv22.s_ = 'bye bye'
201
+
202
+ hello_obj.unionValue2 = uv22
203
+
204
+ assert_not 'ERROR with attribute unionValue2' do
205
+ uv21._disc == hello_obj.unionValue2._disc || uv21._value == hello_obj.unionValue2._value
206
+ end
207
+
208
+ assert_not 'ERROR with attribute unionValue2' do
209
+ uv21._disc == hello_obj.unionValue2._disc || uv21._value == hello_obj.unionValue2._value
210
+ end
211
+
212
+ uv3 = hello_obj.unionValue3
213
+
214
+ assert_except 'ERROR with attribute unionValue3', CORBA::BAD_PARAM do
215
+ uv3._disc = false
216
+ end
217
+
218
+ uv3._default # set implicit default
219
+
220
+ assert 'ERROR with implicit default union U3' do
221
+ uv3._disc == false
222
+ end
223
+
224
+ hello_obj.unionValue3 = uv3
225
+
226
+ assert 'ERROR with implicit default attribute unionValue3' do
227
+ hello_obj.unionValue3._disc == false
228
+ end
229
+
230
+ uv4 = hello_obj.unionValue4
231
+
232
+ assert_except 'ERROR with attribute unionValue4', CORBA::BAD_PARAM do
233
+ uv4._disc = Test::TE_THIRD
234
+ end
235
+
236
+ uv4._default # set implicit default
237
+
238
+ assert 'ERROR with implicit default union U4' do
239
+ uv4._disc == Test::TE_THIRD
240
+ end
241
+
242
+ hello_obj.unionValue4 = uv4
243
+
244
+ assert 'ERROR with implicit default attribute unionValue4' do
245
+ hello_obj.unionValue4._disc == Test::TE_THIRD
246
+ end
247
+
248
+ ## recursive struct test
249
+
250
+ s3val = hello_obj.s3Value
251
+
252
+ s3 = s3val.m_seq.shift
253
+ s3val.m_seq.first.m_seq << s3
254
+ s3val.m_seq.first.m_has_more = true
255
+
256
+ hello_obj.s3Value = s3val
257
+
258
+ assert_not 'ERROR with attribute s3Value' do
259
+ s3val.m_seq.size != hello_obj.s3Value.m_seq.size || s3val.m_seq.first.m_has_more != hello_obj.s3Value.m_seq.first.m_has_more
260
+ end
261
+
262
+ ## in, inout, out test
263
+
264
+ reslen, resinoutstr, resoutstr = hello_obj.run_test(instr = Test::TString.new('This is instr'), inoutstr = 'This is inoutstr')
265
+
266
+ assert_not 'ERROR with run_test' do
267
+ reslen != resoutstr.size || resinoutstr != instr || resoutstr != (instr + inoutstr)
268
+ end
269
+
270
+ hello_obj.shutdown()
271
+
272
+ ensure
273
+
274
+ orb.destroy()
275
+
276
+ end
@@ -0,0 +1,68 @@
1
+ #--------------------------------------------------------------------
2
+ #
3
+ # Author: Martin Corino
4
+ #
5
+ # This program is free software; you can redistribute it and/or
6
+ # modify it under the terms of the R2CORBA LICENSE which is
7
+ # included with this program.
8
+ #
9
+ # Copyright (c) Remedy IT Expertise BV
10
+ #--------------------------------------------------------------------
11
+
12
+ OPTIONS = {
13
+ :debug_opt => '',
14
+ :use_implement => '--use-implement'
15
+ }
16
+
17
+ require 'optparse'
18
+
19
+ ARGV.options do |opts|
20
+ script_name = File.basename($0)
21
+ opts.banner = "Usage: ruby #{script_name} [options]"
22
+
23
+ opts.separator ''
24
+
25
+ opts.on('-d',
26
+ 'Run with debugging output.',
27
+ 'Default: false') { OPTIONS[:debug_opt] = '--d 10' }
28
+ opts.on('--use-stubs',
29
+ 'Use stubs generated by RIDL.',
30
+ 'Default: false (uses embedded IDL)') { OPTIONS[:use_implement] = '' }
31
+
32
+ opts.separator ''
33
+
34
+ opts.on('-h', '--help',
35
+ 'Show this help message.') { puts opts; exit }
36
+
37
+ opts.parse!
38
+ end
39
+
40
+ require 'lib/test.rb'
41
+ include TestUtil
42
+
43
+ ior_file = 'server.ior'
44
+
45
+ TestUtil.remove_file(ior_file)
46
+
47
+ srv = Test.new
48
+
49
+ exit(255) if !srv.run('server.rb', "--o #{ior_file} #{OPTIONS[:debug_opt]} #{OPTIONS[:use_implement]}")
50
+
51
+ TestUtil.wait_for_file(ior_file, 400)
52
+
53
+ clt = Test.new
54
+
55
+ if !clt.run('client.rb', "--k file://#{ior_file} #{OPTIONS[:debug_opt]} #{OPTIONS[:use_implement]}")
56
+ srv.kill(100)
57
+ exit(255)
58
+ end
59
+
60
+ exrc = clt.wait(400)
61
+
62
+ if exrc == 0
63
+ srv.wait(400)
64
+ else
65
+ srv.wait_term(400)
66
+ end
67
+
68
+ exit(exrc)
@@ -0,0 +1,295 @@
1
+ #--------------------------------------------------------------------
2
+ #
3
+ # Author: Martin Corino
4
+ #
5
+ # This program is free software; you can redistribute it and/or
6
+ # modify it under the terms of the R2CORBA LICENSE which is
7
+ # included with this program.
8
+ #
9
+ # Copyright (c) Remedy IT Expertise BV
10
+ #--------------------------------------------------------------------
11
+
12
+ require 'optparse'
13
+
14
+ OPTIONS = {
15
+ :use_implement => false,
16
+ :orb_debuglevel => 0,
17
+ :iorfile => 'server.ior'
18
+ }
19
+
20
+ ARGV.options do |opts|
21
+ script_name = File.basename($0)
22
+ opts.banner = "Usage: ruby #{script_name} [options]"
23
+
24
+ opts.separator ''
25
+
26
+ opts.on('--o IORFILE',
27
+ 'Set IOR filename.',
28
+ "Default: 'server.ior'") { |v| OPTIONS[:iorfile] = v }
29
+ opts.on('--d LVL',
30
+ 'Set ORBDebugLevel value.',
31
+ 'Default: 0') { |v| OPTIONS[:orb_debuglevel] = v }
32
+ opts.on('--use-implement',
33
+ 'Load IDL through CORBA.implement() instead of precompiled code.',
34
+ 'Default: off') { |v| OPTIONS[:use_implement] = v }
35
+
36
+ opts.separator ''
37
+
38
+ opts.on('-h', '--help',
39
+ 'Show this help message.') { puts opts; exit }
40
+
41
+ opts.parse!
42
+ end
43
+
44
+ if OPTIONS[:use_implement]
45
+ require 'corba/poa'
46
+ CORBA.implement('Test.idl', OPTIONS, CORBA::IDL::SERVANT_INTF)
47
+ else
48
+ require 'TestS.rb'
49
+ end
50
+
51
+ class MyHello < POA::Test::Hello
52
+
53
+ def initialize(orb)
54
+ @orb = orb
55
+ @msg = 'message'
56
+ @nums = Test::TShortSeq.new((0...10).collect { |i| i * 2 })
57
+ s1 = Test::S1.new
58
+ s1.m_one = 123
59
+ s1.m_two = 2.54
60
+ s1.m_three = 'field three'
61
+ s1.m_four = Test::S1::S2.new
62
+ s1.m_four.m_b = false
63
+ s1.m_five = ::Test::TE_ZEROTH
64
+ @s1seq = Test::S1Seq.new << s1
65
+ @cube = Test::TLongCube.new((0...3).collect {|x|
66
+ (0...3).collect {|y|
67
+ (0...4).collect {|z| x + (y * 10) + (z * 100) }
68
+ }
69
+ })
70
+ @anysel = 0
71
+ @s3 = Test::S3.new
72
+ @s3.m_has_more = true
73
+ @s3.m_seq = []
74
+ s3_ = Test::S3.new
75
+ s3_.m_has_more = false
76
+ @s3.m_seq << s3_
77
+ s3_ = Test::S3.new
78
+ s3_.m_has_more = false
79
+ @s3.m_seq << s3_
80
+ @u1 = Test::U1.new
81
+ @u1._disc = Test::TE_FIRST
82
+ @u1.m_str = 'Hello world!'
83
+ @u2 = Test::U2.new
84
+ @u2._disc = Test::U2::ONE
85
+ @u2.l_ = 12345
86
+ @u3 = Test::U3.new
87
+ @u3._disc = true
88
+ @u3.lval = 123456
89
+ @u4 = Test::U4.new
90
+ @u4._disc = Test::TE_FIRST
91
+ @u4.m_str = 'Hello world!'
92
+ @nex = 0
93
+ end
94
+
95
+ def max_LongLong()
96
+ Test::Max_longlong
97
+ end # of attribute get_Max_LongLong
98
+
99
+ def min_LongLong()
100
+ Test::Min_longlong
101
+ end # of attribute get_Min_LongLong
102
+
103
+ def max_ULongLong()
104
+ Test::Max_ulonglong
105
+ end # of attribute get_Max_ULongLong
106
+
107
+ def min_ULongLong()
108
+ Test::Min_ulonglong
109
+ end # of attribute get_Min_ULongLong
110
+
111
+ def max_Long()
112
+ Test::Max_long
113
+ end # of attribute get_Max_Long
114
+
115
+ def min_Long()
116
+ Test::Min_long
117
+ end # of attribute get_Min_Long
118
+
119
+ def max_ULong()
120
+ Test::Max_ulong
121
+ end # of attribute get_Max_ULong
122
+
123
+ def min_ULong()
124
+ Test::Min_ulong
125
+ end # of attribute get_Min_ULong
126
+
127
+ def max_Short()
128
+ Test::Max_short
129
+ end # of attribute get_Max_Short
130
+
131
+ def min_Short()
132
+ Test::Min_short
133
+ end # of attribute get_Min_Short
134
+
135
+ def max_UShort()
136
+ Test::Max_ushort
137
+ end # of attribute get_Max_UShort
138
+
139
+ def min_UShort()
140
+ Test::Min_ushort
141
+ end # of attribute get_Min_UShort
142
+
143
+ def max_Octet()
144
+ Test::Max_octet
145
+ end # of attribute get_Max_Octet
146
+
147
+ def min_Octet()
148
+ Test::Min_octet
149
+ end # of attribute get_Min_Octet
150
+
151
+ def get_string()
152
+ 'Hello there!'
153
+ end
154
+
155
+ def message()
156
+ @msg
157
+ end # of attribute get_message
158
+
159
+ def message=(val)
160
+ @msg = val.to_s
161
+ end # of attribute set_message
162
+
163
+ def numbers()
164
+ @nums
165
+ end # of attribute get_numbers
166
+
167
+ def numbers=(val)
168
+ @nums = val
169
+ end # of attribute set_numbers
170
+
171
+ def list_of_doubles()
172
+ [1.0, 1.1, 1.2, 1.3]
173
+ end # of attribute get_numbers
174
+
175
+ def structSeq()
176
+ @s1seq
177
+ end # of attribute get_structSeq
178
+
179
+ def structSeq=(val)
180
+ @s1seq = val
181
+ end # of attribute set_structSeq
182
+
183
+ def theCube()
184
+ @cube
185
+ end # of attribute get_theCube
186
+
187
+ def theCube=(val)
188
+ @cube = val
189
+ end # of attribute set_theCube
190
+
191
+ def anyValue()
192
+ case @anysel
193
+ when 1
194
+ @cube
195
+ when 2
196
+ @s1seq
197
+ when 3
198
+ CORBA::Any.to_any([1, 2, 3, 4, 5], CORBA::TypeCode::Sequence.new(CORBA._tc_long))
199
+ else
200
+ @anysel
201
+ end
202
+ end # of attribute get_anyValue
203
+
204
+ def anyValue=(val)
205
+ @anysel = val.to_i
206
+ end # of attribute set_anyValue
207
+
208
+ def selfref()
209
+ self._this
210
+ end # of attribute get_selfref
211
+
212
+ def s3Value()
213
+ @s3
214
+ end # of attribute get_s3Value
215
+
216
+ def s3Value=(val)
217
+ @s3 = val
218
+ end # of attribute set_s3Value
219
+
220
+ def unionValue()
221
+ @u1
222
+ end # of attribute get_unionValue
223
+
224
+ def unionValue=(val)
225
+ @u1 = val
226
+ end # of attribute set_unionValue
227
+
228
+ def unionValue2()
229
+ @u2
230
+ end # of attribute get_unionValue2
231
+
232
+ def unionValue2=(val)
233
+ @u2 = val
234
+ end # of attribute set_unionValue2
235
+
236
+ def unionValue3()
237
+ @u3
238
+ end # of attribute get_unionValue3
239
+
240
+ def unionValue3=(val)
241
+ @u3 = val
242
+ end # of attribute set_unionValue3
243
+
244
+ def unionValue4()
245
+ @u4
246
+ end # of attribute get_unionValue4
247
+
248
+ def unionValue4=(val)
249
+ @u4 = val
250
+ end # of attribute set_unionValue4
251
+
252
+ def run_test(instr, inoutstr)
253
+ outstr = instr + inoutstr
254
+ inoutstr = instr
255
+ [outstr.size, inoutstr, outstr]
256
+ end
257
+
258
+ def shutdown()
259
+ @orb.shutdown()
260
+ end
261
+ end # of servant Hello
262
+
263
+
264
+ orb = CORBA.ORB_init(['-ORBDebugLevel', OPTIONS[:orb_debuglevel]], 'myORB')
265
+
266
+ obj = orb.resolve_initial_references('RootPOA')
267
+
268
+ root_poa = PortableServer::POA._narrow(obj)
269
+
270
+ poa_man = root_poa.the_POAManager
271
+
272
+ poa_man.activate
273
+
274
+ hello_srv = MyHello.new(orb)
275
+
276
+ hello_oid = root_poa.activate_object(hello_srv)
277
+
278
+ hello_obj = root_poa.id_to_reference(hello_oid)
279
+
280
+ hello_ior = orb.object_to_string(hello_obj)
281
+
282
+ open(OPTIONS[:iorfile], 'w') { |io|
283
+ io.write hello_ior
284
+ }
285
+
286
+ Signal.trap('INT') do
287
+ puts 'SIGINT - shutting down ORB...'
288
+ orb.shutdown()
289
+ end
290
+
291
+ if Signal.list.has_key?('USR2')
292
+ Signal.trap('USR2', 'EXIT')
293
+ end
294
+
295
+ orb.run
@@ -0,0 +1,26 @@
1
+ /*--------------------------------------------------------------------
2
+ * Author: Martin Corino
3
+ *
4
+ * This program is free software; you can redistribute it and/or
5
+ * modify it under the terms of the R2CORBA LICENSE which is
6
+ * included with this program.
7
+ *
8
+ * Copyright (c) Remedy IT Expertise BV
9
+ *--------------------------------------------------------------------*/
10
+
11
+ /// Put the interfaces in a module, to avoid global namespace pollution
12
+ module Test
13
+ {
14
+ /// A very simple interface
15
+ interface Hello
16
+ {
17
+ /// Send some data round
18
+ long do_test (in long count, inout string data);
19
+
20
+ /// A method to shutdown the ORB
21
+ /**
22
+ * This method is used to simplify the test shutdown process
23
+ */
24
+ oneway void shutdown ();
25
+ };
26
+ };