r2corba 1.6.1-x64-mingw-ucrt

Sign up to get free protection for your applications and to get access to all the features.
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,497 @@
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('valuebox.idl', OPTIONS)
49
+ else
50
+ require 'valueboxC'
51
+ end
52
+
53
+ ##
54
+
55
+ module Test
56
+ def Test.basic_invocations(test)
57
+ # test boxed value
58
+ p1 = VBlong.new(25)
59
+ p2 = VBlong.new(53)
60
+ p2_out = nil
61
+ p3_out = nil
62
+ retval = nil
63
+
64
+ STDERR.puts '*** basic_op1 (1)'
65
+ retval, p2_out, p3_out = test.basic_op1(p1, p2)
66
+
67
+ assert 'basic_invocations:1 failed', (p2_out == (53 * 3))
68
+ assert 'basic_invocations:1 failed', (p3_out == (53 * 5))
69
+ assert 'basic_invocations:1 failed', (retval == (p1.value * 3))
70
+
71
+ # test boxed value using implicit conversion of Ruby types
72
+ p1 = 25
73
+ p2 = 53
74
+ p2_out = nil
75
+ p3_out = nil
76
+ retval = nil
77
+
78
+ STDERR.puts '*** basic_op1 (2)'
79
+ retval, p2_out, p3_out = test.basic_op1(p1, p2)
80
+
81
+ assert 'basic_invocations:2 failed', (p2_out == (53 * 3))
82
+ assert 'basic_invocations:2 failed', (p3_out == (53 * 5))
83
+ assert 'basic_invocations:2 failed', (retval == (p1 * 3))
84
+
85
+ # test boxed value using nil
86
+ p1 = nil
87
+ p2 = VBlong.new(53)
88
+ p2_out = nil
89
+ p3_out = nil
90
+ retval = nil
91
+
92
+ STDERR.puts '*** basic_op1 (3)'
93
+ retval, p2_out, p3_out = test.basic_op1(p1, p2)
94
+
95
+ assert 'basic_invocations:2 failed', (p2_out == (53 * 3))
96
+ assert 'basic_invocations:2 failed', (p3_out == (53 * 5))
97
+ assert 'basic_invocations:2 failed', (retval.nil?)
98
+
99
+ # test boxed value from nested module
100
+ p1 = Vb_basic::M_VBlong.new(25) # explicit value box
101
+ p2 = 53 # implicitly converted value
102
+ p2_out = nil
103
+ p3_out = nil
104
+ retval = nil
105
+
106
+ retval, p2_out, p3_out = test.basic_op2(p1, p2)
107
+
108
+ assert 'basic_invocations:3 failed', (p2_out == (53 * 3))
109
+ assert 'basic_invocations:3 failed', (p3_out == (53 * 5))
110
+ assert 'basic_invocations:3 failed', (retval == (p1.value * 3))
111
+
112
+ # test regular Ruby types using values from valueboxes
113
+ p1 = VBlong.new(25)
114
+ p2 = VBlong.new(53)
115
+ p2_out = nil
116
+ p3_out = nil
117
+ retval = nil
118
+
119
+ retval, p2_out, p3_out = test.basic_op3(p1.value, p2.value)
120
+
121
+ assert 'basic_invocations:4 failed', (p2_out == (53 * 3))
122
+ assert 'basic_invocations:4 failed', (p3_out == (53 * 5))
123
+ assert 'basic_invocations:4 failed', (retval == (p1.value * 3))
124
+ end
125
+
126
+ def Test.boxed_string_invocations(test)
127
+ string1 = 'First-string'
128
+ string2 = 'Second-string'
129
+
130
+ # Establish that we have data setup correctly...
131
+ assert 'boxed_string_invocations:0 failed', (string1 < string2)
132
+ assert 'boxed_string_invocations:0 failed', (string2 > string1)
133
+ assert 'boxed_string_invocations:0 failed', (string1 == string1)
134
+
135
+ # create valueboxes
136
+ vbstring1 = VBstring.new(string1.dup)
137
+ vbstring2 = VBstring.new(string1.dup)
138
+
139
+ # check valuebox correctness
140
+ assert 'boxed_string_invocations:1 failed', (vbstring1.value == string1)
141
+ assert 'boxed_string_invocations:1 failed', (vbstring2.value == string1)
142
+
143
+ # test value modifier
144
+ vbstring2.value = string2.dup
145
+ assert 'boxed_string_invocations:2 failed', (vbstring2.value == string2)
146
+
147
+ # test invocation with value boxes
148
+ p1 = VBstring.new('string1')
149
+ p2 = VBstring.new('string2')
150
+ assert 'boxed_string_invocations:3 failed', (p1.value == 'string1')
151
+ assert 'boxed_string_invocations:3 failed', (p2.value == 'string2')
152
+
153
+ p2_out = nil
154
+ p3_out = nil
155
+ retval = nil
156
+ retval, p2_out, p3_out = test.string_op1(p1, p2)
157
+
158
+ assert 'boxed_string_invocations:4 failed', (p2_out == '2string')
159
+ assert 'boxed_string_invocations:4 failed', (p3_out == '2string')
160
+ assert 'boxed_string_invocations:4 failed', (retval == '1string')
161
+
162
+ # test invocation with Ruby types using valuebox values
163
+ assert 'boxed_string_invocations:3 failed', (p1.value == 'string1')
164
+ assert 'boxed_string_invocations:3 failed', (p2.value == 'string2')
165
+
166
+ p2_out = nil
167
+ p3_out = nil
168
+ retval = nil
169
+ retval, p2_out, p3_out = test.string_op2(p1.value, p2.value)
170
+
171
+ assert 'boxed_string_invocations:4 failed', (p2_out == '2string')
172
+ assert 'boxed_string_invocations:4 failed', (p3_out == '2string')
173
+ assert 'boxed_string_invocations:4 failed', (retval == '1string')
174
+ end
175
+
176
+ def Test.boxed_sequence_invocations(test)
177
+ # basic test
178
+ p1 = VBseqlong.new([101, 202, 303])
179
+ assert 'boxed_sequence_invocations:0 failed', (p1.value[0] == 101 && p1.value[2] == 303)
180
+
181
+ # test invocation with value boxes
182
+ p1 = VBseqlong.new([10, 9, 8, 7])
183
+ p2 = VBseqlong.new([100, 99, 98])
184
+ assert 'boxed_sequence_invocations:1 failed', (p1.value[0] == 10 && p1.value[3] == 7)
185
+ assert 'boxed_sequence_invocations:1 failed', (p2.value[0] == 100 && p2.value[2] == 98)
186
+
187
+ p2_out = nil
188
+ p3_out = nil
189
+ retval = nil
190
+ retval, p2_out, p3_out = test.seq_op1(p1, p2)
191
+
192
+ p2.value().each_with_index do |e, i|
193
+ assert 'boxed_sequence_invocations:2 failed', (p2_out[i] == e * 3)
194
+ end
195
+ p2.value().each_with_index do |e, i|
196
+ assert 'boxed_sequence_invocations:2 failed', (p3_out[i] == e * 5)
197
+ end
198
+ p1.value().each_with_index do |e, i|
199
+ assert 'boxed_sequence_invocations:2 failed', (retval[i] == e)
200
+ end
201
+
202
+ # test invocation with Ruby types using valuebox values
203
+ p2_out = nil
204
+ p3_out = nil
205
+ p2_out, p3_out = test.seq_op2(p1.value, p2.value)
206
+
207
+ p2.value().each_with_index do |e, i|
208
+ assert 'boxed_sequence_invocations:3 failed', (p2_out[i] == e * 3)
209
+ end
210
+ p2.value().each_with_index do |e, i|
211
+ assert 'boxed_sequence_invocations:3 failed', (p3_out[i] == e * 5)
212
+ end
213
+ end
214
+
215
+ def Test.boxed_struct_invocations(test)
216
+ # basic test
217
+ p1 = VBfixed_struct1.new(
218
+ Fixed_Struct1.new(29,
219
+ Fixed_Struct1::Bstruct.new(117, 21)))
220
+
221
+ assert 'boxed_struct_invocations:0 failed', (p1.value.is_a?(Fixed_Struct1))
222
+ assert 'boxed_struct_invocations:0 failed', (p1.value.l == 29)
223
+ assert 'boxed_struct_invocations:0 failed', (p1.value.abstruct.s1 == 117 && p1.value.abstruct.s2 == 21)
224
+
225
+ # test invocation with valueboxes
226
+ p2 = VBfixed_struct1.new(
227
+ Fixed_Struct1.new(92,
228
+ Fixed_Struct1::Bstruct.new(171, 12)))
229
+ p2_out = nil
230
+ p3_out = nil
231
+ retval = nil
232
+ retval, p2_out, p3_out = test.struct_op1(p1, p2)
233
+
234
+ assert 'boxed_struct_invocations:1 failed', (p2_out.is_a?(Fixed_Struct1))
235
+ assert 'boxed_struct_invocations:1 failed', (p2_out.l == (92 * 3))
236
+ assert 'boxed_struct_invocations:1 failed', (p2_out.abstruct.s1 == (171 * 3) &&
237
+ p2_out.abstruct.s2 == (12 * 3))
238
+
239
+ assert 'boxed_struct_invocations:1 failed', (p3_out.is_a?(Fixed_Struct1))
240
+ assert 'boxed_struct_invocations:1 failed', (p3_out.l == (92 * 5))
241
+ assert 'boxed_struct_invocations:1 failed', (p3_out.abstruct.s1 == (171 * 5) &&
242
+ p3_out.abstruct.s2 == (12 * 5))
243
+
244
+ assert 'boxed_struct_invocations:1 failed', (retval.is_a?(Fixed_Struct1))
245
+ assert 'boxed_struct_invocations:1 failed', (retval.l == p1.value.l)
246
+ assert 'boxed_struct_invocations:1 failed', (retval.abstruct.s1 == p1.value.abstruct.s1 &&
247
+ retval.abstruct.s2 == p1.value.abstruct.s2)
248
+
249
+ # test invocation with Ruby types using valuebox values
250
+ p2_out, p3_out = test.struct_op2(p1.value, p2_out)
251
+
252
+ assert 'boxed_struct_invocations:2 failed', (p2_out.is_a?(Fixed_Struct1))
253
+ assert 'boxed_struct_invocations:2 failed', (p2_out.l == (92 * 3 * 3))
254
+ assert 'boxed_struct_invocations:2 failed', (p2_out.abstruct.s1 == (171 * 3 * 3) &&
255
+ p2_out.abstruct.s2 == (12 * 3 * 3))
256
+
257
+ assert 'boxed_struct_invocations:2 failed', (p3_out.is_a?(Fixed_Struct1))
258
+ assert 'boxed_struct_invocations:2 failed', (p3_out.l == p1.value.l)
259
+ assert 'boxed_struct_invocations:2 failed', (p3_out.abstruct.s1 == p1.value.abstruct.s1 &&
260
+ p3_out.abstruct.s2 == p1.value.abstruct.s2)
261
+
262
+ # test invocation with valueboxes
263
+ p1 = VBvariable_struct1.new(Variable_Struct1.new(29, 'variable1'))
264
+ p2 = VBvariable_struct1.new(Variable_Struct1.new(37, 'variable2'))
265
+
266
+ assert 'boxed_struct_invocations:3 failed', (p1.value.is_a?(Variable_Struct1))
267
+ assert 'boxed_struct_invocations:3 failed', (p1.value.l == 29)
268
+ assert 'boxed_struct_invocations:3 failed', (p1.value.str == 'variable1')
269
+
270
+ p2_out = nil
271
+ p3_out = nil
272
+ retval = nil
273
+ retval, p2_out, p3_out = test.struct_op3(p1, p2)
274
+
275
+ assert 'boxed_struct_invocations:4 failed', (p2_out.is_a?(Variable_Struct1))
276
+ assert 'boxed_struct_invocations:4 failed', (p2_out.l == (37 * 3))
277
+ assert 'boxed_struct_invocations:4 failed', (p2_out.str == '2variable')
278
+
279
+ assert 'boxed_struct_invocations:4 failed', (p3_out.is_a?(Variable_Struct1))
280
+ assert 'boxed_struct_invocations:4 failed', (p3_out.l == (37 * 3))
281
+ assert 'boxed_struct_invocations:4 failed', (p3_out.str == '2variable')
282
+
283
+ assert 'boxed_struct_invocations:1 failed', (retval.is_a?(Variable_Struct1))
284
+ assert 'boxed_struct_invocations:1 failed', (retval.l == p1.value.l)
285
+ assert 'boxed_struct_invocations:1 failed', (retval.str == p1.value.str)
286
+
287
+ # test invocation with Ruby types using valuebox values
288
+ p2_out, p3_out = test.struct_op4(p1.value, p2_out)
289
+
290
+ assert 'boxed_struct_invocations:4 failed', (p2_out.is_a?(Variable_Struct1))
291
+ assert 'boxed_struct_invocations:4 failed', (p2_out.l == (37 * 3 * 3))
292
+ assert 'boxed_struct_invocations:4 failed', (p2_out.str == 'e2variabl')
293
+
294
+ assert 'boxed_struct_invocations:1 failed', (p3_out.is_a?(Variable_Struct1))
295
+ assert 'boxed_struct_invocations:1 failed', (p3_out.l == p1.value.l)
296
+ assert 'boxed_struct_invocations:1 failed', (p3_out.str == p1.value.str)
297
+ end
298
+
299
+ def Test.boxed_array_invocations(test)
300
+ # basic test
301
+ p1 = VBlongarray.new([101, 202, 303])
302
+ assert 'boxed_array_invocations:0 failed', (p1.value[0] == 101 && p1.value[2] == 303)
303
+
304
+ # test invocation with value boxes
305
+ p1 = VBlongarray.new([10, 9, 8])
306
+ p2 = VBlongarray.new([100, 99, 98])
307
+ assert 'boxed_array_invocations:1 failed', (p1.value[0] == 10 && p1.value[2] == 8)
308
+ assert 'boxed_array_invocations:1 failed', (p2.value[0] == 100 && p2.value[2] == 98)
309
+
310
+ p2_out = nil
311
+ p3_out = nil
312
+ retval = nil
313
+ retval, p2_out, p3_out = test.array_op1(p1, p2)
314
+
315
+ p2.value().each_with_index do |e, i|
316
+ assert 'boxed_array_invocations:2 failed', (p2_out[i] == e * 3)
317
+ end
318
+ p2.value().each_with_index do |e, i|
319
+ assert 'boxed_array_invocations:2 failed', (p3_out[i] == e * 3)
320
+ end
321
+ p1.value().each_with_index do |e, i|
322
+ assert 'boxed_array_invocations:2 failed', (retval[i] == e)
323
+ end
324
+
325
+ # test invocation with Ruby types using valuebox values
326
+ p2_out = nil
327
+ p3_out = nil
328
+ p2_out, p3_out = test.array_op2(p1.value, p2.value)
329
+
330
+ p2.value().each_with_index do |e, i|
331
+ assert 'boxed_array_invocations:3 failed', (p2_out[i] == e * 3)
332
+ end
333
+ p1.value().each_with_index do |e, i|
334
+ assert 'boxed_array_invocations:3 failed', (p3_out[i] == e)
335
+ end
336
+
337
+ # test invocation with value boxes
338
+ p1 = VBstringarray.new(['in string1', 'in string1'])
339
+ p2 = VBstringarray.new(['inout string1', 'inout string1'])
340
+ assert 'boxed_array_invocations:4 failed', (p1.value[0] == 'in string1' && p1.value[1] == 'in string1')
341
+ assert 'boxed_array_invocations:4 failed', (p2.value[0] == 'inout string1' && p2.value[1] == 'inout string1')
342
+
343
+ p2_out = nil
344
+ p3_out = nil
345
+ retval = nil
346
+ retval, p2_out, p3_out = test.array_op3(p1, p2)
347
+
348
+ p2.value().each_with_index do |e, i|
349
+ assert 'boxed_array_invocations:5 failed', (p2_out[i] == '1inout string')
350
+ end
351
+ p2.value().each_with_index do |e, i|
352
+ assert 'boxed_array_invocations:5 failed', (p3_out[i] == '1inout string')
353
+ end
354
+ p1.value().each_with_index do |e, i|
355
+ assert 'boxed_array_invocations:5 failed', (retval[i] == e)
356
+ end
357
+
358
+ # test invocation with Ruby types using valuebox values
359
+ p2_out = nil
360
+ p3_out = nil
361
+ p2_out, p3_out = test.array_op4(p1.value, p2.value)
362
+
363
+ p2.value().each_with_index do |e, i|
364
+ assert 'boxed_array_invocations:6 failed', (p2_out[i] == '1inout string')
365
+ end
366
+ p1.value().each_with_index do |e, i|
367
+ assert 'boxed_array_invocations:6 failed', (p3_out[i] == e)
368
+ end
369
+ end
370
+
371
+ def Test.boxed_union_invocations(test)
372
+ # basic test
373
+ p1 = VBfixed_union1.new(Fixed_Union1.new)
374
+ p1.value.m1 = 321
375
+ p2 = VBfixed_union1.new(Fixed_Union1.new)
376
+ p2.value.m2 = 789
377
+
378
+ assert 'boxed_union_invocations:0 failed', (p1.value.is_a?(Fixed_Union1))
379
+ assert 'boxed_union_invocations:0 failed', (p1.value._disc == 1)
380
+ assert 'boxed_union_invocations:0 failed', (p1.value.m1 == 321)
381
+
382
+ assert 'boxed_union_invocations:0 failed', (p2.value.is_a?(Fixed_Union1))
383
+ assert 'boxed_union_invocations:0 failed', (p2.value._disc == 2)
384
+ assert 'boxed_union_invocations:0 failed', (p2.value.m1 == 789)
385
+
386
+ # test invocation with valueboxes
387
+ p2_out = nil
388
+ p3_out = nil
389
+ retval = nil
390
+ retval, p2_out, p3_out = test.union_op1(p1, p2)
391
+
392
+ assert 'boxed_union_invocations:1 failed', (p2_out.is_a?(Fixed_Union1))
393
+ assert 'boxed_union_invocations:1 failed', (p2_out._disc == 2)
394
+ assert 'boxed_union_invocations:1 failed', (p2_out.m2 == 789 * 3)
395
+
396
+ assert 'boxed_union_invocations:1 failed', (p3_out.is_a?(Fixed_Union1))
397
+ assert 'boxed_union_invocations:1 failed', (p3_out._disc == 1)
398
+ assert 'boxed_union_invocations:1 failed', (p3_out.m1 == 321 * 3)
399
+
400
+ assert 'boxed_union_invocations:1 failed', (retval.is_a?(Fixed_Union1))
401
+ assert 'boxed_union_invocations:1 failed', (retval._disc == 1)
402
+ assert 'boxed_union_invocations:1 failed', (retval.m1 == 321 * 3)
403
+
404
+ # test invocation with Ruby types using valuebox values
405
+ p2_out = nil
406
+ p3_out = nil
407
+ p2_out, p3_out = test.union_op2(p1.value, p2.value)
408
+
409
+ assert 'boxed_union_invocations:1 failed', (p2_out.is_a?(Fixed_Union1))
410
+ assert 'boxed_union_invocations:1 failed', (p2_out._disc == 2)
411
+ assert 'boxed_union_invocations:1 failed', (p2_out.m2 == 789 * 3)
412
+
413
+ assert 'boxed_union_invocations:1 failed', (p3_out.is_a?(Fixed_Union1))
414
+ assert 'boxed_union_invocations:1 failed', (p3_out._disc == 1)
415
+ assert 'boxed_union_invocations:1 failed', (p3_out.m1 == 321)
416
+
417
+ # test invocation with valueboxes
418
+ p1 = VBvariable_union1.new(Variable_Union1.new)
419
+ p1.value.m1 = 321
420
+ p2 = VBvariable_union1.new(Variable_Union1.new)
421
+ p2.value.m2 = 'abracadabra'
422
+
423
+ assert 'boxed_union_invocations:0 failed', (p1.value.is_a?(Variable_Union1))
424
+ assert 'boxed_union_invocations:0 failed', (p1.value._disc == 1)
425
+ assert 'boxed_union_invocations:0 failed', (p1.value.m1 == 321)
426
+
427
+ assert 'boxed_union_invocations:0 failed', (p2.value.is_a?(Variable_Union1))
428
+ assert 'boxed_union_invocations:0 failed', (p2.value._disc == 2)
429
+ assert 'boxed_union_invocations:0 failed', (p2.value.m1 == 'abracadabra')
430
+
431
+ p2_out = nil
432
+ p3_out = nil
433
+ retval = nil
434
+ retval, p2_out, p3_out = test.union_op3(p1, p2)
435
+
436
+ assert 'boxed_union_invocations:1 failed', (p2_out.is_a?(Variable_Union1))
437
+ assert 'boxed_union_invocations:1 failed', (p2_out._disc == 2)
438
+ assert 'boxed_union_invocations:1 failed', (p2_out.m2 == 'aabracadabr')
439
+
440
+ assert 'boxed_union_invocations:1 failed', (p3_out.is_a?(Variable_Union1))
441
+ assert 'boxed_union_invocations:1 failed', (p3_out._disc == 1)
442
+ assert 'boxed_union_invocations:1 failed', (p3_out.m1 == 321)
443
+
444
+ assert 'boxed_union_invocations:1 failed', (retval.is_a?(Variable_Union1))
445
+ assert 'boxed_union_invocations:1 failed', (retval._disc == 1)
446
+ assert 'boxed_union_invocations:1 failed', (retval.m1 == 321)
447
+
448
+ # test invocation with Ruby types using valuebox values
449
+ p2_out = nil
450
+ p3_out = nil
451
+ p2_out, p3_out = test.union_op4(p1.value, p2.value)
452
+
453
+ assert 'boxed_union_invocations:1 failed', (p2_out.is_a?(Variable_Union1))
454
+ assert 'boxed_union_invocations:1 failed', (p2_out._disc == 2)
455
+ assert 'boxed_union_invocations:1 failed', (p2_out.m2 == 'aabracadabr')
456
+
457
+ assert 'boxed_union_invocations:1 failed', (p3_out.is_a?(Variable_Union1))
458
+ assert 'boxed_union_invocations:1 failed', (p3_out._disc == 1)
459
+ assert 'boxed_union_invocations:1 failed', (p3_out.m1 == 321)
460
+
461
+ end
462
+ end
463
+
464
+ ##
465
+
466
+ orb = CORBA.ORB_init(['-ORBDebugLevel', OPTIONS[:orb_debuglevel]], 'myORB')
467
+
468
+ begin
469
+ obj = orb.string_to_object(OPTIONS[:iorfile])
470
+
471
+ assert_not 'Object reference is nil.', CORBA::is_nil(obj)
472
+
473
+ test = Test._narrow(obj)
474
+
475
+ # run tests
476
+
477
+ Test.basic_invocations(test)
478
+
479
+ Test.boxed_string_invocations(test)
480
+
481
+ Test.boxed_sequence_invocations(test)
482
+
483
+ Test.boxed_struct_invocations(test)
484
+
485
+ Test.boxed_array_invocations(test)
486
+
487
+ Test.boxed_union_invocations(test)
488
+
489
+ # shutdown test service
490
+
491
+ test.shutdown()
492
+
493
+ ensure
494
+
495
+ orb.destroy()
496
+
497
+ 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)