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
;
10 sub count_matching_lines
{
16 ++$count if /$pattern/;
24 my $sink = PerlACE
::TestTarget
::create_target
(1) || die "Create target 1 failed\n";
25 my $middle = PerlACE
::TestTarget
::create_target
(2) || die "Create target 2 failed\n";
26 my $source = PerlACE
::TestTarget
::create_target
(2) || die "Create target 2 failed\n";
28 my $sinkiorfilebase = "sink.ior";
29 my $sinkiorfile = $sink->LocalFile ($sinkiorfilebase);
31 my $middleiorfilebase = "middle.ior";
32 my $middleiorfile = $middle->LocalFile ($middleiorfilebase);
34 my $sinklogfilebase = "sink.log";
35 my $sinklogfile = $sink->LocalFile ($sinklogfilebase);
37 my $middlelogfilebase = "middle.log";
38 my $middlelogfile = $middle->LocalFile ($middlelogfilebase);
40 my $sourcelogfilebase = "source.log";
41 my $sourcelogfile = $source->LocalFile ($sourcelogfilebase);
43 $sink->DeleteFile ($sinkiorfilebase);
44 $sink->DeleteFile ($sinklogfilebase);
46 $middle->DeleteFile ($middleiorfilebase);
47 $middle->DeleteFile ($middlelogfilebase);
49 $source->DeleteFile ($sourcelogfilebase);
51 my $middleconffilebase = "middle.conf";
52 my $middleconffile = $middle->LocalFile ($middleconffilebase);
54 # copy the configuation file
55 if ($middle->PutFile ($middleconffilebase) == -1) {
56 print STDERR
"ERROR: cannot set file <$middleconffile>\n";
57 $SV->Kill (); $SV->TimedWait (1);
62 $SV = $sink->CreateProcess ("sink", "-o $sinkiorfile -orblogfile $sinklogfile -orbdebuglevel 9");
63 $MD = $middle->CreateProcess ("middle", "-o $middleiorfile -f $sinkiorfile -ORBSvcConf $middleconffile -orblogfile $middlelogfile -orbdebuglevel 9");
64 $CL = $source->CreateProcess ("source", "-f $middleiorfile -orblogfile $sourcelogfile -orbdebuglevel 9");
68 if ($sink->WaitForFileTimed ($sinkiorfilebase,
69 $sink->ProcessStartWaitInterval ()) == -1) {
70 print STDERR
"ERROR: Could not find file <$sinkiorfile>\n";
71 $SV->Kill (); $SV->TimedWait (1);
77 if ($middle->WaitForFileTimed($middleiorfilebase,
78 $middle->ProcessStartWaitInterval ()) == -1) {
79 print STDERR
"ERROR: Could not find file <$middleiorfile>\n";
80 $SV->Kill (); $SV->TimedWait (1);
81 $MD->Kill (); $MD->TimedWait (1);
86 $source_status = $CL->SpawnWaitKill ($source->ProcessStartWaitInterval ());
88 if ($source_status != 0) {
89 print STDERR
"ERROR: source returned $source_status\n";
93 $middle_status = $MD->WaitKill ($middle->ProcessStopWaitInterval ());
94 if ($middle_status != 0) {
95 print STDERR
"ERROR: middle returned $middle_status\n";
99 $sink_status = $SV->WaitKill ($sink->ProcessStopWaitInterval ());
100 if ($sink_status != 0) {
101 print STDERR
"ERROR: sink returned $sink_status\n";
106 $connections = count_matching_lines
($sinklogfile, "IIOP connection to peer");
107 if ($connections != 1) {
108 print STDERR
"ERROR: Connections to sink should be 1: $connections\n";
112 print STDERR
"OK: Found 1 connection to sink.\n";
117 $sink->DeleteFile ($sinkiorfilebase);
118 $sink->DeleteFile ($sinklogfilebase);
120 $middle->DeleteFile ($middleiorfilebase);
121 $middle->DeleteFile ($middlelogfilebase);
123 $source->DeleteFile ($sourcelogfilebase);