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 $es = PerlACE
::TestTarget
::create_target
(2) || die "Create target 2 failed\n";
20 my $s = PerlACE
::TestTarget
::create_target
(3) || die "Create target 3 failed\n";
21 my $c = PerlACE
::TestTarget
::create_target
(4) || die "Create target 4 failed\n";
23 my $nsiorfile = "ns.ior";
24 my $esiorfile = "es.ior";
26 my $ns_nsiorfile = $ns->LocalFile ($nsiorfile);
27 my $es_nsiorfile = $es->LocalFile ($nsiorfile);
28 my $s_nsiorfile = $s->LocalFile ($nsiorfile);
29 my $c_nsiorfile = $c->LocalFile ($nsiorfile);
30 my $es_esiorfile = $es->LocalFile ($esiorfile);
31 $ns->DeleteFile ($nsiorfile);
32 $es->DeleteFile ($nsiorfile);
33 $s->DeleteFile ($nsiorfile);
34 $c->DeleteFile ($nsiorfile);
35 $es->DeleteFile ($esiorfile);
39 $NameService = "$ENV{TAO_ROOT}/orbsvcs/Naming_Service/tao_cosnaming";
40 $NS = $ns->CreateProcess ($NameService, "-ORBdebuglevel $debug_level -ORBListenEndpoints iiop://:2809 ".
43 $EventService = "$ENV{TAO_ROOT}/orbsvcs/CosEvent_Service/tao_cosevent";
44 $ES = $es->CreateProcess ($EventService, " -o $es_esiorfile ".
45 "-ORBInitRef NameService=file://$es_nsiorfile");
46 $S = $ns->CreateProcess ("EchoEventSupplier", "-ORBInitRef NameService=file://$s_nsiorfile");
47 $C = $ns->CreateProcess ("EchoEventConsumer", "-ORBInitRef NameService=file://$c_nsiorfile");
49 # start Naming Service
50 $NS_status = $NS->Spawn ();
52 if ($NS_status != 0) {
53 print STDERR
"ERROR: Name Service returned $NS_status\n";
59 if ($ns->WaitForFileTimed ($nsiorfile,$ns->ProcessStartWaitInterval()) == -1) {
60 print STDERR
"ERROR: cannot find file <$ns_nsiorfile>\n";
61 $NS->Kill (); $NS->TimedWait (1);
65 if ($ns->GetFile ($nsiorfile) == -1) {
66 print STDERR
"ERROR: cannot retrieve file <$ns_nsiorfile>\n";
67 $NS->Kill (); $NS->TimedWait (1);
70 if ($es->PutFile ($nsiorfile) == -1) {
71 print STDERR
"ERROR: cannot set file <$es_nsiorfile>\n";
72 $NS->Kill (); $NS->TimedWait (1);
75 if ($s->PutFile ($nsiorfile) == -1) {
76 print STDERR
"ERROR: cannot set file <$s_nsiorfile>\n";
77 $NS->Kill (); $NS->TimedWait (1);
80 if ($c->PutFile ($nsiorfile) == -1) {
81 print STDERR
"ERROR: cannot set file <$c_nsiorfile>\n";
82 $NS->Kill (); $NS->TimedWait (1);
87 $ES_status = $ES->Spawn ();
89 if ($ES_status != 0) {
90 print STDERR
"ERROR: Event Service returned $ES_status\n";
96 if ($es->WaitForFileTimed ($esiorfile,$es->ProcessStartWaitInterval()) == -1) {
97 print STDERR
"ERROR: cannot find file <$es_esiorfile>\n";
98 $ES->Kill (); $ES->TimedWait (1);
102 # start EchoEventSupplier
103 $S_status = $S->Spawn ();
105 if ($S_status != 0) {
106 print STDERR
"ERROR: Supplier returned $S_status\n";
110 # start EchoEventConsumer
111 $C_status = $C->Spawn ();
113 if ($C_status != 0) {
114 print STDERR
"ERROR: Consumer returned $C_status\n";
118 $C_status = $C->WaitKill ($c->ProcessStopWaitInterval()+45);
120 if ($C_status != 0) {
121 print STDERR
"ERROR: Consumer returned $C_status\n";
125 $S_status = $S->TerminateWaitKill ($s->ProcessStopWaitInterval());
127 if ($S_status != 0) {
128 print STDERR
"ERROR: Supplier returned $S_status\n";
132 $ES_status = $ES->TerminateWaitKill ($es->ProcessStopWaitInterval());
134 if ($ES_status != 0) {
135 print STDERR
"ERROR: Event Service returned $ES_status\n";
139 $NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval());
141 if ($NS_status != 0) {
142 print STDERR
"ERROR: Name Service returned $NS_status\n";
146 $ns->DeleteFile ($nsiorfile);
147 $es->DeleteFile ($nsiorfile);
148 $s->DeleteFile ($nsiorfile);
149 $c->DeleteFile ($nsiorfile);
150 $es->DeleteFile ($esiorfile);