r2corba 1.6.1-x64-mingw-ucrt
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGES +173 -0
- data/LICENSE +59 -0
- data/README.rdoc +62 -0
- data/THANKS +54 -0
- data/bin/r2corba +8 -0
- data/bin/r2corba.bat +20 -0
- data/bin/ridlc +11 -0
- data/bin/ridlc.bat +23 -0
- data/bin/rins +7 -0
- data/bin/rins.bat +19 -0
- data/ext/.keep +0 -0
- data/lib/corba/cbase/IORMap.rb +32 -0
- data/lib/corba/cbase/ORB.rb +239 -0
- data/lib/corba/cbase/Request.rb +133 -0
- data/lib/corba/cbase/Streams.rb +128 -0
- data/lib/corba/cbase/Stub.rb +18 -0
- data/lib/corba/cbase/Typecode.rb +440 -0
- data/lib/corba/cbase/Values.rb +130 -0
- data/lib/corba/cbase/exception.rb +67 -0
- data/lib/corba/cbase/poa.rb +22 -0
- data/lib/corba/cbase/policies.rb +77 -0
- data/lib/corba/cbase/post_require.rb +13 -0
- data/lib/corba/cbase/require.rb +36 -0
- data/lib/corba/cmds/base.rb +84 -0
- data/lib/corba/cmds/test.rb +29 -0
- data/lib/corba/common/Any.rb +91 -0
- data/lib/corba/common/IDL.rb +100 -0
- data/lib/corba/common/ORB.rb +367 -0
- data/lib/corba/common/Object.rb +211 -0
- data/lib/corba/common/Request.rb +19 -0
- data/lib/corba/common/Servant.rb +107 -0
- data/lib/corba/common/Struct.rb +21 -0
- data/lib/corba/common/Stub.rb +78 -0
- data/lib/corba/common/Typecode.rb +1147 -0
- data/lib/corba/common/Union.rb +60 -0
- data/lib/corba/common/Values.rb +92 -0
- data/lib/corba/common/const.rb +21 -0
- data/lib/corba/common/exception.rb +68 -0
- data/lib/corba/common/require.rb +34 -0
- data/lib/corba/common/version.rb +21 -0
- data/lib/corba/idl/BiDirPolicyC.rb +62 -0
- data/lib/corba/idl/CosNamingC.rb +460 -0
- data/lib/corba/idl/CosNamingS.rb +308 -0
- data/lib/corba/idl/IDL.rb +20 -0
- data/lib/corba/idl/IORTable.pidl +61 -0
- data/lib/corba/idl/IORTableC.rb +116 -0
- data/lib/corba/idl/MessagingC.rb +903 -0
- data/lib/corba/idl/POAC.rb +929 -0
- data/lib/corba/idl/TAO_Ext.pidl +45 -0
- data/lib/corba/idl/TAO_ExtC.rb +178 -0
- data/lib/corba/idl/r2c_orb.rb +571 -0
- data/lib/corba/idl/require.rb +19 -0
- data/lib/corba/jbase/Any.rb +274 -0
- data/lib/corba/jbase/IORMap.rb +35 -0
- data/lib/corba/jbase/ORB.rb +111 -0
- data/lib/corba/jbase/Object.rb +98 -0
- data/lib/corba/jbase/Request.rb +225 -0
- data/lib/corba/jbase/Servant.rb +247 -0
- data/lib/corba/jbase/ServerRequest.rb +127 -0
- data/lib/corba/jbase/Streams.rb +734 -0
- data/lib/corba/jbase/Stub.rb +37 -0
- data/lib/corba/jbase/Typecode.rb +520 -0
- data/lib/corba/jbase/Values.rb +174 -0
- data/lib/corba/jbase/exception.rb +106 -0
- data/lib/corba/jbase/poa.rb +228 -0
- data/lib/corba/jbase/policies.rb +299 -0
- data/lib/corba/jbase/post_require.rb +13 -0
- data/lib/corba/jbase/require.rb +92 -0
- data/lib/corba/naming.rb +13 -0
- data/lib/corba/naming_service.rb +14 -0
- data/lib/corba/poa.rb +14 -0
- data/lib/corba/policies.rb +17 -0
- data/lib/corba/require.rb +16 -0
- data/lib/corba/svcs/ins/cos_naming.rb +432 -0
- data/lib/corba/svcs/ins/ins.rb +525 -0
- data/lib/corba/svcs/ins/naming_service.rb +118 -0
- data/lib/corba.rb +15 -0
- data/lib/ridlbe/ruby/config.rb +340 -0
- data/lib/ridlbe/ruby/orb.pidlc +0 -0
- data/lib/ridlbe/ruby/require.rb +15 -0
- data/lib/ridlbe/ruby/walker.rb +1605 -0
- data/mkrf_conf_bingem.rb +149 -0
- data/rakelib/bin.rake +79 -0
- data/rakelib/bin.rb +145 -0
- data/rakelib/build.rake +87 -0
- data/rakelib/config.rake +51 -0
- data/rakelib/config.rb +542 -0
- data/rakelib/ext.rake +183 -0
- data/rakelib/ext.rb +277 -0
- data/rakelib/ext_r2tao.rb +208 -0
- data/rakelib/gem.rake +251 -0
- data/rakelib/gem.rb +145 -0
- data/rakelib/package.rake +25 -0
- data/rakelib/test.rake +22 -0
- data/test/BiDirectional/Test.idl +33 -0
- data/test/BiDirectional/client.rb +131 -0
- data/test/BiDirectional/run_test.rb +67 -0
- data/test/BiDirectional/server.rb +167 -0
- data/test/CORBA_Services/Naming/BindingIterator/Test.idl +26 -0
- data/test/CORBA_Services/Naming/BindingIterator/client.rb +120 -0
- data/test/CORBA_Services/Naming/BindingIterator/run_test.rb +81 -0
- data/test/CORBA_Services/Naming/BindingIterator/server.rb +108 -0
- data/test/CORBA_Services/Naming/Corbaname/Test.idl +26 -0
- data/test/CORBA_Services/Naming/Corbaname/client.rb +84 -0
- data/test/CORBA_Services/Naming/Corbaname/run_test.rb +87 -0
- data/test/CORBA_Services/Naming/Corbaname/server.rb +134 -0
- data/test/CORBA_Services/Naming/Simple/Test.idl +26 -0
- data/test/CORBA_Services/Naming/Simple/client.rb +83 -0
- data/test/CORBA_Services/Naming/Simple/run_test.rb +81 -0
- data/test/CORBA_Services/Naming/Simple/server.rb +108 -0
- data/test/Collocation/Diamond.idl +38 -0
- data/test/Collocation/run_test.rb +51 -0
- data/test/Collocation/test.rb +201 -0
- data/test/Connect_Timeout/Test.idl +26 -0
- data/test/Connect_Timeout/client.rb +109 -0
- data/test/Connect_Timeout/run_test.rb +51 -0
- data/test/DII/Test.idl +26 -0
- data/test/DII/client.rb +114 -0
- data/test/DII/run_test.rb +68 -0
- data/test/DII/server.rb +94 -0
- data/test/DSI/Test.idl +26 -0
- data/test/DSI/client.rb +65 -0
- data/test/DSI/run_test.rb +68 -0
- data/test/DSI/server.rb +105 -0
- data/test/Exceptions/Test.idl +47 -0
- data/test/Exceptions/client.rb +117 -0
- data/test/Exceptions/run_test.rb +68 -0
- data/test/Exceptions/server.rb +130 -0
- data/test/Hello/Test.idl +26 -0
- data/test/Hello/client.rb +77 -0
- data/test/Hello/run_test.rb +70 -0
- data/test/Hello/server.rb +94 -0
- data/test/IDL_Test/Test.idl +116 -0
- data/test/IDL_Test/Test_inc.idl +17 -0
- data/test/IDL_Test/client.rb +103 -0
- data/test/IDL_Test/run_test.rb +68 -0
- data/test/IDL_Test/server.rb +103 -0
- data/test/IORMap/Test.idl +26 -0
- data/test/IORMap/client.rb +72 -0
- data/test/IORMap/run_test.rb +68 -0
- data/test/IORMap/server.rb +113 -0
- data/test/IORTable/Test.idl +26 -0
- data/test/IORTable/client.rb +74 -0
- data/test/IORTable/run_test.rb +68 -0
- data/test/IORTable/server.rb +129 -0
- data/test/Implicit_Conversion/Test.idl +30 -0
- data/test/Implicit_Conversion/client.rb +112 -0
- data/test/Implicit_Conversion/run_test.rb +68 -0
- data/test/Implicit_Conversion/server.rb +98 -0
- data/test/Multi_Threading/Multiple_ORB/Test.idl +26 -0
- data/test/Multi_Threading/Multiple_ORB/client.rb +81 -0
- data/test/Multi_Threading/Multiple_ORB/run_test.rb +70 -0
- data/test/Multi_Threading/Multiple_ORB/server.rb +107 -0
- data/test/Multi_Threading/Simple/Test.idl +26 -0
- data/test/Multi_Threading/Simple/client.rb +92 -0
- data/test/Multi_Threading/Simple/run_test.rb +68 -0
- data/test/Multi_Threading/Simple/server.rb +117 -0
- data/test/Multi_Threading/Threads/Test.idl +27 -0
- data/test/Multi_Threading/Threads/client.rb +77 -0
- data/test/Multi_Threading/Threads/run_test.rb +75 -0
- data/test/Multi_Threading/Threads/server.rb +116 -0
- data/test/Multi_Threading/Threads/watchdog.rb +87 -0
- data/test/Multiple_Servant_Interfaces/Test.idl +33 -0
- data/test/Multiple_Servant_Interfaces/client.rb +69 -0
- data/test/Multiple_Servant_Interfaces/run_test.rb +68 -0
- data/test/Multiple_Servant_Interfaces/server.rb +101 -0
- data/test/Nil/Test.idl +26 -0
- data/test/Nil/run_test.rb +51 -0
- data/test/Nil/test.rb +80 -0
- data/test/OBV/AbstractInterface/client.rb +178 -0
- data/test/OBV/AbstractInterface/run_test.rb +68 -0
- data/test/OBV/AbstractInterface/server.rb +149 -0
- data/test/OBV/AbstractInterface/test.idl +52 -0
- data/test/OBV/Custom/OBV.idl +18 -0
- data/test/OBV/Custom/OBV_impl.rb +41 -0
- data/test/OBV/Custom/client.rb +85 -0
- data/test/OBV/Custom/run_test.rb +68 -0
- data/test/OBV/Custom/server.rb +99 -0
- data/test/OBV/Simple/OBV.idl +15 -0
- data/test/OBV/Simple/OBV_impl.rb +26 -0
- data/test/OBV/Simple/client.rb +85 -0
- data/test/OBV/Simple/run_test.rb +68 -0
- data/test/OBV/Simple/server.rb +99 -0
- data/test/OBV/Simple_Event/Event.idl +15 -0
- data/test/OBV/Simple_Event/Event_impl.rb +26 -0
- data/test/OBV/Simple_Event/client.rb +85 -0
- data/test/OBV/Simple_Event/run_test.rb +68 -0
- data/test/OBV/Simple_Event/server.rb +99 -0
- data/test/OBV/Supports/client.rb +115 -0
- data/test/OBV/Supports/run_test.rb +68 -0
- data/test/OBV/Supports/server.rb +102 -0
- data/test/OBV/Supports/supports.idl +32 -0
- data/test/OBV/Supports/supports_impl.rb +59 -0
- data/test/OBV/Tree/client.rb +115 -0
- data/test/OBV/Tree/run_test.rb +68 -0
- data/test/OBV/Tree/server.rb +116 -0
- data/test/OBV/Tree/test.idl +31 -0
- data/test/OBV/Truncatable/Extra.idl +26 -0
- data/test/OBV/Truncatable/Truncatable.idl +105 -0
- data/test/OBV/Truncatable/Truncatable_impl.rb +85 -0
- data/test/OBV/Truncatable/client.rb +278 -0
- data/test/OBV/Truncatable/run_test.rb +68 -0
- data/test/OBV/Truncatable/server.rb +88 -0
- data/test/OBV/ValueBox/client.rb +497 -0
- data/test/OBV/ValueBox/run_test.rb +68 -0
- data/test/OBV/ValueBox/server.rb +271 -0
- data/test/OBV/ValueBox/valuebox.idl +101 -0
- data/test/OBV/ValueBox/vb_basic.idl +75 -0
- data/test/OBV/ValueBox/vb_struct.idl +68 -0
- data/test/OBV/ValueBox/vb_union.idl +21 -0
- data/test/Object/Test.idl +26 -0
- data/test/Object/client.rb +111 -0
- data/test/Object/run_test.rb +68 -0
- data/test/Object/server.rb +125 -0
- data/test/POA/Test.idl +27 -0
- data/test/POA/run_test.rb +51 -0
- data/test/POA/test.rb +111 -0
- data/test/Param_Test/Test.idl +182 -0
- data/test/Param_Test/client.rb +276 -0
- data/test/Param_Test/run_test.rb +68 -0
- data/test/Param_Test/server.rb +295 -0
- data/test/Performance/Simple/Test.idl +26 -0
- data/test/Performance/Simple/client.rb +89 -0
- data/test/Performance/Simple/run_test.rb +68 -0
- data/test/Performance/Simple/server.rb +94 -0
- data/test/Policies/Test.idl +26 -0
- data/test/Policies/run_test.rb +51 -0
- data/test/Policies/test.rb +142 -0
- data/test/Timeout/client.rb +206 -0
- data/test/Timeout/run_test.rb +68 -0
- data/test/Timeout/server.rb +108 -0
- data/test/Timeout/test.idl +18 -0
- data/test/lib/assert.rb +41 -0
- data/test/lib/test.rb +546 -0
- data/test/test_runner.rb +191 -0
- metadata +318 -0
@@ -0,0 +1,117 @@
|
|
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 get_string(tid)
|
57
|
+
"[server #{Thread.current}] Hello there thread \##{tid}!"
|
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
|
+
if defined?(JRUBY_VERSION)
|
95
|
+
# JRuby based jR2CORBA behaves slightly different from MRI based R2CORBA
|
96
|
+
# because the underlying ORB (JacORB) uses an implicit threadpool based
|
97
|
+
# thread-per-request model; so running multiple threads with ORB#run
|
98
|
+
# does not bring anything here
|
99
|
+
orb.run
|
100
|
+
else
|
101
|
+
# TAO, the underlying ORB implementation for MRI base R2CORBA has support
|
102
|
+
# for several multithreading options; the simplest way to set up multithreaded
|
103
|
+
# request processing is starting ORB#run in multiple threads which results
|
104
|
+
# in each of those threads being 're-used' as request processing threads.
|
105
|
+
# NOTE: as MRI Ruby 1.8 threads are 'green' threads there is only 1 native
|
106
|
+
# thread from which the TAO ORB is run however many Ruby threads are
|
107
|
+
# started; the ORB#run method for this platform implements a special
|
108
|
+
# cooperative ORB event loop allowing multiple Ruby threads executing
|
109
|
+
# ORB#run to operate in parallel.
|
110
|
+
orb_trds = (0..1).collect do
|
111
|
+
Thread.new() do
|
112
|
+
orb.run
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
orb_trds.each {|t| t.join }
|
117
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
/// Put the interfaces in a module, to avoid global namespace pollution
|
2
|
+
module Test
|
3
|
+
{
|
4
|
+
/// A very simple interface
|
5
|
+
interface Hello
|
6
|
+
{
|
7
|
+
/// Return a simple string
|
8
|
+
string get_string ();
|
9
|
+
|
10
|
+
/// A method to shutdown the ORB
|
11
|
+
/**
|
12
|
+
* This method is used to simplify the test shutdown process
|
13
|
+
*/
|
14
|
+
oneway void shutdown ();
|
15
|
+
};
|
16
|
+
|
17
|
+
interface Watchdog
|
18
|
+
{
|
19
|
+
void ping( in string name );
|
20
|
+
|
21
|
+
/// A method to shutdown the ORB
|
22
|
+
/**
|
23
|
+
* This method is used to simplify the test shutdown process
|
24
|
+
*/
|
25
|
+
oneway void shutdown ();
|
26
|
+
};
|
27
|
+
};
|
@@ -0,0 +1,77 @@
|
|
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
|
+
hello_strings = (1..10000).map {hello_obj.get_string}
|
62
|
+
|
63
|
+
puts "Client - got #{hello_strings.length} strings."
|
64
|
+
|
65
|
+
hello_obj.shutdown()
|
66
|
+
|
67
|
+
assert_not 'ERROR: Object is reported nil!', CORBA::is_nil(hello_obj)
|
68
|
+
|
69
|
+
hello_obj._free_ref()
|
70
|
+
|
71
|
+
assert 'ERROR: Object is reported non-nil!', CORBA::is_nil(hello_obj)
|
72
|
+
|
73
|
+
ensure
|
74
|
+
|
75
|
+
orb.destroy()
|
76
|
+
|
77
|
+
end
|
@@ -0,0 +1,75 @@
|
|
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
|
+
watchdog_ior_file = 'watchdog.ior'
|
45
|
+
|
46
|
+
TestUtil.remove_file(ior_file)
|
47
|
+
TestUtil.remove_file(watchdog_ior_file)
|
48
|
+
|
49
|
+
wdog = Test.new
|
50
|
+
srv = Test.new
|
51
|
+
|
52
|
+
exit(255) if !wdog.run('watchdog.rb', "--o #{watchdog_ior_file} #{OPTIONS[:debug_opt]} #{OPTIONS[:use_implement]}")
|
53
|
+
|
54
|
+
TestUtil.wait_for_file(watchdog_ior_file, 400)
|
55
|
+
|
56
|
+
exit(255) if !srv.run('server.rb', "--o #{ior_file} #{OPTIONS[:debug_opt]} #{OPTIONS[:use_implement]}")
|
57
|
+
|
58
|
+
TestUtil.wait_for_file(ior_file, 400)
|
59
|
+
|
60
|
+
clt = Test.new
|
61
|
+
|
62
|
+
if !clt.run('client.rb', "--k file://#{ior_file} #{OPTIONS[:debug_opt]} #{OPTIONS[:use_implement]}")
|
63
|
+
srv.kill(100)
|
64
|
+
exit(255)
|
65
|
+
end
|
66
|
+
|
67
|
+
exrc = clt.wait(400)
|
68
|
+
|
69
|
+
if exrc == 0
|
70
|
+
srv.wait(400)
|
71
|
+
else
|
72
|
+
srv.wait_term(400)
|
73
|
+
end
|
74
|
+
|
75
|
+
exit(exrc)
|
@@ -0,0 +1,116 @@
|
|
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
|
+
:watchdog_iorfile => 'file://watchdog.ior'
|
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('--o IORFILE',
|
28
|
+
'Set IOR filename.',
|
29
|
+
"Default: 'server.ior'") { |v| OPTIONS[:iorfile] = v }
|
30
|
+
opts.on('--w IORFILE',
|
31
|
+
'Set Watchdog IOR filename.',
|
32
|
+
"Default: 'file://watchdog.ior'") { |v| OPTIONS[:watchdog_iorfile] = v }
|
33
|
+
opts.on('--d LVL',
|
34
|
+
'Set ORBDebugLevel value.',
|
35
|
+
'Default: 0') { |v| OPTIONS[:orb_debuglevel] = v }
|
36
|
+
opts.on('--use-implement',
|
37
|
+
'Load IDL through CORBA.implement() instead of precompiled code.',
|
38
|
+
'Default: off') { |v| OPTIONS[:use_implement] = v }
|
39
|
+
|
40
|
+
opts.separator ''
|
41
|
+
|
42
|
+
opts.on('-h', '--help',
|
43
|
+
'Show this help message.') { puts opts; exit }
|
44
|
+
|
45
|
+
opts.parse!
|
46
|
+
end
|
47
|
+
|
48
|
+
if OPTIONS[:use_implement]
|
49
|
+
require 'corba/poa'
|
50
|
+
CORBA.implement('Test.idl', OPTIONS, CORBA::IDL::SERVANT_INTF)
|
51
|
+
else
|
52
|
+
require 'TestS.rb'
|
53
|
+
end
|
54
|
+
|
55
|
+
class MyHello < POA::Test::Hello
|
56
|
+
def initialize(orb, watchdog)
|
57
|
+
@orb = orb
|
58
|
+
@watchdog = watchdog
|
59
|
+
@count = 0
|
60
|
+
@stop = false
|
61
|
+
@wdt = Thread.new do
|
62
|
+
while !@stop
|
63
|
+
@watchdog.ping(self.object_id.to_s)
|
64
|
+
@count += 1
|
65
|
+
sleep 0.001
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def get_string()
|
71
|
+
return 'Hello, world!'
|
72
|
+
end
|
73
|
+
|
74
|
+
def shutdown()
|
75
|
+
@stop = true
|
76
|
+
@wdt.join
|
77
|
+
@watchdog.shutdown()
|
78
|
+
puts %Q{Server - pinged watchdog #{@count} times.}
|
79
|
+
@orb.shutdown()
|
80
|
+
end
|
81
|
+
end # of servant MyHello
|
82
|
+
|
83
|
+
orb = CORBA.ORB_init(['-ORBDebugLevel', OPTIONS[:orb_debuglevel]], 'myORB')
|
84
|
+
|
85
|
+
obj = orb.resolve_initial_references('RootPOA')
|
86
|
+
|
87
|
+
root_poa = PortableServer::POA._narrow(obj)
|
88
|
+
|
89
|
+
poa_man = root_poa.the_POAManager
|
90
|
+
|
91
|
+
poa_man.activate
|
92
|
+
|
93
|
+
obj = orb.string_to_object(OPTIONS[:watchdog_iorfile])
|
94
|
+
|
95
|
+
watchdog_obj = Test::Watchdog._narrow(obj)
|
96
|
+
|
97
|
+
hello_srv = MyHello.new(orb, watchdog_obj)
|
98
|
+
|
99
|
+
hello_obj = hello_srv._this()
|
100
|
+
|
101
|
+
hello_ior = orb.object_to_string(hello_obj)
|
102
|
+
|
103
|
+
open(OPTIONS[:iorfile], 'w') { |io|
|
104
|
+
io.write hello_ior
|
105
|
+
}
|
106
|
+
|
107
|
+
Signal.trap('INT') do
|
108
|
+
puts 'SIGINT - shutting down ORB...'
|
109
|
+
orb.shutdown()
|
110
|
+
end
|
111
|
+
|
112
|
+
if Signal.list.has_key?('USR2')
|
113
|
+
Signal.trap('USR2', 'EXIT')
|
114
|
+
end
|
115
|
+
|
116
|
+
orb.run
|
@@ -0,0 +1,87 @@
|
|
1
|
+
# Runs a do-nothing Watchdog instance
|
2
|
+
|
3
|
+
require 'optparse'
|
4
|
+
|
5
|
+
OPTIONS = {
|
6
|
+
:use_implement => false,
|
7
|
+
:orb_debuglevel => 0,
|
8
|
+
:iorfile => 'watchdog.ior'
|
9
|
+
}
|
10
|
+
|
11
|
+
ARGV.options do |opts|
|
12
|
+
script_name = File.basename($0)
|
13
|
+
opts.banner = "Usage: ruby #{script_name} [options]"
|
14
|
+
|
15
|
+
opts.separator ''
|
16
|
+
|
17
|
+
opts.on('--o IORFILE',
|
18
|
+
'Set IOR filename.',
|
19
|
+
"Default: 'watchdog.ior'") { |v| OPTIONS[:iorfile] = v }
|
20
|
+
opts.on('--d LVL',
|
21
|
+
'Set ORBDebugLevel value.',
|
22
|
+
'Default: 0') { |v| OPTIONS[:orb_debuglevel] = v }
|
23
|
+
opts.on('--use-implement',
|
24
|
+
'Load IDL through CORBA.implement() instead of precompiled code.',
|
25
|
+
'Default: off') { |v| OPTIONS[:use_implement] = v }
|
26
|
+
|
27
|
+
opts.separator ''
|
28
|
+
|
29
|
+
opts.on('-h', '--help',
|
30
|
+
'Show this help message.') { puts opts; exit }
|
31
|
+
|
32
|
+
opts.parse!
|
33
|
+
end
|
34
|
+
|
35
|
+
if OPTIONS[:use_implement]
|
36
|
+
require 'corba/poa'
|
37
|
+
CORBA.implement('Test.idl', OPTIONS, CORBA::IDL::SERVANT_INTF)
|
38
|
+
else
|
39
|
+
require 'TestS.rb'
|
40
|
+
end
|
41
|
+
|
42
|
+
class MyWatchdog < POA::Test::Watchdog
|
43
|
+
def initialize(orb)
|
44
|
+
@orb = orb
|
45
|
+
@count = 0
|
46
|
+
end
|
47
|
+
|
48
|
+
def ping(name)
|
49
|
+
@count += 1
|
50
|
+
end
|
51
|
+
|
52
|
+
def shutdown()
|
53
|
+
puts %Q{Watchdog - received #{@count} pings}
|
54
|
+
@orb.shutdown()
|
55
|
+
end
|
56
|
+
end # of servant MyWatchdog
|
57
|
+
|
58
|
+
orb = CORBA.ORB_init(['-ORBDebugLevel', OPTIONS[:orb_debuglevel]], 'myORB')
|
59
|
+
|
60
|
+
obj = orb.resolve_initial_references('RootPOA')
|
61
|
+
|
62
|
+
root_poa = PortableServer::POA._narrow(obj)
|
63
|
+
|
64
|
+
poa_man = root_poa.the_POAManager
|
65
|
+
|
66
|
+
poa_man.activate
|
67
|
+
|
68
|
+
srv = MyWatchdog.new(orb)
|
69
|
+
|
70
|
+
obj = srv._this()
|
71
|
+
|
72
|
+
ior = orb.object_to_string(obj)
|
73
|
+
|
74
|
+
open(OPTIONS[:iorfile], 'w') { |io|
|
75
|
+
io.write ior
|
76
|
+
}
|
77
|
+
|
78
|
+
Signal.trap('INT') do
|
79
|
+
puts 'SIGINT - shutting down ORB...'
|
80
|
+
orb.shutdown()
|
81
|
+
end
|
82
|
+
|
83
|
+
if Signal.list.has_key?('USR2')
|
84
|
+
Signal.trap('USR2', 'EXIT')
|
85
|
+
end
|
86
|
+
|
87
|
+
orb.run
|
@@ -0,0 +1,33 @@
|
|
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
|
+
|
27
|
+
/// A very simple interface
|
28
|
+
interface Hello_2
|
29
|
+
{
|
30
|
+
/// Return a simple string
|
31
|
+
string get_string_2 ();
|
32
|
+
};
|
33
|
+
};
|
@@ -0,0 +1,69 @@
|
|
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 => 'file://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('--k IORFILE',
|
27
|
+
'Set IOR.',
|
28
|
+
"Default: 'file://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'
|
46
|
+
CORBA.implement('Test.idl', OPTIONS)
|
47
|
+
else
|
48
|
+
require 'TestC.rb'
|
49
|
+
end
|
50
|
+
|
51
|
+
orb = CORBA.ORB_init(['-ORBDebugLevel', OPTIONS[:orb_debuglevel]], 'myORB')
|
52
|
+
|
53
|
+
obj = orb.string_to_object(OPTIONS[:iorfile])
|
54
|
+
|
55
|
+
hello_obj = Test::Hello._narrow(obj)
|
56
|
+
|
57
|
+
hello_2_obj = Test::Hello_2._narrow(obj)
|
58
|
+
|
59
|
+
the_string = hello_obj.get_string()
|
60
|
+
|
61
|
+
puts "string returned from Test::Hello <#{the_string}>"
|
62
|
+
|
63
|
+
the_string = hello_2_obj.get_string_2()
|
64
|
+
|
65
|
+
puts "string returned from Test::Hello_2 <#{the_string}>"
|
66
|
+
|
67
|
+
hello_obj.shutdown()
|
68
|
+
|
69
|
+
orb.destroy()
|
@@ -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)
|