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,89 @@
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
+ DATA = 'Hello world! 0123456789012345678901234567890123456789012345678901234567890123456789'
56
+
57
+ begin
58
+
59
+ obj = orb.string_to_object(OPTIONS[:iorfile])
60
+
61
+ hello_obj = Test::Hello._narrow(obj)
62
+
63
+ # run once to initialize the whole path
64
+ hello_obj.do_test(0, DATA)
65
+
66
+ t_start = Time.now
67
+
68
+ # run test
69
+ 10000.times do |i|
70
+ count_, data_ = hello_obj.do_test(i, DATA)
71
+ end
72
+
73
+ t_diff = Time.now - t_start
74
+
75
+ STDERR.puts "*** Avg turnaround time per invocation = #{'%.2f' % (t_diff / 10)} msec"
76
+
77
+ hello_obj.shutdown()
78
+
79
+ assert_not 'ERROR: Object is reported nil!', CORBA::is_nil(hello_obj)
80
+
81
+ hello_obj._free_ref()
82
+
83
+ assert 'ERROR: Object is reported non-nil!', CORBA::is_nil(hello_obj)
84
+
85
+ ensure
86
+
87
+ orb.destroy()
88
+
89
+ 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,94 @@
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
+ def initialize(orb)
53
+ @orb = orb
54
+ end
55
+
56
+ def do_test(count, data)
57
+ [count, data]
58
+ end
59
+
60
+ def shutdown()
61
+ @orb.shutdown()
62
+ end
63
+ end # of servant MyHello
64
+
65
+ orb = CORBA.ORB_init(['-ORBDebugLevel', OPTIONS[:orb_debuglevel]], 'myORB')
66
+
67
+ obj = orb.resolve_initial_references('RootPOA')
68
+
69
+ root_poa = PortableServer::POA._narrow(obj)
70
+
71
+ poa_man = root_poa.the_POAManager
72
+
73
+ poa_man.activate
74
+
75
+ hello_srv = MyHello.new(orb)
76
+
77
+ hello_obj = hello_srv._this()
78
+
79
+ hello_ior = orb.object_to_string(hello_obj)
80
+
81
+ open(OPTIONS[:iorfile], 'w') { |io|
82
+ io.write hello_ior
83
+ }
84
+
85
+ Signal.trap('INT') do
86
+ puts 'SIGINT - shutting down ORB...'
87
+ orb.shutdown()
88
+ end
89
+
90
+ if Signal.list.has_key?('USR2')
91
+ Signal.trap('USR2', 'EXIT')
92
+ end
93
+
94
+ 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
+ /// Return a simple string
18
+ string get_string ();
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
+ };
@@ -0,0 +1,51 @@
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
+ clt = Test.new
44
+
45
+ if !clt.run('test.rb', "#{OPTIONS[:debug_opt]} #{OPTIONS[:use_implement]}")
46
+ exit(255)
47
+ end
48
+
49
+ exrc = clt.wait(400)
50
+
51
+ exit(exrc)
@@ -0,0 +1,142 @@
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
+ }
20
+
21
+ ARGV.options do |opts|
22
+ script_name = File.basename($0)
23
+ opts.banner = "Usage: ruby #{script_name} [options]"
24
+
25
+ opts.separator ''
26
+
27
+ opts.on('--d LVL',
28
+ 'Set ORBDebugLevel value.',
29
+ 'Default: 0') { |v| OPTIONS[:orb_debuglevel] = v }
30
+ opts.on('--use-implement',
31
+ 'Load IDL through CORBA.implement() instead of precompiled code.',
32
+ 'Default: off') { |v| OPTIONS[:use_implement] = v }
33
+
34
+ opts.separator ''
35
+
36
+ opts.on('-h', '--help',
37
+ 'Show this help message.') { puts opts; exit }
38
+
39
+ opts.parse!
40
+ end
41
+
42
+ if OPTIONS[:use_implement]
43
+ require 'corba/poa'
44
+ CORBA.implement('Test.idl', OPTIONS, CORBA::IDL::SERVANT_INTF)
45
+ else
46
+ require 'TestS.rb'
47
+ end
48
+ require 'corba/policies'
49
+
50
+ class MyHello < POA::Test::Hello
51
+ def initialize(orb)
52
+ @orb = orb
53
+ end
54
+
55
+ def get_string()
56
+ 'Hello there!'
57
+ end
58
+
59
+ def shutdown()
60
+ @orb.shutdown()
61
+ end
62
+ end # of servant MyHello
63
+
64
+ if defined?(JRUBY_VERSION)
65
+ ## JacORB needs explicit activation of this option
66
+ props = {
67
+ 'org.omg.PortableInterceptor.ORBInitializerClass.bidir_init' =>
68
+ 'org.jacorb.orb.giop.BiDirConnectionInitializer'
69
+ }
70
+ else
71
+ props = {}
72
+ end
73
+ orb = CORBA.ORB_init(['-ORBDebugLevel', OPTIONS[:orb_debuglevel]], 'myORB', props)
74
+
75
+ begin
76
+
77
+ o = orb.resolve_initial_references('RootPOA')
78
+
79
+ rootpoa = PortableServer::POA._narrow(o)
80
+
81
+ assert_not 'Failed to resolve RootPOA', CORBA.is_nil(rootpoa) || !rootpoa.is_a?(PortableServer::POA)
82
+
83
+ pol = rootpoa.create_thread_policy(PortableServer::SINGLE_THREAD_MODEL)
84
+ assert 'Failed to create correct policy',
85
+ !pol.nil? and pol.is_a?(PortableServer::ThreadPolicy) and pol.value == PortableServer::SINGLE_THREAD_MODEL
86
+
87
+ pol = rootpoa.create_lifespan_policy(PortableServer::PERSISTENT)
88
+ assert 'Failed to create correct policy',
89
+ !pol.nil? and pol.is_a?(PortableServer::LifespanPolicy) and pol.value == PortableServer::PERSISTENT
90
+
91
+ pol = rootpoa.create_id_uniqueness_policy(PortableServer::UNIQUE_ID)
92
+ assert 'Failed to create correct policy',
93
+ !pol.nil? and pol.is_a?(PortableServer::IdUniquenessPolicy) and pol.value == PortableServer::UNIQUE_ID
94
+
95
+ pol = rootpoa.create_id_assignment_policy(PortableServer::USER_ID)
96
+ assert 'Failed to create correct policy',
97
+ !pol.nil? and pol.is_a?(PortableServer::IdAssignmentPolicy) and pol.value == PortableServer::USER_ID
98
+
99
+ pol = rootpoa.create_implicit_activation_policy(PortableServer::NO_IMPLICIT_ACTIVATION)
100
+ assert 'Failed to create correct policy',
101
+ !pol.nil? and pol.is_a?(PortableServer::ImplicitActivationPolicy) and pol.value == PortableServer::NO_IMPLICIT_ACTIVATION
102
+
103
+ pol = rootpoa.create_servant_retention_policy(PortableServer::RETAIN)
104
+ assert 'Failed to create correct policy',
105
+ !pol.nil? and pol.is_a?(PortableServer::ServantRetentionPolicy) and pol.value == PortableServer::RETAIN
106
+
107
+ pol = rootpoa.create_request_processing_policy(PortableServer::USE_DEFAULT_SERVANT)
108
+ assert 'Failed to create correct policy',
109
+ !pol.nil? and pol.is_a?(PortableServer::RequestProcessingPolicy) and pol.value == PortableServer::USE_DEFAULT_SERVANT
110
+
111
+ assert_except('orb.create_policy should have thrown a PolicyError',
112
+ CORBA::PolicyError) { orb.create_policy(9999, CORBA::Any.to_any(0)) }
113
+
114
+ pol = orb.create_policy(BiDirPolicy::BIDIRECTIONAL_POLICY_TYPE,
115
+ CORBA::Any.to_any(BiDirPolicy::BOTH, BiDirPolicy::BidirectionalPolicyValue._tc))
116
+ assert 'Failed to create correct policy',
117
+ !pol.nil? and pol.is_a?(BiDirPolicy) and pol.value == BiDirPolicy::BOTH
118
+
119
+ poa_man = rootpoa.the_POAManager
120
+
121
+ poa_man.activate
122
+
123
+ hello_srv = MyHello.new(orb)
124
+
125
+ id = rootpoa.activate_object(hello_srv)
126
+
127
+ obj = rootpoa.id_to_reference(id)
128
+
129
+ assert_except('obj._get_policy(BiDirPolicy::BIDIRECTIONAL_POLICY_TYPE) should have thrown INV_POLICY',
130
+ CORBA::INV_POLICY) { obj._get_policy(BiDirPolicy::BIDIRECTIONAL_POLICY_TYPE) }
131
+
132
+ assert 'obj._get_policy_overrides should have returned an empty sequence',
133
+ obj._get_policy_overrides([BiDirPolicy::BIDIRECTIONAL_POLICY_TYPE, Messaging::RELATIVE_RT_TIMEOUT_POLICY_TYPE]).empty?
134
+
135
+ obj = obj._set_policy_overrides([pol], CORBA::SET_OVERRIDE)
136
+
137
+ assert 'obj._get_policy_overrides should have returned 1 policy',
138
+ obj._get_policy_overrides([BiDirPolicy::BIDIRECTIONAL_POLICY_TYPE, Messaging::RELATIVE_RT_TIMEOUT_POLICY_TYPE]).size == 1
139
+
140
+ ensure
141
+ orb.destroy()
142
+ end
@@ -0,0 +1,206 @@
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', Integer) { |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
+ require 'corba/policies.rb'
53
+
54
+ Min_timeout = 0
55
+ Max_timeout = 20
56
+
57
+ None, Orb1, Thread1, Object1 = (0..3).to_a
58
+ To_type_names = ['none', 'orb', 'thread', 'object']
59
+
60
+ Timeout_count = [0, 0, 0, 0]
61
+ In_time_count = [0, 0, 0, 0]
62
+
63
+ def send_echo (ctype, orb, server, t)
64
+ begin
65
+ server.echo(0, t)
66
+
67
+ In_time_count[ctype] += 1
68
+ rescue CORBA::TIMEOUT
69
+ Timeout_count[ctype] += 1
70
+
71
+ # Trap this exception and continue...
72
+ puts '==> Trapped a TIMEOUT exception (expected)'
73
+
74
+ # Sleep so the server can send the reply...
75
+ tv = Max_timeout / 1000.0 # max_timeout is in msec, so get seconds
76
+
77
+ ts_end = Time.now + tv
78
+ begin
79
+ orb.perform_work if orb.work_pending
80
+ sleep 0.01
81
+ end until Time.now > ts_end
82
+ # This is a non-standard TAO call that's used to give the
83
+ # client ORB a chance to cleanup the reply that's come back
84
+ # from the server.
85
+ # orb.run(tv)
86
+ end
87
+ end
88
+
89
+
90
+ orb = CORBA.ORB_init(['-ORBDebugLevel', OPTIONS[:orb_debuglevel]], 'myORB')
91
+
92
+ begin
93
+
94
+ obj = orb.string_to_object(OPTIONS[:iorfile])
95
+
96
+ assert_not 'Object reference is nil.', CORBA::is_nil(obj)
97
+
98
+ simple_srv = Simple_Server._narrow(obj)
99
+
100
+ obj = orb.resolve_initial_references('ORBPolicyManager')
101
+
102
+ pol_man = CORBA::PolicyManager._narrow(obj)
103
+
104
+ obj = begin
105
+ orb.resolve_initial_references('PolicyCurrent')
106
+ rescue CORBA::ORB::InvalidName
107
+ STDERR.puts 'Client: PolicyCurrent not supported'
108
+ nil
109
+ end
110
+
111
+ pol_cur = obj ? CORBA::PolicyCurrent._narrow(obj) : nil
112
+
113
+ mid_value = 10000 * (Min_timeout + Max_timeout) / 2 # convert from msec to "TimeT" (0.1 usec units)
114
+
115
+ any_orb = CORBA::Any.to_any(mid_value, TimeBase::TimeT._tc)
116
+ any_thread = CORBA::Any.to_any(mid_value + 10000, TimeBase::TimeT._tc) # midvalue + 1 msec
117
+ any_object = CORBA::Any.to_any(mid_value + 20000, TimeBase::TimeT._tc) # midvalue + 2 msec
118
+
119
+ policies = []
120
+ policies << orb.create_policy(Messaging::RELATIVE_RT_TIMEOUT_POLICY_TYPE, any_object)
121
+
122
+ obj = simple_srv._set_policy_overrides(policies, CORBA::SET_OVERRIDE)
123
+
124
+ simple_timeout_srv = Simple_Server._narrow(obj)
125
+
126
+ policies[0].destroy()
127
+ policies[0] = nil
128
+
129
+ puts "client (#{Process.pid}) testing from #{Min_timeout} to #{Max_timeout} milliseconds"
130
+
131
+ for t in Min_timeout...Max_timeout
132
+ puts ''
133
+ puts "client (#{Process.pid}) ================================"
134
+ puts "client (#{Process.pid}) Trying with timeout = #{t} msec"
135
+
136
+ puts "client (#{Process.pid}) Cleanup ORB/Thread/Object policies"
137
+
138
+ policies.clear()
139
+ pol_man.set_policy_overrides(policies, CORBA::SET_OVERRIDE)
140
+ pol_cur.set_policy_overrides(policies, CORBA::SET_OVERRIDE) if pol_cur
141
+
142
+ send_echo(None, orb, simple_srv, t)
143
+
144
+ puts "client (#{Process.pid}) Set the ORB policies"
145
+
146
+ policies << orb.create_policy(Messaging::RELATIVE_RT_TIMEOUT_POLICY_TYPE,
147
+ any_orb)
148
+
149
+ pol_man.set_policy_overrides(policies, CORBA::SET_OVERRIDE)
150
+
151
+ send_echo(Orb1, orb, simple_srv, t)
152
+
153
+ policies[0].destroy()
154
+
155
+ if pol_cur
156
+ puts "client (#{Process.pid}) Set the thread policies"
157
+
158
+ policies.clear()
159
+ policies << orb.create_policy(Messaging::RELATIVE_RT_TIMEOUT_POLICY_TYPE,
160
+ any_thread)
161
+
162
+ pol_cur.set_policy_overrides(policies, CORBA::SET_OVERRIDE)
163
+
164
+ send_echo(Thread1, orb, simple_srv, t)
165
+
166
+ policies[0].destroy()
167
+ end
168
+
169
+ puts "client (#{Process.pid}) Use the object policies"
170
+
171
+ send_echo(Object1, orb, simple_timeout_srv, t)
172
+ end
173
+
174
+ puts "\n\n"
175
+ puts "client (#{Process.pid}) Test completed, resynch with server"
176
+
177
+ policies.clear()
178
+ pol_man.set_policy_overrides(policies, CORBA::SET_OVERRIDE)
179
+ pol_cur.set_policy_overrides(policies, CORBA::SET_OVERRIDE) if pol_cur
180
+
181
+ send_echo(None, orb, simple_srv, 0)
182
+
183
+ simple_srv.shutdown()
184
+
185
+ timeout_count_total = 0
186
+ in_time_count_total = 0
187
+ for i in 0..3
188
+ timeout_count_total += Timeout_count[i]
189
+ in_time_count_total += In_time_count[i]
190
+ puts "client (#{Process.pid}) in_time_count[#{To_type_names[i]}]= #{In_time_count[i]} " +
191
+ "timeout_count[#{To_type_names[i]}]= #{Timeout_count[i]}"
192
+ end
193
+
194
+ assert_not "client (#{Process.pid}) ERROR: No messages timed out", timeout_count_total == 0
195
+
196
+ assert_not "client (#{Process.pid}) ERROR: No messages on time (within time limit)", in_time_count_total == 0
197
+
198
+ puts "client (#{Process.pid}) in_time_count_total = #{in_time_count_total}, timeout_count_total = #{timeout_count_total}"
199
+
200
+ sleep(0.1)
201
+
202
+ ensure
203
+
204
+ orb.destroy()
205
+
206
+ end