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');
26 $ns->AddLibPath ('../lib');
28 #my $nscorbaloc = "-ORBInitRef NameService=file://$namingior";
30 my $supiorfile = "supplier.ior";
31 my $nsiorfile = "naming.ior";
32 my $nfsiorfile = "notify.ior";
34 my $ns_nsiorfile = $ns->LocalFile ($nsiorfile);
35 my $nfs_nsiorfile = $nfs->LocalFile ($nsiorfile);
36 my $sup_nsiorfile = $sup->LocalFile ($nsiorfile);
37 my $con_nsiorfile = $con->LocalFile ($nsiorfile);
38 my $nfs_nfsiorfile = $nfs->LocalFile ($nfsiorfile);
39 my $sup_supiorfile = $sup->LocalFile ($supiorfile);
40 my $con_supiorfile = $con->LocalFile ($supiorfile);
41 $ns->DeleteFile ($nsiorfile);
42 $nfs->DeleteFile ($nsiorfile);
43 $sup->DeleteFile ($nsiorfile);
44 $con->DeleteFile ($nsiorfile);
45 $nfs->DeleteFile ($nfsiorfile);
46 $sup->DeleteFile ($supiorfile);
47 $con->DeleteFile ($supiorfile);
49 my $NS = $ns->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Naming_Service/tao_cosnaming",
51 my $NFS = $ns->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Notify_Service/tao_cosnotification",
52 "-ORBInitRef NameService=file://$nfs_nsiorfile " .
53 "-IORoutput $nfs_nfsiorfile -Timeout 750");
54 my $SUP = $ns->CreateProcess("Structured_Supplier",
55 "-ORBDebugLevel $debug_level ".
56 "-ORBInitRef NameService=file://$sup_nsiorfile ".
57 "-o $sup_supiorfile");
58 my $CON = $ns->CreateProcess("Structured_Consumer",
59 "-ORBInitRef NameService=file://$con_nsiorfile ".
60 "-k file://$con_supiorfile");
62 $NS_status = $NS->Spawn ();
63 if ($NS_status != 0) {
64 print STDERR
"ERROR: Name Service returned $NS_status\n";
68 if ($ns->WaitForFileTimed ($nsiorfile,$ns->ProcessStartWaitInterval()+$startup_timeout) == -1) {
69 print STDERR
"ERROR: cannot find file <$ns_nsiorfile>\n";
70 $NS->Kill (); $NS->TimedWait (1);
74 if ($ns->GetFile ($nsiorfile) == -1) {
75 print STDERR
"ERROR: cannot retrieve file <$ns_nsiorfile>\n";
76 $NS->Kill (); $NS->TimedWait (1);
79 if ($nfs->PutFile ($nsiorfile) == -1) {
80 print STDERR
"ERROR: cannot set file <$nfs_nsiorfile>\n";
81 $NS->Kill (); $NS->TimedWait (1);
84 if ($sup->PutFile ($nsiorfile) == -1) {
85 print STDERR
"ERROR: cannot set file <$sup_nsiorfile>\n";
86 $NS->Kill (); $NS->TimedWait (1);
89 if ($con->PutFile ($nsiorfile) == -1) {
90 print STDERR
"ERROR: cannot set file <$con_nsiorfile>\n";
91 $NS->Kill (); $NS->TimedWait (1);
95 $NFS_status = $NFS->Spawn ();
97 if ($NFS_status != 0) {
98 print STDERR
"ERROR: Notify Service returned $NFS_status\n";
102 if ($nfs->WaitForFileTimed ($nfsiorfile,$nfs->ProcessStartWaitInterval()+$startup_timeout) == -1) {
103 print STDERR
"ERROR: cannot find file <$nfs_nfsiorfile>\n";
104 $NS->Kill (); $NS->TimedWait (1);
105 $NFS->Kill (); $NFS->TimedWait (1);
109 $SUP_status = $SUP->Spawn ();
110 if ($SUP_status != 0) {
111 print STDERR
"ERROR: Supplier returned $SUP_status\n";
114 if ($sup->WaitForFileTimed ($supiorfile,$sup->ProcessStartWaitInterval()+$startup_timeout) == -1) {
115 print STDERR
"ERROR: cannot find file <$sup_supiorfile>\n";
116 $SUP->Kill (); $SUP->TimedWait (1);
117 $NS->Kill (); $NS->TimedWait (1);
118 $NFS->Kill (); $NFS->TimedWait (1);
121 if ($sup->GetFile ($supiorfile) == -1) {
122 print STDERR
"ERROR: cannot retrieve file <$sup_supiorfile>\n";
123 $SUP->Kill (); $SUP->TimedWait (1);
124 $NS->Kill (); $NS->TimedWait (1);
125 $NFS->Kill (); $NFS->TimedWait (1);
128 if ($con->PutFile ($supiorfile) == -1) {
129 print STDERR
"ERROR: cannot set file <$con_supiorfile>\n";
130 $SUP->Kill (); $SUP->TimedWait (1);
131 $NS->Kill (); $NS->TimedWait (1);
132 $NFS->Kill (); $NFS->TimedWait (1);
136 ## Wait for the supplier to create the event channel in
137 ## the tao_cosnotification and register it with the Name Service
140 $CON_status = $CON->SpawnWaitKill ($con->ProcessStartWaitInterval()+5);
141 if ($CON_status != 0) {
142 print STDERR
"ERROR: Consumer returned $CON_status\n";
146 $SUP_status = $SUP->WaitKill ($sup->ProcessStopWaitInterval());
147 if ($SUP_status != 0) {
148 print STDERR
"ERROR: Supplier returned $SUP_status\n";
152 $NFS_status = $NFS->TerminateWaitKill ($nfs->ProcessStopWaitInterval());
153 if ($NFS_status != 0) {
154 print STDERR
"ERROR: Notification Service returned $NFS_status\n";
158 $NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval());
159 if ($NS_status != 0) {
160 print STDERR
"ERROR: Name Service returned $NS_status\n";
164 $ns->DeleteFile ($nsiorfile);
165 $nfs->DeleteFile ($nsiorfile);
166 $sup->DeleteFile ($nsiorfile);
167 $con->DeleteFile ($nsiorfile);
168 $nfs->DeleteFile ($nfsiorfile);
169 $sup->DeleteFile ($supiorfile);
170 $con->DeleteFile ($supiorfile);