summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/DevGuideExamples
diff options
context:
space:
mode:
authordbudko <dbudko@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2009-11-25 09:05:43 +0000
committerdbudko <dbudko@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2009-11-25 09:05:43 +0000
commit3bc10cba54f913265a010c2955a4f350292ec38e (patch)
treedd8eba54b56000bcd480b2b09d154401d69898b6 /TAO/orbsvcs/DevGuideExamples
parente8373a990d20b12116b0130a2fc29c984ce568e7 (diff)
downloadATCD-3bc10cba54f913265a010c2955a4f350292ec38e.tar.gz
Wed Nov 25 09:01:20 UTC 2009 Denis Budko <denis.budko@remedy.nl>
* orbsvcs/DevGuideExamples/ValueTypes/Notify/supplier.cpp: * orbsvcs/DevGuideExamples/ValueTypes/Notify/consumer.cpp: * orbsvcs/DevGuideExamples/ValueTypes/Notify/run_test.pl: * orbsvcs/DevGuideExamples/Security/PolicyControllingApp/MessengerServer.cpp: * orbsvcs/DevGuideExamples/Security/PolicyControllingApp/MessengerClient.cpp: * orbsvcs/DevGuideExamples/Security/PolicyControllingApp/run_test.pl: * orbsvcs/DevGuideExamples/Security/SecurityUnawareApp/MessengerServer.cpp: * orbsvcs/DevGuideExamples/Security/SecurityUnawareApp/MessengerClient.cpp: * orbsvcs/DevGuideExamples/Security/SecurityUnawareApp/run_test.pl: * orbsvcs/DevGuideExamples/NotifyService/QoSProperties/MessengerServer.cpp: * orbsvcs/DevGuideExamples/NotifyService/QoSProperties/MessengerClient.cpp: * orbsvcs/DevGuideExamples/NotifyService/QoSProperties/run_test.pl: * orbsvcs/DevGuideExamples/NotifyService/Filtering/run_test.pl: * orbsvcs/DevGuideExamples/NotifyService/Messenger/MessengerServer.cpp: * orbsvcs/DevGuideExamples/NotifyService/Messenger/MessengerClient.cpp: * orbsvcs/DevGuideExamples/NotifyService/Messenger/run_test.pl: * orbsvcs/DevGuideExamples/NotifyService/OfferSubscriptions/MessengerServer.cpp: * orbsvcs/DevGuideExamples/NotifyService/OfferSubscriptions/run_test.pl: * orbsvcs/DevGuideExamples/NotifyService/SupplierSideNC/MessengerServer.cpp: * orbsvcs/DevGuideExamples/NotifyService/SupplierSideNC/run_test.pl: * orbsvcs/DevGuideExamples/NotifyService/EventSequence/MessengerServer.cpp: * orbsvcs/DevGuideExamples/NotifyService/EventSequence/MessengerClient.cpp: * orbsvcs/DevGuideExamples/NotifyService/EventSequence/run_test.pl: * orbsvcs/DevGuideExamples/NotifyService/RTNotify/MessengerConsumer.cpp: * orbsvcs/DevGuideExamples/NotifyService/RTNotify/MessengerServer.cpp: * orbsvcs/DevGuideExamples/NotifyService/RTNotify/MessengerClient.cpp: * orbsvcs/DevGuideExamples/NotifyService/RTNotify/run_test.pl: * orbsvcs/DevGuideExamples/NamingService/corbaname_Messenger/MessengerServer.cpp: * orbsvcs/DevGuideExamples/NamingService/corbaname_Messenger/run_test.pl: * orbsvcs/DevGuideExamples/NamingService/Naming_Client/run_test.pl: * orbsvcs/DevGuideExamples/NamingService/Messenger/run_test.pl: * orbsvcs/DevGuideExamples/NamingService/corbaloc_Messenger/run_test.pl: * orbsvcs/DevGuideExamples/NamingService/Naming_Context_Ext/MessengerServer.cpp: * orbsvcs/DevGuideExamples/NamingService/Naming_Context_Ext/MessengerClient.cpp: * orbsvcs/DevGuideExamples/NamingService/Naming_Context_Ext/run_test.pl: * orbsvcs/DevGuideExamples/PortableInterceptors/PICurrent_NameService/run_test.pl: * orbsvcs/tests/Notify/Bug_3646c_Regression/server.cpp: * orbsvcs/tests/Notify/Bug_3646c_Regression/run_test.pl: * orbsvcs/tests/InterfaceRepo/Bug_3200_Regression/run_test.pl: * orbsvcs/tests/InterfaceRepo/IDL3_Test/run_test.pl: * orbsvcs/tests/InterfaceRepo/Bug_3495_Regression/run_test.pl: * orbsvcs/tests/InterfaceRepo/Application_Test/ifr_dii_client.cpp: * orbsvcs/tests/InterfaceRepo/Application_Test/server.cpp: * orbsvcs/tests/InterfaceRepo/Application_Test/ifr_dii_client.h: * orbsvcs/tests/InterfaceRepo/Application_Test/run_test.pl: * orbsvcs/examples/Log/Basic/run_test.pl: * orbsvcs/examples/Log/Event/run_test.pl: * orbsvcs/examples/Log/RTEvent/run_test.pl: * orbsvcs/examples/Log/Notify/run_test.pl: * orbsvcs/examples/CosEC/TypedSimple/Consumer.cpp: * orbsvcs/examples/CosEC/TypedSimple/run_test.pl: * orbsvcs/examples/CosEC/RtEC_Based/tests/Multiple/run_test2.pl: * orbsvcs/examples/CosEC/RtEC_Based/tests/Multiple/run_test.pl: * orbsvcs/examples/LoadBalancing/run_test.pl: * performance-tests/Sequence_Latency/DSI/run_test.pl: * performance-tests/Sequence_Latency/Deferred/run_test.pl: * performance-tests/Sequence_Latency/Thread_Pool/run_test.pl: * performance-tests/Sequence_Latency/Single_Threaded/default_configuration.pl: * performance-tests/Sequence_Latency/Single_Threaded/run_test.pl: * performance-tests/Sequence_Latency/DII/run_test.pl: * performance-tests/Sequence_Latency/AMH_Single_Threaded/run_test.pl: * performance-tests/Sequence_Latency/AMI/run_test.pl: * performance-tests/Sequence_Latency/Thread_Per_Connection/run_test.pl: * performance-tests/RTCorba/Oneways/Reliable/client_test.pl: * performance-tests/RTCorba/Oneways/Reliable/server.cpp: * performance-tests/RTCorba/Oneways/Reliable/run_test.pl: * performance-tests/Latency/Thread_Pool/run_test.pl: * performance-tests/Latency/Single_Threaded/default_configuration.pl: * performance-tests/Latency/Single_Threaded/run_test.pl: * performance-tests/Latency/Thread_Per_Connection/run_test.pl: * tests/GIOP_Fragments/Java_Big_Request/run_test.pl: * tests/GIOP_Fragments/Java_Big_Reply/run_test.pl: * examples/CSD_Strategy/ThreadPool2/run_test.pl: * examples/CSD_Strategy/ThreadPool4/run_test.pl: * examples/CSD_Strategy/ThreadPool5/run_test.pl: * examples/CSD_Strategy/ThreadPool6/run_test.pl: Tests are converted to use new test framework and added to fuzz build.
Diffstat (limited to 'TAO/orbsvcs/DevGuideExamples')
-rwxr-xr-xTAO/orbsvcs/DevGuideExamples/NamingService/Messenger/run_test.pl102
-rwxr-xr-xTAO/orbsvcs/DevGuideExamples/NamingService/Naming_Client/run_test.pl107
-rw-r--r--TAO/orbsvcs/DevGuideExamples/NamingService/Naming_Context_Ext/MessengerClient.cpp42
-rw-r--r--TAO/orbsvcs/DevGuideExamples/NamingService/Naming_Context_Ext/MessengerServer.cpp60
-rwxr-xr-xTAO/orbsvcs/DevGuideExamples/NamingService/Naming_Context_Ext/run_test.pl124
-rwxr-xr-xTAO/orbsvcs/DevGuideExamples/NamingService/corbaloc_Messenger/run_test.pl185
-rw-r--r--TAO/orbsvcs/DevGuideExamples/NamingService/corbaname_Messenger/MessengerServer.cpp35
-rwxr-xr-xTAO/orbsvcs/DevGuideExamples/NamingService/corbaname_Messenger/run_test.pl122
-rw-r--r--TAO/orbsvcs/DevGuideExamples/NotifyService/EventSequence/MessengerClient.cpp34
-rw-r--r--TAO/orbsvcs/DevGuideExamples/NotifyService/EventSequence/MessengerServer.cpp31
-rwxr-xr-xTAO/orbsvcs/DevGuideExamples/NotifyService/EventSequence/run_test.pl229
-rwxr-xr-xTAO/orbsvcs/DevGuideExamples/NotifyService/Filtering/run_test.pl210
-rw-r--r--TAO/orbsvcs/DevGuideExamples/NotifyService/Messenger/MessengerClient.cpp35
-rw-r--r--TAO/orbsvcs/DevGuideExamples/NotifyService/Messenger/MessengerServer.cpp32
-rwxr-xr-xTAO/orbsvcs/DevGuideExamples/NotifyService/Messenger/run_test.pl229
-rw-r--r--TAO/orbsvcs/DevGuideExamples/NotifyService/OfferSubscriptions/MessengerServer.cpp32
-rwxr-xr-xTAO/orbsvcs/DevGuideExamples/NotifyService/OfferSubscriptions/run_test.pl210
-rw-r--r--TAO/orbsvcs/DevGuideExamples/NotifyService/QoSProperties/MessengerClient.cpp33
-rw-r--r--TAO/orbsvcs/DevGuideExamples/NotifyService/QoSProperties/MessengerServer.cpp31
-rwxr-xr-xTAO/orbsvcs/DevGuideExamples/NotifyService/QoSProperties/run_test.pl229
-rw-r--r--TAO/orbsvcs/DevGuideExamples/NotifyService/RTNotify/MessengerClient.cpp35
-rw-r--r--TAO/orbsvcs/DevGuideExamples/NotifyService/RTNotify/MessengerConsumer.cpp29
-rw-r--r--TAO/orbsvcs/DevGuideExamples/NotifyService/RTNotify/MessengerServer.cpp32
-rwxr-xr-xTAO/orbsvcs/DevGuideExamples/NotifyService/RTNotify/run_test.pl265
-rw-r--r--TAO/orbsvcs/DevGuideExamples/NotifyService/SupplierSideNC/MessengerServer.cpp32
-rwxr-xr-xTAO/orbsvcs/DevGuideExamples/NotifyService/SupplierSideNC/run_test.pl157
-rwxr-xr-xTAO/orbsvcs/DevGuideExamples/PortableInterceptors/PICurrent_NameService/run_test.pl88
-rw-r--r--TAO/orbsvcs/DevGuideExamples/Security/PolicyControllingApp/MessengerClient.cpp20
-rw-r--r--TAO/orbsvcs/DevGuideExamples/Security/PolicyControllingApp/MessengerServer.cpp31
-rwxr-xr-xTAO/orbsvcs/DevGuideExamples/Security/PolicyControllingApp/run_test.pl155
-rw-r--r--TAO/orbsvcs/DevGuideExamples/Security/SecurityUnawareApp/MessengerClient.cpp35
-rw-r--r--TAO/orbsvcs/DevGuideExamples/Security/SecurityUnawareApp/MessengerServer.cpp32
-rwxr-xr-xTAO/orbsvcs/DevGuideExamples/Security/SecurityUnawareApp/run_test.pl129
-rw-r--r--TAO/orbsvcs/DevGuideExamples/ValueTypes/Notify/consumer.cpp46
-rwxr-xr-xTAO/orbsvcs/DevGuideExamples/ValueTypes/Notify/run_test.pl132
-rw-r--r--TAO/orbsvcs/DevGuideExamples/ValueTypes/Notify/supplier.cpp57
36 files changed, 2638 insertions, 749 deletions
diff --git a/TAO/orbsvcs/DevGuideExamples/NamingService/Messenger/run_test.pl b/TAO/orbsvcs/DevGuideExamples/NamingService/Messenger/run_test.pl
index e2fa978cf93..4ede6d3629e 100755
--- a/TAO/orbsvcs/DevGuideExamples/NamingService/Messenger/run_test.pl
+++ b/TAO/orbsvcs/DevGuideExamples/NamingService/Messenger/run_test.pl
@@ -4,52 +4,100 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
& eval 'exec perl -S $0 $argv:q'
if 0;
-use Env (ACE_ROOT);
-use lib "$ACE_ROOT/bin";
-use PerlACE::Run_Test;
+use lib "$ENV{ACE_ROOT}/bin";
+use PerlACE::TestTarget;
+$status = 0;
+$debug_level = '0';
-$TARGETHOSTNAME = "localhost";
-$def_port = 2809;
+foreach $i (@ARGV) {
+ if ($i eq '-debug') {
+ $debug_level = '10';
+ }
+}
+
+my $ns = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
+my $srv = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
+my $cli = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n";
-$nsiorfile = PerlACE::LocalFile ("ns.ior");
-$arg_ns_ref = "-ORBInitRef NameService=file://$nsiorfile";
+my $nsiorfile = "ns.ior";
-unlink $nsiorfile;
+my $ns_nsiorfile = $ns->LocalFile ($nsiorfile);
+my $srv_nsiorfile = $srv->LocalFile ($nsiorfile);
+my $cli_nsiorfile = $cli->LocalFile ($nsiorfile);
+$ns->DeleteFile ($nsiorfile);
+$srv->DeleteFile ($nsiorfile);
+$cli->DeleteFile ($nsiorfile);
# start Naming Service
$NameService = "$ENV{TAO_ROOT}/orbsvcs/Naming_Service/Naming_Service";
-$NS = new PerlACE::Process($NameService, "-o $nsiorfile");
-$NS->Spawn();
-if (PerlACE::waitforfile_timed ($nsiorfile, 5) == -1) {
- print STDERR "ERROR: cannot find file <$nsiorfile>\n";
- $NS->Kill();
+$NS = $ns->CreateProcess ($NameService, " -o $ns_nsiorfile");
+$SRV = $srv->CreateProcess ("MessengerServer", "-ORBdebuglevel $debug_level ".
+ "-ORBInitRef NameService=file://$srv_nsiorfile");
+$CLI = $cli->CreateProcess ("MessengerClient", "-ORBInitRef NameService=file://$cli_nsiorfile");
+
+$NS_status = $NS->Spawn ();
+
+if ($NS_status != 0) {
+ print STDERR "ERROR: Name Service returned $NS_status\n";
+ exit 1;
+}
+
+if ($ns->WaitForFileTimed ($nsiorfile,$ns->ProcessStartWaitInterval()) == -1) {
+ print STDERR "ERROR: cannot find file <$ns_nsiorfile>\n";
+ $NS->Kill (); $NS->TimedWait (1);
+ exit 1;
+}
+
+if ($ns->GetFile ($nsiorfile) == -1) {
+ print STDERR "ERROR: cannot retrieve file <$ns_nsiorfile>\n";
+ $NS->Kill (); $NS->TimedWait (1);
+ exit 1;
+}
+if ($srv->PutFile ($nsiorfile) == -1) {
+ print STDERR "ERROR: cannot set file <$srv_nsiorfile>\n";
+ $NS->Kill (); $NS->TimedWait (1);
+ exit 1;
+}
+if ($cli->PutFile ($nsiorfile) == -1) {
+ print STDERR "ERROR: cannot set file <$cli_nsiorfile>\n";
+ $NS->Kill (); $NS->TimedWait (1);
exit 1;
}
# start MessengerServer
-$S = new PerlACE::Process("MessengerServer", $arg_ns_ref);
-$S->Spawn();
+$SRV_status = $SRV->Spawn ();
+
+if ($SRV_status != 0) {
+ print STDERR "ERROR: Messenger Server returned $SRV_status\n";
+ exit 1;
+}
# start MessengerClient
-$C = new PerlACE::Process("MessengerClient", $arg_ns_ref);
+$CLI_status = $CLI->SpawnWaitKill ($cli->ProcessStartWaitInterval());
-if ($C->SpawnWaitKill(15) != 0) {
- print STDERR "ERROR: client failed\n";
- $S->Kill();
- $NS->Kill();
- exit 1;
+if ($CLI_status != 0) {
+ print STDERR "ERROR: Messenger Client returned $CLI_status\n";
+ $status = 1;
}
# clean-up
+$SRV_status = $SRV->TerminateWaitKill ($srv->ProcessStopWaitInterval());
-$C->Kill();
-$S->Kill();
-$NS->Kill();
-
-unlink $nsiorfile;
+if ($SRV_status != 0) {
+ print STDERR "ERROR: Messenger Server returned $SRV_status\n";
+ $status = 1;
+}
-exit 0;
+$NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval());
+if ($NS_status != 0) {
+ print STDERR "ERROR: Name Service returned $NS_status\n";
+ $status = 1;
+}
+$ns->DeleteFile ($nsiorfile);
+$srv->DeleteFile ($nsiorfile);
+$cli->DeleteFile ($nsiorfile);
+exit $status;
diff --git a/TAO/orbsvcs/DevGuideExamples/NamingService/Naming_Client/run_test.pl b/TAO/orbsvcs/DevGuideExamples/NamingService/Naming_Client/run_test.pl
index 9070b8886ac..3e4fd9bf1d5 100755
--- a/TAO/orbsvcs/DevGuideExamples/NamingService/Naming_Client/run_test.pl
+++ b/TAO/orbsvcs/DevGuideExamples/NamingService/Naming_Client/run_test.pl
@@ -4,55 +4,100 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
& eval 'exec perl -S $0 $argv:q'
if 0;
-use Env (ACE_ROOT);
-use lib "$ACE_ROOT/bin";
-use PerlACE::Run_Test;
+use lib "$ENV{ACE_ROOT}/bin";
+use PerlACE::TestTarget;
+$status = 0;
+$debug_level = '0';
-$TARGETHOSTNAME = "localhost";
-$def_port = 2809;
+foreach $i (@ARGV) {
+ if ($i eq '-debug') {
+ $debug_level = '10';
+ }
+}
-$nsiorfile = PerlACE::LocalFile ("ns.ior");
-$arg_ns_ref = "-ORBInitRef NameService=file://$nsiorfile";
+my $ns = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
+my $srv = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
+my $cli = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n";
-unlink $nsiorfile;
+my $nsiorfile = "ns.ior";
+
+my $ns_nsiorfile = $ns->LocalFile ($nsiorfile);
+my $srv_nsiorfile = $srv->LocalFile ($nsiorfile);
+my $cli_nsiorfile = $cli->LocalFile ($nsiorfile);
+$ns->DeleteFile ($nsiorfile);
+$srv->DeleteFile ($nsiorfile);
+$cli->DeleteFile ($nsiorfile);
-# start Naming Service
$NameService = "$ENV{TAO_ROOT}/orbsvcs/Naming_Service/Naming_Service";
-$NS = new PerlACE::Process($NameService, "-o $nsiorfile");
-$NS->Spawn();
-if (PerlACE::waitforfile_timed ($nsiorfile, 5) == -1) {
- print STDERR "ERROR: cannot find file <$nsiorfile>\n";
- $NS->Kill();
+$NS = $ns->CreateProcess ($NameService, " -o $ns_nsiorfile");
+$SRV = $srv->CreateProcess ("MessengerServer", "-ORBdebuglevel $debug_level ".
+ "-ORBInitRef NameService=file://$srv_nsiorfile");
+$CLI = $cli->CreateProcess ("MessengerClient", "-ORBInitRef NameService=file://$cli_nsiorfile");
+
+# start Naming Service
+$NS_status = $NS->Spawn ();
+
+if ($NS_status != 0) {
+ print STDERR "ERROR: Name Service returned $NS_status\n";
+ exit 1;
+}
+
+if ($ns->WaitForFileTimed ($nsiorfile,$ns->ProcessStartWaitInterval()) == -1) {
+ print STDERR "ERROR: cannot find file <$ns_nsiorfile>\n";
+ $NS->Kill (); $NS->TimedWait (1);
+ exit 1;
+}
+
+if ($ns->GetFile ($nsiorfile) == -1) {
+ print STDERR "ERROR: cannot retrieve file <$ns_nsiorfile>\n";
+ $NS->Kill (); $NS->TimedWait (1);
+ exit 1;
+}
+if ($srv->PutFile ($nsiorfile) == -1) {
+ print STDERR "ERROR: cannot set file <$srv_nsiorfile>\n";
+ $NS->Kill (); $NS->TimedWait (1);
+ exit 1;
+}
+if ($cli->PutFile ($nsiorfile) == -1) {
+ print STDERR "ERROR: cannot set file <$cli_nsiorfile>\n";
+ $NS->Kill (); $NS->TimedWait (1);
exit 1;
}
# start MessengerServer
-$MessengerServer = "MessengerServer";
-$S = new PerlACE::Process($MessengerServer, $arg_ns_ref);
-$S->Spawn();
+$SRV_status = $SRV->Spawn ();
+
+if ($SRV_status != 0) {
+ print STDERR "ERROR: Messenger Server returned $SRV_status\n";
+ exit 1;
+}
# start MessengerClient
-$MessengerClient = "MessengerClient";
-$C = new PerlACE::Process($MessengerClient, $arg_ns_ref );
+$CLI_status = $CLI->SpawnWaitKill ($cli->ProcessStartWaitInterval());
-if ($C->SpawnWaitKill(15) != 0) {
- print STDERR "ERROR: client failed\n";
- $S->Kill();
- $NS->Kill();
- exit 1;
+if ($CLI_status != 0) {
+ print STDERR "ERROR: Messenger Client returned $CLI_status\n";
+ $status = 1;
}
-
# clean-up
+$SRV_status = $SRV->TerminateWaitKill ($srv->ProcessStopWaitInterval());
-$C->Kill();
-$S->Kill();
-$NS->Kill();
-
-unlink $nsiorfile;
+if ($SRV_status != 0) {
+ print STDERR "ERROR: Messenger Server returned $SRV_status\n";
+ $status = 1;
+}
-exit 0;
+$NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval());
+if ($NS_status != 0) {
+ print STDERR "ERROR: Name Service returned $NS_status\n";
+ $status = 1;
+}
+$ns->DeleteFile ($nsiorfile);
+$srv->DeleteFile ($nsiorfile);
+$cli->DeleteFile ($nsiorfile);
+exit $status;
diff --git a/TAO/orbsvcs/DevGuideExamples/NamingService/Naming_Context_Ext/MessengerClient.cpp b/TAO/orbsvcs/DevGuideExamples/NamingService/Naming_Context_Ext/MessengerClient.cpp
index e942c7b662b..eb1baab211b 100644
--- a/TAO/orbsvcs/DevGuideExamples/NamingService/Naming_Context_Ext/MessengerClient.cpp
+++ b/TAO/orbsvcs/DevGuideExamples/NamingService/Naming_Context_Ext/MessengerClient.cpp
@@ -4,21 +4,47 @@
#include "orbsvcs/CosNamingC.h"
#include <iostream>
#include <fstream>
+#include "ace/Get_Opt.h"
+
+const ACE_TCHAR *ior_input_file = ACE_TEXT("file://url.ior");
+
+int
+parse_args (int argc, ACE_TCHAR *argv[])
+{
+ ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:"));
+ int c;
+
+ while ((c = get_opts ()) != -1)
+ switch (c)
+ {
+ case 'k':
+ ior_input_file = get_opts.opt_arg ();
+ break;
+
+ case '?':
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "usage: %s "
+ "-k <ior> "
+ "\n",
+ argv [0]),
+ -1);
+ }
+ // Indicates successful parsing of the command line
+ return 0;
+}
+
int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
try {
// Initialize orb
CORBA::ORB_var orb = CORBA::ORB_init( argc, argv );
- char url[200];
- std::ifstream iorFile( "url.ior" );
- iorFile >> url;
- iorFile.close();
-
- std::cout << "url: " << url << std::endl;
+ if (parse_args (argc, argv) != 0)
+ return 1;
- // Find the Naming Service & the Message Server name in it
- CORBA::Object_var obj = orb->string_to_object(url);
+ // Find the Naming Service & the Message Server name in it
+ CORBA::Object_var obj = orb->string_to_object(ior_input_file);
// Narrow
Messenger_var messenger = Messenger::_narrow(obj.in());
diff --git a/TAO/orbsvcs/DevGuideExamples/NamingService/Naming_Context_Ext/MessengerServer.cpp b/TAO/orbsvcs/DevGuideExamples/NamingService/Naming_Context_Ext/MessengerServer.cpp
index e08e6bba229..28716321e81 100644
--- a/TAO/orbsvcs/DevGuideExamples/NamingService/Naming_Context_Ext/MessengerServer.cpp
+++ b/TAO/orbsvcs/DevGuideExamples/NamingService/Naming_Context_Ext/MessengerServer.cpp
@@ -4,6 +4,48 @@
#include "orbsvcs/CosNamingC.h"
#include <iostream>
#include <fstream>
+#include "ace/Get_Opt.h"
+
+const ACE_TCHAR *ior_output_file = ACE_TEXT ("url.ior");
+const ACE_TCHAR *hostname = ACE_TEXT ("localhost");
+const ACE_TCHAR *port = ACE_TEXT ("2809");
+
+int
+parse_args (int argc, ACE_TCHAR *argv[])
+{
+ ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("o:h:p:"));
+ int c;
+
+ while ((c = get_opts ()) != -1)
+ switch (c)
+ {
+ case 'o':
+ ior_output_file = get_opts.opt_arg ();
+ break;
+
+ case 'h':
+ hostname = get_opts.opt_arg ();
+ break;
+
+ case 'p':
+ port = get_opts.opt_arg ();
+ break;
+
+ case '?':
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "usage: %s "
+ "-o <iorfile> "
+ "-h <host> "
+ "-p <port>"
+ "\n",
+ argv [0]),
+ -1);
+ }
+ // Indicates sucessful parsing of the command line
+ return 0;
+}
+
int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
@@ -11,6 +53,9 @@ int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
// Initialize orb
CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
+ if (parse_args (argc, argv) != 0)
+ return 1;
+
//Get reference to Root POA
CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
PortableServer::POA_var poa = PortableServer::POA::_narrow(obj.in());
@@ -87,8 +132,15 @@ int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
return 1;
}
+ ACE_CString base_address (":");
+ base_address += ACE_TEXT_ALWAYS_CHAR (hostname);
+ base_address += ":";
+ base_address += ACE_TEXT_ALWAYS_CHAR (port);
+ ACE_CString addr ("");
+ addr = base_address + "/key/str";
+
// Create an URL string for application object.
- CORBA::String_var address = CORBA::string_dup (":localhost:2809/key/str");
+ CORBA::String_var address = CORBA::string_dup (addr.c_str());
std::cout << "call to_url(\"" << address.in() << "\"" << std::endl;
std::cout << " ,\"" << str_simple.in() << "\")"<< std::endl;
@@ -100,7 +152,7 @@ int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
// Write NS url to a file to let client read NS URL to get
// NamingContext reference.
- CORBA::String_var ns_addr = CORBA::string_dup(":localhost:2809");
+ CORBA::String_var ns_addr = CORBA::string_dup(base_address.c_str());
std::cout << "call to_url(\"" <<ns_addr.in() << "\",\""
<< str_simple.in() << "\")"<< std::endl;
@@ -109,11 +161,11 @@ int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
std::cout << "to_url result: " << url.in() << std::endl;
- std::ofstream iorFile("url.ior");
+ std::ofstream iorFile(ACE_TEXT_ALWAYS_CHAR (ior_output_file));
iorFile << url.in() << std::endl;
iorFile.close();
- std::cout << "Naming Service URL written to file url.ior" << std::endl;
+ std::cout << "Naming Service URL written to file " << ior_output_file << std::endl;
// Accept requests
orb->run();
diff --git a/TAO/orbsvcs/DevGuideExamples/NamingService/Naming_Context_Ext/run_test.pl b/TAO/orbsvcs/DevGuideExamples/NamingService/Naming_Context_Ext/run_test.pl
index eac00add5ad..959dd590ba7 100755
--- a/TAO/orbsvcs/DevGuideExamples/NamingService/Naming_Context_Ext/run_test.pl
+++ b/TAO/orbsvcs/DevGuideExamples/NamingService/Naming_Context_Ext/run_test.pl
@@ -4,53 +4,113 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
& eval 'exec perl -S $0 $argv:q'
if 0;
-use Env (ACE_ROOT);
-use lib "$ACE_ROOT/bin";
-use PerlACE::Run_Test;
+use lib "$ENV{ACE_ROOT}/bin";
+use PerlACE::TestTarget;
-$nsref="-ORBInitRef NameService=iiop://localhost:2809/NameService";
-$nsior = "ns.ior";
-$ior="url.ior";
-unlink $ior;
+$status = 0;
+$debug_level = '0';
+
+foreach $i (@ARGV) {
+ if ($i eq '-debug') {
+ $debug_level = '10';
+ }
+}
+
+my $ns = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
+my $srv = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
+my $cli = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n";
+
+my $nsiorfile = "ns.ior";
+my $srviorfile = "url.ior";
+
+my $ns_nsiorfile = $ns->LocalFile ($nsiorfile);
+my $srv_srviorfile = $srv->LocalFile ($srviorfile);
+my $cli_srviorfile = $cli->LocalFile ($srviorfile);
+$ns->DeleteFile ($nsiorfile);
+$srv->DeleteFile ($srviorfile);
+$cli->DeleteFile ($srviorfile);
+
+$hostname = $ns->HostName ();
+$port = "2809";
-# start Naming Service
-unlink($nsior);
$NameService = "$ENV{TAO_ROOT}/orbsvcs/Naming_Service/Naming_Service";
-$NS = new PerlACE::Process($NameService, "-ORBListenEndpoints iiop://localhost:2809 -o $nsior");
-$NS->Spawn();
+$NS = $ns->CreateProcess ($NameService, "-ORBListenEndpoints iiop://$hostname:$port ".
+ " -o $ns_nsiorfile");
+$SRV = $srv->CreateProcess ("MessengerServer", "-ORBdebuglevel $debug_level ".
+ "-o $srv_srviorfile ".
+ "-h $hostname ".
+ "-p $port ".
+ "-ORBInitRef NameService=iiop://$hostname:$port/NameService");
+$CLI = $cli->CreateProcess ("MessengerClient", "-k file://$cli_srviorfile ".
+ "-ORBInitRef NameService=iiop://$hostname:$port/NameService");
-if (PerlACE::waitforfile_timed ($nsior, 10) == -1) {
- print STDERR "ERROR: cannot find IOR file <$nsior>\n";
- $NS->Kill ();
- exit 1;
+# start Naming Service
+$NS_status = $NS->Spawn ();
+
+if ($NS_status != 0) {
+ print STDERR "ERROR: Name Service returned $NS_status\n";
+ exit 1;
+}
+
+if ($ns->WaitForFileTimed ($nsiorfile,$ns->ProcessStartWaitInterval()) == -1) {
+ print STDERR "ERROR: cannot find file <$ns_nsiorfile>\n";
+ $NS->Kill (); $NS->TimedWait (1);
+ exit 1;
}
# start MessengerServer
-$MessengerServer = "MessengerServer";
-$S = new PerlACE::Process($MessengerServer, $nsref );
-$S->Spawn();
-if (PerlACE::waitforfile_timed ($ior, 15) == -1) {
- print STDERR "ERROR: cannot find file $ior\n";
- $NS->Kill();
- $S->Kill();
+$SRV_status = $SRV->Spawn ();
+
+if ($SRV_status != 0) {
+ print STDERR "ERROR: Messenger Server returned $SRV_status\n";
+ exit 1;
+}
+
+if ($srv->WaitForFileTimed ($srviorfile,$srv->ProcessStartWaitInterval()) == -1) {
+ print STDERR "ERROR: cannot find file <$srv_srviorfile>\n";
+ $NS->Kill (); $NS->TimedWait (1);
+ $SRV->Kill (); $SRV->TimedWait (1);
+ exit 1;
+}
+
+if ($srv->GetFile ($srviorfile) == -1) {
+ print STDERR "ERROR: cannot retrieve file <$srv_srviorfile>\n";
+ $NS->Kill (); $NS->TimedWait (1);
+ $SRV->Kill (); $SRV->TimedWait (1);
+ exit 1;
+}
+if ($cli->PutFile ($srviorfile) == -1) {
+ print STDERR "ERROR: cannot set file <$cli_srviorfile>\n";
+ $NS->Kill (); $NS->TimedWait (1);
+ $SRV->Kill (); $SRV->TimedWait (1);
exit 1;
}
# start MessengerClient
-$C = new PerlACE::Process("MessengerClient", $nsref);
-if ($C->SpawnWaitKill(15) != 0) {
- print STDERR "ERROR: client failed\n";
- $S->Kill();
- $NS->Kill();
- exit 1;
+$CLI_status = $CLI->SpawnWaitKill ($cli->ProcessStartWaitInterval());
+
+if ($CLI_status != 0) {
+ print STDERR "ERROR: Messenger Client failed with status $CLI_status\n";
+ $status = 1;
}
# clean-up
-$S->Kill();
-$NS->Kill();
-unlink $ior;
+$SRV_status = $SRV->TerminateWaitKill ($srv->ProcessStopWaitInterval());
-exit 0;
+if ($SRV_status != 0) {
+ print STDERR "ERROR: Messenger Server returned $SRV_status\n";
+ $status = 1;
+}
+
+$NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval());
+if ($NS_status != 0) {
+ print STDERR "ERROR: Name Service returned $NS_status\n";
+ $status = 1;
+}
+$ns->DeleteFile ($nsiorfile);
+$srv->DeleteFile ($srviorfile);
+$cli->DeleteFile ($srviorfile);
+exit $status;
diff --git a/TAO/orbsvcs/DevGuideExamples/NamingService/corbaloc_Messenger/run_test.pl b/TAO/orbsvcs/DevGuideExamples/NamingService/corbaloc_Messenger/run_test.pl
index b622edee34d..3df6d8ec73d 100755
--- a/TAO/orbsvcs/DevGuideExamples/NamingService/corbaloc_Messenger/run_test.pl
+++ b/TAO/orbsvcs/DevGuideExamples/NamingService/corbaloc_Messenger/run_test.pl
@@ -4,31 +4,51 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
& eval 'exec perl -S $0 $argv:q'
if 0;
-use Env (ACE_ROOT);
-use lib "$ACE_ROOT/bin";
-use PerlACE::Run_Test;
+use lib "$ENV{ACE_ROOT}/bin";
+use PerlACE::TestTarget;
+$status = 0;
+$debug_level = '0';
-$TARGETHOSTNAME = "localhost";
+foreach $i (@ARGV) {
+ if ($i eq '-debug') {
+ $debug_level = '10';
+ }
+}
+
+my $ns = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
+my $srv = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
+my $cli = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n";
+my $tnd = PerlACE::TestTarget::create_target (4) || die "Create target 4 failed\n";
+
+$TARGETHOSTNAME = $ns->HostName ();
$def_port = 2809;
-my($nsiorfile) = "ns.ior";
-unlink($nsiorfile);
+my $nsiorfile = "ns.ior";
+
+my $ns_nsiorfile = $ns->LocalFile ($nsiorfile);
+$ns->DeleteFile ($nsiorfile);
# start Naming Service
$NameService = "$ENV{TAO_ROOT}/orbsvcs/Naming_Service/Naming_Service";
-$NS = new PerlACE::Process($NameService, "-ORBListenEndpoints iiop://$TARGETHOSTNAME:$def_port -o $nsiorfile");
+$NS = $ns->CreateProcess ($NameService, " -ORBListenEndpoints iiop://$TARGETHOSTNAME:$def_port ".
+ "-o $ns_nsiorfile");
+$NS_status = $NS->Spawn ();
-$NS->Spawn();
-if (PerlACE::waitforfile_timed ($nsiorfile, 5) == -1) {
- print STDERR "ERROR: cannot find file <$nsiorfile>\n";
- $NS->Kill();
- exit 1;
+if ($NS_status != 0) {
+ print STDERR "ERROR: Name Service returned $NS_status\n";
+ exit 1;
+}
+
+if ($ns->WaitForFileTimed ($nsiorfile,$ns->ProcessStartWaitInterval()) == -1) {
+ print STDERR "ERROR: cannot find file <$ns_nsiorfile>\n";
+ $NS->Kill (); $NS->TimedWait (1);
+ exit 1;
}
# File is only used to make sure the NS is fully running, so we can
# remove it now.
-unlink($nsiorfile);
+$ns->DeleteFile ($nsiorfile);
# List of tests to test corbaloc URL syntax.
@corbaloc_servers = ( "-ORBDefaultInitRef corbaloc::$TARGETHOSTNAME",
@@ -43,84 +63,105 @@ unlink($nsiorfile);
@corbaloc_clients = ( "corbaloc::$TARGETHOSTNAME/NameService",
"-ORBInitRef NameService=iiop://$TARGETHOSTNAME:$def_port/NameService corbaloc:rir:/NameService");
-@clients_comments = ( "Using the URL parameter: \n");
- "Using a corbaloc:rir form URL(must specify initial reference): \n",
-
-
-
+@clients_comments = ( "Using the URL parameter: \n",
+ "Using a corbaloc:rir form URL(must specify initial reference): \n");
$MessengerServer= "MessengerServer";
$MessengerClient= "MessengerClient";
+$nsdel = "$ENV{ACE_ROOT}/bin/tao_nsdel";
$test_number = 0;
foreach $o (@corbaloc_servers) {
- # Run messenger server for each test.
- #print "Start $MessengerServer $o \n";
- $SR = new PerlACE::Process($MessengerServer, $o);
- $SR->Spawn();
-
- #print "Start $MessengerClient \n";
- $CL = new PerlACE::Process($MessengerClient, "-ORBDefaultInitRef iiop://$TARGETHOSTNAME:$def_port");
- $test_number++;
-
- if ($CL->SpawnWaitKill(15) != 0) {
- print STDERR "ERROR: client failed\n";
- $SR->Kill();
- $NS->Kill();
- exit 1;
- }
-
- print "======================================\n";
- print "Finish Test $test_number: $servers_comments[$test_number] \n";
- print " $MessengerServer $o\n";
- print "======================================\n\n";
-
- $SR->Kill(1);
-
- # remove ns entry...
- $nsdel = "$ENV{ACE_ROOT}/bin/tao_nsdel";
- $NSDEL = new PerlACE::Process($nsdel, "--quiet --name example/Messenger -ORBInitRef NameService=corbaloc::$TARGETHOSTNAME:$def_port/NameService");
- if ($NSDEL->SpawnWaitKill(15) != 0) {
- print STDERR "ERROR: tao_nsdel failed\n";
- $NS->Kill();
- exit 1;
- }
+ # Run messenger server for each test.
+ #print "Start $MessengerServer $o \n";
+ $SRV = $srv->CreateProcess ($MessengerServer, "-ORBdebuglevel $debug_level ".
+ "$o");
+ $SRV->Spawn();
+ if ($SRV_status != 0) {
+ print STDERR "ERROR: Messenger Server returned $SRV_status\n";
+ exit 1;
+ }
+
+ #print "Start $MessengerClient \n";
+ $CLI = $cli->CreateProcess ($MessengerClient, "-ORBDefaultInitRef iiop://$TARGETHOSTNAME:$def_port");
+ $test_number++;
+
+ $CLI_status = $CLI->SpawnWaitKill($cli->ProcessStartWaitInterval());
+ if ($CLI_status != 0) {
+ print STDERR "ERROR: Messenger Client returned $CLI_status\n";
+ $SRV->Kill(); $SRV->TimedWait (1);
+ $NS->Kill(); $NS->TimedWait (1);
+ exit 1;
+ }
+
+ print "======================================\n";
+ print "Finish Test $test_number: $servers_comments[$test_number] \n";
+ print " $MessengerServer $o\n";
+ print "======================================\n\n";
+
+ $SRV->Kill(); $SRV->TimedWait (1);
+
+ # remove ns entry...
+ $TND = $tnd->CreateProcess ($nsdel, "--quiet ".
+ "--name example/Messenger ".
+ "-ORBInitRef NameService=corbaloc::$TARGETHOSTNAME:$def_port/NameService");
+ $TND_status = $TND->SpawnWaitKill($tnd->ProcessStartWaitInterval());
+ if ($TND_status != 0) {
+ print STDERR "ERROR: tao_nsdel failed with status $TND_status\n";
+ $NS->Kill(); $NS->TimedWait (1);
+ exit 1;
+ }
}
#print "Start $MessengerServer \n";
-$SR = new PerlACE::Process($MessengerServer, "-ORBDefaultInitRef iiop://$TARGETHOSTNAME:$def_port");
-$SR->Spawn();
+$SRV = $srv->CreateProcess ($MessengerServer, "-ORBdebuglevel $debug_level ".
+ "-ORBDefaultInitRef iiop://$TARGETHOSTNAME:$def_port");
+$SRV->Spawn();
+if ($SRV_status != 0) {
+ print STDERR "ERROR: Messenger Server returned $SRV_status\n";
+ exit 1;
+}
$i = 0;
foreach $o (@corbaloc_clients) {
-
- # Run the client for each test.
- #print "Start $MessengerClient $o \n";
- $CL = new PerlACE::Process($MessengerClient, $o);
+ # Run the client for each test.
+ #print "Start $MessengerClient $o \n";
+ $CLI = $cli->CreateProcess ($MessengerClient, "$o");
+
+ $CLI_status = $CLI->SpawnWaitKill($cli->ProcessStartWaitInterval());
+ if ($CLI_status != 0) {
+ print STDERR "ERROR: Messenger Client returned $CLI_status\n";
+ $SRV->Kill(); $SRV->TimedWait (1);
+ $NS->Kill(); $NS->TimedWait (1);
+ exit 1;
+ }
+
+ $test_number++;
+ print "======================================\n";
+ print "Finish Test $test_number: $clients_comments[$i]\n";
+ print " $MessengerClient $o";
+ print "\n======================================\n\n";
+
+ $i ++;
+}
- if ($CL->SpawnWaitKill(15) != 0) {
- print STDERR "ERROR: client failed\n";
- $SR->Kill();
- $NS->Kill();
- exit 1;
- }
- $test_number++;
- print "======================================\n";
- print "Finish Test $test_number: $clients_comments[$i]\n";
- print " $MessengerClient $o";
- print "\n======================================\n\n";
+# clean up
+$SRV_status = $SRV->TerminateWaitKill ($srv->ProcessStopWaitInterval());
- $i ++;
+if ($SRV_status != 0) {
+ print STDERR "ERROR: Messenger Server returned $SRV_status\n";
+ $status = 1;
}
+$NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval());
-# clean up
-
-$SR->Kill();
-$NS->Kill();
+if ($NS_status != 0) {
+ print STDERR "ERROR: Name Service returned $NS_status\n";
+ $status = 1;
+}
-exit 0;
+exit $status;
diff --git a/TAO/orbsvcs/DevGuideExamples/NamingService/corbaname_Messenger/MessengerServer.cpp b/TAO/orbsvcs/DevGuideExamples/NamingService/corbaname_Messenger/MessengerServer.cpp
index 694c87d02e5..cbea180cda8 100644
--- a/TAO/orbsvcs/DevGuideExamples/NamingService/corbaname_Messenger/MessengerServer.cpp
+++ b/TAO/orbsvcs/DevGuideExamples/NamingService/corbaname_Messenger/MessengerServer.cpp
@@ -4,12 +4,45 @@
#include "orbsvcs/CosNamingC.h"
#include <iostream>
#include <fstream>
+#include "ace/Get_Opt.h"
+
+const ACE_TCHAR *output_file = ACE_TEXT ("MessengerServer.ready");
+
+int
+parse_args (int argc, ACE_TCHAR *argv[])
+{
+ ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("o:"));
+ int c;
+
+ while ((c = get_opts ()) != -1)
+ switch (c)
+ {
+ case 'o':
+ output_file = get_opts.opt_arg ();
+ break;
+
+ case '?':
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "usage: %s "
+ "-o <outputfile>"
+ "\n",
+ argv [0]),
+ -1);
+ }
+ // Indicates sucessful parsing of the command line
+ return 0;
+}
+
int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
try {
// Initialize orb
CORBA::ORB_var orb = CORBA::ORB_init( argc, argv );
+ if (parse_args (argc, argv) != 0)
+ return 1;
+
//Get reference to Root POA
CORBA::Object_var obj = orb->resolve_initial_references( "RootPOA" );
PortableServer::POA_var poa = PortableServer::POA::_narrow( obj.in() );
@@ -52,7 +85,7 @@ int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
std::cout << "Messenger object bound in Naming Service" << std::endl;
// Write a file to let the run_test.pl script know we are ready.
- std::ofstream iorFile( "MessengerServer.ready" );
+ std::ofstream iorFile( ACE_TEXT_ALWAYS_CHAR(output_file) );
iorFile << "Ready" << std::endl;
iorFile.close();
diff --git a/TAO/orbsvcs/DevGuideExamples/NamingService/corbaname_Messenger/run_test.pl b/TAO/orbsvcs/DevGuideExamples/NamingService/corbaname_Messenger/run_test.pl
index 90faf119c93..650780eb90c 100755
--- a/TAO/orbsvcs/DevGuideExamples/NamingService/corbaname_Messenger/run_test.pl
+++ b/TAO/orbsvcs/DevGuideExamples/NamingService/corbaname_Messenger/run_test.pl
@@ -4,43 +4,68 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
& eval 'exec perl -S $0 $argv:q'
if 0;
-use Env (ACE_ROOT);
-use lib "$ACE_ROOT/bin";
-use PerlACE::Run_Test;
+use lib "$ENV{ACE_ROOT}/bin";
+use PerlACE::TestTarget;
+$status = 0;
+$debug_level = '0';
+
+foreach $i (@ARGV) {
+ if ($i eq '-debug') {
+ $debug_level = '10';
+ }
+}
+
+my $ns = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
+my $srv = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
+my $cli = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n";
$TARGETHOSTNAME = "localhost";
$def_port = 2809;
-$nsior = "ns.ior";
+
+$nsiorfile = "ns.ior";
$msfile = "MessengerServer.ready";
+my $ns_nsiorfile = $ns->LocalFile ($nsiorfile);
+my $srv_msfile = $srv->LocalFile ($msfile);
+$ns->DeleteFile ($nsiorfile);
+$srv->DeleteFile ($msfile);
+
# start Naming Service
-unlink($nsior);
$NameService = "$ENV{TAO_ROOT}/orbsvcs/Naming_Service/Naming_Service";
-$NS = new PerlACE::Process($NameService, "-ORBListenEndpoints iiop://$TARGETHOSTNAME:$def_port -o $nsior");
-$NS->Spawn();
+$NS = $ns->CreateProcess ($NameService, " -ORBListenEndpoints iiop://$TARGETHOSTNAME:$def_port ".
+ "-o $ns_nsiorfile");
+$NS_status = $NS->Spawn ();
-if (PerlACE::waitforfile_timed ($nsior, 10) == -1) {
- print STDERR "ERROR: cannot find IOR file <$nsior>\n";
- $NS->Kill ();
- exit 1;
+if ($NS_status != 0) {
+ print STDERR "ERROR: Name Service returned $NS_status\n";
+ exit 1;
+}
+
+if ($ns->WaitForFileTimed ($nsiorfile,$ns->ProcessStartWaitInterval()) == -1) {
+ print STDERR "ERROR: cannot find file <$ns_nsiorfile>\n";
+ $NS->Kill (); $NS->TimedWait (1);
+ exit 1;
}
# start the server
-unlink($msfile);
print "Start Messenger Server \n";
-$SR = new PerlACE::Process("MessengerServer",
- "-ORBInitRef NameService=iiop://$TARGETHOSTNAME:$def_port/NameService");
-$SR->Spawn();
-
-if (PerlACE::waitforfile_timed ($msfile, 10) == -1) {
- print STDERR "ERROR: cannot find file <$msfile>\n";
- $SR->Kill ();
- $NS->Kill ();
- exit 1;
+$SRV = $srv->CreateProcess ("MessengerServer", "-ORBdebuglevel $debug_level ".
+ "-o $srv_msfile ".
+ "-ORBInitRef NameService=iiop://$TARGETHOSTNAME:$def_port/NameService");
+$SRV->Spawn();
+if ($SRV_status != 0) {
+ print STDERR "ERROR: Messenger Server returned $SRV_status\n";
+ $SRV->Kill (); $SRV->TimedWait (1);
+ $NS->Kill (); $NS->TimedWait (1);
+ exit 1;
+}
+if ($srv->WaitForFileTimed ($msfile,$srv->ProcessStartWaitInterval()) == -1) {
+ print STDERR "ERROR: cannot find file <$srv_msfile>\n";
+ $SRV->Kill (); $SRV->TimedWait (1);
+ $NS->Kill (); $NS->TimedWait (1);
+ exit 1;
}
-unlink($msfile);
-
@corbaname_clients = ("corbaname:iiop:$TARGETHOSTNAME:2809#example/Messenger",
"corbaname::$TARGETHOSTNAME:2809#example/Messenger",
@@ -54,28 +79,43 @@ unlink($msfile);
# Run the client for each of the corbaname test.
$test_number = 0;
+$MessengerClient = "MessengerClient";
foreach $o (@corbaname_clients) {
-
- $CL = new PerlACE::Process("MessengerClient", $o);
-
- if ($CL->SpawnWaitKill(15) != 0) {
- print STDERR "ERROR: client failed\n";
- $SR->Kill();
- $NS->Kill();
- exit 1;
- }
-
- $test_number++;
- print "======================================\n";
- print "Finish Test $test_number: $clients_comments[$test_number]\n";
- print " $CL_NAME $o\n";
- print "======================================\n\n";
+ $CLI = $cli->CreateProcess ($MessengerClient, "$o");
+
+ $CLI_status = $CLI->SpawnWaitKill($cli->ProcessStartWaitInterval());
+ if ($CLI_status != 0) {
+ print STDERR "ERROR: Messenger Client returned $CLI_status\n";
+ $SRV->Kill(); $SRV->TimedWait (1);
+ $NS->Kill(); $NS->TimedWait (1);
+ exit 1;
+ }
+
+ $test_number++;
+ print "======================================\n";
+ print "Finish Test $test_number: $clients_comments[$test_number]\n";
+ print " $MessengerClient $o\n";
+ print "======================================\n\n";
}
# clean up
-$SR->Kill ();
-$NS->Kill ();
+$SRV_status = $SRV->TerminateWaitKill ($srv->ProcessStopWaitInterval());
+
+if ($SRV_status != 0) {
+ print STDERR "ERROR: Messenger Server returned $SRV_status\n";
+ $status = 1;
+}
+
+$NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval());
+
+if ($NS_status != 0) {
+ print STDERR "ERROR: Name Service returned $NS_status\n";
+ $status = 1;
+}
+
+$ns->DeleteFile ($nsiorfile);
+$srv->DeleteFile ($msfile);
-exit 0;
+exit $status;
diff --git a/TAO/orbsvcs/DevGuideExamples/NotifyService/EventSequence/MessengerClient.cpp b/TAO/orbsvcs/DevGuideExamples/NotifyService/EventSequence/MessengerClient.cpp
index eeea6d8701a..e2ef6e68a4b 100644
--- a/TAO/orbsvcs/DevGuideExamples/NotifyService/EventSequence/MessengerClient.cpp
+++ b/TAO/orbsvcs/DevGuideExamples/NotifyService/EventSequence/MessengerClient.cpp
@@ -3,6 +3,35 @@
#include "MessengerC.h"
#include "orbsvcs/CosNamingC.h"
#include <iostream>
+#include "ace/Get_Opt.h"
+
+const ACE_TCHAR *ior = ACE_TEXT("file://Messenger.ior");
+
+int
+parse_args (int argc, ACE_TCHAR *argv[])
+{
+ ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:"));
+ int c;
+
+ while ((c = get_opts ()) != -1)
+ switch (c)
+ {
+ case 'k':
+ ior = get_opts.opt_arg ();
+ break;
+
+ case '?':
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "usage: %s "
+ "-k <ior> "
+ "\n",
+ argv [0]),
+ -1);
+ }
+ // Indicates successful parsing of the command line
+ return 0;
+}
int ACE_TMAIN(int argc, ACE_TCHAR * argv[])
{
@@ -11,7 +40,10 @@ int ACE_TMAIN(int argc, ACE_TCHAR * argv[])
// Initialize orb
CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
- CORBA::Object_var obj = orb->string_to_object("file://Messenger.ior");
+ if (parse_args (argc, argv) != 0)
+ return 1;
+
+ CORBA::Object_var obj = orb->string_to_object(ior);
if (CORBA::is_nil(obj.in())) {
std::cerr << "Nil Messenger reference" << std::endl;
return 1;
diff --git a/TAO/orbsvcs/DevGuideExamples/NotifyService/EventSequence/MessengerServer.cpp b/TAO/orbsvcs/DevGuideExamples/NotifyService/EventSequence/MessengerServer.cpp
index e0ff009ea28..ca1ef264102 100644
--- a/TAO/orbsvcs/DevGuideExamples/NotifyService/EventSequence/MessengerServer.cpp
+++ b/TAO/orbsvcs/DevGuideExamples/NotifyService/EventSequence/MessengerServer.cpp
@@ -4,6 +4,30 @@
#include "Messenger_i.h"
#include <iostream>
#include <fstream>
+#include "ace/Get_Opt.h"
+
+const ACE_TCHAR *ior_output_file = ACE_TEXT ("Messenger.ior");
+
+int
+parse_args (int argc, ACE_TCHAR *argv[])
+{
+ ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("o:"));
+ int c;
+
+ while ((c = get_opts ()) != -1)
+ switch (c)
+ {
+ case 'o':
+ ior_output_file = get_opts.opt_arg ();
+ break;
+
+ case '?':
+ default:
+ ;
+ }
+ // Indicates sucessful parsing of the command line
+ return 0;
+}
int
ACE_TMAIN (int argc, ACE_TCHAR *argv [])
@@ -12,6 +36,9 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv [])
{
CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
+ if (parse_args (argc, argv) != 0)
+ return 1;
+
CORBA::Object_var obj = orb->resolve_initial_references("NameService");
CosNaming::NamingContextExt_var rootNC =
CosNaming::NamingContextExt::_narrow(obj.in());
@@ -27,10 +54,10 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv [])
obj = poa->id_to_reference(oid.in());
CORBA::String_var str = orb->object_to_string (obj.in());
- std::ofstream iorFile ("Messenger.ior");
+ std::ofstream iorFile (ACE_TEXT_ALWAYS_CHAR(ior_output_file));
iorFile << str.in() << std::endl;
iorFile.close();
- std::cout << "IOR written to file Messenger.ior " << std::endl;
+ std::cout << "IOR written to file " << ior_output_file << std::endl;
orb->run();
orb->destroy();
diff --git a/TAO/orbsvcs/DevGuideExamples/NotifyService/EventSequence/run_test.pl b/TAO/orbsvcs/DevGuideExamples/NotifyService/EventSequence/run_test.pl
index b787dd9f8c8..737f4ab9046 100755
--- a/TAO/orbsvcs/DevGuideExamples/NotifyService/EventSequence/run_test.pl
+++ b/TAO/orbsvcs/DevGuideExamples/NotifyService/EventSequence/run_test.pl
@@ -4,74 +4,199 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
& eval 'exec perl -S $0 $argv:q'
if 0;
-use Env (ACE_ROOT);
-use lib "$ACE_ROOT/bin";
-use PerlACE::Run_Test;
-
-$nsiorfile = PerlACE::LocalFile("ns.ior");
-$messiorfile = PerlACE::LocalFile("Messenger.ior");
-$notify_ior = PerlACE::LocalFile("notify.ior");
-$arg_ns_ref = "-ORBInitRef NameService=file://$nsiorfile";
-unlink $nsiorfile;
-unlink $messiorfile;
-unlink $notify_ior;
+use lib "$ENV{ACE_ROOT}/bin";
+use PerlACE::TestTarget;
+
+$status = 0;
+$debug_level = '0';
+
+foreach $i (@ARGV) {
+ if ($i eq '-debug') {
+ $debug_level = '10';
+ }
+}
+
+my $ns = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
+my $nfs = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
+my $srv = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n";
+my $con = PerlACE::TestTarget::create_target (4) || die "Create target 4 failed\n";
+my $cli = PerlACE::TestTarget::create_target (5) || die "Create target 5 failed\n";
+
+$nsiorfile = "ns.ior";
+$srviorfile = "Messenger.ior";
+$nfsiorfile = "notify.ior";
+
+my $ns_nsiorfile = $ns->LocalFile ($nsiorfile);
+my $nfs_nsiorfile = $nfs->LocalFile ($nsiorfile);
+my $srv_nsiorfile = $srv->LocalFile ($nsiorfile);
+my $con_nsiorfile = $con->LocalFile ($nsiorfile);
+my $cli_nsiorfile = $cli->LocalFile ($nsiorfile);
+my $nfs_nfsiorfile = $nfs->LocalFile ($nfsiorfile);
+my $srv_srviorfile = $srv->LocalFile ($srviorfile);
+my $cli_srviorfile = $cli->LocalFile ($srviorfile);
+$ns->DeleteFile ($nsiorfile);
+$nfs->DeleteFile ($nsiorfile);
+$srv->DeleteFile ($nsiorfile);
+$con->DeleteFile ($nsiorfile);
+$cli->DeleteFile ($nsiorfile);
+$nfs->DeleteFile ($nfsiorfile);
+$srv->DeleteFile ($srviorfile);
+$cli->DeleteFile ($srviorfile);
-# start Naming Service
$NameService = "$ENV{TAO_ROOT}/orbsvcs/Naming_Service/Naming_Service";
-$NS = new PerlACE::Process($NameService, "-o $nsiorfile");
-$NS->Spawn();
-if (PerlACE::waitforfile_timed ($nsiorfile, 10) == -1) {
- print STDERR "ERROR: cannot find file $nsiorfile\n";
- $NS->Kill();
+$NS = $ns->CreateProcess ($NameService, " -o $ns_nsiorfile");
+
+
+$NotifyService = "$ENV{TAO_ROOT}/orbsvcs/Notify_Service/Notify_Service";
+$NFS = $nfs->CreateProcess ($NotifyService, "-ORBInitRef NameService=file://$nfs_nsiorfile ".
+ "-IORoutput $nfs_nfsiorfile");
+$SRV = $srv->CreateProcess ("MessengerServer", "-ORBdebuglevel $debug_level ".
+ "-o $srv_srviorfile ".
+ "-ORBInitRef NameService=file://$srv_nsiorfile");
+$CON = $con->CreateProcess ("MessengerConsumer", "-ORBInitRef NameService=file://$con_nsiorfile");
+$CLI = $cli->CreateProcess ("MessengerClient", "-ORBInitRef NameService=file://$cli_nsiorfile ".
+ "-k file://$cli_srviorfile");
+
+# start Naming Service
+$NS_status = $NS->Spawn ();
+
+if ($NS_status != 0) {
+ print STDERR "ERROR: Name Service returned $NS_status\n";
+ exit 1;
+}
+
+if ($ns->WaitForFileTimed ($nsiorfile,$ns->ProcessStartWaitInterval()) == -1) {
+ print STDERR "ERROR: cannot find file <$ns_nsiorfile>\n";
+ $NS->Kill (); $NS->TimedWait (1);
+ exit 1;
+}
+
+if ($ns->GetFile ($nsiorfile) == -1) {
+ print STDERR "ERROR: cannot retrieve file <$ns_nsiorfile>\n";
+ $NS->Kill (); $NS->TimedWait (1);
+ exit 1;
+}
+if ($nfs->PutFile ($nsiorfile) == -1) {
+ print STDERR "ERROR: cannot set file <$nfs_nsiorfile>\n";
+ $NS->Kill (); $NS->TimedWait (1);
+ exit 1;
+}
+if ($srv->PutFile ($nsiorfile) == -1) {
+ print STDERR "ERROR: cannot set file <$srv_nsiorfile>\n";
+ $NS->Kill (); $NS->TimedWait (1);
+ exit 1;
+}
+if ($con->PutFile ($nsiorfile) == -1) {
+ print STDERR "ERROR: cannot set file <$con_nsiorfile>\n";
+ $NS->Kill (); $NS->TimedWait (1);
+ exit 1;
+}
+if ($cli->PutFile ($nsiorfile) == -1) {
+ print STDERR "ERROR: cannot set file <$cli_nsiorfile>\n";
+ $NS->Kill (); $NS->TimedWait (1);
exit 1;
}
# start Notification Service
+$NFS_status = $NFS->Spawn ();
-$NotifyService = "$ENV{TAO_ROOT}/orbsvcs/Notify_Service/Notify_Service";
-$NFS = new PerlACE::Process($NotifyService, "$arg_ns_ref -IORoutput $notify_ior");
-$NFS->Spawn();
-# the ior file is only used to wait for the service to start
-if (PerlACE::waitforfile_timed ($notify_ior, 10) == -1) {
- print STDERR "ERROR: Timed out waiting for $notify_ior\n";
- $NS->Kill ();
- $NFS->Kill ();
- exit 1;
+if ($NFS_status != 0) {
+ print STDERR "ERROR: Notify Service returned $NFS_status\n";
+ exit 1;
+}
+
+if ($nfs->WaitForFileTimed ($nfsiorfile,$nfs->ProcessStartWaitInterval()) == -1) {
+ print STDERR "ERROR: cannot find file <$nfs_nfsiorfile>\n";
+ $NS->Kill (); $NS->TimedWait (1);
+ $NFS->Kill (); $NFS->TimedWait (1);
+ exit 1;
}
# start MessengerServer
-$S = new PerlACE::Process("MessengerServer", $arg_ns_ref);
-$S->Spawn();
+$SRV_status = $SRV->Spawn ();
+
+if ($SRV_status != 0) {
+ print STDERR "ERROR: Server returned $SRV_status\n";
+ exit 1;
+}
-# Wait for the MessengerServer
-if (PerlACE::waitforfile_timed ($messiorfile, 10) == -1) {
- print STDERR "ERROR: Timed out waiting for $messiorfile\n";
- $S->Kill();
- $NS->Kill ();
- $NFS->Kill ();
- exit 1;
+if ($srv->WaitForFileTimed ($srviorfile,$srv->ProcessStartWaitInterval()) == -1) {
+ print STDERR "ERROR: cannot find file <$srv_srviorfile>\n";
+ $SRV->Kill (); $SRV->TimedWait (1);
+ $NS->Kill (); $NS->TimedWait (1);
+ $NFS->Kill (); $NFS->TimedWait (1);
+ exit 1;
+}
+
+if ($srv->GetFile ($srviorfile) == -1) {
+ print STDERR "ERROR: cannot retrieve file <$srv_srviorfile>\n";
+ $SRV->Kill (); $SRV->TimedWait (1);
+ $NS->Kill (); $NS->TimedWait (1);
+ $NFS->Kill (); $NFS->TimedWait (1);
+ exit 1;
}
+if ($cli->PutFile ($srviorfile) == -1) {
+ print STDERR "ERROR: cannot set file <$cli_srviorfile>\n";
+ $SRV->Kill (); $SRV->TimedWait (1);
+ $NS->Kill (); $NS->TimedWait (1);
+ $NFS->Kill (); $NFS->TimedWait (1);
+ exit 1;
+}
+
# start MessengerConsumer
-$MC = new PerlACE::Process("MessengerConsumer", $arg_ns_ref);
-$MC->Spawn();
+$CON_status = $CON->Spawn ();
+
+if ($CON_status != 0) {
+ print STDERR "ERROR: Consumer returned $CON_status\n";
+ exit 1;
+}
# start MessengerClient
-$C = new PerlACE::Process("MessengerClient", $arg_ns_ref);
-if ($C->SpawnWaitKill(10) != 0) {
- $MC->Kill();
- $S->Kill();
- $NFS->Kill();
- $NS->Kill();
- exit (1);
+$CLI_status = $CLI->SpawnWaitKill ($cli->ProcessStartWaitInterval());
+
+if ($CLI_status != 0) {
+ print STDERR "ERROR: Messenger Client returned $CLI_status\n";
+ $CON->Kill (); $CON->TimedWait (1);
+ $SRV->Kill (); $SRV->TimedWait (1);
+ $NFS->Kill (); $NFS->TimedWait (1);
+ $NS->Kill (); $NS->TimedWait (1);
+ $status = 1;
+}
+
+$CON_status = $CON->TerminateWaitKill ($con->ProcessStopWaitInterval());
+
+if ($CON_status != 0) {
+ print STDERR "ERROR: Messenger Consumer returned $CON_status\n";
+ $status = 1;
}
-$MC->Kill();
-$S->Kill();
-$NFS->Kill();
-$NS->Kill();
+$SRV_status = $SRV->TerminateWaitKill ($srv->ProcessStopWaitInterval());
+
+if ($SRV_status != 0) {
+ print STDERR "ERROR: Messenger Server returned $SRV_status\n";
+ $status = 1;
+}
+$NFS_status = $NFS->TerminateWaitKill ($nfs->ProcessStopWaitInterval());
+
+if ($NFS_status != 0) {
+ print STDERR "ERROR: Notification Service returned $NFS_status\n";
+ $status = 1;
+}
+
+$NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval());
+
+if ($NS_status != 0) {
+ print STDERR "ERROR: Name Service returned $NS_status\n";
+ $status = 1;
+}
-unlink $nsiorfile;
-unlink $messiorfile;
-unlink $notify_ior;
+$ns->DeleteFile ($nsiorfile);
+$nfs->DeleteFile ($nsiorfile);
+$srv->DeleteFile ($nsiorfile);
+$con->DeleteFile ($nsiorfile);
+$cli->DeleteFile ($nsiorfile);
+$nfs->DeleteFile ($nfsiorfile);
+$srv->DeleteFile ($srviorfile);
+$cli->DeleteFile ($srviorfile);
-exit 0;
+exit $status;
diff --git a/TAO/orbsvcs/DevGuideExamples/NotifyService/Filtering/run_test.pl b/TAO/orbsvcs/DevGuideExamples/NotifyService/Filtering/run_test.pl
index 7a52de8ba1d..3332eeb8e15 100755
--- a/TAO/orbsvcs/DevGuideExamples/NotifyService/Filtering/run_test.pl
+++ b/TAO/orbsvcs/DevGuideExamples/NotifyService/Filtering/run_test.pl
@@ -4,74 +4,180 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
& eval 'exec perl -S $0 $argv:q'
if 0;
-use Env (ACE_ROOT);
-use lib "$ACE_ROOT/bin";
-use PerlACE::Run_Test;
-
-$nsiorfile = PerlACE::LocalFile("ns.ior");
-$messiorfile = PerlACE::LocalFile("Messenger.ior");
-$notify_ior = PerlACE::LocalFile("notify.ior");
-$arg_ns_ref = "-ORBInitRef NameService=file://$nsiorfile";
-unlink $nsiorfile;
-unlink $messiorfile;
-unlink $notify_ior;
+use lib "$ENV{ACE_ROOT}/bin";
+use PerlACE::TestTarget;
+
+$status = 0;
+$debug_level = '0';
+
+foreach $i (@ARGV) {
+ if ($i eq '-debug') {
+ $debug_level = '10';
+ }
+}
+
+my $ns = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
+my $nfs = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
+my $srv = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n";
+my $con = PerlACE::TestTarget::create_target (4) || die "Create target 4 failed\n";
+my $cli = PerlACE::TestTarget::create_target (5) || die "Create target 5 failed\n";
+
+$nsiorfile = "ns.ior";
+$srviorfile = "Messenger.ior";
+$nfsiorfile = "notify.ior";
+
+my $ns_nsiorfile = $ns->LocalFile ($nsiorfile);
+my $nfs_nsiorfile = $nfs->LocalFile ($nsiorfile);
+my $srv_nsiorfile = $srv->LocalFile ($nsiorfile);
+my $con_nsiorfile = $con->LocalFile ($nsiorfile);
+my $cli_nsiorfile = $cli->LocalFile ($nsiorfile);
+my $nfs_nfsiorfile = $nfs->LocalFile ($nfsiorfile);
+my $srv_srviorfile = $srv->LocalFile ($srviorfile);
+$ns->DeleteFile ($nsiorfile);
+$nfs->DeleteFile ($nsiorfile);
+$srv->DeleteFile ($nsiorfile);
+$con->DeleteFile ($nsiorfile);
+$cli->DeleteFile ($nsiorfile);
+$nfs->DeleteFile ($nfsiorfile);
+$srv->DeleteFile ($srviorfile);
-# start Naming Service
$NameService = "$ENV{TAO_ROOT}/orbsvcs/Naming_Service/Naming_Service";
-$NS = new PerlACE::Process($NameService, "-o $nsiorfile");
-$NS->Spawn();
-if (PerlACE::waitforfile_timed ($nsiorfile, 10) == -1) {
- print STDERR "ERROR: cannot find file $nsiorfile\n";
- $NS->Kill();
+$NS = $ns->CreateProcess ($NameService, " -o $ns_nsiorfile");
+
+$NotifyService = "$ENV{TAO_ROOT}/orbsvcs/Notify_Service/Notify_Service";
+$NFS = $nfs->CreateProcess ($NotifyService, "-ORBInitRef NameService=file://$nfs_nsiorfile ".
+ "-IORoutput $nfs_nfsiorfile");
+$SRV = $srv->CreateProcess ("MessengerServer", "-ORBdebuglevel $debug_level ".
+ "-o $srv_srviorfile ".
+ "-ORBInitRef NameService=file://$srv_nsiorfile");
+$CON = $con->CreateProcess ("MessengerConsumer", "-ORBInitRef NameService=file://$con_nsiorfile");
+$CLI = $cli->CreateProcess ("MessengerClient", "-ORBInitRef NameService=file://$cli_nsiorfile ");
+
+# start Naming Service
+$NS_status = $NS->Spawn ();
+
+if ($NS_status != 0) {
+ print STDERR "ERROR: Name Service returned $NS_status\n";
+ exit 1;
+}
+
+if ($ns->WaitForFileTimed ($nsiorfile,$ns->ProcessStartWaitInterval()) == -1) {
+ print STDERR "ERROR: cannot find file <$ns_nsiorfile>\n";
+ $NS->Kill (); $NS->TimedWait (1);
+ exit 1;
+}
+
+if ($ns->GetFile ($nsiorfile) == -1) {
+ print STDERR "ERROR: cannot retrieve file <$ns_nsiorfile>\n";
+ $NS->Kill (); $NS->TimedWait (1);
+ exit 1;
+}
+if ($nfs->PutFile ($nsiorfile) == -1) {
+ print STDERR "ERROR: cannot set file <$nfs_nsiorfile>\n";
+ $NS->Kill (); $NS->TimedWait (1);
+ exit 1;
+}
+if ($srv->PutFile ($nsiorfile) == -1) {
+ print STDERR "ERROR: cannot set file <$srv_nsiorfile>\n";
+ $NS->Kill (); $NS->TimedWait (1);
+ exit 1;
+}
+if ($con->PutFile ($nsiorfile) == -1) {
+ print STDERR "ERROR: cannot set file <$con_nsiorfile>\n";
+ $NS->Kill (); $NS->TimedWait (1);
+ exit 1;
+}
+if ($cli->PutFile ($nsiorfile) == -1) {
+ print STDERR "ERROR: cannot set file <$cli_nsiorfile>\n";
+ $NS->Kill (); $NS->TimedWait (1);
exit 1;
}
# start Notification Service
+$NFS_status = $NFS->Spawn ();
-$NotifyService = "$ENV{TAO_ROOT}/orbsvcs/Notify_Service/Notify_Service";
-$NFS = new PerlACE::Process($NotifyService, "$arg_ns_ref -IORoutput $notify_ior");
-$NFS->Spawn();
-# the ior file is only used to wait for the service to start
-if (PerlACE::waitforfile_timed ($notify_ior, 10) == -1) {
- print STDERR "ERROR: Timed out waiting for $notify_ior\n";
- $NS->Kill ();
- $NFS->Kill ();
- exit 1;
+if ($NFS_status != 0) {
+ print STDERR "ERROR: Notify Service returned $NFS_status\n";
+ exit 1;
+}
+
+if ($nfs->WaitForFileTimed ($nfsiorfile,$nfs->ProcessStartWaitInterval()) == -1) {
+ print STDERR "ERROR: cannot find file <$nfs_nfsiorfile>\n";
+ $NS->Kill (); $NS->TimedWait (1);
+ $NFS->Kill (); $NFS->TimedWait (1);
+ exit 1;
}
# start MessengerServer
-$S = new PerlACE::Process("MessengerServer", "$arg_ns_ref -o $messiorfile");
-$S->Spawn();
+$SRV_status = $SRV->Spawn ();
-# Wait for the MessengerServer
-if (PerlACE::waitforfile_timed ($messiorfile, 10) == -1) {
- print STDERR "ERROR: Timed out waiting for $messiorfile\n";
- $S->Kill();
- $NS->Kill ();
- $NFS->Kill ();
- exit 1;
+if ($SRV_status != 0) {
+ print STDERR "ERROR: Server returned $SRV_status\n";
+ exit 1;
}
+
+if ($srv->WaitForFileTimed ($srviorfile,$srv->ProcessStartWaitInterval()) == -1) {
+ print STDERR "ERROR: cannot find file <$srv_srviorfile>\n";
+ $SRV->Kill (); $SRV->TimedWait (1);
+ $NS->Kill (); $NS->TimedWait (1);
+ $NFS->Kill (); $NFS->TimedWait (1);
+ exit 1;
+}
+
# start MessengerConsumer
-$MC = new PerlACE::Process("MessengerConsumer", $arg_ns_ref);
-$MC->Spawn();
+$CON_status = $CON->Spawn ();
+
+if ($CON_status != 0) {
+ print STDERR "ERROR: Consumer returned $CON_status\n";
+ exit 1;
+}
# start MessengerClient
-$C = new PerlACE::Process("MessengerClient", $arg_ns_ref);
-if ($C->SpawnWaitKill(10) != 0) {
- $MC->Kill();
- $S->Kill();
- $NFS->Kill();
- $NS->Kill();
- exit (1);
+$CLI_status = $CLI->SpawnWaitKill ($cli->ProcessStartWaitInterval());
+
+if ($CLI_status != 0) {
+ print STDERR "ERROR: Messenger Client returned $CLI_status\n";
+ $CON->Kill (); $CON->TimedWait (1);
+ $SRV->Kill (); $SRV->TimedWait (1);
+ $NFS->Kill (); $NFS->TimedWait (1);
+ $NS->Kill (); $NS->TimedWait (1);
+ $status = 1;
+}
+
+$CON_status = $CON->TerminateWaitKill ($con->ProcessStopWaitInterval());
+
+if ($CON_status != 0) {
+ print STDERR "ERROR: Messenger Consumer returned $CON_status\n";
+ $status = 1;
+}
+
+$SRV_status = $SRV->TerminateWaitKill ($srv->ProcessStopWaitInterval());
+
+if ($SRV_status != 0) {
+ print STDERR "ERROR: Messenger Server returned $SRV_status\n";
+ $status = 1;
+}
+$NFS_status = $NFS->TerminateWaitKill ($nfs->ProcessStopWaitInterval());
+
+if ($NFS_status != 0) {
+ print STDERR "ERROR: Notification Service returned $NFS_status\n";
+ $status = 1;
+}
+
+$NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval());
+
+if ($NS_status != 0) {
+ print STDERR "ERROR: Name Service returned $NS_status\n";
+ $status = 1;
}
-$MC->Kill();
-$S->Kill();
-$NFS->Kill();
-$NS->Kill();
+$ns->DeleteFile ($nsiorfile);
+$nfs->DeleteFile ($nsiorfile);
+$srv->DeleteFile ($nsiorfile);
+$con->DeleteFile ($nsiorfile);
+$cli->DeleteFile ($nsiorfile);
+$nfs->DeleteFile ($nfsiorfile);
+$srv->DeleteFile ($srviorfile);
-unlink $nsiorfile;
-unlink $messiorfile;
-unlink $notify_ior;
+exit $status;
-exit 0;
diff --git a/TAO/orbsvcs/DevGuideExamples/NotifyService/Messenger/MessengerClient.cpp b/TAO/orbsvcs/DevGuideExamples/NotifyService/Messenger/MessengerClient.cpp
index 226fd6b54c6..789bd3b575f 100644
--- a/TAO/orbsvcs/DevGuideExamples/NotifyService/Messenger/MessengerClient.cpp
+++ b/TAO/orbsvcs/DevGuideExamples/NotifyService/Messenger/MessengerClient.cpp
@@ -3,6 +3,35 @@
#include "MessengerC.h"
#include "orbsvcs/CosNamingC.h"
#include <iostream>
+#include "ace/Get_Opt.h"
+
+const ACE_TCHAR *ior = ACE_TEXT("file://Messenger.ior");
+
+int
+parse_args (int argc, ACE_TCHAR *argv[])
+{
+ ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:"));
+ int c;
+
+ while ((c = get_opts ()) != -1)
+ switch (c)
+ {
+ case 'k':
+ ior = get_opts.opt_arg ();
+ break;
+
+ case '?':
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "usage: %s "
+ "-k <ior> "
+ "\n",
+ argv [0]),
+ -1);
+ }
+ // Indicates successful parsing of the command line
+ return 0;
+}
int ACE_TMAIN(int argc, ACE_TCHAR * argv[])
{
@@ -10,7 +39,11 @@ int ACE_TMAIN(int argc, ACE_TCHAR * argv[])
{
// Initialize orb
CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
- CORBA::Object_var obj = orb->string_to_object( "file://Messenger.ior" );
+
+ if (parse_args (argc, argv) != 0)
+ return 1;
+
+ CORBA::Object_var obj = orb->string_to_object( ior );
if (CORBA::is_nil(obj.in())) {
std::cerr << "Nil Messenger reference" << std::endl;
return 1;
diff --git a/TAO/orbsvcs/DevGuideExamples/NotifyService/Messenger/MessengerServer.cpp b/TAO/orbsvcs/DevGuideExamples/NotifyService/Messenger/MessengerServer.cpp
index f375895feb6..3413f093c09 100644
--- a/TAO/orbsvcs/DevGuideExamples/NotifyService/Messenger/MessengerServer.cpp
+++ b/TAO/orbsvcs/DevGuideExamples/NotifyService/Messenger/MessengerServer.cpp
@@ -4,6 +4,31 @@
#include "Messenger_i.h"
#include <iostream>
#include <fstream>
+#include "ace/Get_Opt.h"
+
+const ACE_TCHAR *ior_output_file = ACE_TEXT ("Messenger.ior");
+
+int
+parse_args (int argc, ACE_TCHAR *argv[])
+{
+ ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("o:"));
+ int c;
+
+ while ((c = get_opts ()) != -1)
+ switch (c)
+ {
+ case 'o':
+ ior_output_file = get_opts.opt_arg ();
+ break;
+
+ case '?':
+ default:
+ ;
+ }
+ // Indicates sucessful parsing of the command line
+ return 0;
+}
+
int
ACE_TMAIN (int argc, ACE_TCHAR *argv [])
{
@@ -11,6 +36,9 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv [])
{
CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
+ if (parse_args (argc, argv) != 0)
+ return 1;
+
CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
PortableServer::POA_var poa = PortableServer::POA::_narrow(obj.in());
PortableServer::POAManager_var mgr = poa->the_POAManager();
@@ -22,10 +50,10 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv [])
CORBA::Object_var messenger_obj = poa->id_to_reference (oid.in ());
CORBA::String_var str = orb->object_to_string (messenger_obj.in());
- std::ofstream iorFile ("Messenger.ior");
+ std::ofstream iorFile (ACE_TEXT_ALWAYS_CHAR(ior_output_file));
iorFile << str.in () << std::endl;
iorFile.close ();
- std::cout << "IOR written to file Messenger.ior " << std::endl;
+ std::cout << "IOR written to file " << ior_output_file << std::endl;
orb->run ();
orb->destroy ();
diff --git a/TAO/orbsvcs/DevGuideExamples/NotifyService/Messenger/run_test.pl b/TAO/orbsvcs/DevGuideExamples/NotifyService/Messenger/run_test.pl
index b787dd9f8c8..737f4ab9046 100755
--- a/TAO/orbsvcs/DevGuideExamples/NotifyService/Messenger/run_test.pl
+++ b/TAO/orbsvcs/DevGuideExamples/NotifyService/Messenger/run_test.pl
@@ -4,74 +4,199 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
& eval 'exec perl -S $0 $argv:q'
if 0;
-use Env (ACE_ROOT);
-use lib "$ACE_ROOT/bin";
-use PerlACE::Run_Test;
-
-$nsiorfile = PerlACE::LocalFile("ns.ior");
-$messiorfile = PerlACE::LocalFile("Messenger.ior");
-$notify_ior = PerlACE::LocalFile("notify.ior");
-$arg_ns_ref = "-ORBInitRef NameService=file://$nsiorfile";
-unlink $nsiorfile;
-unlink $messiorfile;
-unlink $notify_ior;
+use lib "$ENV{ACE_ROOT}/bin";
+use PerlACE::TestTarget;
+
+$status = 0;
+$debug_level = '0';
+
+foreach $i (@ARGV) {
+ if ($i eq '-debug') {
+ $debug_level = '10';
+ }
+}
+
+my $ns = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
+my $nfs = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
+my $srv = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n";
+my $con = PerlACE::TestTarget::create_target (4) || die "Create target 4 failed\n";
+my $cli = PerlACE::TestTarget::create_target (5) || die "Create target 5 failed\n";
+
+$nsiorfile = "ns.ior";
+$srviorfile = "Messenger.ior";
+$nfsiorfile = "notify.ior";
+
+my $ns_nsiorfile = $ns->LocalFile ($nsiorfile);
+my $nfs_nsiorfile = $nfs->LocalFile ($nsiorfile);
+my $srv_nsiorfile = $srv->LocalFile ($nsiorfile);
+my $con_nsiorfile = $con->LocalFile ($nsiorfile);
+my $cli_nsiorfile = $cli->LocalFile ($nsiorfile);
+my $nfs_nfsiorfile = $nfs->LocalFile ($nfsiorfile);
+my $srv_srviorfile = $srv->LocalFile ($srviorfile);
+my $cli_srviorfile = $cli->LocalFile ($srviorfile);
+$ns->DeleteFile ($nsiorfile);
+$nfs->DeleteFile ($nsiorfile);
+$srv->DeleteFile ($nsiorfile);
+$con->DeleteFile ($nsiorfile);
+$cli->DeleteFile ($nsiorfile);
+$nfs->DeleteFile ($nfsiorfile);
+$srv->DeleteFile ($srviorfile);
+$cli->DeleteFile ($srviorfile);
-# start Naming Service
$NameService = "$ENV{TAO_ROOT}/orbsvcs/Naming_Service/Naming_Service";
-$NS = new PerlACE::Process($NameService, "-o $nsiorfile");
-$NS->Spawn();
-if (PerlACE::waitforfile_timed ($nsiorfile, 10) == -1) {
- print STDERR "ERROR: cannot find file $nsiorfile\n";
- $NS->Kill();
+$NS = $ns->CreateProcess ($NameService, " -o $ns_nsiorfile");
+
+
+$NotifyService = "$ENV{TAO_ROOT}/orbsvcs/Notify_Service/Notify_Service";
+$NFS = $nfs->CreateProcess ($NotifyService, "-ORBInitRef NameService=file://$nfs_nsiorfile ".
+ "-IORoutput $nfs_nfsiorfile");
+$SRV = $srv->CreateProcess ("MessengerServer", "-ORBdebuglevel $debug_level ".
+ "-o $srv_srviorfile ".
+ "-ORBInitRef NameService=file://$srv_nsiorfile");
+$CON = $con->CreateProcess ("MessengerConsumer", "-ORBInitRef NameService=file://$con_nsiorfile");
+$CLI = $cli->CreateProcess ("MessengerClient", "-ORBInitRef NameService=file://$cli_nsiorfile ".
+ "-k file://$cli_srviorfile");
+
+# start Naming Service
+$NS_status = $NS->Spawn ();
+
+if ($NS_status != 0) {
+ print STDERR "ERROR: Name Service returned $NS_status\n";
+ exit 1;
+}
+
+if ($ns->WaitForFileTimed ($nsiorfile,$ns->ProcessStartWaitInterval()) == -1) {
+ print STDERR "ERROR: cannot find file <$ns_nsiorfile>\n";
+ $NS->Kill (); $NS->TimedWait (1);
+ exit 1;
+}
+
+if ($ns->GetFile ($nsiorfile) == -1) {
+ print STDERR "ERROR: cannot retrieve file <$ns_nsiorfile>\n";
+ $NS->Kill (); $NS->TimedWait (1);
+ exit 1;
+}
+if ($nfs->PutFile ($nsiorfile) == -1) {
+ print STDERR "ERROR: cannot set file <$nfs_nsiorfile>\n";
+ $NS->Kill (); $NS->TimedWait (1);
+ exit 1;
+}
+if ($srv->PutFile ($nsiorfile) == -1) {
+ print STDERR "ERROR: cannot set file <$srv_nsiorfile>\n";
+ $NS->Kill (); $NS->TimedWait (1);
+ exit 1;
+}
+if ($con->PutFile ($nsiorfile) == -1) {
+ print STDERR "ERROR: cannot set file <$con_nsiorfile>\n";
+ $NS->Kill (); $NS->TimedWait (1);
+ exit 1;
+}
+if ($cli->PutFile ($nsiorfile) == -1) {
+ print STDERR "ERROR: cannot set file <$cli_nsiorfile>\n";
+ $NS->Kill (); $NS->TimedWait (1);
exit 1;
}
# start Notification Service
+$NFS_status = $NFS->Spawn ();
-$NotifyService = "$ENV{TAO_ROOT}/orbsvcs/Notify_Service/Notify_Service";
-$NFS = new PerlACE::Process($NotifyService, "$arg_ns_ref -IORoutput $notify_ior");
-$NFS->Spawn();
-# the ior file is only used to wait for the service to start
-if (PerlACE::waitforfile_timed ($notify_ior, 10) == -1) {
- print STDERR "ERROR: Timed out waiting for $notify_ior\n";
- $NS->Kill ();
- $NFS->Kill ();
- exit 1;
+if ($NFS_status != 0) {
+ print STDERR "ERROR: Notify Service returned $NFS_status\n";
+ exit 1;
+}
+
+if ($nfs->WaitForFileTimed ($nfsiorfile,$nfs->ProcessStartWaitInterval()) == -1) {
+ print STDERR "ERROR: cannot find file <$nfs_nfsiorfile>\n";
+ $NS->Kill (); $NS->TimedWait (1);
+ $NFS->Kill (); $NFS->TimedWait (1);
+ exit 1;
}
# start MessengerServer
-$S = new PerlACE::Process("MessengerServer", $arg_ns_ref);
-$S->Spawn();
+$SRV_status = $SRV->Spawn ();
+
+if ($SRV_status != 0) {
+ print STDERR "ERROR: Server returned $SRV_status\n";
+ exit 1;
+}
-# Wait for the MessengerServer
-if (PerlACE::waitforfile_timed ($messiorfile, 10) == -1) {
- print STDERR "ERROR: Timed out waiting for $messiorfile\n";
- $S->Kill();
- $NS->Kill ();
- $NFS->Kill ();
- exit 1;
+if ($srv->WaitForFileTimed ($srviorfile,$srv->ProcessStartWaitInterval()) == -1) {
+ print STDERR "ERROR: cannot find file <$srv_srviorfile>\n";
+ $SRV->Kill (); $SRV->TimedWait (1);
+ $NS->Kill (); $NS->TimedWait (1);
+ $NFS->Kill (); $NFS->TimedWait (1);
+ exit 1;
+}
+
+if ($srv->GetFile ($srviorfile) == -1) {
+ print STDERR "ERROR: cannot retrieve file <$srv_srviorfile>\n";
+ $SRV->Kill (); $SRV->TimedWait (1);
+ $NS->Kill (); $NS->TimedWait (1);
+ $NFS->Kill (); $NFS->TimedWait (1);
+ exit 1;
}
+if ($cli->PutFile ($srviorfile) == -1) {
+ print STDERR "ERROR: cannot set file <$cli_srviorfile>\n";
+ $SRV->Kill (); $SRV->TimedWait (1);
+ $NS->Kill (); $NS->TimedWait (1);
+ $NFS->Kill (); $NFS->TimedWait (1);
+ exit 1;
+}
+
# start MessengerConsumer
-$MC = new PerlACE::Process("MessengerConsumer", $arg_ns_ref);
-$MC->Spawn();
+$CON_status = $CON->Spawn ();
+
+if ($CON_status != 0) {
+ print STDERR "ERROR: Consumer returned $CON_status\n";
+ exit 1;
+}
# start MessengerClient
-$C = new PerlACE::Process("MessengerClient", $arg_ns_ref);
-if ($C->SpawnWaitKill(10) != 0) {
- $MC->Kill();
- $S->Kill();
- $NFS->Kill();
- $NS->Kill();
- exit (1);
+$CLI_status = $CLI->SpawnWaitKill ($cli->ProcessStartWaitInterval());
+
+if ($CLI_status != 0) {
+ print STDERR "ERROR: Messenger Client returned $CLI_status\n";
+ $CON->Kill (); $CON->TimedWait (1);
+ $SRV->Kill (); $SRV->TimedWait (1);
+ $NFS->Kill (); $NFS->TimedWait (1);
+ $NS->Kill (); $NS->TimedWait (1);
+ $status = 1;
+}
+
+$CON_status = $CON->TerminateWaitKill ($con->ProcessStopWaitInterval());
+
+if ($CON_status != 0) {
+ print STDERR "ERROR: Messenger Consumer returned $CON_status\n";
+ $status = 1;
}
-$MC->Kill();
-$S->Kill();
-$NFS->Kill();
-$NS->Kill();
+$SRV_status = $SRV->TerminateWaitKill ($srv->ProcessStopWaitInterval());
+
+if ($SRV_status != 0) {
+ print STDERR "ERROR: Messenger Server returned $SRV_status\n";
+ $status = 1;
+}
+$NFS_status = $NFS->TerminateWaitKill ($nfs->ProcessStopWaitInterval());
+
+if ($NFS_status != 0) {
+ print STDERR "ERROR: Notification Service returned $NFS_status\n";
+ $status = 1;
+}
+
+$NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval());
+
+if ($NS_status != 0) {
+ print STDERR "ERROR: Name Service returned $NS_status\n";
+ $status = 1;
+}
-unlink $nsiorfile;
-unlink $messiorfile;
-unlink $notify_ior;
+$ns->DeleteFile ($nsiorfile);
+$nfs->DeleteFile ($nsiorfile);
+$srv->DeleteFile ($nsiorfile);
+$con->DeleteFile ($nsiorfile);
+$cli->DeleteFile ($nsiorfile);
+$nfs->DeleteFile ($nfsiorfile);
+$srv->DeleteFile ($srviorfile);
+$cli->DeleteFile ($srviorfile);
-exit 0;
+exit $status;
diff --git a/TAO/orbsvcs/DevGuideExamples/NotifyService/OfferSubscriptions/MessengerServer.cpp b/TAO/orbsvcs/DevGuideExamples/NotifyService/OfferSubscriptions/MessengerServer.cpp
index e8f21aa8af4..b0fff2d36e8 100644
--- a/TAO/orbsvcs/DevGuideExamples/NotifyService/OfferSubscriptions/MessengerServer.cpp
+++ b/TAO/orbsvcs/DevGuideExamples/NotifyService/OfferSubscriptions/MessengerServer.cpp
@@ -4,6 +4,31 @@
#include "Messenger_i.h"
#include <iostream>
#include <fstream>
+#include "ace/Get_Opt.h"
+
+const ACE_TCHAR *ior_output_file = ACE_TEXT ("Messenger.ior");
+
+int
+parse_args (int argc, ACE_TCHAR *argv[])
+{
+ ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("o:"));
+ int c;
+
+ while ((c = get_opts ()) != -1)
+ switch (c)
+ {
+ case 'o':
+ ior_output_file = get_opts.opt_arg ();
+ break;
+
+ case '?':
+ default:
+ ;
+ }
+ // Indicates sucessful parsing of the command line
+ return 0;
+}
+
int
ACE_TMAIN (int argc, ACE_TCHAR *argv [])
{
@@ -11,6 +36,9 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv [])
{
CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
+ if (parse_args (argc, argv) != 0)
+ return 1;
+
CORBA::Object_var rootObj = orb->resolve_initial_references("NameService");
CosNaming::NamingContext_var rootNC =
@@ -39,10 +67,10 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv [])
rootNC->rebind(name, messenger.in());
CORBA::String_var str = orb->object_to_string (messenger.in());
- std::ofstream iorFile ("Messenger.ior");
+ std::ofstream iorFile (ACE_TEXT_ALWAYS_CHAR(ior_output_file));
iorFile << str.in () << std::endl;
iorFile.close ();
- std::cout << "IOR written to file Messenger.ior " << std::endl;
+ std::cout << "IOR written to file " << ior_output_file << std::endl;
// Accept requests
orb->run();
diff --git a/TAO/orbsvcs/DevGuideExamples/NotifyService/OfferSubscriptions/run_test.pl b/TAO/orbsvcs/DevGuideExamples/NotifyService/OfferSubscriptions/run_test.pl
index b787dd9f8c8..fa81c4c1f62 100755
--- a/TAO/orbsvcs/DevGuideExamples/NotifyService/OfferSubscriptions/run_test.pl
+++ b/TAO/orbsvcs/DevGuideExamples/NotifyService/OfferSubscriptions/run_test.pl
@@ -4,74 +4,180 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
& eval 'exec perl -S $0 $argv:q'
if 0;
-use Env (ACE_ROOT);
-use lib "$ACE_ROOT/bin";
-use PerlACE::Run_Test;
-
-$nsiorfile = PerlACE::LocalFile("ns.ior");
-$messiorfile = PerlACE::LocalFile("Messenger.ior");
-$notify_ior = PerlACE::LocalFile("notify.ior");
-$arg_ns_ref = "-ORBInitRef NameService=file://$nsiorfile";
-unlink $nsiorfile;
-unlink $messiorfile;
-unlink $notify_ior;
+use lib "$ENV{ACE_ROOT}/bin";
+use PerlACE::TestTarget;
+
+$status = 0;
+$debug_level = '0';
+
+foreach $i (@ARGV) {
+ if ($i eq '-debug') {
+ $debug_level = '10';
+ }
+}
+
+my $ns = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
+my $nfs = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
+my $srv = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n";
+my $con = PerlACE::TestTarget::create_target (4) || die "Create target 4 failed\n";
+my $cli = PerlACE::TestTarget::create_target (5) || die "Create target 5 failed\n";
+
+$nsiorfile = "ns.ior";
+$srviorfile = "Messenger.ior";
+$nfsiorfile = "notify.ior";
+
+my $ns_nsiorfile = $ns->LocalFile ($nsiorfile);
+my $nfs_nsiorfile = $nfs->LocalFile ($nsiorfile);
+my $srv_nsiorfile = $srv->LocalFile ($nsiorfile);
+my $con_nsiorfile = $con->LocalFile ($nsiorfile);
+my $cli_nsiorfile = $cli->LocalFile ($nsiorfile);
+my $nfs_nfsiorfile = $nfs->LocalFile ($nfsiorfile);
+my $srv_srviorfile = $srv->LocalFile ($srviorfile);
+$ns->DeleteFile ($nsiorfile);
+$nfs->DeleteFile ($nsiorfile);
+$srv->DeleteFile ($nsiorfile);
+$con->DeleteFile ($nsiorfile);
+$cli->DeleteFile ($nsiorfile);
+$nfs->DeleteFile ($nfsiorfile);
+$srv->DeleteFile ($srviorfile);
-# start Naming Service
$NameService = "$ENV{TAO_ROOT}/orbsvcs/Naming_Service/Naming_Service";
-$NS = new PerlACE::Process($NameService, "-o $nsiorfile");
-$NS->Spawn();
-if (PerlACE::waitforfile_timed ($nsiorfile, 10) == -1) {
- print STDERR "ERROR: cannot find file $nsiorfile\n";
- $NS->Kill();
+$NS = $ns->CreateProcess ($NameService, " -o $ns_nsiorfile");
+
+
+$NotifyService = "$ENV{TAO_ROOT}/orbsvcs/Notify_Service/Notify_Service";
+$NFS = $nfs->CreateProcess ($NotifyService, "-ORBInitRef NameService=file://$nfs_nsiorfile ".
+ "-IORoutput $nfs_nfsiorfile");
+$SRV = $srv->CreateProcess ("MessengerServer", "-ORBdebuglevel $debug_level ".
+ "-o $srv_srviorfile ".
+ "-ORBInitRef NameService=file://$srv_nsiorfile");
+$CON = $con->CreateProcess ("MessengerConsumer", "-ORBInitRef NameService=file://$con_nsiorfile");
+$CLI = $cli->CreateProcess ("MessengerClient", "-ORBInitRef NameService=file://$cli_nsiorfile ");
+
+# start Naming Service
+$NS_status = $NS->Spawn ();
+
+if ($NS_status != 0) {
+ print STDERR "ERROR: Name Service returned $NS_status\n";
+ exit 1;
+}
+
+if ($ns->WaitForFileTimed ($nsiorfile,$ns->ProcessStartWaitInterval()) == -1) {
+ print STDERR "ERROR: cannot find file <$ns_nsiorfile>\n";
+ $NS->Kill (); $NS->TimedWait (1);
+ exit 1;
+}
+
+if ($ns->GetFile ($nsiorfile) == -1) {
+ print STDERR "ERROR: cannot retrieve file <$ns_nsiorfile>\n";
+ $NS->Kill (); $NS->TimedWait (1);
+ exit 1;
+}
+if ($nfs->PutFile ($nsiorfile) == -1) {
+ print STDERR "ERROR: cannot set file <$nfs_nsiorfile>\n";
+ $NS->Kill (); $NS->TimedWait (1);
+ exit 1;
+}
+if ($srv->PutFile ($nsiorfile) == -1) {
+ print STDERR "ERROR: cannot set file <$srv_nsiorfile>\n";
+ $NS->Kill (); $NS->TimedWait (1);
+ exit 1;
+}
+if ($con->PutFile ($nsiorfile) == -1) {
+ print STDERR "ERROR: cannot set file <$con_nsiorfile>\n";
+ $NS->Kill (); $NS->TimedWait (1);
+ exit 1;
+}
+if ($cli->PutFile ($nsiorfile) == -1) {
+ print STDERR "ERROR: cannot set file <$cli_nsiorfile>\n";
+ $NS->Kill (); $NS->TimedWait (1);
exit 1;
}
# start Notification Service
+$NFS_status = $NFS->Spawn ();
-$NotifyService = "$ENV{TAO_ROOT}/orbsvcs/Notify_Service/Notify_Service";
-$NFS = new PerlACE::Process($NotifyService, "$arg_ns_ref -IORoutput $notify_ior");
-$NFS->Spawn();
-# the ior file is only used to wait for the service to start
-if (PerlACE::waitforfile_timed ($notify_ior, 10) == -1) {
- print STDERR "ERROR: Timed out waiting for $notify_ior\n";
- $NS->Kill ();
- $NFS->Kill ();
- exit 1;
+if ($NFS_status != 0) {
+ print STDERR "ERROR: Notify Service returned $NFS_status\n";
+ exit 1;
+}
+
+if ($nfs->WaitForFileTimed ($nfsiorfile,$nfs->ProcessStartWaitInterval()) == -1) {
+ print STDERR "ERROR: cannot find file <$nfs_nfsiorfile>\n";
+ $NS->Kill (); $NS->TimedWait (1);
+ $NFS->Kill (); $NFS->TimedWait (1);
+ exit 1;
}
# start MessengerServer
-$S = new PerlACE::Process("MessengerServer", $arg_ns_ref);
-$S->Spawn();
+$SRV_status = $SRV->Spawn ();
-# Wait for the MessengerServer
-if (PerlACE::waitforfile_timed ($messiorfile, 10) == -1) {
- print STDERR "ERROR: Timed out waiting for $messiorfile\n";
- $S->Kill();
- $NS->Kill ();
- $NFS->Kill ();
- exit 1;
+if ($SRV_status != 0) {
+ print STDERR "ERROR: Server returned $SRV_status\n";
+ exit 1;
}
+
+if ($srv->WaitForFileTimed ($srviorfile,$srv->ProcessStartWaitInterval()) == -1) {
+ print STDERR "ERROR: cannot find file <$srv_srviorfile>\n";
+ $SRV->Kill (); $SRV->TimedWait (1);
+ $NS->Kill (); $NS->TimedWait (1);
+ $NFS->Kill (); $NFS->TimedWait (1);
+ exit 1;
+}
+
# start MessengerConsumer
-$MC = new PerlACE::Process("MessengerConsumer", $arg_ns_ref);
-$MC->Spawn();
+$CON_status = $CON->Spawn ();
+
+if ($CON_status != 0) {
+ print STDERR "ERROR: Consumer returned $CON_status\n";
+ exit 1;
+}
# start MessengerClient
-$C = new PerlACE::Process("MessengerClient", $arg_ns_ref);
-if ($C->SpawnWaitKill(10) != 0) {
- $MC->Kill();
- $S->Kill();
- $NFS->Kill();
- $NS->Kill();
- exit (1);
+$CLI_status = $CLI->SpawnWaitKill ($cli->ProcessStartWaitInterval());
+
+if ($CLI_status != 0) {
+ print STDERR "ERROR: Messenger Client returned $CLI_status\n";
+ $CON->Kill (); $CON->TimedWait (1);
+ $SRV->Kill (); $SRV->TimedWait (1);
+ $NFS->Kill (); $NFS->TimedWait (1);
+ $NS->Kill (); $NS->TimedWait (1);
+ $status = 1;
+}
+
+$CON_status = $CON->TerminateWaitKill ($con->ProcessStopWaitInterval());
+
+if ($CON_status != 0) {
+ print STDERR "ERROR: Messenger Consumer returned $CON_status\n";
+ $status = 1;
+}
+
+$SRV_status = $SRV->TerminateWaitKill ($srv->ProcessStopWaitInterval());
+
+if ($SRV_status != 0) {
+ print STDERR "ERROR: Messenger Server returned $SRV_status\n";
+ $status = 1;
+}
+$NFS_status = $NFS->TerminateWaitKill ($nfs->ProcessStopWaitInterval());
+
+if ($NFS_status != 0) {
+ print STDERR "ERROR: Notification Service returned $NFS_status\n";
+ $status = 1;
}
-$MC->Kill();
-$S->Kill();
-$NFS->Kill();
-$NS->Kill();
+$NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval());
+
+if ($NS_status != 0) {
+ print STDERR "ERROR: Name Service returned $NS_status\n";
+ $status = 1;
+}
-unlink $nsiorfile;
-unlink $messiorfile;
-unlink $notify_ior;
+$ns->DeleteFile ($nsiorfile);
+$nfs->DeleteFile ($nsiorfile);
+$srv->DeleteFile ($nsiorfile);
+$con->DeleteFile ($nsiorfile);
+$cli->DeleteFile ($nsiorfile);
+$nfs->DeleteFile ($nfsiorfile);
+$srv->DeleteFile ($srviorfile);
-exit 0;
+exit $status;
diff --git a/TAO/orbsvcs/DevGuideExamples/NotifyService/QoSProperties/MessengerClient.cpp b/TAO/orbsvcs/DevGuideExamples/NotifyService/QoSProperties/MessengerClient.cpp
index 21c6615ea95..9593e561210 100644
--- a/TAO/orbsvcs/DevGuideExamples/NotifyService/QoSProperties/MessengerClient.cpp
+++ b/TAO/orbsvcs/DevGuideExamples/NotifyService/QoSProperties/MessengerClient.cpp
@@ -3,7 +3,35 @@
#include "MessengerC.h"
#include "orbsvcs/CosNamingC.h"
#include <iostream>
+#include "ace/Get_Opt.h"
+const ACE_TCHAR *ior = ACE_TEXT("file://Messenger.ior");
+
+int
+parse_args (int argc, ACE_TCHAR *argv[])
+{
+ ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:"));
+ int c;
+
+ while ((c = get_opts ()) != -1)
+ switch (c)
+ {
+ case 'k':
+ ior = get_opts.opt_arg ();
+ break;
+
+ case '?':
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "usage: %s "
+ "-k <ior> "
+ "\n",
+ argv [0]),
+ -1);
+ }
+ // Indicates successful parsing of the command line
+ return 0;
+}
int ACE_TMAIN(int argc, ACE_TCHAR * argv[])
{
try
@@ -11,7 +39,10 @@ int ACE_TMAIN(int argc, ACE_TCHAR * argv[])
// Initialize orb
CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
- CORBA::Object_var obj = orb->string_to_object( "file://Messenger.ior" );
+ if (parse_args (argc, argv) != 0)
+ return 1;
+
+ CORBA::Object_var obj = orb->string_to_object( ior );
if (CORBA::is_nil(obj.in())) {
std::cerr << "Nil Messenger reference" << std::endl;
return 1;
diff --git a/TAO/orbsvcs/DevGuideExamples/NotifyService/QoSProperties/MessengerServer.cpp b/TAO/orbsvcs/DevGuideExamples/NotifyService/QoSProperties/MessengerServer.cpp
index 9cc7b95420f..072bf111c29 100644
--- a/TAO/orbsvcs/DevGuideExamples/NotifyService/QoSProperties/MessengerServer.cpp
+++ b/TAO/orbsvcs/DevGuideExamples/NotifyService/QoSProperties/MessengerServer.cpp
@@ -5,6 +5,30 @@
#include <iostream>
#include <fstream>
#include <fstream>
+#include "ace/Get_Opt.h"
+
+const ACE_TCHAR *ior_output_file = ACE_TEXT ("Messenger.ior");
+
+int
+parse_args (int argc, ACE_TCHAR *argv[])
+{
+ ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("o:"));
+ int c;
+
+ while ((c = get_opts ()) != -1)
+ switch (c)
+ {
+ case 'o':
+ ior_output_file = get_opts.opt_arg ();
+ break;
+
+ case '?':
+ default:
+ ;
+ }
+ // Indicates sucessful parsing of the command line
+ return 0;
+}
int
ACE_TMAIN (int argc, ACE_TCHAR *argv [])
@@ -13,6 +37,9 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv [])
{
CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
+ if (parse_args (argc, argv) != 0)
+ return 1;
+
CORBA::Object_var rootObj = orb->resolve_initial_references("NameService");
CosNaming::NamingContext_var rootNC =
CosNaming::NamingContext::_narrow(rootObj.in());
@@ -28,10 +55,10 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv [])
CORBA::Object_var messenger_obj = poa->id_to_reference (oid.in ());
CORBA::String_var str = orb->object_to_string (messenger_obj.in());
- std::ofstream iorFile ("Messenger.ior");
+ std::ofstream iorFile (ACE_TEXT_ALWAYS_CHAR(ior_output_file));
iorFile << str.in () << std::endl;
iorFile.close ();
- std::cout << "IOR written to file Messenger.ior " << std::endl;
+ std::cout << "IOR written to file " << ior_output_file << std::endl;
orb->run ();
orb->destroy ();
diff --git a/TAO/orbsvcs/DevGuideExamples/NotifyService/QoSProperties/run_test.pl b/TAO/orbsvcs/DevGuideExamples/NotifyService/QoSProperties/run_test.pl
index b787dd9f8c8..737f4ab9046 100755
--- a/TAO/orbsvcs/DevGuideExamples/NotifyService/QoSProperties/run_test.pl
+++ b/TAO/orbsvcs/DevGuideExamples/NotifyService/QoSProperties/run_test.pl
@@ -4,74 +4,199 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
& eval 'exec perl -S $0 $argv:q'
if 0;
-use Env (ACE_ROOT);
-use lib "$ACE_ROOT/bin";
-use PerlACE::Run_Test;
-
-$nsiorfile = PerlACE::LocalFile("ns.ior");
-$messiorfile = PerlACE::LocalFile("Messenger.ior");
-$notify_ior = PerlACE::LocalFile("notify.ior");
-$arg_ns_ref = "-ORBInitRef NameService=file://$nsiorfile";
-unlink $nsiorfile;
-unlink $messiorfile;
-unlink $notify_ior;
+use lib "$ENV{ACE_ROOT}/bin";
+use PerlACE::TestTarget;
+
+$status = 0;
+$debug_level = '0';
+
+foreach $i (@ARGV) {
+ if ($i eq '-debug') {
+ $debug_level = '10';
+ }
+}
+
+my $ns = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
+my $nfs = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
+my $srv = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n";
+my $con = PerlACE::TestTarget::create_target (4) || die "Create target 4 failed\n";
+my $cli = PerlACE::TestTarget::create_target (5) || die "Create target 5 failed\n";
+
+$nsiorfile = "ns.ior";
+$srviorfile = "Messenger.ior";
+$nfsiorfile = "notify.ior";
+
+my $ns_nsiorfile = $ns->LocalFile ($nsiorfile);
+my $nfs_nsiorfile = $nfs->LocalFile ($nsiorfile);
+my $srv_nsiorfile = $srv->LocalFile ($nsiorfile);
+my $con_nsiorfile = $con->LocalFile ($nsiorfile);
+my $cli_nsiorfile = $cli->LocalFile ($nsiorfile);
+my $nfs_nfsiorfile = $nfs->LocalFile ($nfsiorfile);
+my $srv_srviorfile = $srv->LocalFile ($srviorfile);
+my $cli_srviorfile = $cli->LocalFile ($srviorfile);
+$ns->DeleteFile ($nsiorfile);
+$nfs->DeleteFile ($nsiorfile);
+$srv->DeleteFile ($nsiorfile);
+$con->DeleteFile ($nsiorfile);
+$cli->DeleteFile ($nsiorfile);
+$nfs->DeleteFile ($nfsiorfile);
+$srv->DeleteFile ($srviorfile);
+$cli->DeleteFile ($srviorfile);
-# start Naming Service
$NameService = "$ENV{TAO_ROOT}/orbsvcs/Naming_Service/Naming_Service";
-$NS = new PerlACE::Process($NameService, "-o $nsiorfile");
-$NS->Spawn();
-if (PerlACE::waitforfile_timed ($nsiorfile, 10) == -1) {
- print STDERR "ERROR: cannot find file $nsiorfile\n";
- $NS->Kill();
+$NS = $ns->CreateProcess ($NameService, " -o $ns_nsiorfile");
+
+
+$NotifyService = "$ENV{TAO_ROOT}/orbsvcs/Notify_Service/Notify_Service";
+$NFS = $nfs->CreateProcess ($NotifyService, "-ORBInitRef NameService=file://$nfs_nsiorfile ".
+ "-IORoutput $nfs_nfsiorfile");
+$SRV = $srv->CreateProcess ("MessengerServer", "-ORBdebuglevel $debug_level ".
+ "-o $srv_srviorfile ".
+ "-ORBInitRef NameService=file://$srv_nsiorfile");
+$CON = $con->CreateProcess ("MessengerConsumer", "-ORBInitRef NameService=file://$con_nsiorfile");
+$CLI = $cli->CreateProcess ("MessengerClient", "-ORBInitRef NameService=file://$cli_nsiorfile ".
+ "-k file://$cli_srviorfile");
+
+# start Naming Service
+$NS_status = $NS->Spawn ();
+
+if ($NS_status != 0) {
+ print STDERR "ERROR: Name Service returned $NS_status\n";
+ exit 1;
+}
+
+if ($ns->WaitForFileTimed ($nsiorfile,$ns->ProcessStartWaitInterval()) == -1) {
+ print STDERR "ERROR: cannot find file <$ns_nsiorfile>\n";
+ $NS->Kill (); $NS->TimedWait (1);
+ exit 1;
+}
+
+if ($ns->GetFile ($nsiorfile) == -1) {
+ print STDERR "ERROR: cannot retrieve file <$ns_nsiorfile>\n";
+ $NS->Kill (); $NS->TimedWait (1);
+ exit 1;
+}
+if ($nfs->PutFile ($nsiorfile) == -1) {
+ print STDERR "ERROR: cannot set file <$nfs_nsiorfile>\n";
+ $NS->Kill (); $NS->TimedWait (1);
+ exit 1;
+}
+if ($srv->PutFile ($nsiorfile) == -1) {
+ print STDERR "ERROR: cannot set file <$srv_nsiorfile>\n";
+ $NS->Kill (); $NS->TimedWait (1);
+ exit 1;
+}
+if ($con->PutFile ($nsiorfile) == -1) {
+ print STDERR "ERROR: cannot set file <$con_nsiorfile>\n";
+ $NS->Kill (); $NS->TimedWait (1);
+ exit 1;
+}
+if ($cli->PutFile ($nsiorfile) == -1) {
+ print STDERR "ERROR: cannot set file <$cli_nsiorfile>\n";
+ $NS->Kill (); $NS->TimedWait (1);
exit 1;
}
# start Notification Service
+$NFS_status = $NFS->Spawn ();
-$NotifyService = "$ENV{TAO_ROOT}/orbsvcs/Notify_Service/Notify_Service";
-$NFS = new PerlACE::Process($NotifyService, "$arg_ns_ref -IORoutput $notify_ior");
-$NFS->Spawn();
-# the ior file is only used to wait for the service to start
-if (PerlACE::waitforfile_timed ($notify_ior, 10) == -1) {
- print STDERR "ERROR: Timed out waiting for $notify_ior\n";
- $NS->Kill ();
- $NFS->Kill ();
- exit 1;
+if ($NFS_status != 0) {
+ print STDERR "ERROR: Notify Service returned $NFS_status\n";
+ exit 1;
+}
+
+if ($nfs->WaitForFileTimed ($nfsiorfile,$nfs->ProcessStartWaitInterval()) == -1) {
+ print STDERR "ERROR: cannot find file <$nfs_nfsiorfile>\n";
+ $NS->Kill (); $NS->TimedWait (1);
+ $NFS->Kill (); $NFS->TimedWait (1);
+ exit 1;
}
# start MessengerServer
-$S = new PerlACE::Process("MessengerServer", $arg_ns_ref);
-$S->Spawn();
+$SRV_status = $SRV->Spawn ();
+
+if ($SRV_status != 0) {
+ print STDERR "ERROR: Server returned $SRV_status\n";
+ exit 1;
+}
-# Wait for the MessengerServer
-if (PerlACE::waitforfile_timed ($messiorfile, 10) == -1) {
- print STDERR "ERROR: Timed out waiting for $messiorfile\n";
- $S->Kill();
- $NS->Kill ();
- $NFS->Kill ();
- exit 1;
+if ($srv->WaitForFileTimed ($srviorfile,$srv->ProcessStartWaitInterval()) == -1) {
+ print STDERR "ERROR: cannot find file <$srv_srviorfile>\n";
+ $SRV->Kill (); $SRV->TimedWait (1);
+ $NS->Kill (); $NS->TimedWait (1);
+ $NFS->Kill (); $NFS->TimedWait (1);
+ exit 1;
+}
+
+if ($srv->GetFile ($srviorfile) == -1) {
+ print STDERR "ERROR: cannot retrieve file <$srv_srviorfile>\n";
+ $SRV->Kill (); $SRV->TimedWait (1);
+ $NS->Kill (); $NS->TimedWait (1);
+ $NFS->Kill (); $NFS->TimedWait (1);
+ exit 1;
}
+if ($cli->PutFile ($srviorfile) == -1) {
+ print STDERR "ERROR: cannot set file <$cli_srviorfile>\n";
+ $SRV->Kill (); $SRV->TimedWait (1);
+ $NS->Kill (); $NS->TimedWait (1);
+ $NFS->Kill (); $NFS->TimedWait (1);
+ exit 1;
+}
+
# start MessengerConsumer
-$MC = new PerlACE::Process("MessengerConsumer", $arg_ns_ref);
-$MC->Spawn();
+$CON_status = $CON->Spawn ();
+
+if ($CON_status != 0) {
+ print STDERR "ERROR: Consumer returned $CON_status\n";
+ exit 1;
+}
# start MessengerClient
-$C = new PerlACE::Process("MessengerClient", $arg_ns_ref);
-if ($C->SpawnWaitKill(10) != 0) {
- $MC->Kill();
- $S->Kill();
- $NFS->Kill();
- $NS->Kill();
- exit (1);
+$CLI_status = $CLI->SpawnWaitKill ($cli->ProcessStartWaitInterval());
+
+if ($CLI_status != 0) {
+ print STDERR "ERROR: Messenger Client returned $CLI_status\n";
+ $CON->Kill (); $CON->TimedWait (1);
+ $SRV->Kill (); $SRV->TimedWait (1);
+ $NFS->Kill (); $NFS->TimedWait (1);
+ $NS->Kill (); $NS->TimedWait (1);
+ $status = 1;
+}
+
+$CON_status = $CON->TerminateWaitKill ($con->ProcessStopWaitInterval());
+
+if ($CON_status != 0) {
+ print STDERR "ERROR: Messenger Consumer returned $CON_status\n";
+ $status = 1;
}
-$MC->Kill();
-$S->Kill();
-$NFS->Kill();
-$NS->Kill();
+$SRV_status = $SRV->TerminateWaitKill ($srv->ProcessStopWaitInterval());
+
+if ($SRV_status != 0) {
+ print STDERR "ERROR: Messenger Server returned $SRV_status\n";
+ $status = 1;
+}
+$NFS_status = $NFS->TerminateWaitKill ($nfs->ProcessStopWaitInterval());
+
+if ($NFS_status != 0) {
+ print STDERR "ERROR: Notification Service returned $NFS_status\n";
+ $status = 1;
+}
+
+$NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval());
+
+if ($NS_status != 0) {
+ print STDERR "ERROR: Name Service returned $NS_status\n";
+ $status = 1;
+}
-unlink $nsiorfile;
-unlink $messiorfile;
-unlink $notify_ior;
+$ns->DeleteFile ($nsiorfile);
+$nfs->DeleteFile ($nsiorfile);
+$srv->DeleteFile ($nsiorfile);
+$con->DeleteFile ($nsiorfile);
+$cli->DeleteFile ($nsiorfile);
+$nfs->DeleteFile ($nfsiorfile);
+$srv->DeleteFile ($srviorfile);
+$cli->DeleteFile ($srviorfile);
-exit 0;
+exit $status;
diff --git a/TAO/orbsvcs/DevGuideExamples/NotifyService/RTNotify/MessengerClient.cpp b/TAO/orbsvcs/DevGuideExamples/NotifyService/RTNotify/MessengerClient.cpp
index 226fd6b54c6..789bd3b575f 100644
--- a/TAO/orbsvcs/DevGuideExamples/NotifyService/RTNotify/MessengerClient.cpp
+++ b/TAO/orbsvcs/DevGuideExamples/NotifyService/RTNotify/MessengerClient.cpp
@@ -3,6 +3,35 @@
#include "MessengerC.h"
#include "orbsvcs/CosNamingC.h"
#include <iostream>
+#include "ace/Get_Opt.h"
+
+const ACE_TCHAR *ior = ACE_TEXT("file://Messenger.ior");
+
+int
+parse_args (int argc, ACE_TCHAR *argv[])
+{
+ ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:"));
+ int c;
+
+ while ((c = get_opts ()) != -1)
+ switch (c)
+ {
+ case 'k':
+ ior = get_opts.opt_arg ();
+ break;
+
+ case '?':
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "usage: %s "
+ "-k <ior> "
+ "\n",
+ argv [0]),
+ -1);
+ }
+ // Indicates successful parsing of the command line
+ return 0;
+}
int ACE_TMAIN(int argc, ACE_TCHAR * argv[])
{
@@ -10,7 +39,11 @@ int ACE_TMAIN(int argc, ACE_TCHAR * argv[])
{
// Initialize orb
CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
- CORBA::Object_var obj = orb->string_to_object( "file://Messenger.ior" );
+
+ if (parse_args (argc, argv) != 0)
+ return 1;
+
+ CORBA::Object_var obj = orb->string_to_object( ior );
if (CORBA::is_nil(obj.in())) {
std::cerr << "Nil Messenger reference" << std::endl;
return 1;
diff --git a/TAO/orbsvcs/DevGuideExamples/NotifyService/RTNotify/MessengerConsumer.cpp b/TAO/orbsvcs/DevGuideExamples/NotifyService/RTNotify/MessengerConsumer.cpp
index 8d6f28b5ae5..39b64f2faae 100644
--- a/TAO/orbsvcs/DevGuideExamples/NotifyService/RTNotify/MessengerConsumer.cpp
+++ b/TAO/orbsvcs/DevGuideExamples/NotifyService/RTNotify/MessengerConsumer.cpp
@@ -10,6 +10,30 @@
#include "Priorities.h"
#include <iostream>
#include <fstream>
+#include "ace/Get_Opt.h"
+
+const ACE_TCHAR *output_file = ACE_TEXT ("MessengerConsumer.ready");
+
+int
+parse_args (int argc, ACE_TCHAR *argv[])
+{
+ ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("o:"));
+ int c;
+
+ while ((c = get_opts ()) != -1)
+ switch (c)
+ {
+ case 'o':
+ output_file = get_opts.opt_arg ();
+ break;
+
+ case '?':
+ default:
+ ;
+ }
+ // Indicates sucessful parsing of the command line
+ return 0;
+}
int
ACE_TMAIN (int argc, ACE_TCHAR *argv[])
@@ -18,6 +42,9 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
+ if (parse_args (argc, argv) != 0)
+ return 1;
+
CORBA::Object_var naming_obj =
orb->resolve_initial_references ("NameService");
@@ -166,7 +193,7 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[])
poa_manager->activate();
// Write a file to let the run_test.pl script know we are ready.
- std::ofstream iorFile( "MessengerConsumer.ready" );
+ std::ofstream iorFile( ACE_TEXT_ALWAYS_CHAR(output_file) );
iorFile << "Ready" << std::endl;
iorFile.close();
diff --git a/TAO/orbsvcs/DevGuideExamples/NotifyService/RTNotify/MessengerServer.cpp b/TAO/orbsvcs/DevGuideExamples/NotifyService/RTNotify/MessengerServer.cpp
index f375895feb6..3413f093c09 100644
--- a/TAO/orbsvcs/DevGuideExamples/NotifyService/RTNotify/MessengerServer.cpp
+++ b/TAO/orbsvcs/DevGuideExamples/NotifyService/RTNotify/MessengerServer.cpp
@@ -4,6 +4,31 @@
#include "Messenger_i.h"
#include <iostream>
#include <fstream>
+#include "ace/Get_Opt.h"
+
+const ACE_TCHAR *ior_output_file = ACE_TEXT ("Messenger.ior");
+
+int
+parse_args (int argc, ACE_TCHAR *argv[])
+{
+ ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("o:"));
+ int c;
+
+ while ((c = get_opts ()) != -1)
+ switch (c)
+ {
+ case 'o':
+ ior_output_file = get_opts.opt_arg ();
+ break;
+
+ case '?':
+ default:
+ ;
+ }
+ // Indicates sucessful parsing of the command line
+ return 0;
+}
+
int
ACE_TMAIN (int argc, ACE_TCHAR *argv [])
{
@@ -11,6 +36,9 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv [])
{
CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
+ if (parse_args (argc, argv) != 0)
+ return 1;
+
CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
PortableServer::POA_var poa = PortableServer::POA::_narrow(obj.in());
PortableServer::POAManager_var mgr = poa->the_POAManager();
@@ -22,10 +50,10 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv [])
CORBA::Object_var messenger_obj = poa->id_to_reference (oid.in ());
CORBA::String_var str = orb->object_to_string (messenger_obj.in());
- std::ofstream iorFile ("Messenger.ior");
+ std::ofstream iorFile (ACE_TEXT_ALWAYS_CHAR(ior_output_file));
iorFile << str.in () << std::endl;
iorFile.close ();
- std::cout << "IOR written to file Messenger.ior " << std::endl;
+ std::cout << "IOR written to file " << ior_output_file << std::endl;
orb->run ();
orb->destroy ();
diff --git a/TAO/orbsvcs/DevGuideExamples/NotifyService/RTNotify/run_test.pl b/TAO/orbsvcs/DevGuideExamples/NotifyService/RTNotify/run_test.pl
index eaaceb005b9..227d221bab4 100755
--- a/TAO/orbsvcs/DevGuideExamples/NotifyService/RTNotify/run_test.pl
+++ b/TAO/orbsvcs/DevGuideExamples/NotifyService/RTNotify/run_test.pl
@@ -4,89 +4,212 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
& eval 'exec perl -S $0 $argv:q'
if 0;
-use Env (ACE_ROOT);
-use lib "$ACE_ROOT/bin";
-use PerlACE::Run_Test;
-
-$nsiorfile = PerlACE::LocalFile("ns.ior");
-$messiorfile = PerlACE::LocalFile("Messenger.ior");
-$notify_ior = PerlACE::LocalFile("notify.ior");
-$consumerfile = PerlACE::LocalFile("MessengerConsumer.ready");
-$arg_ns_ref = "-ORBInitRef NameService=file://$nsiorfile";
-unlink $nsiorfile;
-unlink $messiorfile;
-unlink $notify_ior;
-unlink $consumerfile;
+use lib "$ENV{ACE_ROOT}/bin";
+use PerlACE::TestTarget;
+
+$status = 0;
+$debug_level = '0';
+
+foreach $i (@ARGV) {
+ if ($i eq '-debug') {
+ $debug_level = '10';
+ }
+}
+
+my $ns = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
+my $nfs = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
+my $srv = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n";
+my $con = PerlACE::TestTarget::create_target (4) || die "Create target 4 failed\n";
+my $cli = PerlACE::TestTarget::create_target (5) || die "Create target 5 failed\n";
+
+$nsiorfile = "ns.ior";
+$srviorfile = "Messenger.ior";
+$nfsiorfile = "notify.ior";
+$confile = "MessengerConsumer.ready";
+$conconf = "notify.conf";
+$nscliconf = "nsclient.conf";
+
+my $ns_nsiorfile = $ns->LocalFile ($nsiorfile);
+my $nfs_nsiorfile = $nfs->LocalFile ($nsiorfile);
+my $srv_nsiorfile = $srv->LocalFile ($nsiorfile);
+my $con_nsiorfile = $con->LocalFile ($nsiorfile);
+my $nfs_nfsiorfile = $nfs->LocalFile ($nfsiorfile);
+my $srv_srviorfile = $srv->LocalFile ($srviorfile);
+my $cli_srviorfile = $cli->LocalFile ($srviorfile);
+my $con_confile = $con->LocalFile ($confile);
+my $con_conconf = $con->LocalFile ($conconf);
+my $srv_nscliconf = $srv->LocalFile ($nscliconf);
+my $con_nscliconf = $con->LocalFile ($nscliconf);
+$ns->DeleteFile ($nsiorfile);
+$nfs->DeleteFile ($nsiorfile);
+$srv->DeleteFile ($nsiorfile);
+$con->DeleteFile ($nsiorfile);
+$nfs->DeleteFile ($nfsiorfile);
+$srv->DeleteFile ($srviorfile);
+$cli->DeleteFile ($srviorfile);
+$con->DeleteFile ($confile);
-# start Naming Service
$NameService = "$ENV{TAO_ROOT}/orbsvcs/Naming_Service/Naming_Service";
-$NS = new PerlACE::Process($NameService, "-o $nsiorfile");
-$NS->Spawn();
-if (PerlACE::waitforfile_timed ($nsiorfile, 10) == -1) {
- print STDERR "ERROR: cannot find file $nsiorfile\n";
- $NS->Kill();
+$NS = $ns->CreateProcess ($NameService, " -o $ns_nsiorfile");
+
+
+$NotifyService = "$ENV{TAO_ROOT}/orbsvcs/Notify_Service/Notify_Service";
+$NFS = $nfs->CreateProcess ($NotifyService, "-ORBInitRef NameService=file://$nfs_nsiorfile ".
+ "-IORoutput $nfs_nfsiorfile ".
+ "-ORBSvcConf $con_conconf");
+$SRV = $srv->CreateProcess ("MessengerServer", "-ORBdebuglevel $debug_level ".
+ "-o $srv_srviorfile ".
+ "-ORBInitRef NameService=file://$srv_nsiorfile ".
+ "-ORBSvcConf $srv_nscliconf");
+$CON = $con->CreateProcess ("MessengerConsumer", "-ORBInitRef NameService=file://$con_nsiorfile ".
+ "-ORBSvcConf $con_nscliconf ".
+ "-o $con_confile");
+$CLI = $cli->CreateProcess ("MessengerClient", "-k file://$cli_srviorfile");
+
+# start Naming Service
+$NS_status = $NS->Spawn ();
+
+if ($NS_status != 0) {
+ print STDERR "ERROR: Name Service returned $NS_status\n";
+ exit 1;
+}
+
+if ($ns->WaitForFileTimed ($nsiorfile,$ns->ProcessStartWaitInterval()) == -1) {
+ print STDERR "ERROR: cannot find file <$ns_nsiorfile>\n";
+ $NS->Kill (); $NS->TimedWait (1);
+ exit 1;
+}
+
+if ($ns->GetFile ($nsiorfile) == -1) {
+ print STDERR "ERROR: cannot retrieve file <$ns_nsiorfile>\n";
+ $NS->Kill (); $NS->TimedWait (1);
+ exit 1;
+}
+if ($nfs->PutFile ($nsiorfile) == -1) {
+ print STDERR "ERROR: cannot set file <$nfs_nsiorfile>\n";
+ $NS->Kill (); $NS->TimedWait (1);
+ exit 1;
+}
+if ($srv->PutFile ($nsiorfile) == -1) {
+ print STDERR "ERROR: cannot set file <$srv_nsiorfile>\n";
+ $NS->Kill (); $NS->TimedWait (1);
+ exit 1;
+}
+if ($con->PutFile ($nsiorfile) == -1) {
+ print STDERR "ERROR: cannot set file <$con_nsiorfile>\n";
+ $NS->Kill (); $NS->TimedWait (1);
exit 1;
}
# start Notification Service
+$NFS_status = $NFS->Spawn ();
-$NotifyService = "$ENV{TAO_ROOT}/orbsvcs/Notify_Service/Notify_Service";
-$NFS = new PerlACE::Process($NotifyService,
- "$arg_ns_ref -IORoutput $notify_ior " .
- "-ORBSvcConf notify.conf");
-$NFS->Spawn();
-# the ior file is only used to wait for the service to start
-if (PerlACE::waitforfile_timed ($notify_ior, 10) == -1) {
- print STDERR "ERROR: Timed out waiting for $notify_ior\n";
- $NS->Kill ();
- $NFS->Kill ();
- exit 1;
+if ($NFS_status != 0) {
+ print STDERR "ERROR: Notify Service returned $NFS_status\n";
+ exit 1;
+}
+
+if ($nfs->WaitForFileTimed ($nfsiorfile,$nfs->ProcessStartWaitInterval()) == -1) {
+ print STDERR "ERROR: cannot find file <$nfs_nfsiorfile>\n";
+ $NS->Kill (); $NS->TimedWait (1);
+ $NFS->Kill (); $NFS->TimedWait (1);
+ exit 1;
}
# start MessengerServer
-$S = new PerlACE::Process("MessengerServer",
- "$arg_ns_ref -ORBSvcConf nsclient.conf");
-$S->Spawn();
-
-# Wait for the MessengerServer
-if (PerlACE::waitforfile_timed ($messiorfile, 15) == -1) {
- print STDERR "ERROR: Timed out waiting for $messiorfile\n";
- $S->Kill();
- $NS->Kill ();
- $NFS->Kill ();
- exit 1;
+$SRV_status = $SRV->Spawn ();
+
+if ($SRV_status != 0) {
+ print STDERR "ERROR: Server returned $SRV_status\n";
+ exit 1;
+}
+
+if ($srv->WaitForFileTimed ($srviorfile,$srv->ProcessStartWaitInterval()) == -1) {
+ print STDERR "ERROR: cannot find file <$srv_srviorfile>\n";
+ $SRV->Kill (); $SRV->TimedWait (1);
+ $NS->Kill (); $NS->TimedWait (1);
+ $NFS->Kill (); $NFS->TimedWait (1);
+ exit 1;
}
+
+if ($srv->GetFile ($srviorfile) == -1) {
+ print STDERR "ERROR: cannot retrieve file <$srv_srviorfile>\n";
+ $SRV->Kill (); $SRV->TimedWait (1);
+ $NS->Kill (); $NS->TimedWait (1);
+ $NFS->Kill (); $NFS->TimedWait (1);
+ exit 1;
+}
+if ($cli->PutFile ($srviorfile) == -1) {
+ print STDERR "ERROR: cannot set file <$cli_srviorfile>\n";
+ $SRV->Kill (); $SRV->TimedWait (1);
+ $NS->Kill (); $NS->TimedWait (1);
+ $NFS->Kill (); $NFS->TimedWait (1);
+ exit 1;
+}
+
# start MessengerConsumer
-$MC = new PerlACE::Process("MessengerConsumer",
- "$arg_ns_ref -ORBSvcConf nsclient.conf");
-$MC->Spawn();
-if (PerlACE::waitforfile_timed ($consumerfile, 15) == -1) {
- print STDERR "ERROR: Timed out waiting for $consumerfile\n";
- $MC->Kill();
- $S->Kill();
- $NS->Kill();
- $NFS->Kill();
- exit 1;
+$CON_status = $CON->Spawn ();
+
+if ($CON_status != 0) {
+ print STDERR "ERROR: Consumer returned $CON_status\n";
+ exit 1;
+}
+
+if ($con->WaitForFileTimed ($confile,$con->ProcessStartWaitInterval()) == -1) {
+ print STDERR "ERROR: cannot find file <$con_confile>\n";
+ $CON->Kill (); $CON->TimedWait (1);
+ $SRV->Kill (); $SRV->TimedWait (1);
+ $NS->Kill (); $NS->TimedWait (1);
+ $NFS->Kill (); $NFS->TimedWait (1);
+ exit 1;
}
# start MessengerClient
-$C = new PerlACE::Process("MessengerClient", "");
-if ($C->SpawnWaitKill(10) != 0) {
- $MC->Kill();
- $S->Kill();
- $NFS->Kill();
- $NS->Kill();
- exit (1);
-}
-
-$MC->Kill();
-$S->Kill();
-$NFS->Kill();
-$NS->Kill();
-
-unlink $nsiorfile;
-unlink $messiorfile;
-unlink $notify_ior;
-unlink $consumerfile;
-
-exit 0;
+$CLI_status = $CLI->SpawnWaitKill ($cli->ProcessStartWaitInterval());
+
+if ($CLI_status != 0) {
+ print STDERR "ERROR: Messenger Client returned $CLI_status\n";
+ $CON->Kill (); $CON->TimedWait (1);
+ $SRV->Kill (); $SRV->TimedWait (1);
+ $NFS->Kill (); $NFS->TimedWait (1);
+ $NS->Kill (); $NS->TimedWait (1);
+ $status = 1;
+}
+
+$CON_status = $CON->TerminateWaitKill ($con->ProcessStopWaitInterval());
+
+if ($CON_status != 0) {
+ print STDERR "ERROR: Messenger Consumer returned $CON_status\n";
+ $status = 1;
+}
+
+$SRV_status = $SRV->TerminateWaitKill ($srv->ProcessStopWaitInterval());
+
+if ($SRV_status != 0) {
+ print STDERR "ERROR: Messenger Server returned $SRV_status\n";
+ $status = 1;
+}
+$NFS_status = $NFS->Kill ($nfs->ProcessStopWaitInterval());
+
+if ($NFS_status != 0) {
+ print STDERR "ERROR: Notification Service returned $NFS_status\n";
+ $status = 1;
+}
+
+$NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval());
+
+if ($NS_status != 0) {
+ print STDERR "ERROR: Name Service returned $NS_status\n";
+ $status = 1;
+}
+
+$ns->DeleteFile ($nsiorfile);
+$nfs->DeleteFile ($nsiorfile);
+$srv->DeleteFile ($nsiorfile);
+$con->DeleteFile ($nsiorfile);
+$nfs->DeleteFile ($nfsiorfile);
+$srv->DeleteFile ($srviorfile);
+$cli->DeleteFile ($srviorfile);
+$con->DeleteFile ($confile);
+
+exit $status;
diff --git a/TAO/orbsvcs/DevGuideExamples/NotifyService/SupplierSideNC/MessengerServer.cpp b/TAO/orbsvcs/DevGuideExamples/NotifyService/SupplierSideNC/MessengerServer.cpp
index f557611910b..48fa393279e 100644
--- a/TAO/orbsvcs/DevGuideExamples/NotifyService/SupplierSideNC/MessengerServer.cpp
+++ b/TAO/orbsvcs/DevGuideExamples/NotifyService/SupplierSideNC/MessengerServer.cpp
@@ -4,6 +4,31 @@
#include "Messenger_i.h"
#include <iostream>
#include <fstream>
+#include "ace/Get_Opt.h"
+
+const ACE_TCHAR *ior_output_file = ACE_TEXT ("Messenger.ior");
+
+int
+parse_args (int argc, ACE_TCHAR *argv[])
+{
+ ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("o:"));
+ int c;
+
+ while ((c = get_opts ()) != -1)
+ switch (c)
+ {
+ case 'o':
+ ior_output_file = get_opts.opt_arg ();
+ break;
+
+ case '?':
+ default:
+ ;
+ }
+ // Indicates sucessful parsing of the command line
+ return 0;
+}
+
int
ACE_TMAIN (int argc, ACE_TCHAR *argv [])
{
@@ -12,6 +37,9 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv [])
// Initialize orb
CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
+ if (parse_args (argc, argv) != 0)
+ return 1;
+
// Find the Naming Service.
CORBA::Object_var rootObj = orb->resolve_initial_references("NameService");
CosNaming::NamingContext_var rootNC =
@@ -41,10 +69,10 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv [])
rootNC->rebind(name, messenger_obj.in());
CORBA::String_var str = orb->object_to_string (messenger_obj.in());
- std::ofstream iorFile ("Messenger.ior");
+ std::ofstream iorFile (ACE_TEXT_ALWAYS_CHAR(ior_output_file));
iorFile << str.in () << std::endl;
iorFile.close ();
- std::cout << "IOR written to file Messenger.ior " << std::endl;
+ std::cout << "IOR written to file " << ior_output_file << std::endl;
// Accept requests
orb->run();
diff --git a/TAO/orbsvcs/DevGuideExamples/NotifyService/SupplierSideNC/run_test.pl b/TAO/orbsvcs/DevGuideExamples/NotifyService/SupplierSideNC/run_test.pl
index f0656a34a6c..45e2954e5d8 100755
--- a/TAO/orbsvcs/DevGuideExamples/NotifyService/SupplierSideNC/run_test.pl
+++ b/TAO/orbsvcs/DevGuideExamples/NotifyService/SupplierSideNC/run_test.pl
@@ -4,55 +4,140 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
& eval 'exec perl -S $0 $argv:q'
if 0;
-use Env (ACE_ROOT);
-use lib "$ACE_ROOT/bin";
-use PerlACE::Run_Test;
+use lib "$ENV{ACE_ROOT}/bin";
+use PerlACE::TestTarget;
-$nsiorfile = PerlACE::LocalFile("ns.ior");
-$messiorfile = PerlACE::LocalFile("Messenger.ior");
-$arg_ns_ref = "-ORBInitRef NameService=file://$nsiorfile";
-unlink $nsiorfile;
-unlink $messiorfile;
+$status = 0;
+$debug_level = '0';
+
+foreach $i (@ARGV) {
+ if ($i eq '-debug') {
+ $debug_level = '10';
+ }
+}
+
+my $ns = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
+my $srv = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
+my $con = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n";
+my $cli = PerlACE::TestTarget::create_target (4) || die "Create target 4 failed\n";
+
+$nsiorfile = "ns.ior";
+$srviorfile = "Messenger.ior";
+
+my $ns_nsiorfile = $ns->LocalFile ($nsiorfile);
+my $srv_nsiorfile = $srv->LocalFile ($nsiorfile);
+my $con_nsiorfile = $con->LocalFile ($nsiorfile);
+my $cli_nsiorfile = $cli->LocalFile ($nsiorfile);
+my $srv_srviorfile = $srv->LocalFile ($srviorfile);
+$ns->DeleteFile ($nsiorfile);
+$srv->DeleteFile ($nsiorfile);
+$con->DeleteFile ($nsiorfile);
+$cli->DeleteFile ($nsiorfile);
+$srv->DeleteFile ($srviorfile);
-# start Naming Service
$NameService = "$ENV{TAO_ROOT}/orbsvcs/Naming_Service/Naming_Service";
-$NS = new PerlACE::Process($NameService, "-o $nsiorfile");
-$NS->Spawn();
-if (PerlACE::waitforfile_timed ($nsiorfile, 10) == -1) {
- print STDERR "ERROR: cannot find file $nsiorfile\n";
- $NS->Kill();
+$NS = $ns->CreateProcess ($NameService, " -o $ns_nsiorfile");
+
+$SRV = $srv->CreateProcess ("MessengerServer", "-ORBdebuglevel $debug_level ".
+ "-o $srv_srviorfile ".
+ "-ORBInitRef NameService=file://$srv_nsiorfile");
+$CON = $con->CreateProcess ("MessengerConsumer", "-ORBInitRef NameService=file://$con_nsiorfile");
+$CLI = $cli->CreateProcess ("MessengerClient", "-ORBInitRef NameService=file://$cli_nsiorfile ");
+
+# start Naming Service
+$NS_status = $NS->Spawn ();
+
+if ($NS_status != 0) {
+ print STDERR "ERROR: Name Service returned $NS_status\n";
+ exit 1;
+}
+
+if ($ns->WaitForFileTimed ($nsiorfile,$ns->ProcessStartWaitInterval()) == -1) {
+ print STDERR "ERROR: cannot find file <$ns_nsiorfile>\n";
+ $NS->Kill (); $NS->TimedWait (1);
+ exit 1;
+}
+
+if ($ns->GetFile ($nsiorfile) == -1) {
+ print STDERR "ERROR: cannot retrieve file <$ns_nsiorfile>\n";
+ $NS->Kill (); $NS->TimedWait (1);
+ exit 1;
+}
+if ($srv->PutFile ($nsiorfile) == -1) {
+ print STDERR "ERROR: cannot set file <$srv_nsiorfile>\n";
+ $NS->Kill (); $NS->TimedWait (1);
+ exit 1;
+}
+if ($con->PutFile ($nsiorfile) == -1) {
+ print STDERR "ERROR: cannot set file <$con_nsiorfile>\n";
+ $NS->Kill (); $NS->TimedWait (1);
+ exit 1;
+}
+if ($cli->PutFile ($nsiorfile) == -1) {
+ print STDERR "ERROR: cannot set file <$cli_nsiorfile>\n";
+ $NS->Kill (); $NS->TimedWait (1);
exit 1;
}
# start MessengerServer
-$S = new PerlACE::Process("MessengerServer", $arg_ns_ref);
-$S->Spawn();
+$SRV_status = $SRV->Spawn ();
+
+if ($SRV_status != 0) {
+ print STDERR "ERROR: Server returned $SRV_status\n";
+ exit 1;
+}
-# Wait for the MessengerServer
-if (PerlACE::waitforfile_timed ($messiorfile, 10) == -1) {
- print STDERR "ERROR: Timed out waiting for $messiorfile\n";
- $S->Kill();
- $NS->Kill ();
- exit 1;
+if ($srv->WaitForFileTimed ($srviorfile,$srv->ProcessStartWaitInterval()) == -1) {
+ print STDERR "ERROR: cannot find file <$srv_srviorfile>\n";
+ $SRV->Kill (); $SRV->TimedWait (1);
+ $NS->Kill (); $NS->TimedWait (1);
+ exit 1;
}
+
# start MessengerConsumer
-$MC = new PerlACE::Process("MessengerConsumer", $arg_ns_ref);
-$MC->Spawn();
+$CON_status = $CON->Spawn ();
+
+if ($CON_status != 0) {
+ print STDERR "ERROR: Consumer returned $CON_status\n";
+ exit 1;
+}
# start MessengerClient
-$C = new PerlACE::Process("MessengerClient", $arg_ns_ref);
-if ($C->SpawnWaitKill(10) != 0) {
- $MC->Kill();
- $S->Kill();
- $NS->Kill();
- exit (1);
+$CLI_status = $CLI->SpawnWaitKill ($cli->ProcessStartWaitInterval());
+
+if ($CLI_status != 0) {
+ print STDERR "ERROR: Messenger Client returned $CLI_status\n";
+ $CON->Kill (); $CON->TimedWait (1);
+ $SRV->Kill (); $SRV->TimedWait (1);
+ $NS->Kill (); $NS->TimedWait (1);
+ $status = 1;
}
-$MC->Kill();
-$S->Kill();
-$NS->Kill();
+$CON_status = $CON->TerminateWaitKill ($con->ProcessStopWaitInterval());
+
+if ($CON_status != 0) {
+ print STDERR "ERROR: Messenger Consumer returned $CON_status\n";
+ $status = 1;
+}
+
+$SRV_status = $SRV->TerminateWaitKill ($srv->ProcessStopWaitInterval());
+
+if ($SRV_status != 0) {
+ print STDERR "ERROR: Messenger Server returned $SRV_status\n";
+ $status = 1;
+}
+
+$NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval());
+
+if ($NS_status != 0) {
+ print STDERR "ERROR: Name Service returned $NS_status\n";
+ $status = 1;
+}
-unlink $nsiorfile;
-unlink $messiorfile;
+$ns->DeleteFile ($nsiorfile);
+$srv->DeleteFile ($nsiorfile);
+$con->DeleteFile ($nsiorfile);
+$cli->DeleteFile ($nsiorfile);
+$srv->DeleteFile ($srviorfile);
-exit 0;
+exit $status;
diff --git a/TAO/orbsvcs/DevGuideExamples/PortableInterceptors/PICurrent_NameService/run_test.pl b/TAO/orbsvcs/DevGuideExamples/PortableInterceptors/PICurrent_NameService/run_test.pl
index 56c57b64a40..98129a9a765 100755
--- a/TAO/orbsvcs/DevGuideExamples/PortableInterceptors/PICurrent_NameService/run_test.pl
+++ b/TAO/orbsvcs/DevGuideExamples/PortableInterceptors/PICurrent_NameService/run_test.pl
@@ -4,44 +4,86 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
& eval 'exec perl -S $0 $argv:q'
if 0;
-use Env (ACE_ROOT);
-use lib "$ACE_ROOT/bin";
-use PerlACE::Run_Test;
+use lib "$ENV{ACE_ROOT}/bin";
+use PerlACE::TestTarget;
-$nsiorfile = PerlACE::LocalFile ("ns.ior");
-unlink $nsiorfile;
+$status = 0;
+$debug_level = '0';
+
+foreach $i (@ARGV) {
+ if ($i eq '-debug') {
+ $debug_level = '10';
+ }
+}
+
+my $ns = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
+my $srv = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n";
+my $cli = PerlACE::TestTarget::create_target (5) || die "Create target 5 failed\n";
+
+$nsiorfile = "ns.ior";
+
+my $ns_nsiorfile = $ns->LocalFile ($nsiorfile);
+$ns->DeleteFile ($nsiorfile);
+
+$hostname = $ns->HostName ();
$PORT=9876;
-# start Naming Service
$NameService = "$ENV{TAO_ROOT}/orbsvcs/Naming_Service/Naming_Service";
-$NS = new PerlACE::Process($NameService, "-o $nsiorfile -ORBListenEndpoints iiop://localhost:$PORT");
-$NS->Spawn();
-if (PerlACE::waitforfile_timed ($nsiorfile, $PerlACE::wait_interval_for_process_creation) == -1) {
- print STDERR "ERROR: cannot find file $nsiorfile\n";
- $NS->Kill();
+$NS = $ns->CreateProcess ($NameService, " -o $ns_nsiorfile ".
+ "-ORBListenEndpoints iiop://$hostname:$PORT");
+
+$SRV = $srv->CreateProcess ("MessengerServer", "-ORBdebuglevel $debug_level ".
+ "-ORBInitRef NameService=iioploc://$hostname:$PORT/NameService");
+
+$CLI = $cli->CreateProcess ("MessengerClient", "-ORBInitRef NameService=iioploc://$hostname:$PORT/NameService ");
+
+# start Naming Service
+$NS_status = $NS->Spawn ();
+
+if ($NS_status != 0) {
+ print STDERR "ERROR: Name Service returned $NS_status\n";
exit 1;
}
-# start MessengerServer
-$IREF = "-ORBInitRef NameService=iioploc://localhost:$PORT/NameService";
+if ($ns->WaitForFileTimed ($nsiorfile,$ns->ProcessStartWaitInterval()) == -1) {
+ print STDERR "ERROR: cannot find file <$ns_nsiorfile>\n";
+ $NS->Kill (); $NS->TimedWait (1);
+ exit 1;
+}
# start MessengerServer
-$S = new PerlACE::Process("MessengerServer", $IREF);
-$S->Spawn();
+$SRV_status = $SRV->Spawn ();
+
+if ($SRV_status != 0) {
+ print STDERR "ERROR: Server returned $SRV_status\n";
+ exit 1;
+}
# start MessengerClient
-$C = new PerlACE::Process("MessengerClient", $IREF);
-if ($C->SpawnWaitKill(15) != 0) {
- $S->Kill();
- $NS->Kill();
- exit(1);
+$CLI_status = $CLI->SpawnWaitKill ($cli->ProcessStartWaitInterval());
+
+if ($CLI_status != 0) {
+ print STDERR "ERROR: Messenger Client returned $CLI_status\n";
+ $SRV->Kill (); $SRV->TimedWait (1);
+ $NS->Kill (); $NS->TimedWait (1);
+ $status = 1;
}
+
# clean-up
+$SRV_status = $SRV->TerminateWaitKill ($srv->ProcessStopWaitInterval());
-$S->Kill();
-$NS->Kill();
+if ($SRV_status != 0) {
+ print STDERR "ERROR: Messenger Server returned $SRV_status\n";
+ $status = 1;
+}
-exit 0;
+$NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval());
+if ($NS_status != 0) {
+ print STDERR "ERROR: Name Service returned $NS_status\n";
+ $status = 1;
+}
+$ns->DeleteFile ($nsiorfile);
+exit $status;
diff --git a/TAO/orbsvcs/DevGuideExamples/Security/PolicyControllingApp/MessengerClient.cpp b/TAO/orbsvcs/DevGuideExamples/Security/PolicyControllingApp/MessengerClient.cpp
index d5ac902909d..585dbb67dd9 100644
--- a/TAO/orbsvcs/DevGuideExamples/Security/PolicyControllingApp/MessengerClient.cpp
+++ b/TAO/orbsvcs/DevGuideExamples/Security/PolicyControllingApp/MessengerClient.cpp
@@ -76,33 +76,39 @@
// static Resource_Factory "-ORBProtocolFactory SSLIOP_Factory"
//
+const ACE_TCHAR *ior = ACE_TEXT("file://Messenger.ior");
int which = 0;
int
parse_args (int argc, ACE_TCHAR *argv[])
{
- ACE_Get_Opt get_opts (argc, argv, "e:");
+ ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("e:k:"));
int c;
while ((c = get_opts ()) != -1)
switch (c)
{
+ case 'k':
+ ior = get_opts.opt_arg ();
+ break;
case 'e':
which = ACE_OS::atoi(get_opts.optarg);
if(which < 1 || 2 < which)
ACE_ERROR_RETURN ((LM_ERROR,
"Usage: %s "
- "-e [12]"
+ "-e [12] "
+ "-k <ior>"
"\n",
argv [0]),
-1);
break;
- case '?':
+ case '?':
default:
ACE_ERROR_RETURN ((LM_ERROR,
"Usage: %s "
- "-e [12]"
+ "-e [12] "
+ "-k <ior>"
"\n",
argv [0]),
-1);
@@ -119,14 +125,14 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[])
CORBA::ORB_var orb =
CORBA::ORB_init( argc, argv );
- CORBA::Object_var obj =
- orb->string_to_object( "file://Messenger.ior" );
-
if (parse_args (argc, argv) != 0)
return 1;
else if(which < 1 || 2 < which)
return 1;
+ CORBA::Object_var obj =
+ orb->string_to_object( ior );
+
Security::QOP qop;
CORBA::Any protection;
Security::EstablishTrust establish_trust;
diff --git a/TAO/orbsvcs/DevGuideExamples/Security/PolicyControllingApp/MessengerServer.cpp b/TAO/orbsvcs/DevGuideExamples/Security/PolicyControllingApp/MessengerServer.cpp
index 430cd575761..4bdbd816ed2 100644
--- a/TAO/orbsvcs/DevGuideExamples/Security/PolicyControllingApp/MessengerServer.cpp
+++ b/TAO/orbsvcs/DevGuideExamples/Security/PolicyControllingApp/MessengerServer.cpp
@@ -3,6 +3,30 @@
#include "Messenger_i.h"
#include <iostream>
#include <fstream>
+#include "ace/Get_Opt.h"
+
+const ACE_TCHAR *ior_output_file = ACE_TEXT ("Messenger.ior");
+
+int
+parse_args (int argc, ACE_TCHAR *argv[])
+{
+ ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("o:"));
+ int c;
+
+ while ((c = get_opts ()) != -1)
+ switch (c)
+ {
+ case 'o':
+ ior_output_file = get_opts.opt_arg ();
+ break;
+
+ case '?':
+ default:
+ ;
+ }
+ // Indicates sucessful parsing of the command line
+ return 0;
+}
int
ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
@@ -10,6 +34,9 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[])
// Initialize orb
CORBA::ORB_var orb = CORBA::ORB_init( argc, argv );
+ if (parse_args (argc, argv) != 0)
+ return 1;
+
//Get reference to Root POA
CORBA::Object_var obj = orb->resolve_initial_references( "RootPOA" );
PortableServer::POA_var poa = PortableServer::POA::_narrow( obj.in() );
@@ -27,10 +54,10 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[])
poa->activate_object( messenger_servant.in() );
CORBA::Object_var messenger_obj = poa->id_to_reference( oid.in() );
CORBA::String_var str = orb->object_to_string( messenger_obj.in() );
- std::ofstream iorFile( "Messenger.ior" );
+ std::ofstream iorFile( ACE_TEXT_ALWAYS_CHAR(ior_output_file) );
iorFile << str.in() << std::endl;
iorFile.close();
- std::cout << "IOR written to file Messenger.ior" << std::endl;
+ std::cout << "IOR written to file " << ior_output_file << std::endl;
// Accept requests
orb->run();
diff --git a/TAO/orbsvcs/DevGuideExamples/Security/PolicyControllingApp/run_test.pl b/TAO/orbsvcs/DevGuideExamples/Security/PolicyControllingApp/run_test.pl
index 1e1ac789af7..bb6201a9af4 100755
--- a/TAO/orbsvcs/DevGuideExamples/Security/PolicyControllingApp/run_test.pl
+++ b/TAO/orbsvcs/DevGuideExamples/Security/PolicyControllingApp/run_test.pl
@@ -4,66 +4,149 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
& eval 'exec perl -S $0 $argv:q'
if 0;
-use Env (ACE_ROOT);
-use lib "$ACE_ROOT/bin";
-use PerlACE::Run_Test;
+use lib "$ENV{ACE_ROOT}/bin";
+use PerlACE::TestTarget;
-$file = PerlACE::LocalFile("Messenger.ior");
+$status = 0;
+$debug_level = '0';
-unlink $file;
-
-$ENV{'SSL_CERT_FILE'} = 'cacert.pem';
-
-# start MessengerServer
-$S = new PerlACE::Process("MessengerServer",
- "-ORBSvcConf server.conf");
+foreach $i (@ARGV) {
+ if ($i eq '-debug') {
+ $debug_level = '10';
+ }
+}
-$S1 = new PerlACE::Process("MessengerServer",
- "-ORBSvcConf server1.conf");
+my $srv = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
+my $cli = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
+my $srv1 = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n";
+my $cli1 = PerlACE::TestTarget::create_target (4) || die "Create target 4 failed\n";
+
+$srviorfile = "Messenger.ior";
+$srvconf = "server.conf";
+$srv1conf = "server1.conf";
+$cliconf = "client.conf";
+$cli1conf = "client1.conf";
+
+my $srv_srviorfile = $srv->LocalFile ($srviorfile);
+my $cli_srviorfile = $cli->LocalFile ($srviorfile);
+my $srv1_srviorfile = $srv1->LocalFile ($srviorfile);
+my $cli1_srviorfile = $cli1->LocalFile ($srviorfile);
+my $srv_srvconf = $srv->LocalFile ($srvconf);
+my $srv_srv1conf = $srv->LocalFile ($srv1conf);
+my $cli_cliconf = $srv->LocalFile ($cliconf);
+my $cli_cli1conf = $srv->LocalFile ($cli1conf);
+$srv->DeleteFile ($srviorfile);
+$cli->DeleteFile ($srviorfile);
+$srv1->DeleteFile ($srviorfile);
+$cli1->DeleteFile ($srviorfile);
-$C = new PerlACE::Process("MessengerClient",
- "-e 1 -ORBSvcConf client.conf");
+$ENV{'SSL_CERT_FILE'} = 'cacert.pem';
-$C1 = new PerlACE::Process("MessengerClient",
- "-e 2 -ORBSvcConf client1.conf");
+$SRV = $srv->CreateProcess ("MessengerServer", "-ORBdebuglevel $debug_level ".
+ "-o $srv_srviorfile ".
+ "-ORBSvcConf $srv_srvconf");
+$SRV1 = $srv1->CreateProcess ("MessengerServer", "-ORBdebuglevel $debug_level ".
+ "-o $srv1_srviorfile ".
+ "-ORBSvcConf $srv_srv1conf");
+$CLI = $cli->CreateProcess ("MessengerClient", "-e 1 ".
+ "-k file://$cli_srviorfile ".
+ "-ORBSvcConf $cli_cliconf");
+$CLI1 = $cli1->CreateProcess ("MessengerClient", "-e 2 ".
+ "-k file://$cli1_srviorfile ".
+ "-ORBSvcConf $cli_cli1conf");
+# start MessengerServer
print STDERR "\n\nSecurity Policy Controlling Application Examples\n";
print STDERR "------------------------------------------------\n";
print STDERR "Starting Messenger Server, example 1...\n\n";
-$S->Spawn();
-if (PerlACE::waitforfile_timed ($file, 5) == -1) {
- print STDERR "ERROR: cannot find file <$file>\n";
- $SV->Kill ();
+$SRV_status = $SRV->Spawn ();
+
+if ($SRV_status != 0) {
+ print STDERR "ERROR: Server returned $SRV_status\n";
+ exit 1;
+}
+
+if ($srv->WaitForFileTimed ($srviorfile,$srv->ProcessStartWaitInterval()) == -1) {
+ print STDERR "ERROR: cannot find file <$srv_srviorfile>\n";
+ $SRV->Kill (); $SRV->TimedWait (1);
+ exit 1;
+}
+
+if ($srv->GetFile ($srviorfile) == -1) {
+ print STDERR "ERROR: cannot retrieve file <$srv_srviorfile>\n";
+ $SRV->Kill (); $SRV->TimedWait (1);
+ exit 1;
+}
+if ($cli->PutFile ($srviorfile) == -1) {
+ print STDERR "ERROR: cannot set file <$cli_srviorfile>\n";
+ $SRV->Kill (); $SRV->TimedWait (1);
exit 1;
}
print STDERR "\nStarting MessengerClient, example 1...\n\n";
-if ($C->SpawnWaitKill(10) != 0) {
- $S->Kill();
- exit (1);
+$CLI_status = $CLI->SpawnWaitKill ($cli->ProcessStartWaitInterval());
+
+if ($CLI_status != 0) {
+ print STDERR "ERROR: Messenger Client returned $CLI_status\n";
+ $SRV->Kill (); $SRV->TimedWait (1);
+ exit 1;
}
-unlink $file;
-$S->Kill();
+$SRV_status = $SRV->TerminateWaitKill ($srv->ProcessStopWaitInterval());
+
+if ($SRV_status != 0) {
+ print STDERR "ERROR: Messenger Server returned $SRV_status\n";
+ exit 1;
+}
+
+$srv->DeleteFile ($srviorfile);
+$cli->DeleteFile ($srviorfile);
+
print STDERR "\nStarting Messenger Server, example 2...\n\n";
-$S1->Spawn();
-if (PerlACE::waitforfile_timed ($file, 5) == -1) {
- print STDERR "ERROR: cannot find file <$file>\n";
- $SV->Kill ();
+$SRV_status = $SRV1->Spawn ();
+
+if ($SRV_status != 0) {
+ print STDERR "ERROR: Server returned $SRV_status\n";
+ exit 1;
+}
+
+if ($srv1->WaitForFileTimed ($srviorfile,$srv1->ProcessStartWaitInterval()) == -1) {
+ print STDERR "ERROR: cannot find file <$srv1_srviorfile>\n";
+ $SRV1->Kill (); $SRV1->TimedWait (1);
+ exit 1;
+}
+
+if ($srv1->GetFile ($srviorfile) == -1) {
+ print STDERR "ERROR: cannot retrieve file <$srv1_srviorfile>\n";
+ $SRV1->Kill (); $SRV1->TimedWait (1);
+ exit 1;
+}
+if ($cli1->PutFile ($srviorfile) == -1) {
+ print STDERR "ERROR: cannot set file <$cli1_srviorfile>\n";
+ $SRV1->Kill (); $SRV1->TimedWait (1);
exit 1;
}
print STDERR "\nStarting MessengerClient, example 2...\n\n";
-if ($C1->SpawnWaitKill(10) != 0) {
- $S->Kill();
- exit (1);
+$CLI_status = $CLI1->SpawnWaitKill ($cli1->ProcessStartWaitInterval());
+
+if ($CLI_status != 0) {
+ print STDERR "ERROR: Messenger Client returned $CLI_status\n";
+ $SRV1->Kill (); $SRV1->TimedWait (1);
+ $status = 1;
}
-# clean-up
-$S1->Kill();
+$SRV_status = $SRV1->TerminateWaitKill ($srv1->ProcessStopWaitInterval());
+
+if ($SRV_status != 0) {
+ print STDERR "ERROR: Messenger Server returned $SRV_status\n";
+ $status = 1;
+}
-exit 0;
+$srv1->DeleteFile ($srviorfile);
+$cli1->DeleteFile ($srviorfile);
+exit $status;
diff --git a/TAO/orbsvcs/DevGuideExamples/Security/SecurityUnawareApp/MessengerClient.cpp b/TAO/orbsvcs/DevGuideExamples/Security/SecurityUnawareApp/MessengerClient.cpp
index 76f812e7cff..a7ac2d75343 100644
--- a/TAO/orbsvcs/DevGuideExamples/Security/SecurityUnawareApp/MessengerClient.cpp
+++ b/TAO/orbsvcs/DevGuideExamples/Security/SecurityUnawareApp/MessengerClient.cpp
@@ -2,14 +2,47 @@
#include "MessengerC.h"
#include <iostream>
+#include "ace/Get_Opt.h"
+
+const ACE_TCHAR *ior = ACE_TEXT("file://Messenger.ior");
+
+int
+parse_args (int argc, ACE_TCHAR *argv[])
+{
+ ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:"));
+ int c;
+
+ while ((c = get_opts ()) != -1)
+ switch (c)
+ {
+ case 'k':
+ ior = get_opts.opt_arg ();
+ break;
+
+ case '?':
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "usage: %s "
+ "-k <ior> "
+ "\n",
+ argv [0]),
+ -1);
+ }
+ // Indicates successful parsing of the command line
+ return 0;
+}
+
int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
try {
// Initialize orb
CORBA::ORB_var orb = CORBA::ORB_init( argc, argv );
+ if (parse_args (argc, argv) != 0)
+ return 1;
+
// Destringify ior
- CORBA::Object_var obj = orb->string_to_object( "file://Messenger.ior" );
+ CORBA::Object_var obj = orb->string_to_object( ior );
if (CORBA::is_nil(obj.in())) {
std::cerr << "Nil Messenger reference" << std::endl;
return 1;
diff --git a/TAO/orbsvcs/DevGuideExamples/Security/SecurityUnawareApp/MessengerServer.cpp b/TAO/orbsvcs/DevGuideExamples/Security/SecurityUnawareApp/MessengerServer.cpp
index e0d7bfe827b..cb99ce025d7 100644
--- a/TAO/orbsvcs/DevGuideExamples/Security/SecurityUnawareApp/MessengerServer.cpp
+++ b/TAO/orbsvcs/DevGuideExamples/Security/SecurityUnawareApp/MessengerServer.cpp
@@ -3,6 +3,31 @@
#include "Messenger_i.h"
#include <iostream>
#include <fstream>
+#include "ace/Get_Opt.h"
+
+const ACE_TCHAR *ior_output_file = ACE_TEXT ("Messenger.ior");
+
+int
+parse_args (int argc, ACE_TCHAR *argv[])
+{
+ ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("o:"));
+ int c;
+
+ while ((c = get_opts ()) != -1)
+ switch (c)
+ {
+ case 'o':
+ ior_output_file = get_opts.opt_arg ();
+ break;
+
+ case '?':
+ default:
+ ;
+ }
+ // Indicates sucessful parsing of the command line
+ return 0;
+}
+
int
ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
@@ -10,6 +35,9 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[])
// Initialize orb
CORBA::ORB_var orb = CORBA::ORB_init( argc, argv );
+ if (parse_args (argc, argv) != 0)
+ return 1;
+
//Get reference to Root POA
CORBA::Object_var obj = orb->resolve_initial_references( "RootPOA" );
PortableServer::POA_var poa = PortableServer::POA::_narrow( obj.in() );
@@ -27,10 +55,10 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[])
poa->activate_object( messenger_servant.in() );
CORBA::Object_var messenger_obj = poa->id_to_reference( oid.in() );
CORBA::String_var str = orb->object_to_string( messenger_obj.in() );
- std::ofstream iorFile( "Messenger.ior" );
+ std::ofstream iorFile( ACE_TEXT_ALWAYS_CHAR(ior_output_file) );
iorFile << str.in() << std::endl;
iorFile.close();
- std::cout << "IOR written to file Messenger.ior" << std::endl;
+ std::cout << "IOR written to file "<< ior_output_file << std::endl;
// Accept requests
orb->run();
diff --git a/TAO/orbsvcs/DevGuideExamples/Security/SecurityUnawareApp/run_test.pl b/TAO/orbsvcs/DevGuideExamples/Security/SecurityUnawareApp/run_test.pl
index 0b3a2b0446e..1ccc9ab5cbf 100755
--- a/TAO/orbsvcs/DevGuideExamples/Security/SecurityUnawareApp/run_test.pl
+++ b/TAO/orbsvcs/DevGuideExamples/Security/SecurityUnawareApp/run_test.pl
@@ -4,61 +4,132 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
& eval 'exec perl -S $0 $argv:q'
if 0;
-use Env (ACE_ROOT);
-use lib "$ACE_ROOT/bin";
-use PerlACE::Run_Test;
+use lib "$ENV{ACE_ROOT}/bin";
+use PerlACE::TestTarget;
-$file = PerlACE::LocalFile("Messenger.ior");
+$status = 0;
+$debug_level = '0';
-unlink $file;
+foreach $i (@ARGV) {
+ if ($i eq '-debug') {
+ $debug_level = '10';
+ }
+}
+
+my $srv = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
+my $cli = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
+my $cli1 = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n";
+my $cli2 = PerlACE::TestTarget::create_target (4) || die "Create target 4 failed\n";
+
+$srviorfile = "Messenger.ior";
+$srvconf = "server.conf";
+$cliconf = "client.conf";
+$cli1conf = "client1.conf";
+
+my $srv_srviorfile = $srv->LocalFile ($srviorfile);
+my $cli_srviorfile = $cli->LocalFile ($srviorfile);
+my $cli1_srviorfile = $cli1->LocalFile ($srviorfile);
+my $cli2_srviorfile = $cli2->LocalFile ($srviorfile);
+my $srv_srvconf = $srv->LocalFile ($srvconf);
+my $cli_cliconf = $srv->LocalFile ($cliconf);
+my $cli_cli1conf = $srv->LocalFile ($cli1conf);
+$srv->DeleteFile ($srviorfile);
+$cli->DeleteFile ($srviorfile);
+$cli1->DeleteFile ($srviorfile);
+$cli2->DeleteFile ($srviorfile);
$ENV{'SSL_CERT_FILE'} = 'cacert.pem';
-# start MessengerServer
-$S = new PerlACE::Process("MessengerServer",
- "-ORBSvcConf server.conf");
+$SRV = $srv->CreateProcess ("MessengerServer", "-ORBdebuglevel $debug_level ".
+ "-o $srv_srviorfile ".
+ "-ORBSvcConf $srv_srvconf");
+$CLI = $cli->CreateProcess ("MessengerClient", "-k file://$cli_srviorfile ");
+$CLI1 = $cli1->CreateProcess ("MessengerClient", "-k file://$cli_srviorfile ".
+ "-ORBSvcConf $cli_cliconf");
+$CLI2 = $cli2->CreateProcess ("MessengerClient", "-k file://$cli1_srviorfile ".
+ "-ORBSvcConf $cli_cli1conf");
+# start MessengerServer
print STDERR "\n\nSecurity Unaware Application Examples\n";
print STDERR "-------------------------------------\n";
print STDERR "Starting Messenger Server...\n\n";
-$S->Spawn();
-if (PerlACE::waitforfile_timed ($file, 5) == -1) {
- print STDERR "ERROR: cannot find file <$file>\n";
- $SV->Kill ();
+$SRV_status = $SRV->Spawn ();
+
+if ($SRV_status != 0) {
+ print STDERR "ERROR: Server returned $SRV_status\n";
exit 1;
}
-# start MessengerClient
-$C = new PerlACE::Process("MessengerClient");
+if ($srv->WaitForFileTimed ($srviorfile,$srv->ProcessStartWaitInterval()) == -1) {
+ print STDERR "ERROR: cannot find file <$srv_srviorfile>\n";
+ $SRV->Kill (); $SRV->TimedWait (1);
+ exit 1;
+}
-$C1 = new PerlACE::Process("MessengerClient",
- "-ORBSvcConf client.conf");
+if ($srv->GetFile ($srviorfile) == -1) {
+ print STDERR "ERROR: cannot retrieve file <$srv_srviorfile>\n";
+ $SRV->Kill (); $SRV->TimedWait (1);
+ exit 1;
+}
+if ($cli->PutFile ($srviorfile) == -1) {
+ print STDERR "ERROR: cannot set file <$cli_srviorfile>\n";
+ $SRV->Kill (); $SRV->TimedWait (1);
+ exit 1;
+}
+if ($cli1->PutFile ($srviorfile) == -1) {
+ print STDERR "ERROR: cannot set file <$cli1_srviorfile>\n";
+ $SRV->Kill (); $SRV->TimedWait (1);
+ exit 1;
+}
+if ($cli2->PutFile ($srviorfile) == -1) {
+ print STDERR "ERROR: cannot set file <$cli2_srviorfile>\n";
+ $SRV->Kill (); $SRV->TimedWait (1);
+ exit 1;
+}
-$C2 = new PerlACE::Process("MessengerClient",
- "-ORBSvcConf client1.conf");
+# start MessengerClient
print STDERR "\nStarting MessengerClient, example 1...\n\n";
-if ($C->SpawnWaitKill(10) == 0) {
- $S->Kill();
- exit (1);
+$CLI_status = $CLI->SpawnWaitKill ($cli->ProcessStartWaitInterval());
+
+if ($CLI_status == 0) {
+ print STDERR "ERROR: Messenger Client returned $CLI_status\n";
+ $SRV->Kill (); $SRV->TimedWait (1);
+ $status = 1;
}
print STDERR "\nStarting MessengerClient, example 2...\n\n";
-if ($C1->SpawnWaitKill(10) != 0) {
- $S->Kill();
- exit (1);
+$CLI1_status = $CLI1->SpawnWaitKill ($cli1->ProcessStartWaitInterval());
+
+if ($CLI1_status != 0) {
+ print STDERR "ERROR: Messenger Client1 returned $CLI1_status\n";
+ $SRV->Kill (); $SRV->TimedWait (1);
+ $status = 1;
}
$ENV{'SSL_CERT_FILE'} = '';
print STDERR "\nStarting MessengerClient, example 3...\n\n";
-if ($C2->SpawnWaitKill(10) != 0) {
- $S->Kill();
- exit (1);
+$CLI2_status = $CLI2->SpawnWaitKill ($cli2->ProcessStartWaitInterval());
+
+if ($CLI2_status != 0) {
+ print STDERR "ERROR: Messenger Client2 returned $CLI2_status\n";
+ $SRV->Kill (); $SRV->TimedWait (1);
+ $status = 1;
}
# clean-up
-$S->Kill();
+$SRV_status = $SRV->TerminateWaitKill ($srv->ProcessStopWaitInterval());
+
+if ($SRV_status != 0) {
+ print STDERR "ERROR: Messenger Server returned $SRV_status\n";
+ exit 1;
+}
+
+$srv->DeleteFile ($srviorfile);
+$cli->DeleteFile ($srviorfile);
+$cli1->DeleteFile ($srviorfile);
+$cli2->DeleteFile ($srviorfile);
-exit 0;
+exit $status;
diff --git a/TAO/orbsvcs/DevGuideExamples/ValueTypes/Notify/consumer.cpp b/TAO/orbsvcs/DevGuideExamples/ValueTypes/Notify/consumer.cpp
index 099ad96ad48..c80e78b1ec9 100644
--- a/TAO/orbsvcs/DevGuideExamples/ValueTypes/Notify/consumer.cpp
+++ b/TAO/orbsvcs/DevGuideExamples/ValueTypes/Notify/consumer.cpp
@@ -3,7 +3,6 @@
// This supplier requires that the Notify_Service is started with
// -IOROutput notify.ior -channel -nonamesvc
// at minimum.
-const char* notify_ior = "corbaloc::localhost:8888/NotifyEventChannelFactory";
#include "Event_i.h"
@@ -16,8 +15,39 @@ const char* notify_ior = "corbaloc::localhost:8888/NotifyEventChannelFactory";
#include <iostream>
#include <stdexcept>
+#include "ace/Get_Opt.h"
-const char* ec_ior_output_file = "ec.ior";
+const ACE_TCHAR *ec_ior_output_file = ACE_TEXT ("ec.ior");
+const ACE_TCHAR *hostname = ACE_TEXT ("localhost");
+const ACE_TCHAR *port = ACE_TEXT("8888");
+//const char* notify_ior = "corbaloc::localhost:8888/NotifyEventChannelFactory";
+
+int
+parse_args (int argc, ACE_TCHAR *argv[])
+{
+ ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("o:h:p:"));
+ int c;
+
+ while ((c = get_opts ()) != -1)
+ switch (c)
+ {
+ case 'o':
+ ec_ior_output_file = get_opts.opt_arg ();
+ break;
+ case 'h':
+ hostname = get_opts.opt_arg ();
+ break;
+ case 'p':
+ port = get_opts.opt_arg ();
+ break;
+
+ case '?':
+ default:
+ ;
+ }
+ // Indicates sucessful parsing of the command line
+ return 0;
+}
class TestConsumer : public POA_CosEventComm::PushConsumer
{
@@ -135,6 +165,9 @@ int ACE_TMAIN (int ac, ACE_TCHAR* av[]) {
try {
CORBA::ORB_var orb = CORBA::ORB_init(ac, av);
+ if (parse_args (ac, av) != 0)
+ return 1;
+
CORBA::ValueFactoryBase_var factory = new MyEventFactory;
CORBA::String_var id = _tc_MyEvent->id();
orb->register_value_factory(id.in(), factory.in());
@@ -144,7 +177,14 @@ int ACE_TMAIN (int ac, ACE_TCHAR* av[]) {
PortableServer::POA::_unchecked_narrow(obj.in());
PortableServer::POAManager_var mgr = poa->the_POAManager();
- obj = orb->string_to_object(notify_ior);
+ // "corbaloc::localhost:8888/NotifyEventChannelFactory"
+ ACE_CString notify_ior ("corbaloc::");
+ notify_ior += ACE_TEXT_ALWAYS_CHAR (hostname);
+ notify_ior += ":";
+ notify_ior += ACE_TEXT_ALWAYS_CHAR (port);
+ notify_ior += "/NotifyEventChannelFactory";
+
+ obj = orb->string_to_object(notify_ior.c_str());
CosNotifyChannelAdmin::EventChannelFactory_var ecf
= CosNotifyChannelAdmin::EventChannelFactory::_unchecked_narrow(obj.in());
diff --git a/TAO/orbsvcs/DevGuideExamples/ValueTypes/Notify/run_test.pl b/TAO/orbsvcs/DevGuideExamples/ValueTypes/Notify/run_test.pl
index 285f3b3df0c..4f096515287 100755
--- a/TAO/orbsvcs/DevGuideExamples/ValueTypes/Notify/run_test.pl
+++ b/TAO/orbsvcs/DevGuideExamples/ValueTypes/Notify/run_test.pl
@@ -6,28 +6,58 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
# $Id$
# -*- perl -*-
-use Env(ACE_ROOT);
-use Env (TAO_ROOT);
-use lib "$ACE_ROOT/bin";
-use PerlACE::Run_Test;
-my $ec_ior = PerlACE::LocalFile ("ec.ior");
-my $notifyior = PerlACE::LocalFile ("notify.ior");
-my $notify_conf = PerlACE::LocalFile ("notify$PerlACE::svcconf_ext");
+use lib "$ENV{ACE_ROOT}/bin";
+use PerlACE::TestTarget;
-my $TS = new PerlACE::Process ("$TAO_ROOT/orbsvcs/Notify_Service/Notify_Service",
- "-boot -orblistenendpoints iiop://:8888 -NoNameSvc -IORoutput $notifyior -ORBSvcConf " .
- "$notify_conf");
-my $SUP = new PerlACE::Process ("supplier");
-my $CONS = new PerlACE::Process ("consumer");
+$status = 0;
+$debug_level = '0';
-unlink $ec_ior;
-unlink $notifyior;
+foreach $i (@ARGV) {
+ if ($i eq '-debug') {
+ $debug_level = '10';
+ }
+}
-$TS->Spawn ();
+my $nfs = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
+my $sup = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
+my $con = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n";
+
+$conf = $PerlACE::svcconf_ext;
+$hostname = $nfs->HostName();
+$port = "8888";
+
+my $eciorfile = "ec.ior";
+my $nfsiorfile = "notify.ior";
+my $nfsconf = "notify$conf";
+
+my $nfs_nfsiorfile = $nfs->LocalFile ($nfsiorfile);
+my $con_eciorfile = $con->LocalFile ($eciorfile);
+my $sup_eciorfile = $sup->LocalFile ($eciorfile);
+my $nfs_nfsconf = $nfs->LocalFile ($nfsconf);
+$nfs->DeleteFile ($nfsiorfile);
+$con->DeleteFile ($eciorfile);
+$sup->DeleteFile ($eciorfile);
+
+$NotifyService = "$ENV{TAO_ROOT}/orbsvcs/Notify_Service/Notify_Service";
+$NFS = $nfs->CreateProcess ($NotifyService, " -boot ".
+ "-orblistenendpoints iiop://:$port ".
+ "-NoNameSvc ".
+ "-IORoutput $nfs_nfsiorfile ".
+ "-ORBSvcConf $nfs_nfsconf");
+$SUP = $sup->CreateProcess ("supplier", "-k $sup_eciorfile -h $hostname -p $port");
+$CON = $con->CreateProcess ("consumer", "-o $con_eciorfile -h $hostname -p $port");
+
+$NFS_status = $NFS->Spawn ();
+
+if ($NFS_status != 0) {
+ print STDERR "ERROR: Notify Service returned $NFS_status\n";
+ exit 1;
+}
-if (PerlACE::waitforfile_timed ($notifyior, $PerlACE::wait_interval_for_process_creation) == -1) {
- $TS->Kill ();
+if ($nfs->WaitForFileTimed ($nfsiorfile,$nfs->ProcessStartWaitInterval()) == -1) {
+ print STDERR "ERROR: cannot find file <$nfs_nfsiorfile>\n";
+ $NFS->Kill (); $NFS->TimedWait (1);
exit 1;
}
@@ -36,17 +66,31 @@ print "****** Running consumer ******\n";
## The consumer takes one argument indicating
## how many events to receive before disconnecting.
-$CONS->Arguments("5");
-my $client = $CONS->Spawn();
-if ($client != 0) {
- $TS->Kill ();
- exit 1;
+$CON->Arguments("5");
+$CON_status = $CON->Spawn ();
+
+if ($CON_status != 0) {
+ print STDERR "ERROR: Consumer returned $CON_status\n";
+ exit 1;
+}
+
+if ($con->WaitForFileTimed ($eciorfile,$con->ProcessStartWaitInterval()+5) == -1) {
+ print STDERR "ERROR: cannot find file <$con_eciorfile>\n";
+ $CON->Kill (); $CON->TimedWait (1);
+ $NFS->Kill (); $NFS->TimedWait (1);
+ exit 1;
}
-## The supplier needs wait after the consumer creates the event channel.
-if (PerlACE::waitforfile_timed ($ec_ior, 20) == -1) {
- $TS->Kill ();
- $client->Kill ();
+if ($con->GetFile ($eciorfile) == -1) {
+ print STDERR "ERROR: cannot retrieve file <$con_eciorfile>\n";
+ $CON->Kill (); $CON->TimedWait (1);
+ $NFS->Kill (); $NFS->TimedWait (1);
+ exit 1;
+}
+if ($sup->PutFile ($eciorfile) == -1) {
+ print STDERR "ERROR: cannot set file <$sup_eciorfile>\n";
+ $CON->Kill (); $CON->TimedWait (1);
+ $NFS->Kill (); $NFS->TimedWait (1);
exit 1;
}
@@ -57,25 +101,31 @@ if (PerlACE::waitforfile_timed ($ec_ior, 20) == -1) {
print "****** Running supplier ******\n";
$SUP->Arguments("10 5");
-my $server = $SUP->Spawn();
-if ($server != 0) {
- $TS->Kill();
- $CONS->Kill();
- exit 1;
+$SUP_status = $SUP->Spawn ();
+
+if ($SUP_status != 0) {
+ print STDERR "ERROR: Supplier returned $SUP_status\n";
+ $status = 1;
}
-$CONS->WaitKill(30);
+$CON_status = $CON->WaitKill ($con->ProcessStopWaitInterval()+15);
+if ($CON_status != 0) {
+ print STDERR "ERROR: Consumer returned $CON_status\n";
+ $status = 1;
+}
+
+$SUP_status = $SUP->WaitKill ($sup->ProcessStopWaitInterval()+15);
-$server = $SUP->WaitKill(30);
-if ($server != 0) {
- $TS->Kill();
- $CONS->Kill();
- exit 1;
+if ($SUP_status != 0) {
+ print STDERR "ERROR: Supplier returned $SUP_status\n";
+ $status = 1;
}
-$TS->Kill ();
+$NFS->Kill (); $NFS->TimedWait (1);
+
+$nfs->DeleteFile ($nfsiorfile);
+$con->DeleteFile ($eciorfile);
+$sup->DeleteFile ($eciorfile);
-unlink $ec_ior;
-unlink $notifyior;
-exit 0;
+exit $status;
diff --git a/TAO/orbsvcs/DevGuideExamples/ValueTypes/Notify/supplier.cpp b/TAO/orbsvcs/DevGuideExamples/ValueTypes/Notify/supplier.cpp
index 97bbb208c9a..06759c263d5 100644
--- a/TAO/orbsvcs/DevGuideExamples/ValueTypes/Notify/supplier.cpp
+++ b/TAO/orbsvcs/DevGuideExamples/ValueTypes/Notify/supplier.cpp
@@ -3,7 +3,6 @@
// This supplier requires that the Notify_Service is started with
// -IOROutput notify.ior -channel -nonamesvc
// at minimum.
-const char* notify_ior = "corbaloc::localhost:8888/NotifyEventChannelFactory";
#include "Event_i.h"
@@ -18,13 +17,51 @@ const char* notify_ior = "corbaloc::localhost:8888/NotifyEventChannelFactory";
#include "ace/Event_Handler.h"
#include <iostream>
#include <stdexcept>
+#include "ace/Get_Opt.h"
+
+const ACE_TCHAR *ec_ior = ACE_TEXT("file://ec.ior");
+const ACE_TCHAR *hostname = ACE_TEXT("localhost");
+const ACE_TCHAR *port = ACE_TEXT("8888");
+//const char* notify_ior = "corbaloc::localhost:8888/NotifyEventChannelFactory";
+
+int
+parse_args (int argc, ACE_TCHAR *argv[])
+{
+ ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:h:p:"));
+ int c;
+
+ while ((c = get_opts ()) != -1)
+ switch (c)
+ {
+ case 'k':
+ ec_ior = get_opts.opt_arg ();
+ break;
+ case 'h':
+ hostname = get_opts.opt_arg ();
+ break;
+ case 'p':
+ port = get_opts.opt_arg ();
+ break;
+
+ case '?':
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "usage: %s "
+ "-k <ec_ior> "
+ "-h <host> "
+ "\n",
+ argv [0]),
+ -1);
+ }
+ // Indicates successful parsing of the command line
+ return 0;
+}
+
const ACE_Time_Value EVENT_DELAY(0, 10 * 1000);
static MyEvent_var event_;
-const char* ec_ior = "file://ec.ior";
-
class TestSupplier
: public POA_CosEventComm::PushSupplier
, public ACE_Event_Handler
@@ -159,6 +196,9 @@ int ACE_TMAIN (int ac, ACE_TCHAR* av[]) {
CORBA::ORB_var orb = CORBA::ORB_init(ac, av);
+ if (parse_args (ac, av) != 0)
+ return 1;
+
CORBA::ValueFactoryBase_var vfb = new MyEventFactory;
CORBA::String_var id = _tc_MyEvent->id();
orb->register_value_factory(id.in(), vfb);
@@ -167,8 +207,15 @@ int ACE_TMAIN (int ac, ACE_TCHAR* av[]) {
PortableServer::POA_var poa = PortableServer::POA::_narrow(obj.in());
PortableServer::POAManager_var mgr = poa->the_POAManager();
-
- obj = orb->string_to_object(notify_ior);
+
+ // "corbaloc::localhost:8888/NotifyEventChannelFactory"
+ ACE_CString notify_ior ("corbaloc::");
+ notify_ior += ACE_TEXT_ALWAYS_CHAR (hostname);
+ notify_ior += ":";
+ notify_ior += ACE_TEXT_ALWAYS_CHAR (port);
+ notify_ior += "/NotifyEventChannelFactory";
+
+ obj = orb->string_to_object(notify_ior.c_str());
CosNotifyChannelAdmin::EventChannelFactory_var ecf
= CosNotifyChannelAdmin::EventChannelFactory::_narrow(obj.in());
if (CORBA::is_nil(ecf.in()))