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 $ns = PerlACE
::TestTarget
::create_target
(1) || die "Create target 1 failed\n";
19 my $srv = PerlACE
::TestTarget
::create_target
(2) || die "Create target 2 failed\n";
20 my $cli = PerlACE
::TestTarget
::create_target
(3) || die "Create target 3 failed\n";
22 my $nsiorfile = "ns.ior";
23 my $srviorfile = "url.ior";
25 my $ns_nsiorfile = $ns->LocalFile ($nsiorfile);
26 my $srv_srviorfile = $srv->LocalFile ($srviorfile);
27 my $cli_srviorfile = $cli->LocalFile ($srviorfile);
28 $ns->DeleteFile ($nsiorfile);
29 $srv->DeleteFile ($srviorfile);
30 $cli->DeleteFile ($srviorfile);
32 $hostname = $ns->HostName ();
35 $NameService = "$ENV{TAO_ROOT}/orbsvcs/Naming_Service/tao_cosnaming";
36 $NS = $ns->CreateProcess ($NameService, "-ORBListenEndpoints iiop://$hostname:$port ".
38 $SRV = $srv->CreateProcess ("MessengerServer", "-ORBdebuglevel $debug_level ".
39 "-o $srv_srviorfile ".
42 "-ORBInitRef NameService=iiop://$hostname:$port/NameService");
43 $CLI = $cli->CreateProcess ("MessengerClient", "-k file://$cli_srviorfile ".
44 "-ORBInitRef NameService=iiop://$hostname:$port/NameService");
46 # start Naming Service
47 $NS_status = $NS->Spawn ();
49 if ($NS_status != 0) {
50 print STDERR
"ERROR: Name Service returned $NS_status\n";
54 if ($ns->WaitForFileTimed ($nsiorfile,$ns->ProcessStartWaitInterval()) == -1) {
55 print STDERR
"ERROR: cannot find file <$ns_nsiorfile>\n";
56 $NS->Kill (); $NS->TimedWait (1);
60 # start MessengerServer
61 $SRV_status = $SRV->Spawn ();
63 if ($SRV_status != 0) {
64 print STDERR
"ERROR: Messenger Server returned $SRV_status\n";
68 if ($srv->WaitForFileTimed ($srviorfile,$srv->ProcessStartWaitInterval()) == -1) {
69 print STDERR
"ERROR: cannot find file <$srv_srviorfile>\n";
70 $NS->Kill (); $NS->TimedWait (1);
71 $SRV->Kill (); $SRV->TimedWait (1);
75 if ($srv->GetFile ($srviorfile) == -1) {
76 print STDERR
"ERROR: cannot retrieve file <$srv_srviorfile>\n";
77 $NS->Kill (); $NS->TimedWait (1);
78 $SRV->Kill (); $SRV->TimedWait (1);
81 if ($cli->PutFile ($srviorfile) == -1) {
82 print STDERR
"ERROR: cannot set file <$cli_srviorfile>\n";
83 $NS->Kill (); $NS->TimedWait (1);
84 $SRV->Kill (); $SRV->TimedWait (1);
88 # start MessengerClient
89 $CLI_status = $CLI->SpawnWaitKill ($cli->ProcessStartWaitInterval());
91 if ($CLI_status != 0) {
92 print STDERR
"ERROR: Messenger Client failed with status $CLI_status\n";
97 $SRV_status = $SRV->TerminateWaitKill ($srv->ProcessStopWaitInterval());
99 if ($SRV_status != 0) {
100 print STDERR
"ERROR: Messenger Server returned $SRV_status\n";
104 $NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval());
106 if ($NS_status != 0) {
107 print STDERR
"ERROR: Name Service returned $NS_status\n";
111 $ns->DeleteFile ($nsiorfile);
112 $srv->DeleteFile ($srviorfile);
113 $cli->DeleteFile ($srviorfile);