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 $imr = PerlACE
::TestTarget
::create_target
(1) || die "Create target 1 failed\n";
20 my $act = PerlACE
::TestTarget
::create_target
(2) || die "Create target 2 failed\n";
21 my $ti = PerlACE
::TestTarget
::create_target
(3) || die "Create target 3 failed\n";
22 my $ns = PerlACE
::TestTarget
::create_target
(4) || die "Create target 4 failed\n";
23 my $test = PerlACE
::TestTarget
::create_target
(5) || die "Create target 5 failed\n";
25 ################################################################################
28 $imriorfile = "imr.ior";
29 $nsiorfile = "name.ior";
30 $actiorfile = "activator.ior";
32 my $imr_imriorfile = $imr->LocalFile ($imriorfile);
33 my $act_imriorfile = $act->LocalFile ($imriorfile);
34 my $ti_imriorfile = $ti->LocalFile ($imriorfile);
35 my $ns_imriorfile = $ns->LocalFile ($imriorfile);
36 my $act_actiorfile = $act->LocalFile ($actiorfile);
37 my $ns_nsiorfile = $ns->LocalFile ($nsiorfile);
38 my $test_nsiorfile = $test->LocalFile ($nsiorfile);
40 $IMR = $imr->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/ImplRepo_Service/tao_imr_locator");
42 $ACT = $act->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/ImplRepo_Service/tao_imr_activator");
44 $NS = $ns->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Naming_Service/tao_cosnaming");
45 my $ns_cmd = $NS->Executable();
46 my $ns_ns_cmd = $imr->LocalFile ($ns_cmd);
48 $TI = $ti->CreateProcess ("$ENV{ACE_ROOT}/bin/tao_imr");
49 # We want the tao_imr executable to be found exactly in the path
50 # given, without being modified by the value of -ExeSubDir.
51 # So, we tell its Process object to ignore the setting of -ExeSubDir.
52 $TI->IgnoreExeSubDir (1);
54 $TEST = $test->CreateProcess ("test");
56 ################################################################################
58 $imr->DeleteFile ($imriorfile);
59 $act->DeleteFile ($imriorfile);
60 $ti->DeleteFile ($imriorfile);
61 $ns->DeleteFile ($imriorfile);
62 $act->DeleteFile ($actiorfile);
63 $ns->DeleteFile ($nsiorfile);
64 $test->DeleteFile ($nsiorfile);
66 ################################################################################
67 ## Start the implementation Repository
69 $IMR->Arguments ("-o $imr_imriorfile -d 2");
70 $IMR_status = $IMR->Spawn ();
71 if ($IMR_status != 0) {
72 print STDERR
"ERROR: ImplRepo Service returned $IMR_status\n";
75 if ($imr->WaitForFileTimed ($imriorfile,$imr->ProcessStartWaitInterval()) == -1) {
76 print STDERR
"ERROR: cannot find file <$imr_imriorfile>\n";
77 $IMR->Kill (); $IMR->TimedWait (1);
80 if ($imr->GetFile ($imriorfile) == -1) {
81 print STDERR
"ERROR: cannot retrieve file <$imr_imriorfile>\n";
82 $IMR->Kill (); $IMR->TimedWait (1);
85 if ($act->PutFile ($imriorfile) == -1) {
86 print STDERR
"ERROR: cannot set file <$act_imriorfile>\n";
87 $IMR->Kill (); $IMR->TimedWait (1);
90 if ($ti->PutFile ($imriorfile) == -1) {
91 print STDERR
"ERROR: cannot set file <$ti_imriorfile>\n";
92 $IMR->Kill (); $IMR->TimedWait (1);
95 if ($ns->PutFile ($imriorfile) == -1) {
96 print STDERR
"ERROR: cannot set file <$ns_imriorfile>\n";
97 $IMR->Kill (); $IMR->TimedWait (1);
101 $ACT->Arguments("-d 1 -o $act_actiorfile -ORBInitRef ImplRepoService=file://$act_imriorfile");
102 $ACT_status = $ACT->Spawn ();
103 if ($ACT_status != 0) {
104 print STDERR
"ERROR: IMR Activator Service returned $ACT_status\n";
107 if ($act->WaitForFileTimed ($actiorfile,$act->ProcessStartWaitInterval()) == -1) {
108 print STDERR
"ERROR: cannot find file <$act_actiorfile>\n";
109 $ACT->Kill (); $ACT->TimedWait (1);
110 $IMR->Kill (); $IMR->TimedWait (1);
114 ################################################################################
115 ## Register the NameService
117 $TI->Arguments("-ORBInitRef ImplRepoService=file://$ti_imriorfile"
118 . " add NameService -c \""
119 . "$ns_ns_cmd -ORBInitRef ImplRepoService=file://$imr_imriorfile -ORBUseIMR 1"
122 $TI_status = $TI->SpawnWaitKill ($ti->ProcessStartWaitInterval()+45);
123 if ($TI_status != 0) {
124 print STDERR
"ERROR: TAO IMR returned $TI_status\n";
125 $ACT->Kill (); $ACT->TimedWait (1);
126 $IMR->Kill (); $IMR->TimedWait (1);
130 ################################################################################
131 ## Create IOR for NameService
133 $TI->Arguments ("-ORBInitRef ImplRepoService=file://$ti_imriorfile ior NameService -f $ns_nsiorfile");
134 $TI_status = $TI->SpawnWaitKill ($ti->ProcessStartWaitInterval()+45);
135 if ($TI_status != 0) {
136 print STDERR
"ERROR: TAO IMR returned $TI_status\n";
137 $ACT->Kill (); $ACT->TimedWait (1);
138 $IMR->Kill (); $IMR->TimedWait (1);
141 if ($ns->WaitForFileTimed ($nsiorfile,$ns->ProcessStartWaitInterval()) == -1) {
142 print STDERR
"ERROR: cannot find file <$ns_nsiorfile>\n";
143 $ACT->Kill (); $ACT->TimedWait (1);
144 $IMR->Kill (); $IMR->TimedWait (1);
147 if ($ns->GetFile ($nsiorfile) == -1) {
148 print STDERR
"ERROR: cannot retrieve file <$ns_nsiorfile>\n";
149 $ACT->Kill (); $ACT->TimedWait (1);
150 $IMR->Kill (); $IMR->TimedWait (1);
153 if ($test->PutFile ($nsiorfile) == -1) {
154 print STDERR
"ERROR: cannot set file <$test_nsiorfile>\n";
155 $ACT->Kill (); $ACT->TimedWait (1);
156 $IMR->Kill (); $IMR->TimedWait (1);
160 ################################################################################
163 $TEST->Arguments ("-ORBInitRef NameService=file://$test_nsiorfile");
164 $TEST_status = $TEST->SpawnWaitKill ($test->ProcessStartWaitInterval()+45);
165 if ($TEST_status != 0) {
166 print STDERR
"ERROR: test returned $TEST_status\n";
170 ################################################################################
171 ## Shutdown the NameService
173 $TI->Arguments ("-ORBInitRef ImplRepoService=file://$imr_imriorfile shutdown "
175 $TI_status = $TI->SpawnWaitKill ($ti->ProcessStartWaitInterval()+45);
176 if ($TI_status != 0) {
177 print STDERR
"ERROR: TAO IMR returned $TI_status\n";
181 ################################################################################
184 $ACT_status = $ACT->TerminateWaitKill ($act->ProcessStopWaitInterval());
186 if ($ACT_status != 0) {
187 print STDERR
"ERROR: IMR Activator returned $ACT_status\n";
191 $IMR_status = $IMR->TerminateWaitKill ($imr->ProcessStopWaitInterval());
193 if ($IMR_status != 0) {
194 print STDERR
"ERROR: ImplRepo Service returned $IMR_status\n";
198 $imr->DeleteFile ($imriorfile);
199 $act->DeleteFile ($imriorfile);
200 $ti->DeleteFile ($imriorfile);
201 $ns->DeleteFile ($imriorfile);
202 $act->DeleteFile ($actiorfile);
203 $ns->DeleteFile ($nsiorfile);
204 $test->DeleteFile ($nsiorfile);