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,167 @@
|
|
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
|
+
:iter_num => 10
|
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('--d LVL',
|
31
|
+
'Set ORBDebugLevel value.',
|
32
|
+
'Default: 0') { |v| OPTIONS[:orb_debuglevel] = v }
|
33
|
+
opts.on('--use-implement',
|
34
|
+
'Load IDL through CORBA.implement() instead of precompiled code.',
|
35
|
+
'Default: off') { |v| OPTIONS[:use_implement] = v }
|
36
|
+
opts.on('--i ITERATIONS',
|
37
|
+
'Set number of iterations.',
|
38
|
+
'Default: 10', Integer) { |v| OPTIONS[:iter_num] = 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.rb'
|
50
|
+
CORBA.implement('Test.idl', OPTIONS, CORBA::IDL::SERVANT_INTF)
|
51
|
+
else
|
52
|
+
require 'TestS.rb'
|
53
|
+
end
|
54
|
+
require 'corba/policies.rb'
|
55
|
+
|
56
|
+
class Simple_Server_i < POA::Simple_Server
|
57
|
+
def initialize(orb, iter_num)
|
58
|
+
@orb = orb
|
59
|
+
@iter_num = iter_num
|
60
|
+
@flag = false
|
61
|
+
@callback = nil
|
62
|
+
end
|
63
|
+
|
64
|
+
def test_method(do_callback)
|
65
|
+
if do_callback == true
|
66
|
+
@flag = true
|
67
|
+
end
|
68
|
+
0
|
69
|
+
end
|
70
|
+
|
71
|
+
def callback_object(cb)
|
72
|
+
@callback = cb
|
73
|
+
end
|
74
|
+
|
75
|
+
def shutdown()
|
76
|
+
@orb.shutdown()
|
77
|
+
end
|
78
|
+
|
79
|
+
def call_client()
|
80
|
+
if @flag
|
81
|
+
@iter_num.times do
|
82
|
+
@callback.callback_method()
|
83
|
+
end
|
84
|
+
|
85
|
+
@callback.shutdown()
|
86
|
+
@flag = false
|
87
|
+
|
88
|
+
return 1
|
89
|
+
else
|
90
|
+
sleep(0.05) # don't hog the CPU
|
91
|
+
end
|
92
|
+
return 0
|
93
|
+
end
|
94
|
+
|
95
|
+
end # of servant Simple_Server_i
|
96
|
+
|
97
|
+
if defined?(JRUBY_VERSION)
|
98
|
+
## JacORB needs explicit activation of this option
|
99
|
+
props = {
|
100
|
+
'org.omg.PortableInterceptor.ORBInitializerClass.bidir_init' =>
|
101
|
+
'org.jacorb.orb.giop.BiDirConnectionInitializer'
|
102
|
+
}
|
103
|
+
else
|
104
|
+
props = {}
|
105
|
+
end
|
106
|
+
|
107
|
+
orb = CORBA.ORB_init(['-ORBDebugLevel', OPTIONS[:orb_debuglevel]], 'myORB', props)
|
108
|
+
|
109
|
+
obj = orb.resolve_initial_references('RootPOA')
|
110
|
+
|
111
|
+
root_poa = PortableServer::POA._narrow(obj)
|
112
|
+
|
113
|
+
poa_man = root_poa.the_POAManager
|
114
|
+
|
115
|
+
policies = []
|
116
|
+
policies << orb.create_policy(BiDirPolicy::BIDIRECTIONAL_POLICY_TYPE,
|
117
|
+
CORBA::Any.to_any(BiDirPolicy::BOTH, BiDirPolicy::BidirectionalPolicyValue._tc))
|
118
|
+
|
119
|
+
puts 'policies created'
|
120
|
+
|
121
|
+
child_poa = root_poa.create_POA('childPOA', poa_man, policies)
|
122
|
+
|
123
|
+
puts 'child_poa created'
|
124
|
+
|
125
|
+
policies.each { |pol| pol.destroy() }
|
126
|
+
|
127
|
+
puts 'policies destroyed'
|
128
|
+
|
129
|
+
poa_man.activate
|
130
|
+
|
131
|
+
simple_srv = Simple_Server_i.new(orb, OPTIONS[:iter_num])
|
132
|
+
|
133
|
+
id = child_poa.activate_object(simple_srv)
|
134
|
+
|
135
|
+
obj = child_poa.id_to_reference(id)
|
136
|
+
|
137
|
+
ior = orb.object_to_string(obj)
|
138
|
+
|
139
|
+
puts "Activated as <#{ior}>"
|
140
|
+
|
141
|
+
open(OPTIONS[:iorfile], 'w') { |io|
|
142
|
+
io.write ior
|
143
|
+
}
|
144
|
+
|
145
|
+
Signal.trap('INT') do
|
146
|
+
puts 'SIGINT - shutting down ORB...'
|
147
|
+
orb.shutdown()
|
148
|
+
end
|
149
|
+
|
150
|
+
if Signal.list.has_key?('USR2')
|
151
|
+
Signal.trap('USR2', 'EXIT')
|
152
|
+
end
|
153
|
+
|
154
|
+
retval = 0
|
155
|
+
while retval == 0
|
156
|
+
pending = orb.work_pending()
|
157
|
+
|
158
|
+
if pending
|
159
|
+
orb.perform_work()
|
160
|
+
end
|
161
|
+
|
162
|
+
retval = simple_srv.call_client()
|
163
|
+
end
|
164
|
+
|
165
|
+
puts 'event loop finished'
|
166
|
+
|
167
|
+
root_poa.destroy(true, true)
|
@@ -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,120 @@
|
|
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://ins.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://ins.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
|
+
require 'corba/naming'
|
53
|
+
|
54
|
+
orb = CORBA.ORB_init(['-ORBDebugLevel', OPTIONS[:orb_debuglevel]], 'myORB')
|
55
|
+
|
56
|
+
begin
|
57
|
+
|
58
|
+
# resolve NamingContext
|
59
|
+
obj = orb.string_to_object(OPTIONS[:iorfile])
|
60
|
+
|
61
|
+
nc = CosNaming::NamingContextExt._narrow(obj)
|
62
|
+
|
63
|
+
assert_not 'ERROR: INS IOR resolved to nil object!', CORBA::is_nil(nc)
|
64
|
+
|
65
|
+
# list registered items in context
|
66
|
+
binding_list, binding_iterator = nc.list(1)
|
67
|
+
|
68
|
+
assert 'ERROR: INS list() does not function', (!CORBA::is_nil(binding_iterator) && binding_list.size == 1) &&
|
69
|
+
binding_list.first.binding_type == CosNaming::Nobject
|
70
|
+
|
71
|
+
n = binding_list.first.binding_name.first
|
72
|
+
puts "first binding: id=#{n.r_id}, kind=#{n.kind}"
|
73
|
+
|
74
|
+
has_one, binding = binding_iterator.next_one()
|
75
|
+
|
76
|
+
assert 'ERROR: INS BindingIterator#next_one() does not function',
|
77
|
+
(has_one && binding) &&
|
78
|
+
binding.binding_type == CosNaming::Nobject
|
79
|
+
|
80
|
+
n = binding.binding_name.first
|
81
|
+
puts "second binding: id=#{n.r_id}, kind=#{n.kind}"
|
82
|
+
|
83
|
+
has_list, binding_list = binding_iterator.next_n(3)
|
84
|
+
|
85
|
+
assert 'ERROR: INS BindingIterator#next_n() does not function',
|
86
|
+
(has_list && binding_list.size == 3) &&
|
87
|
+
binding_list.first.binding_type == CosNaming::Nobject &&
|
88
|
+
binding_list.last.binding_type == CosNaming::Nobject
|
89
|
+
|
90
|
+
counts = ['third', 'fourth', 'fifth']
|
91
|
+
binding_list.each do |binding|
|
92
|
+
n = binding.binding_name.first
|
93
|
+
puts "#{counts.shift} binding: id=#{n.r_id}, kind=#{n.kind}"
|
94
|
+
end
|
95
|
+
|
96
|
+
has_one, binding = binding_iterator.next_one()
|
97
|
+
|
98
|
+
assert_not 'ERROR: INS BindingIterator#next_one() does not function (2)', has_one
|
99
|
+
|
100
|
+
binding_iterator.destroy()
|
101
|
+
|
102
|
+
# retrieve object reference for servant from Naming service
|
103
|
+
name = binding_list.last.binding_name
|
104
|
+
|
105
|
+
obj = nc.resolve(name)
|
106
|
+
|
107
|
+
# narrow object ref and call
|
108
|
+
hello_obj = Test::Hello._narrow(obj)
|
109
|
+
|
110
|
+
the_string = hello_obj.get_string()
|
111
|
+
|
112
|
+
puts "string returned <#{the_string}>"
|
113
|
+
|
114
|
+
hello_obj.shutdown()
|
115
|
+
|
116
|
+
ensure
|
117
|
+
|
118
|
+
orb.destroy()
|
119
|
+
|
120
|
+
end
|
@@ -0,0 +1,81 @@
|
|
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
|
+
def do_exit(rc)
|
44
|
+
ins_stop = Test.new
|
45
|
+
ins_stop.run("-e \'require \"corba/svcs/ins/ins.rb\"\' -e \'R2CORBA::INS.run\'", '-- stop --no-daemon')
|
46
|
+
ins_stop.wait(50)
|
47
|
+
exit(rc)
|
48
|
+
end
|
49
|
+
|
50
|
+
ior_file = 'ins.ior'
|
51
|
+
|
52
|
+
TestUtil.remove_file(ior_file)
|
53
|
+
|
54
|
+
ins = Test.new
|
55
|
+
|
56
|
+
exit(255) if !ins.run("-e \'require \"corba/svcs/ins/ins.rb\"\' -e \'R2CORBA::INS.run\'", '-- start')
|
57
|
+
|
58
|
+
do_exit(255) if !TestUtil.wait_for_file(ior_file, 400)
|
59
|
+
|
60
|
+
srv = Test.new
|
61
|
+
|
62
|
+
do_exit(255) if !srv.run('server.rb', "--k file://#{ior_file} #{OPTIONS[:debug_opt]} #{OPTIONS[:use_implement]}")
|
63
|
+
|
64
|
+
sleep(1) # give the server some time to register with INS
|
65
|
+
|
66
|
+
clt = Test.new
|
67
|
+
|
68
|
+
if !clt.run('client.rb', "--k file://#{ior_file} #{OPTIONS[:debug_opt]} #{OPTIONS[:use_implement]}")
|
69
|
+
srv.kill(100)
|
70
|
+
do_exit(255)
|
71
|
+
end
|
72
|
+
|
73
|
+
exrc = clt.wait(400)
|
74
|
+
|
75
|
+
if exrc == 0
|
76
|
+
srv.wait(400)
|
77
|
+
else
|
78
|
+
srv.wait_term(400)
|
79
|
+
end
|
80
|
+
|
81
|
+
do_exit(exrc)
|
@@ -0,0 +1,108 @@
|
|
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://ins.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 INS IOR filename.',
|
30
|
+
"Default: 'file://ins.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/poa'
|
48
|
+
CORBA.implement('Test.idl', OPTIONS, CORBA::IDL::SERVANT_INTF)
|
49
|
+
else
|
50
|
+
require 'TestS.rb'
|
51
|
+
end
|
52
|
+
require 'corba/naming'
|
53
|
+
|
54
|
+
class MyHello < POA::Test::Hello
|
55
|
+
def initialize(orb)
|
56
|
+
@orb = orb
|
57
|
+
end
|
58
|
+
|
59
|
+
def get_string()
|
60
|
+
'Hello there!'
|
61
|
+
end
|
62
|
+
|
63
|
+
def shutdown()
|
64
|
+
@orb.shutdown()
|
65
|
+
end
|
66
|
+
end # of servant MyHello
|
67
|
+
|
68
|
+
# initialize ORB
|
69
|
+
orb = CORBA.ORB_init(['-ORBDebugLevel', OPTIONS[:orb_debuglevel]], 'myORB')
|
70
|
+
|
71
|
+
# resolve NamingContext
|
72
|
+
obj = orb.string_to_object(OPTIONS[:iorfile])
|
73
|
+
|
74
|
+
nc = CosNaming::NamingContextExt._narrow(obj)
|
75
|
+
|
76
|
+
assert_not 'ERROR: INS IOR resolved to nil object!', CORBA::is_nil(nc)
|
77
|
+
|
78
|
+
# initialize POA
|
79
|
+
obj = orb.resolve_initial_references('RootPOA')
|
80
|
+
|
81
|
+
root_poa = PortableServer::POA._narrow(obj)
|
82
|
+
|
83
|
+
poa_man = root_poa.the_POAManager
|
84
|
+
|
85
|
+
poa_man.activate
|
86
|
+
|
87
|
+
# create and activate servant
|
88
|
+
hello_srv = MyHello.new(orb)
|
89
|
+
|
90
|
+
hello_obj = hello_srv._this()
|
91
|
+
|
92
|
+
# register 5 object references with Naming service
|
93
|
+
5.times do |i|
|
94
|
+
nc.bind([CosNaming::NameComponent.new("Hello#{i}", 'ior')], hello_obj)
|
95
|
+
end
|
96
|
+
|
97
|
+
# initialize signal handling
|
98
|
+
Signal.trap('INT') do
|
99
|
+
puts 'SIGINT - shutting down ORB...'
|
100
|
+
orb.shutdown()
|
101
|
+
end
|
102
|
+
|
103
|
+
if Signal.list.has_key?('USR2')
|
104
|
+
Signal.trap('USR2', 'EXIT')
|
105
|
+
end
|
106
|
+
|
107
|
+
# run ORB event loop
|
108
|
+
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,84 @@
|
|
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 => 'corbaname.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 file.',
|
30
|
+
"Default: 'corbaname.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
|
+
require 'corba/naming'
|
53
|
+
|
54
|
+
orb = CORBA.ORB_init(['-ORBDebugLevel', OPTIONS[:orb_debuglevel]], 'myORB')
|
55
|
+
|
56
|
+
begin
|
57
|
+
|
58
|
+
# read corbaname from file
|
59
|
+
corbaname = ''
|
60
|
+
File.open(OPTIONS[:iorfile], 'r') do |f|
|
61
|
+
corbaname = f.read
|
62
|
+
end
|
63
|
+
|
64
|
+
puts "client: read corbaname URL [#{corbaname}]"
|
65
|
+
|
66
|
+
# resolve object reference
|
67
|
+
obj = orb.string_to_object(corbaname)
|
68
|
+
|
69
|
+
# narrow object ref and call
|
70
|
+
hello_obj = Test::Hello._narrow(obj)
|
71
|
+
|
72
|
+
assert_not 'ERROR: corbaname resolved to nil object!', CORBA::is_nil(hello_obj)
|
73
|
+
|
74
|
+
the_string = hello_obj.get_string()
|
75
|
+
|
76
|
+
puts "client: string returned <#{the_string}>"
|
77
|
+
|
78
|
+
hello_obj.shutdown()
|
79
|
+
|
80
|
+
ensure
|
81
|
+
|
82
|
+
orb.destroy()
|
83
|
+
|
84
|
+
end
|
@@ -0,0 +1,87 @@
|
|
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
|
+
def do_exit(rc)
|
44
|
+
ins_stop = Test.new
|
45
|
+
ins_stop.run("-e \'require \"corba/svcs/ins/ins.rb\"\' -e \'R2CORBA::INS.run\'", '-- stop --no-daemon')
|
46
|
+
ins_stop.wait(50)
|
47
|
+
exit(rc)
|
48
|
+
end
|
49
|
+
|
50
|
+
ior_file = 'ins.ior'
|
51
|
+
|
52
|
+
corbaname_file = 'corbaname.ior'
|
53
|
+
|
54
|
+
TestUtil.remove_file(ior_file)
|
55
|
+
TestUtil.remove_file(corbaname_file)
|
56
|
+
|
57
|
+
ins = Test.new
|
58
|
+
|
59
|
+
exit(255) if !ins.run("-e \'require \"corba/svcs/ins/ins.rb\"\' -e \'R2CORBA::INS.run\'", '-- start -l 2345')
|
60
|
+
|
61
|
+
do_exit(255) if !TestUtil.wait_for_file(ior_file, 400)
|
62
|
+
|
63
|
+
srv = Test.new
|
64
|
+
|
65
|
+
do_exit(255) if !srv.run('server.rb', "--o #{corbaname_file} --p 2345 #{OPTIONS[:debug_opt]} #{OPTIONS[:use_implement]}")
|
66
|
+
|
67
|
+
if !TestUtil.wait_for_file(corbaname_file, 400)
|
68
|
+
svr.kill(100)
|
69
|
+
do_exit(255)
|
70
|
+
end
|
71
|
+
|
72
|
+
clt = Test.new
|
73
|
+
|
74
|
+
if !clt.run('client.rb', "--k #{corbaname_file} #{OPTIONS[:debug_opt]} #{OPTIONS[:use_implement]}")
|
75
|
+
srv.kill(100)
|
76
|
+
do_exit(255)
|
77
|
+
end
|
78
|
+
|
79
|
+
exrc = clt.wait(400)
|
80
|
+
|
81
|
+
if exrc == 0
|
82
|
+
srv.wait(400)
|
83
|
+
else
|
84
|
+
srv.wait_term(400)
|
85
|
+
end
|
86
|
+
|
87
|
+
do_exit(exrc)
|