1 eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
2 & eval 'exec perl -S $0 $argv:q'
7 use lib
"$ENV{ACE_ROOT}/bin";
8 use PerlACE
::TestTarget
;
19 my $ns = PerlACE
::TestTarget
::create_target
(1) || die "Create target 1 failed\n";
20 my $nfs = PerlACE
::TestTarget
::create_target
(2) || die "Create target 2 failed\n";
21 my $sup = PerlACE
::TestTarget
::create_target
(3) || die "Create target 3 failed\n";
22 my $con = PerlACE
::TestTarget
::create_target
(4) || die "Create target 4 failed\n";
24 $sup->AddLibPath ('../lib');
25 $con->AddLibPath ('../lib');
27 $port = $ns->RandomPort ();
28 $host = $ns->HostName ();
30 $supiorfile = "supplier.ior";
31 $nsiorfile = "naming.ior";
32 $nfsiorfile = "notify.ior";
33 $nfsconffile = "notify$PerlACE::svcconf_ext";
35 my $ns_nsiorfile = $ns->LocalFile ($nsiorfile);
36 my $nfs_nfsiorfile = $nfs->LocalFile ($nfsiorfile);
37 my $sup_supiorfile = $sup->LocalFile ($supiorfile);
38 my $con_supiorfile = $con->LocalFile ($supiorfile);
39 my $nfs_nfsconffile = $nfs->LocalFile ($nfsconffile);
40 $ns->DeleteFile ($nsiorfile);
41 $nfs->DeleteFile ($nfsiorfile);
42 $sup->DeleteFile ($supiorfile);
43 $con->DeleteFile ($supiorfile);
45 $NS = $ns->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Naming_Service/tao_cosnaming",
46 "-ORBEndpoint iiop://$host:$port ".
48 $NFS = $nfs->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Notify_Service/tao_cosnotification",
49 "-ORBInitRef NameService=iioploc://" .
50 "$host:$port/NameService " .
51 "-IORoutput $nfs_nfsiorfile -ORBSvcConf " .
53 $SUP = $sup->CreateProcess ("Structured_Supplier",
54 "-ORBDebugLevel $debug_level ".
55 "-ORBInitRef NameService=iioploc://" .
56 "$host:$port/NameService ".
57 "-o $sup_supiorfile");
58 $CON = $con->CreateProcess ("Structured_Consumer",
59 "-ORBInitRef NameService=iioploc://".
60 "$host:$port/NameService ".
61 "-k file://$con_supiorfile");
63 $NS_status = $NS->Spawn ();
64 if ($NS_status != 0) {
65 print STDERR
"ERROR: Name Service returned $NS_status\n";
66 $NS->Kill (); $NS->TimedWait (1);
69 if ($ns->WaitForFileTimed ($nsiorfile,$ns->ProcessStartWaitInterval()) == -1) {
70 print STDERR
"ERROR: cannot find file <$ns_nsiorfile>\n";
71 $NS->Kill (); $NS->TimedWait (1);
75 $NFS_status = $NFS->Spawn ();
76 if ($NFS_status != 0) {
77 print STDERR
"ERROR: Notify Service returned $NFS_status\n";
78 $NS->Kill (); $NS->TimedWait (1);
79 $NFS->Kill (); $NFS->TimedWait (1);
82 if ($nfs->WaitForFileTimed ($nfsiorfile,$nfs->ProcessStartWaitInterval()) == -1) {
83 print STDERR
"ERROR: cannot find file <$nfs_nfsiorfile>\n";
84 $NS->Kill (); $NS->TimedWait (1);
85 $NFS->Kill (); $NFS->TimedWait (1);
89 $SUP_status = $SUP->Spawn ();
90 if ($SUP_status != 0) {
91 print STDERR
"ERROR: Supplier returned $SUP_status\n";
92 $SUP->Kill (); $SUP->TimedWait (1);
93 $NFS->Kill (); $NFS->TimedWait (1);
94 $NS->Kill (); $NS->TimedWait (1);
97 if ($sup->WaitForFileTimed ($supiorfile,$sup->ProcessStartWaitInterval()) == -1) {
98 print STDERR
"ERROR: cannot find file <$sup_supiorfile>\n";
99 $SUP->Kill (); $SUP->TimedWait (1);
100 $NS->Kill (); $NS->TimedWait (1);
101 $NFS->Kill (); $NFS->TimedWait (1);
104 if ($sup->GetFile ($supiorfile) == -1) {
105 print STDERR
"ERROR: cannot retrieve file <$sup_supiorfile>\n";
106 $SUP->Kill (); $SUP->TimedWait (1);
107 $NFS->Kill (); $NFS->TimedWait (1);
108 $NS->Kill (); $NS->TimedWait (1);
111 if ($con->PutFile ($supiorfile) == -1) {
112 print STDERR
"ERROR: cannot set file <$con_supiorfile>\n";
113 $SUP->Kill (); $SUP->TimedWait (1);
114 $NFS->Kill (); $NFS->TimedWait (1);
115 $NS->Kill (); $NS->TimedWait (1);
119 $CON_status = $CON->SpawnWaitKill ($con->ProcessStartWaitInterval());
120 if ($CON_status != 0) {
121 print STDERR
"ERROR: Consumer returned $CON_status\n";
125 $SUP_status = $SUP->WaitKill ($con->ProcessStopWaitInterval());
126 if ($SUP_status != 0) {
127 print STDERR
"ERROR: Supplier returned $SUP_status\n";
131 $NFS_status = $NFS->Kill ($nfs->ProcessStopWaitInterval());
132 if ($NFS_status != 0) {
133 print STDERR
"ERROR: Notify Service returned $NFS_status\n";
134 $NS->Kill (); $NS->TimedWait (1);
138 $NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval());
139 if ($NS_status != 0) {
140 print STDERR
"ERROR: Name Service returned $NS_status\n";
144 $ns->DeleteFile ($nsiorfile);
145 $nfs->DeleteFile ($nfsiorfile);
146 $sup->DeleteFile ($supiorfile);
147 $con->DeleteFile ($supiorfile);