2 eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
3 & eval 'exec perl -S $0 $argv:q'
6 use lib
"$ENV{ACE_ROOT}/bin";
7 use PerlACE
::TestTarget
;
18 my $c1 = PerlACE
::TestTarget
::create_target
(1) || die "Create target 1 failed\n";
19 my $c2 = PerlACE
::TestTarget
::create_target
(2) || die "Create target 2 failed\n";
20 my $imr = PerlACE
::TestTarget
::create_target
(3) || die "Create target 3 failed\n";
21 my $act = PerlACE
::TestTarget
::create_target
(4) || die "Create target 4 failed\n";
22 my $ti = PerlACE
::TestTarget
::create_target
(5) || die "Create target 5 failed\n";
23 my $si = PerlACE
::TestTarget
::create_target
(6) || die "Create target 6 failed\n";
24 my $sdn = PerlACE
::TestTarget
::create_target
(7) || die "Create target 7 failed\n";
26 my $implrepo_server = "$ENV{TAO_ROOT}/orbsvcs/ImplRepo_Service/tao_imr_locator";
27 my $imr_activator = "$ENV{TAO_ROOT}/orbsvcs/ImplRepo_Service/tao_imr_activator";
28 my $tao_imr = "$ENV{ACE_ROOT}/bin/tao_imr";
31 $implrepo_ior = "implrepo.ior";
32 $activator_ior = "activator.ior";
33 $messenger_ior = "Messenger.ior";
35 my $imr_imriorfile = $imr->LocalFile ($implrepo_ior);
36 my $act_imriorfile = $act->LocalFile ($implrepo_ior);
37 my $ti_imriorfile = $ti->LocalFile ($implrepo_ior);
38 my $si_imriorfile = $si->LocalFile ($implrepo_ior);
39 my $sdn_imriorfile = $sdn->LocalFile ($implrepo_ior);
40 my $act_actiorfile = $act->LocalFile ($activator_ior);
41 my $imr_srviorfile = $imr->LocalFile ($messenger_ior);
42 my $c1_srviorfile = $c1->LocalFile ($messenger_ior);
43 my $c2_srviorfile = $c2->LocalFile ($messenger_ior);
44 my $si_srviorfile = $si->LocalFile ($messenger_ior);
46 # Make sure the files are gone, so we can wait on them.
47 $imr->DeleteFile ($implrepo_ior);
48 $act->DeleteFile ($implrepo_ior);
49 $ti->DeleteFile ($implrepo_ior);
50 $si->DeleteFile ($implrepo_ior);
51 $sdn->DeleteFile ($implrepo_ior);
52 $act->DeleteFile ($activator_ior);
53 $imr->DeleteFile ($messenger_ior);
54 $c1->DeleteFile ($messenger_ior);
55 $c2->DeleteFile ($messenger_ior);
56 $si->DeleteFile ($messenger_ior);
58 # Note : We don't actually use SVR, but we need a way to get the
59 # path to the -ExeSubDir
60 $SVR = $imr->CreateProcess ("MessengerServer", "-ORBdebuglevel $debug_level");
61 my $server = $SVR->Executable ();
62 my $srv_server = $imr->LocalFile ($server);
64 $IR = $imr->CreateProcess ($implrepo_server, "-d 1 ".
65 "orbobjrefstyle url ".
67 "-o $imr_imriorfile");
68 print ">>> " . $IR->CommandLine() . "\n";
70 $ACT = $act->CreateProcess ($imr_activator, "-d 1 ".
71 "orbobjrefstyle url ".
72 "-o $act_actiorfile ".
73 "-ORBInitRef ImplRepoService=file://$act_imriorfile");
75 $TI = $ti->CreateProcess ($tao_imr, "-ORBInitRef ImplRepoService=file://$ti_imriorfile ".
76 "add MessengerService ".
77 "-c \"$srv_server -orbobjrefstyle url -ORBUseIMR 1 -ORBInitRef ImplRepoService=file://$imr_imriorfile\" ");
81 $SI = $si->CreateProcess ($tao_imr, "-ORBInitRef ImplRepoService=file://$si_imriorfile ".
82 "ior MessengerService ".
83 "-f $si_srviorfile ");
85 $C1 = $c1->CreateProcess ("MessengerClient", "-k file://$c1_srviorfile ");
87 $SDN = $sdn->CreateProcess ("$tao_imr", "-ORBInitRef ImplRepoService=file://$sdn_imriorfile ".
88 "shutdown MessengerService");
90 $C2 = $c2->CreateProcess ("MessengerClient", "-k file://$c2_srviorfile ");
93 $IR_status = $IR->Spawn ();
95 if ($IR_status != 0) {
96 print STDERR
"ERROR: ImplRepo Service returned $IR_status\n";
100 if ($imr->WaitForFileTimed ($implrepo_ior,$imr->ProcessStartWaitInterval()) == -1) {
101 print STDERR
"ERROR: cannot find file <$imr_imriorfile>\n";
102 $IR->Kill (); $IR->TimedWait (1);
106 if ($imr->GetFile ($implrepo_ior) == -1) {
107 print STDERR
"ERROR: cannot retrieve file <$imr_imriorfile>\n";
108 $IR->Kill (); $IR->TimedWait (1);
111 if ($act->PutFile ($implrepo_ior) == -1) {
112 print STDERR
"ERROR: cannot set file <$act_imriorfile>\n";
113 $IR->Kill (); $IR->TimedWait (1);
116 if ($ti->PutFile ($implrepo_ior) == -1) {
117 print STDERR
"ERROR: cannot set file <$ti_imriorfile>\n";
118 $IR->Kill (); $IR->TimedWait (1);
121 if ($si->PutFile ($implrepo_ior) == -1) {
122 print STDERR
"ERROR: cannot set file <$si_imriorfile>\n";
123 $IR->Kill (); $IR->TimedWait (1);
126 if ($sdn->PutFile ($implrepo_ior) == -1) {
127 print STDERR
"ERROR: cannot set file <$sdn_imriorfile>\n";
128 $IR->Kill (); $IR->TimedWait (1);
132 print ">>> " . $ACT->CommandLine() . "\n";
133 $ACT_status = $ACT->Spawn ();
135 if ($ACT_status != 0) {
136 print STDERR
"ERROR: ImR_Activator returned $ACT_status\n";
140 if ($act->WaitForFileTimed ($activator_ior,$act->ProcessStartWaitInterval()) == -1) {
141 print STDERR
"ERROR: cannot find file <$act_actiorfile>\n";
142 $IR->Kill (); $IR->TimedWait (1);
143 $ACT->Kill (); $ACT->TimedWait (1);
147 print ">>> " . $TI->CommandLine() . "\n";
148 # We want the tao_imr executable to be found exactly in the path
149 # given, without being modified by the value of -ExeSubDir.
150 # So, we tell its Process object to ignore the setting of -ExeSubDir.
152 $TI->IgnoreExeSubDir (1);
154 ## Note : Instead of using tao_imr to generate the ior, it's easy enough
155 ## to just create one by hand. The ior is just a normal corbaloc ior with
156 ## the poa_name of the server and ip address of the imr.
157 ## (ie corbaloc::localhost:8888/Messengerservice)
158 ## Of course, to do this, you'd have to start the imr on port 8888.
159 ## We use the "tao_imr ior" command, because we don't know which port was used.
160 $TI_status = $TI->SpawnWaitKill ($ti->ProcessStartWaitInterval());
162 if ($TI_status != 0) {
163 print STDERR
"ERROR: tao_imr returned $TI_status\n";
164 $IR->Kill (); $IR->TimedWait (1);
165 $ACT->Kill (); $ACT->TimedWait (1);
169 print ">>> " . $SI->CommandLine() . "\n";
170 $SI->IgnoreExeSubDir (1);
173 $SI_status = $SI->SpawnWaitKill ($si->ProcessStartWaitInterval());
175 if ($SI_status != 0) {
176 print STDERR
"ERROR: tao_imr returned $SI_status\n";
177 $IR->Kill (); $IR->TimedWait (1);
178 $ACT->Kill (); $ACT->TimedWait (1);
182 if ($si->WaitForFileTimed ($messenger_ior,$si->ProcessStartWaitInterval()) == -1) {
183 print STDERR
"ERROR: cannot find file <$si_srviorfile>\n";
184 $IR->Kill (); $IR->TimedWait (1);
185 $ACT->Kill (); $ACT->TimedWait (1);
189 if ($si->GetFile ($messenger_ior) == -1) {
190 print STDERR
"ERROR: cannot retrieve file <$si_srviorfile>\n";
191 $IR->Kill (); $IR->TimedWait (1);
192 $ACT->Kill (); $ACT->TimedWait (1);
195 if ($c1->PutFile ($messenger_ior) == -1) {
196 print STDERR
"ERROR: cannot set file <$c1_srviorfile>\n";
197 $IR->Kill (); $IR->TimedWait (1);
198 $ACT->Kill (); $ACT->TimedWait (1);
201 if ($c2->PutFile ($messenger_ior) == -1) {
202 print STDERR
"ERROR: cannot set file <$c2_srviorfile>\n";
203 $IR->Kill (); $IR->TimedWait (1);
204 $ACT->Kill (); $ACT->TimedWait (1);
209 print ">>> " . $C1->CommandLine() . "\n";
210 $C1_status = $C1->SpawnWaitKill ($c1->ProcessStartWaitInterval());
212 if ($C1_status != 0) {
213 print STDERR
"ERROR: Client1 returned $C1_status\n";
214 $IR->Kill (); $IR->TimedWait (1);
215 $ACT->Kill (); $ACT->TimedWait (1);
219 $SDN->IgnoreExeSubDir (1);
220 $SDN_status = $SDN->SpawnWaitKill ($sdn->ProcessStartWaitInterval());
222 if ($SDN_status != 0) {
223 print STDERR
"ERROR: Shutdown returned $SDN_status\n";
224 $IR->Kill (); $IR->TimedWait (1);
225 $ACT->Kill (); $ACT->TimedWait (1);
229 $C2_status = $C2->SpawnWaitKill ($c2->ProcessStartWaitInterval());
231 if ($C2_status != 0) {
232 print STDERR
"ERROR: Client2 returned $C2_status\n";
233 $IR->Kill (); $IR->TimedWait (1);
234 $ACT->Kill (); $ACT->TimedWait (1);
239 $SDN_status = $SDN->SpawnWaitKill ($sdn->ProcessStartWaitInterval());
241 if ($SDN_status != 0) {
242 print STDERR
"ERROR: Shutdown returned $SDN_status\n";
243 $IR->Kill (); $IR->TimedWait (1);
244 $ACT->Kill (); $ACT->TimedWait (1);
248 $ACT_status = $ACT->TerminateWaitKill ($act->ProcessStopWaitInterval());
250 if ($ACT_status != 0) {
251 print STDERR
"ERROR: ImR_Activator returned $ACT_status\n";
255 $IR_status = $IR->TerminateWaitKill ($imr->ProcessStopWaitInterval());
257 if ($IR_status != 0) {
258 print STDERR
"ERROR: ImplRepo Server returned $IR_status\n";
263 $imr->DeleteFile ($implrepo_ior);
264 $act->DeleteFile ($implrepo_ior);
265 $ti->DeleteFile ($implrepo_ior);
266 $si->DeleteFile ($implrepo_ior);
267 $sdn->DeleteFile ($implrepo_ior);
268 $act->DeleteFile ($activator_ior);
269 $imr->DeleteFile ($messenger_ior);
270 $c1->DeleteFile ($messenger_ior);
271 $c2->DeleteFile ($messenger_ior);
272 $si->DeleteFile ($messenger_ior);