summaryrefslogtreecommitdiff
path: root/TAO/DevGuideExamples
diff options
context:
space:
mode:
authordbudko <dbudko@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2009-11-17 11:49:09 +0000
committerdbudko <dbudko@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2009-11-17 11:49:09 +0000
commitd7b8cd35b5db3469ba42125b6b020cf271351fce (patch)
tree15fb819ad66de214ff073b7e6e13809edcb1ab42 /TAO/DevGuideExamples
parent474b7a561c829553b7218c5b4680bbb396e60f54 (diff)
downloadATCD-d7b8cd35b5db3469ba42125b6b020cf271351fce.tar.gz
Tue Nov 17 11:45:03 UTC 2009 Denis Budko <denis.budko@remedy.nl>
* orbsvcs/DevGuideExamples/Security/ParticipatingApp/MessengerServer.cpp: * orbsvcs/DevGuideExamples/Security/ParticipatingApp/MessengerClient.cpp: * orbsvcs/DevGuideExamples/Security/ParticipatingApp/run_test.pl: * DevGuideExamples/Multithreading/Reactive/MessengerServer.cpp: * DevGuideExamples/Multithreading/Reactive/MessengerClient.cpp: * DevGuideExamples/Multithreading/Reactive/run_test.pl: * DevGuideExamples/ValueTypes/Messenger/MessengerServer.cpp: * DevGuideExamples/ValueTypes/Messenger/MessengerClient.cpp: * DevGuideExamples/ValueTypes/Messenger/run_test.pl: * DevGuideExamples/ValueTypes/Bank/server.cpp: * DevGuideExamples/ValueTypes/Bank/run_test.pl: * DevGuideExamples/ValueTypes/Bank/client.cpp: * DevGuideExamples/LocalObjects/ServantLocator/MessengerServer.cpp: * DevGuideExamples/LocalObjects/ServantLocator/run_test.pl: * DevGuideExamples/GettingStarted/MessengerServer.cpp: * DevGuideExamples/GettingStarted/MessengerClient.cpp: * DevGuideExamples/GettingStarted/run_test.pl: * DevGuideExamples/PortableInterceptors/Auth/MessengerServer.cpp: * DevGuideExamples/PortableInterceptors/Auth/MessengerClient.cpp: * DevGuideExamples/PortableInterceptors/Auth/run_test.pl: * DevGuideExamples/PortableInterceptors/SimpleCodec/MessengerServer.cpp: * DevGuideExamples/PortableInterceptors/SimpleCodec/MessengerClient.cpp: * DevGuideExamples/PortableInterceptors/SimpleCodec/run_test.pl: * DevGuideExamples/PortableInterceptors/IOR/MessengerServer.cpp: * DevGuideExamples/PortableInterceptors/IOR/MessengerClient.cpp: * DevGuideExamples/PortableInterceptors/IOR/run_test.pl: * DevGuideExamples/PortableInterceptors/PICurrent/MessengerServer.cpp: * DevGuideExamples/PortableInterceptors/PICurrent/MessengerClient.cpp: * DevGuideExamples/PortableInterceptors/PICurrent/run_test.pl: * DevGuideExamples/RTCORBA/MessengerServer.cpp: * DevGuideExamples/RTCORBA/run_test.pl: * DevGuideExamples/Messaging/AMIcallback/MessengerServer.cpp: * DevGuideExamples/Messaging/AMIcallback/MessengerClient.cpp: * DevGuideExamples/Messaging/AMIcallback/run_test.pl: * DevGuideExamples/Messaging/RelativeRoundtripTimeout/MessengerServer.cpp: * DevGuideExamples/Messaging/RelativeRoundtripTimeout/MessengerClient.cpp: * DevGuideExamples/Messaging/RelativeRoundtripTimeout/run_test.pl: * tests/OBV/Supports/client.cpp: * tests/OBV/Supports/server.cpp: * tests/OBV/Supports/run_test.pl: * tests/Bug_2683_Regression/run_test.pl: * tests/Exposed_Policies/run_test.pl: * bin/tao_other_tests.lst: * bin/tao_orb_tests.lst: * examples/PluggableUDP/tests/SimplePerformance/client.cpp: * examples/PluggableUDP/tests/SimplePerformance/run_test_ipv6.pl: * examples/PluggableUDP/tests/SimplePerformance/server.cpp: * examples/PluggableUDP/tests/SimplePerformance/run_test.pl: Tests are converted to use new test framework and added to fuzz build.
Diffstat (limited to 'TAO/DevGuideExamples')
-rw-r--r--TAO/DevGuideExamples/GettingStarted/MessengerClient.cpp34
-rw-r--r--TAO/DevGuideExamples/GettingStarted/MessengerServer.cpp36
-rwxr-xr-xTAO/DevGuideExamples/GettingStarted/run_test.pl82
-rw-r--r--TAO/DevGuideExamples/LocalObjects/ServantLocator/MessengerServer.cpp4
-rwxr-xr-xTAO/DevGuideExamples/LocalObjects/ServantLocator/run_test.pl14
-rw-r--r--TAO/DevGuideExamples/Messaging/AMIcallback/MessengerClient.cpp41
-rw-r--r--TAO/DevGuideExamples/Messaging/AMIcallback/MessengerServer.cpp64
-rwxr-xr-xTAO/DevGuideExamples/Messaging/AMIcallback/run_test.pl87
-rw-r--r--TAO/DevGuideExamples/Messaging/RelativeRoundtripTimeout/MessengerClient.cpp47
-rw-r--r--TAO/DevGuideExamples/Messaging/RelativeRoundtripTimeout/MessengerServer.cpp38
-rwxr-xr-xTAO/DevGuideExamples/Messaging/RelativeRoundtripTimeout/run_test.pl88
-rw-r--r--TAO/DevGuideExamples/Multithreading/Reactive/MessengerClient.cpp37
-rw-r--r--TAO/DevGuideExamples/Multithreading/Reactive/MessengerServer.cpp37
-rwxr-xr-xTAO/DevGuideExamples/Multithreading/Reactive/run_test.pl88
-rw-r--r--TAO/DevGuideExamples/PortableInterceptors/Auth/MessengerClient.cpp34
-rw-r--r--TAO/DevGuideExamples/PortableInterceptors/Auth/MessengerServer.cpp36
-rwxr-xr-xTAO/DevGuideExamples/PortableInterceptors/Auth/run_test.pl98
-rw-r--r--TAO/DevGuideExamples/PortableInterceptors/IOR/MessengerClient.cpp35
-rw-r--r--TAO/DevGuideExamples/PortableInterceptors/IOR/MessengerServer.cpp36
-rwxr-xr-xTAO/DevGuideExamples/PortableInterceptors/IOR/run_test.pl94
-rw-r--r--TAO/DevGuideExamples/PortableInterceptors/PICurrent/MessengerClient.cpp34
-rw-r--r--TAO/DevGuideExamples/PortableInterceptors/PICurrent/MessengerServer.cpp36
-rwxr-xr-xTAO/DevGuideExamples/PortableInterceptors/PICurrent/run_test.pl91
-rw-r--r--TAO/DevGuideExamples/PortableInterceptors/SimpleCodec/MessengerClient.cpp35
-rw-r--r--TAO/DevGuideExamples/PortableInterceptors/SimpleCodec/MessengerServer.cpp36
-rwxr-xr-xTAO/DevGuideExamples/PortableInterceptors/SimpleCodec/run_test.pl99
-rw-r--r--TAO/DevGuideExamples/RTCORBA/MessengerServer.cpp4
-rwxr-xr-xTAO/DevGuideExamples/RTCORBA/run_test.pl14
-rw-r--r--TAO/DevGuideExamples/ValueTypes/Bank/client.cpp40
-rwxr-xr-xTAO/DevGuideExamples/ValueTypes/Bank/run_test.pl87
-rw-r--r--TAO/DevGuideExamples/ValueTypes/Bank/server.cpp84
-rw-r--r--TAO/DevGuideExamples/ValueTypes/Messenger/MessengerClient.cpp36
-rw-r--r--TAO/DevGuideExamples/ValueTypes/Messenger/MessengerServer.cpp78
-rwxr-xr-xTAO/DevGuideExamples/ValueTypes/Messenger/run_test.pl87
34 files changed, 1400 insertions, 391 deletions
diff --git a/TAO/DevGuideExamples/GettingStarted/MessengerClient.cpp b/TAO/DevGuideExamples/GettingStarted/MessengerClient.cpp
index 2d52434b544..3f41a9b2e3b 100644
--- a/TAO/DevGuideExamples/GettingStarted/MessengerClient.cpp
+++ b/TAO/DevGuideExamples/GettingStarted/MessengerClient.cpp
@@ -4,6 +4,35 @@
#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[])
{
@@ -11,8 +40,11 @@ int ACE_TMAIN (int argc, ACE_TCHAR* argv[])
// Initialize the ORB.
CORBA::ORB_var orb = CORBA::ORB_init( argc, argv );
+ if (parse_args (argc, argv) != 0)
+ return 1;
+
// Read and destringify the Messenger object's 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 << "Could not get Messenger IOR." << std::endl;
return 1;
diff --git a/TAO/DevGuideExamples/GettingStarted/MessengerServer.cpp b/TAO/DevGuideExamples/GettingStarted/MessengerServer.cpp
index 3bc606378b9..15ee01f543d 100644
--- a/TAO/DevGuideExamples/GettingStarted/MessengerServer.cpp
+++ b/TAO/DevGuideExamples/GettingStarted/MessengerServer.cpp
@@ -5,6 +5,35 @@
#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:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "usage: %s "
+ "-o <iorfile>"
+ "\n",
+ argv [0]),
+ -1);
+ }
+ // Indicates sucessful parsing of the command line
+ return 0;
+}
int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
@@ -12,6 +41,9 @@ int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
// Initialize the ORB.
CORBA::ORB_var orb = CORBA::ORB_init( argc, argv );
+ if (parse_args (argc, argv) != 0)
+ return 1;
+
//Get reference to the RootPOA.
CORBA::Object_var obj = orb->resolve_initial_references( "RootPOA" );
PortableServer::POA_var poa = PortableServer::POA::_narrow( obj.in() );
@@ -28,10 +60,10 @@ int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
PortableServer::ObjectId_var oid = poa->activate_object( servant.in() );
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 " << ACE_TEXT_ALWAYS_CHAR(ior_output_file) << std::endl;
// Accept requests from clients.
orb->run();
diff --git a/TAO/DevGuideExamples/GettingStarted/run_test.pl b/TAO/DevGuideExamples/GettingStarted/run_test.pl
index 9f97271d6b7..bdc4548b9b4 100755
--- a/TAO/DevGuideExamples/GettingStarted/run_test.pl
+++ b/TAO/DevGuideExamples/GettingStarted/run_test.pl
@@ -1,46 +1,74 @@
+eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
+ & eval 'exec perl -S $0 $argv:q'
+ if 0;
+
# $Id$
+# -*- perl -*-
-eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
- & eval 'exec perl -S $0 $argv:q'
- if 0;
+use lib "$ENV{ACE_ROOT}/bin";
+use PerlACE::TestTarget;
-use Env (ACE_ROOT);
-use lib "$ACE_ROOT/bin";
-use PerlACE::Run_Test;
+$status = 0;
+$debug_level = '0';
-$ior = PerlACE::LocalFile ("Messenger.ior");
-unlink $ior;
+foreach $i (@ARGV) {
+ if ($i eq '-debug') {
+ $debug_level = '10';
+ }
+}
-# start MessengerServer
+my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
+my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
-$S = new PerlACE::Process("MessengerServer");
-$S->Spawn();
+my $iorbase = "Messenger.ior";
+my $server_iorfile = $server->LocalFile ($iorbase);
+my $client_iorfile = $client->LocalFile ($iorbase);
+$server->DeleteFile($iorbase);
+$client->DeleteFile($iorbase);
-if (PerlACE::waitforfile_timed ($ior, $PerlACE::wait_interval_for_process_creation) == -1) {
- print STDERR "ERROR: cannot find file <$ior>\n";
- $S->Kill();
- unlink $ior;
+$SV = $server->CreateProcess ("MessengerServer", "-ORBdebuglevel $debug_level -o $server_iorfile");
+$CL = $client->CreateProcess ("MessengerClient", "-k file://$client_iorfile");
+$server_status = $SV->Spawn ();
+
+if ($server_status != 0) {
+ print STDERR "ERROR: server returned $server_status\n";
exit 1;
}
-# start MessengerClient
-
-$C = new PerlACE::Process("MessengerClient");
-$C->Spawn();
+if ($server->WaitForFileTimed ($iorbase,
+ $server->ProcessStartWaitInterval()) == -1) {
+ print STDERR "ERROR: cannot find file <$server_iorfile>\n";
+ $SV->Kill (); $SV->TimedWait (1);
+ exit 1;
+}
-$CRET = $C->WaitKill(15);
-$S->Kill();
+if ($server->GetFile ($iorbase) == -1) {
+ print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n";
+ $SV->Kill (); $SV->TimedWait (1);
+ exit 1;
+}
-# clean-up
+if ($client->PutFile ($iorbase) == -1) {
+ print STDERR "ERROR: cannot set file <$client_iorfile>\n";
+ $SV->Kill (); $SV->TimedWait (1);
+ exit 1;
+}
-unlink $ior;
+$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval());
-if ($CRET != 0) {
- print STDERR "ERROR: Client returned <$CRET>\n";
- exit 1 ;
+if ($client_status != 0) {
+ print STDERR "ERROR: client returned $client_status\n";
+ $status = 1;
}
-exit 0;
+$server_status = $SV->Kill ();
+if ($server_status != 0) {
+ print STDERR "ERROR: server returned $server_status\n";
+ $status = 1;
+}
+$server->DeleteFile($iorbase);
+$client->DeleteFile($iorbase);
+exit $status;
diff --git a/TAO/DevGuideExamples/LocalObjects/ServantLocator/MessengerServer.cpp b/TAO/DevGuideExamples/LocalObjects/ServantLocator/MessengerServer.cpp
index 2d12bde6cd0..01f8018f71b 100644
--- a/TAO/DevGuideExamples/LocalObjects/ServantLocator/MessengerServer.cpp
+++ b/TAO/DevGuideExamples/LocalObjects/ServantLocator/MessengerServer.cpp
@@ -86,11 +86,11 @@ int ACE_TMAIN (int argc, ACE_TCHAR *argv [])
CORBA::String_var str = orb->object_to_string(messenger_obj.in());
// Write the IOR string to a file
- std::ofstream iorFile(ior_output_file); // Throws exception if there's a problem.
+ std::ofstream iorFile(ACE_TEXT_ALWAYS_CHAR(ior_output_file)); // Throws exception if there's a problem.
iorFile << str.in();
iorFile.close();
- std::cout << "IOR written to the file " << ior_output_file << std::endl;
+ std::cout << "IOR written to the file " << ACE_TEXT_ALWAYS_CHAR(ior_output_file) << std::endl;
// Accept requests from clients.
orb->run();
diff --git a/TAO/DevGuideExamples/LocalObjects/ServantLocator/run_test.pl b/TAO/DevGuideExamples/LocalObjects/ServantLocator/run_test.pl
index da138171543..4936c559c31 100755
--- a/TAO/DevGuideExamples/LocalObjects/ServantLocator/run_test.pl
+++ b/TAO/DevGuideExamples/LocalObjects/ServantLocator/run_test.pl
@@ -43,6 +43,18 @@ if ($server->WaitForFileTimed ($iorbase,
exit 1;
}
+if ($server->GetFile ($iorbase) == -1) {
+ print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n";
+ $SV->Kill (); $SV->TimedWait (1);
+ exit 1;
+}
+
+if ($client->PutFile ($iorbase) == -1) {
+ print STDERR "ERROR: cannot set file <$client_iorfile>\n";
+ $SV->Kill (); $SV->TimedWait (1);
+ exit 1;
+}
+
$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval());
if ($client_status != 0) {
@@ -50,7 +62,7 @@ if ($client_status != 0) {
$status = 1;
}
-$server_status = $SV->WaitKill ($server->ProcessStopWaitInterval());
+$server_status = $SV->Kill ();
if ($server_status != 0) {
print STDERR "ERROR: server returned $server_status\n";
diff --git a/TAO/DevGuideExamples/Messaging/AMIcallback/MessengerClient.cpp b/TAO/DevGuideExamples/Messaging/AMIcallback/MessengerClient.cpp
index a94421ea765..9ede1f8097b 100644
--- a/TAO/DevGuideExamples/Messaging/AMIcallback/MessengerClient.cpp
+++ b/TAO/DevGuideExamples/Messaging/AMIcallback/MessengerClient.cpp
@@ -7,21 +7,52 @@
#include "ace/OS_NS_unistd.h"
#include "ace/OS_NS_sys_time.h"
#include <iostream>
+#include "ace/Get_Opt.h"
-//-----------------------------------------------------------------------------
+const ACE_TCHAR *ior = ACE_TEXT ("file://MessengerServer.ior");
+bool automated = false;
+
+int
+parse_args (int argc, ACE_TCHAR *argv[])
+{
+ ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:a:"));
+ int c;
+
+ while ((c = get_opts ()) != -1)
+ switch (c)
+ {
+ case 'k':
+ ior = get_opts.opt_arg ();
+ break;
+ case 'a':
+ automated = !(ACE_OS::atoi(get_opts.opt_arg ()) == 0);
+ break;
+ case '?':
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "usage: %s"
+ " -k <ior>"
+ " -a <automated>"
+ "\n",
+ argv [0]),
+ -1);
+ }
+ // Indicates successful parsing of the command line
+ return 0;
+}
int
ACE_TMAIN (int argc, ACE_TCHAR *argv [])
{
try {
- // assume any command line parameter means we want an automated test.
- bool automated = argc > 1;
-
// Initialize orb
CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
- CORBA::Object_var obj = orb->string_to_object("file://MessengerServer.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/DevGuideExamples/Messaging/AMIcallback/MessengerServer.cpp b/TAO/DevGuideExamples/Messaging/AMIcallback/MessengerServer.cpp
index 7929c8c8de1..9dc1a81ebdf 100644
--- a/TAO/DevGuideExamples/Messaging/AMIcallback/MessengerServer.cpp
+++ b/TAO/DevGuideExamples/Messaging/AMIcallback/MessengerServer.cpp
@@ -4,34 +4,58 @@
#include <fstream>
#include <iostream>
#include <fstream>
+#include "ace/Get_Opt.h"
+
+const ACE_TCHAR *ior_output_file = ACE_TEXT ("MessengerServer.ior");
+unsigned int seconds_to_wait = 0;
+CORBA::Boolean servant_throws_exception = false;
int
-ACE_TMAIN (int argc, ACE_TCHAR *argv [])
+parse_args (int argc, ACE_TCHAR *argv[])
{
- try {
- // Initialize orb
- CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
+ ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("o:e:t:"));
+ int c;
- // Set a wait time to an integer if it has been passed as a
- // command line argument. Otherwise, have
- // Messenger_i::send_message() throw an exception if e
- // has been passed as the command lin argument.
- unsigned int seconds_to_wait = 0;
- CORBA::Boolean servant_throws_exception = false;
- if (argc == 2)
- {
- if (argv[1][0] == 'e')
+ while ((c = get_opts ()) != -1)
+ switch (c)
{
+ case 'o':
+ ior_output_file = get_opts.opt_arg ();
+ break;
+ case 'e':
servant_throws_exception = true;
std::cout << "Messenger_i::send_message() will throw an exception." << std::endl;
- }
- else
- {
- seconds_to_wait = ACE_OS::atoi(argv[1]);
+ break;
+ case 't':
+ seconds_to_wait = ACE_OS::atoi(get_opts.opt_arg ());
std::cout << "Messenger_i::send_message() will wait "
<< seconds_to_wait << " seconds" << std::endl;
+ break;
+ case '?':
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "usage: %s"
+ " -o <iorfile>"
+ " -e"
+ " -t <seconds_to_wait>"
+ "\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");
@@ -50,10 +74,10 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv [])
obj = poa->id_to_reference(oid.in());
Messenger_var messenger = Messenger::_narrow(obj.in());
CORBA::String_var str = orb->object_to_string(messenger.in());
- std::ofstream fout("MessengerServer.ior");
+ std::ofstream fout(ACE_TEXT_ALWAYS_CHAR(ior_output_file));
fout << str.in() << std::endl;
fout.close();
- std::cout << "IOR written to file MessengerServer.ior" << std::endl;
+ std::cout << "IOR written to file " << ACE_TEXT_ALWAYS_CHAR(ior_output_file) << std::endl;
// Accept requests
orb->run();
diff --git a/TAO/DevGuideExamples/Messaging/AMIcallback/run_test.pl b/TAO/DevGuideExamples/Messaging/AMIcallback/run_test.pl
index 47d474c4f5d..b1e9d721a76 100755
--- a/TAO/DevGuideExamples/Messaging/AMIcallback/run_test.pl
+++ b/TAO/DevGuideExamples/Messaging/AMIcallback/run_test.pl
@@ -1,39 +1,74 @@
+eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
+ & eval 'exec perl -S $0 $argv:q'
+ if 0;
+
# $Id$
+# -*- perl -*-
-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;
-
-$ior="MessengerServer.ior";
-unlink $ior;
-
-# start MessengerServer
-$S = new PerlACE::Process("MessengerServer");
-$S->Spawn();
-if (PerlACE::waitforfile_timed ($ior, $PerlACE::wait_interval_for_process_creation) == -1) {
- print STDERR "ERROR: cannot find file $ior\n";
- $S->Kill();
+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 $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
+my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
+
+my $iorbase = "MessengerServer.ior";
+my $server_iorfile = $server->LocalFile ($iorbase);
+my $client_iorfile = $client->LocalFile ($iorbase);
+$server->DeleteFile($iorbase);
+$client->DeleteFile($iorbase);
+
+$SV = $server->CreateProcess ("MessengerServer", "-ORBdebuglevel $debug_level -o $server_iorfile");
+$CL = $client->CreateProcess ("MessengerClient", "-k file://$client_iorfile -a 1");
+$server_status = $SV->Spawn ();
+
+if ($server_status != 0) {
+ print STDERR "ERROR: server returned $server_status\n";
exit 1;
}
+if ($server->WaitForFileTimed ($iorbase,
+ $server->ProcessStartWaitInterval()) == -1) {
+ print STDERR "ERROR: cannot find file <$server_iorfile>\n";
+ $SV->Kill (); $SV->TimedWait (1);
+ exit 1;
+}
-# start MessengerClient
-$C = new PerlACE::Process("MessengerClient", "-automated");
+if ($server->GetFile ($iorbase) == -1) {
+ print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n";
+ $SV->Kill (); $SV->TimedWait (1);
+ exit 1;
+}
-if ($C->SpawnWaitKill(15) != 0) {
- $S->Kill();
- exit (1);
+if ($client->PutFile ($iorbase) == -1) {
+ print STDERR "ERROR: cannot set file <$client_iorfile>\n";
+ $SV->Kill (); $SV->TimedWait (1);
+ exit 1;
}
-# clean-up
-$S->Kill();
-unlink $ior;
+$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval());
+
+if ($client_status != 0) {
+ print STDERR "ERROR: client returned $client_status\n";
+ $status = 1;
+}
-exit 0;
+$server_status = $SV->Kill ();
+if ($server_status != 0) {
+ print STDERR "ERROR: server returned $server_status\n";
+ $status = 1;
+}
+$server->DeleteFile($iorbase);
+$client->DeleteFile($iorbase);
+exit $status;
diff --git a/TAO/DevGuideExamples/Messaging/RelativeRoundtripTimeout/MessengerClient.cpp b/TAO/DevGuideExamples/Messaging/RelativeRoundtripTimeout/MessengerClient.cpp
index ce7f6f0019c..a4f9437effa 100644
--- a/TAO/DevGuideExamples/Messaging/RelativeRoundtripTimeout/MessengerClient.cpp
+++ b/TAO/DevGuideExamples/Messaging/RelativeRoundtripTimeout/MessengerClient.cpp
@@ -4,13 +4,50 @@
#include "tao/TimeBaseC.h"
#include "tao/Messaging/Messaging.h"
#include <iostream>
+#include "ace/Get_Opt.h"
+
+const ACE_TCHAR *ior = ACE_TEXT ("file://MessengerServer.ior");
+long msecs = 0; // the RelativeRoundtripTimeout value
+
+int
+parse_args (int argc, ACE_TCHAR *argv[])
+{
+ ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:t:"));
+ int c;
+
+ while ((c = get_opts ()) != -1)
+ switch (c)
+ {
+ case 'k':
+ ior = get_opts.opt_arg ();
+ break;
+ case 't':
+ msecs = ACE_OS::atoi(get_opts.opt_arg ());
+ break;
+ case '?':
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "usage: %s "
+ "-k <ior> "
+ "-t <msec> "
+ "\n",
+ argv [0]),
+ -1);
+ }
+ // Indicates successful parsing of the command line
+ return 0;
+}
+
int ACE_TMAIN(int argc, ACE_TCHAR * argv[])
{
try {
CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
- CORBA::Object_var obj = orb->string_to_object("file://MessengerServer.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;
@@ -25,15 +62,11 @@ int ACE_TMAIN(int argc, ACE_TCHAR * argv[])
CORBA::PolicyCurrent_var policy_current = CORBA::PolicyCurrent::_narrow (obj.in());
ACE_ASSERT(! CORBA::is_nil(policy_current.in()));
- // Set the RelativeRoundtripTimeout value
- long msecs = 0;
- if (argc > 1) {
- msecs = ACE_OS::atoi(argv[1]);
- } else {
+ // TimeT is in 10ths of a microsecond (10000 == 1.0e-3 * 1.0e7).
+ if (msecs <= 0) {
std::cout << "Enter relative roundtrip timeout in milliseconds -->";
std::cin >> msecs;
}
- // TimeT is in 10ths of a microsecond (10000 == 1.0e-3 * 1.0e7).
TimeBase::TimeT relative_rt_timeout = msecs * 10000;
CORBA::Any relative_rt_timeout_as_any;
diff --git a/TAO/DevGuideExamples/Messaging/RelativeRoundtripTimeout/MessengerServer.cpp b/TAO/DevGuideExamples/Messaging/RelativeRoundtripTimeout/MessengerServer.cpp
index dcec42b2b61..c9162bf77d2 100644
--- a/TAO/DevGuideExamples/Messaging/RelativeRoundtripTimeout/MessengerServer.cpp
+++ b/TAO/DevGuideExamples/Messaging/RelativeRoundtripTimeout/MessengerServer.cpp
@@ -3,12 +3,46 @@
#include "Messenger_i.h"
#include <iostream>
#include <fstream>
+#include "ace/Get_Opt.h"
+
+const ACE_TCHAR *ior_output_file = ACE_TEXT ("MessengerServer.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:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "usage: %s "
+ "-o <iorfile>"
+ "\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());
@@ -26,10 +60,10 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv [])
obj = poa->id_to_reference(oid.in());
Messenger_var messenger = Messenger::_narrow(obj.in());
CORBA::String_var str = orb->object_to_string(messenger.in());
- std::ofstream fout("MessengerServer.ior");
+ std::ofstream fout(ACE_TEXT_ALWAYS_CHAR(ior_output_file));
fout << str.in() << std::endl;
fout.close();
- std::cout << "IOR written to file MessengerServer.ior" << std::endl;
+ std::cout << "IOR written to file " << ACE_TEXT_ALWAYS_CHAR(ior_output_file) << std::endl;
// Accept requests
orb->run();
diff --git a/TAO/DevGuideExamples/Messaging/RelativeRoundtripTimeout/run_test.pl b/TAO/DevGuideExamples/Messaging/RelativeRoundtripTimeout/run_test.pl
index 313b53e48ad..385085ed030 100755
--- a/TAO/DevGuideExamples/Messaging/RelativeRoundtripTimeout/run_test.pl
+++ b/TAO/DevGuideExamples/Messaging/RelativeRoundtripTimeout/run_test.pl
@@ -1,39 +1,75 @@
+eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
+ & eval 'exec perl -S $0 $argv:q'
+ if 0;
+
# $Id$
+# -*- perl -*-
-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;
-
-$ior="MessengerServer.ior";
-unlink $ior;
-
-# start MessengerServer
-$S = new PerlACE::Process("MessengerServer");
-$S->Spawn();
-if (PerlACE::waitforfile_timed ($ior, $PerlACE::wait_interval_for_process_creation) == -1) {
- print STDERR "ERROR: cannot find file $ior\n";
- $S->Kill();
+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 $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
+my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
+
+my $iorbase = "MessengerServer.ior";
+my $server_iorfile = $server->LocalFile ($iorbase);
+my $client_iorfile = $client->LocalFile ($iorbase);
+my $client_timeout_msec = 20;
+$server->DeleteFile($iorbase);
+$client->DeleteFile($iorbase);
+
+$SV = $server->CreateProcess ("MessengerServer", "-ORBdebuglevel $debug_level -o $server_iorfile");
+$CL = $client->CreateProcess ("MessengerClient", "-k file://$client_iorfile -t $client_timeout_msec");
+$server_status = $SV->Spawn ();
+
+if ($server_status != 0) {
+ print STDERR "ERROR: server returned $server_status\n";
exit 1;
}
+if ($server->WaitForFileTimed ($iorbase,
+ $server->ProcessStartWaitInterval()) == -1) {
+ print STDERR "ERROR: cannot find file <$server_iorfile>\n";
+ $SV->Kill (); $SV->TimedWait (1);
+ exit 1;
+}
-# start MessengerClient
-$C = new PerlACE::Process("MessengerClient", "20");
+if ($server->GetFile ($iorbase) == -1) {
+ print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n";
+ $SV->Kill (); $SV->TimedWait (1);
+ exit 1;
+}
-if ($C->SpawnWaitKill(10) != 0) {
- $S->Kill();
- exit (1);
+if ($client->PutFile ($iorbase) == -1) {
+ print STDERR "ERROR: cannot set file <$client_iorfile>\n";
+ $SV->Kill (); $SV->TimedWait (1);
+ exit 1;
}
-# clean-up
-$S->Kill();
-unlink $ior;
+$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval());
+
+if ($client_status != 0) {
+ print STDERR "ERROR: client returned $client_status\n";
+ $status = 1;
+}
-exit 0;
+$server_status = $SV->Kill ();
+if ($server_status != 0) {
+ print STDERR "ERROR: server returned $server_status\n";
+ $status = 1;
+}
+$server->DeleteFile($iorbase);
+$client->DeleteFile($iorbase);
+exit $status;
diff --git a/TAO/DevGuideExamples/Multithreading/Reactive/MessengerClient.cpp b/TAO/DevGuideExamples/Multithreading/Reactive/MessengerClient.cpp
index 1e24fd500ef..124a3dcffdb 100644
--- a/TAO/DevGuideExamples/Multithreading/Reactive/MessengerClient.cpp
+++ b/TAO/DevGuideExamples/Multithreading/Reactive/MessengerClient.cpp
@@ -2,14 +2,49 @@
#include "MessengerC.h"
#include <iostream>
+#include "ace/Get_Opt.h"
+
+ACE_RCSID(Hello, client, "$Id$")
+
+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 the ORB.
CORBA::ORB_var orb = CORBA::ORB_init( argc, argv );
+ if (parse_args (argc, argv) != 0)
+ return 1;
+
// Read and destringify the Messenger object's 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 << "Could not get Messenger IOR." << std::endl;
return 1;
diff --git a/TAO/DevGuideExamples/Multithreading/Reactive/MessengerServer.cpp b/TAO/DevGuideExamples/Multithreading/Reactive/MessengerServer.cpp
index 5dc50c06521..8b300719e91 100644
--- a/TAO/DevGuideExamples/Multithreading/Reactive/MessengerServer.cpp
+++ b/TAO/DevGuideExamples/Multithreading/Reactive/MessengerServer.cpp
@@ -3,12 +3,45 @@
#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:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "usage: %s "
+ "-o <iorfile>"
+ "\n",
+ argv [0]),
+ -1);
+ }
+ // Indicates sucessful parsing of the command line
+ return 0;
+}
+
int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
try {
// Initialize the ORB.
CORBA::ORB_var orb = CORBA::ORB_init( argc, argv );
+ if (parse_args (argc, argv) != 0)
+ return 1;
+
//Get reference to the RootPOA.
CORBA::Object_var obj = orb->resolve_initial_references( "RootPOA" );
PortableServer::POA_var poa = PortableServer::POA::_narrow( obj.in() );
@@ -26,10 +59,10 @@ int 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 " << ACE_TEXT_ALWAYS_CHAR(ior_output_file) << std::endl;
// Accept requests from clients.
orb->run();
diff --git a/TAO/DevGuideExamples/Multithreading/Reactive/run_test.pl b/TAO/DevGuideExamples/Multithreading/Reactive/run_test.pl
index fb47fe48665..5ba202b6a1e 100755
--- a/TAO/DevGuideExamples/Multithreading/Reactive/run_test.pl
+++ b/TAO/DevGuideExamples/Multithreading/Reactive/run_test.pl
@@ -1,46 +1,78 @@
+eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
+ & eval 'exec perl -S $0 $argv:q'
+ if 0;
+
# $Id$
+# -*- perl -*-
-eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
- & eval 'exec perl -S $0 $argv:q'
- if 0;
+use lib "$ENV{ACE_ROOT}/bin";
+use PerlACE::TestTarget;
+
+$status = 0;
+$debug_level = '0';
-use Env (ACE_ROOT);
-use lib "$ACE_ROOT/bin";
-use PerlACE::Run_Test;
+foreach $i (@ARGV) {
+ if ($i eq '-debug') {
+ $debug_level = '10';
+ }
+}
+
+my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
+my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
-$ior = PerlACE::LocalFile ("Messenger.ior");
-unlink $ior;
+my $iorbase = "Messenger.ior";
+my $hostname = $server->HostName();
+my $server_iorfile = $server->LocalFile ($iorbase);
+my $client_iorfile = $client->LocalFile ($iorbase);
+$server->DeleteFile($iorbase);
+$client->DeleteFile($iorbase);
-# start MessengerServer
+$SV = $server->CreateProcess ("MessengerServer", "-ORBdebuglevel $debug_level ".
+ "-o $server_iorfile ".
+ "-ORBListenEndpoints iiop://$hostname");
+$CL = $client->CreateProcess ("MessengerClient", "-k file://$client_iorfile");
-$S = new PerlACE::Process("MessengerServer", "-ORBListenEndpoints iiop://localhost");
-$S->Spawn();
+$server_status = $SV->Spawn ();
-if (PerlACE::waitforfile_timed ($ior, $PerlACE::wait_interval_for_process_creation) == -1) {
- print STDERR "ERROR: cannot find file <$ior>\n";
- $S->Kill();
- unlink $ior;
+if ($server_status != 0) {
+ print STDERR "ERROR: server returned $server_status\n";
exit 1;
}
-# start MessengerClient
-
-$C = new PerlACE::Process("MessengerClient");
-$C->Spawn();
+if ($server->WaitForFileTimed ($iorbase,
+ $server->ProcessStartWaitInterval()) == -1) {
+ print STDERR "ERROR: cannot find file <$server_iorfile>\n";
+ $SV->Kill (); $SV->TimedWait (1);
+ exit 1;
+}
-$CRET = $C->WaitKill(15);
-$S->Kill();
+if ($server->GetFile ($iorbase) == -1) {
+ print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n";
+ $SV->Kill (); $SV->TimedWait (1);
+ exit 1;
+}
-# clean-up
+if ($client->PutFile ($iorbase) == -1) {
+ print STDERR "ERROR: cannot set file <$client_iorfile>\n";
+ $SV->Kill (); $SV->TimedWait (1);
+ exit 1;
+}
-unlink $ior;
+$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval());
-if ($CRET != 0) {
- print STDERR "ERROR: Client returned <$CRET>\n";
- exit 1 ;
-}
+if ($client_status != 0) {
+ print STDERR "ERROR: client returned $client_status\n";
+ $status = 1;
+}
-exit 0;
+$server_status = $SV->Kill ();
+if ($server_status != 0) {
+ print STDERR "ERROR: server returned $server_status\n";
+ $status = 1;
+}
+$server->DeleteFile($iorbase);
+$client->DeleteFile($iorbase);
+exit $status;
diff --git a/TAO/DevGuideExamples/PortableInterceptors/Auth/MessengerClient.cpp b/TAO/DevGuideExamples/PortableInterceptors/Auth/MessengerClient.cpp
index bbfb7aab4e2..46ad1a97cca 100644
--- a/TAO/DevGuideExamples/PortableInterceptors/Auth/MessengerClient.cpp
+++ b/TAO/DevGuideExamples/PortableInterceptors/Auth/MessengerClient.cpp
@@ -6,6 +6,35 @@
// Ensure that the PI library is linked in when building statically
#include "tao/PI/PI.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[])
@@ -19,7 +48,10 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[])
CORBA::ORB_var orb = CORBA::ORB_init (argc, argv, "Client ORB");
- 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;
diff --git a/TAO/DevGuideExamples/PortableInterceptors/Auth/MessengerServer.cpp b/TAO/DevGuideExamples/PortableInterceptors/Auth/MessengerServer.cpp
index 162ff20e7cd..e2f8d786fe1 100644
--- a/TAO/DevGuideExamples/PortableInterceptors/Auth/MessengerServer.cpp
+++ b/TAO/DevGuideExamples/PortableInterceptors/Auth/MessengerServer.cpp
@@ -8,6 +8,35 @@
#include "tao/PI_Server/PI_Server.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:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "usage: %s "
+ "-o <iorfile>"
+ "\n",
+ argv [0]),
+ -1);
+ }
+ // Indicates sucessful parsing of the command line
+ return 0;
+}
int
ACE_TMAIN (int argc, ACE_TCHAR *argv[])
@@ -22,6 +51,9 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[])
CORBA::ORB_var orb =
CORBA::ORB_init (argc, argv, "Server ORB");
+ 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() );
@@ -38,10 +70,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 << std::endl << "IOR written to file Messenger.ior" << std::endl;
+ std::cout << std::endl << "IOR written to file " << ACE_TEXT_ALWAYS_CHAR(ior_output_file) << std::endl;
// Accept requests
orb->run();
diff --git a/TAO/DevGuideExamples/PortableInterceptors/Auth/run_test.pl b/TAO/DevGuideExamples/PortableInterceptors/Auth/run_test.pl
index 2b479ea579c..2b431dd59e6 100755
--- a/TAO/DevGuideExamples/PortableInterceptors/Auth/run_test.pl
+++ b/TAO/DevGuideExamples/PortableInterceptors/Auth/run_test.pl
@@ -1,41 +1,75 @@
+eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
+ & eval 'exec perl -S $0 $argv:q'
+ if 0;
+
# $Id$
+# -*- perl -*-
-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;
-
-# start MessengerServer
-my($iorfile) = 'Messenger.ior';
-unlink($iorfile);
-
-$S = new PerlACE::Process("MessengerServer");
-$S->Spawn();
-if (PerlACE::waitforfile_timed (
- $iorfile,
- $PerlACE::wait_interval_for_process_creation) == -1) {
- print STDERR "ERROR: cannot find file <$iorfile>\n";
- $SV->Kill();
- exit(1);
-}
-
-# start MessengerClient
-select undef, undef, undef, .5;
-$C = new PerlACE::Process("MessengerClient");
+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 $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
+my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
+
+my $iorbase = "Messenger.ior";
+my $server_iorfile = $server->LocalFile ($iorbase);
+my $client_iorfile = $client->LocalFile ($iorbase);
+$server->DeleteFile($iorbase);
+$client->DeleteFile($iorbase);
+
+$SV = $server->CreateProcess ("MessengerServer", "-ORBdebuglevel $debug_level -o $server_iorfile");
+$CL = $client->CreateProcess ("MessengerClient", "-k file://$client_iorfile");
+$server_status = $SV->Spawn ();
-if ($C->SpawnWaitKill(15) != 0) {
- $S->Kill();
- exit (1);
+if ($server_status != 0) {
+ print STDERR "ERROR: server returned $server_status\n";
+ exit 1;
}
-# clean-up
-$S->Kill();
-unlink($iorfile);
+if ($server->WaitForFileTimed ($iorbase,
+ $server->ProcessStartWaitInterval()) == -1) {
+ print STDERR "ERROR: cannot find file <$server_iorfile>\n";
+ $SV->Kill (); $SV->TimedWait (1);
+ exit 1;
+}
+
+if ($server->GetFile ($iorbase) == -1) {
+ print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n";
+ $SV->Kill (); $SV->TimedWait (1);
+ exit 1;
+}
+
+if ($client->PutFile ($iorbase) == -1) {
+ print STDERR "ERROR: cannot set file <$client_iorfile>\n";
+ $SV->Kill (); $SV->TimedWait (1);
+ exit 1;
+}
-exit 0;
+select undef, undef, undef, .5;
+$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval());
+
+if ($client_status != 0) {
+ print STDERR "ERROR: client returned $client_status\n";
+ $status = 1;
+}
+$server_status = $SV->Kill ();
+
+if ($server_status != 0) {
+ print STDERR "ERROR: server returned $server_status\n";
+ $status = 1;
+}
+$server->DeleteFile($iorbase);
+$client->DeleteFile($iorbase);
+exit $status;
diff --git a/TAO/DevGuideExamples/PortableInterceptors/IOR/MessengerClient.cpp b/TAO/DevGuideExamples/PortableInterceptors/IOR/MessengerClient.cpp
index 1d743cad3fe..10cfb5c70cd 100644
--- a/TAO/DevGuideExamples/PortableInterceptors/IOR/MessengerClient.cpp
+++ b/TAO/DevGuideExamples/PortableInterceptors/IOR/MessengerClient.cpp
@@ -6,6 +6,36 @@
// Ensure that the PI library is linked in when building statically
#include "tao/PI/PI.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[])
{
@@ -19,8 +49,11 @@ 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;
+
// 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/DevGuideExamples/PortableInterceptors/IOR/MessengerServer.cpp b/TAO/DevGuideExamples/PortableInterceptors/IOR/MessengerServer.cpp
index d4a23c6d70b..eec45d66938 100644
--- a/TAO/DevGuideExamples/PortableInterceptors/IOR/MessengerServer.cpp
+++ b/TAO/DevGuideExamples/PortableInterceptors/IOR/MessengerServer.cpp
@@ -8,6 +8,35 @@
#include "tao/PI_Server/PI_Server.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:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "usage: %s "
+ "-o <iorfile>"
+ "\n",
+ argv [0]),
+ -1);
+ }
+ // Indicates sucessful parsing of the command line
+ return 0;
+}
int
ACE_TMAIN (int argc, ACE_TCHAR *argv[])
@@ -21,6 +50,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() );
@@ -38,10 +70,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 " << ACE_TEXT_ALWAYS_CHAR(ior_output_file) << std::endl;
// Accept requests
orb->run();
diff --git a/TAO/DevGuideExamples/PortableInterceptors/IOR/run_test.pl b/TAO/DevGuideExamples/PortableInterceptors/IOR/run_test.pl
index ec593d127ee..2b431dd59e6 100755
--- a/TAO/DevGuideExamples/PortableInterceptors/IOR/run_test.pl
+++ b/TAO/DevGuideExamples/PortableInterceptors/IOR/run_test.pl
@@ -1,39 +1,75 @@
+eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
+ & eval 'exec perl -S $0 $argv:q'
+ if 0;
+
# $Id$
+# -*- perl -*-
-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;
-
-# start MessengerServer
-my($iorfile) = 'Messenger.ior';
-unlink $iorfile;
-
-$S = new PerlACE::Process("MessengerServer");
-$S->Spawn();
-if (PerlACE::waitforfile_timed (
- $iorfile,
- $PerlACE::wait_interval_for_process_creation) == -1) {
- print STDERR "ERROR: cannot find file <$iorfile>\n";
- $SV->Kill();
- exit(1);
+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 $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
+my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
+
+my $iorbase = "Messenger.ior";
+my $server_iorfile = $server->LocalFile ($iorbase);
+my $client_iorfile = $client->LocalFile ($iorbase);
+$server->DeleteFile($iorbase);
+$client->DeleteFile($iorbase);
+
+$SV = $server->CreateProcess ("MessengerServer", "-ORBdebuglevel $debug_level -o $server_iorfile");
+$CL = $client->CreateProcess ("MessengerClient", "-k file://$client_iorfile");
+$server_status = $SV->Spawn ();
+
+if ($server_status != 0) {
+ print STDERR "ERROR: server returned $server_status\n";
+ exit 1;
+}
+
+if ($server->WaitForFileTimed ($iorbase,
+ $server->ProcessStartWaitInterval()) == -1) {
+ print STDERR "ERROR: cannot find file <$server_iorfile>\n";
+ $SV->Kill (); $SV->TimedWait (1);
+ exit 1;
+}
+
+if ($server->GetFile ($iorbase) == -1) {
+ print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n";
+ $SV->Kill (); $SV->TimedWait (1);
+ exit 1;
+}
+
+if ($client->PutFile ($iorbase) == -1) {
+ print STDERR "ERROR: cannot set file <$client_iorfile>\n";
+ $SV->Kill (); $SV->TimedWait (1);
+ exit 1;
}
-# start MessengerClient
select undef, undef, undef, .5;
-$C = new PerlACE::Process("MessengerClient");
+$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval());
-if ($C->SpawnWaitKill(15) != 0) {
- $S->Kill();
- exit (1);
+if ($client_status != 0) {
+ print STDERR "ERROR: client returned $client_status\n";
+ $status = 1;
}
-# clean-up
-$S->Kill();
+$server_status = $SV->Kill ();
+
+if ($server_status != 0) {
+ print STDERR "ERROR: server returned $server_status\n";
+ $status = 1;
+}
-unlink $iorfile;
+$server->DeleteFile($iorbase);
+$client->DeleteFile($iorbase);
-exit 0;
+exit $status;
diff --git a/TAO/DevGuideExamples/PortableInterceptors/PICurrent/MessengerClient.cpp b/TAO/DevGuideExamples/PortableInterceptors/PICurrent/MessengerClient.cpp
index 8992a47f748..d5d6761f965 100644
--- a/TAO/DevGuideExamples/PortableInterceptors/PICurrent/MessengerClient.cpp
+++ b/TAO/DevGuideExamples/PortableInterceptors/PICurrent/MessengerClient.cpp
@@ -7,6 +7,36 @@
// Ensure that the PI library is linked in when building statically
#include "tao/PI/PI.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[])
@@ -22,12 +52,14 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[])
CORBA::ORB_var orb = CORBA::ORB_init (argc, argv, "Client ORB");
+ if (parse_args (argc, argv) != 0)
+ return 1;
// Now that the ORB is initialized (and subsequently the
// PICurrent), we can set the slot data on the PICurrent for our
// interceptor initializer.
temp_initializer->set_slot_data ();
- 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/DevGuideExamples/PortableInterceptors/PICurrent/MessengerServer.cpp b/TAO/DevGuideExamples/PortableInterceptors/PICurrent/MessengerServer.cpp
index 45871eda26c..bcf37b51d37 100644
--- a/TAO/DevGuideExamples/PortableInterceptors/PICurrent/MessengerServer.cpp
+++ b/TAO/DevGuideExamples/PortableInterceptors/PICurrent/MessengerServer.cpp
@@ -10,6 +10,35 @@
#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:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "usage: %s "
+ "-o <iorfile>"
+ "\n",
+ argv [0]),
+ -1);
+ }
+ // Indicates sucessful parsing of the command line
+ return 0;
+}
int
ACE_TMAIN (int argc, ACE_TCHAR *argv[])
@@ -24,6 +53,9 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[])
CORBA::ORB_var orb =
CORBA::ORB_init (argc, argv, "Server ORB");
+ 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() );
@@ -40,10 +72,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 << std::endl << "IOR written to file Messenger.ior" << std::endl;
+ std::cout << std::endl << "IOR written to file " << ACE_TEXT_ALWAYS_CHAR(ior_output_file) << std::endl;
// Accept requests
orb->run();
diff --git a/TAO/DevGuideExamples/PortableInterceptors/PICurrent/run_test.pl b/TAO/DevGuideExamples/PortableInterceptors/PICurrent/run_test.pl
index fd018aa7160..186e6724704 100755
--- a/TAO/DevGuideExamples/PortableInterceptors/PICurrent/run_test.pl
+++ b/TAO/DevGuideExamples/PortableInterceptors/PICurrent/run_test.pl
@@ -1,39 +1,76 @@
+eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
+ & eval 'exec perl -S $0 $argv:q'
+ if 0;
+
# $Id$
+# -*- perl -*-
-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;
-
-$ior = "Messenger.ior";
-unlink $ior;
-
-# start MessengerServer
-$S = new PerlACE::Process("MessengerServer");
-$S->Spawn();
-if (PerlACE::waitforfile_timed ($ior, $PerlACE::wait_interval_for_process_creation) == -1) {
- print STDERR "ERROR: cannot find file $ior\n";
- $S->Kill();
+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 $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
+my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
+
+my $iorbase = "Messenger.ior";
+my $server_iorfile = $server->LocalFile ($iorbase);
+my $client_iorfile = $client->LocalFile ($iorbase);
+$server->DeleteFile($iorbase);
+$client->DeleteFile($iorbase);
+
+$SV = $server->CreateProcess ("MessengerServer", "-ORBdebuglevel $debug_level -o $server_iorfile");
+$CL = $client->CreateProcess ("MessengerClient", "-ORBInitRef Messenger=file://$client_iorfile ".
+ "-k file://$client_iorfile");
+$server_status = $SV->Spawn ();
+
+if ($server_status != 0) {
+ print STDERR "ERROR: server returned $server_status\n";
exit 1;
}
-# start MessengerClient
-select undef, undef, undef, .5;
-$C = new PerlACE::Process("MessengerClient", " -ORBInitRef Messenger=file://$ior");
+if ($server->WaitForFileTimed ($iorbase,
+ $server->ProcessStartWaitInterval()) == -1) {
+ print STDERR "ERROR: cannot find file <$server_iorfile>\n";
+ $SV->Kill (); $SV->TimedWait (1);
+ exit 1;
+}
+
+if ($server->GetFile ($iorbase) == -1) {
+ print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n";
+ $SV->Kill (); $SV->TimedWait (1);
+ exit 1;
+}
-if ($C->SpawnWaitKill(15) != 0) {
- $S->Kill();
- exit (1);
+if ($client->PutFile ($iorbase) == -1) {
+ print STDERR "ERROR: cannot set file <$client_iorfile>\n";
+ $SV->Kill (); $SV->TimedWait (1);
+ exit 1;
}
-# clean-up
-$S->Kill();
-#unlink $ior;
+select undef, undef, undef, .5;
+$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval());
-exit 0;
+if ($client_status != 0) {
+ print STDERR "ERROR: client returned $client_status\n";
+ $status = 1;
+}
+$server_status = $SV->Kill ();
+
+if ($server_status != 0) {
+ print STDERR "ERROR: server returned $server_status\n";
+ $status = 1;
+}
+$server->DeleteFile($iorbase);
+$client->DeleteFile($iorbase);
+exit $status;
diff --git a/TAO/DevGuideExamples/PortableInterceptors/SimpleCodec/MessengerClient.cpp b/TAO/DevGuideExamples/PortableInterceptors/SimpleCodec/MessengerClient.cpp
index 599126a385f..b855692098c 100644
--- a/TAO/DevGuideExamples/PortableInterceptors/SimpleCodec/MessengerClient.cpp
+++ b/TAO/DevGuideExamples/PortableInterceptors/SimpleCodec/MessengerClient.cpp
@@ -6,6 +6,36 @@
// Ensure that the PI library is linked in when building statically
#include "tao/PI/PI.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[])
@@ -20,8 +50,11 @@ 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;
+
// 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/DevGuideExamples/PortableInterceptors/SimpleCodec/MessengerServer.cpp b/TAO/DevGuideExamples/PortableInterceptors/SimpleCodec/MessengerServer.cpp
index c1efbd4172b..56428bff073 100644
--- a/TAO/DevGuideExamples/PortableInterceptors/SimpleCodec/MessengerServer.cpp
+++ b/TAO/DevGuideExamples/PortableInterceptors/SimpleCodec/MessengerServer.cpp
@@ -8,6 +8,35 @@
#include "tao/PI_Server/PI_Server.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:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "usage: %s "
+ "-o <iorfile>"
+ "\n",
+ argv [0]),
+ -1);
+ }
+ // Indicates sucessful parsing of the command line
+ return 0;
+}
int
ACE_TMAIN (int argc, ACE_TCHAR *argv[])
@@ -22,6 +51,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() );
@@ -39,10 +71,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 " << ACE_TEXT_ALWAYS_CHAR(ior_output_file) << std::endl;
// Accept requests
orb->run();
diff --git a/TAO/DevGuideExamples/PortableInterceptors/SimpleCodec/run_test.pl b/TAO/DevGuideExamples/PortableInterceptors/SimpleCodec/run_test.pl
index 2b479ea579c..5c168220043 100755
--- a/TAO/DevGuideExamples/PortableInterceptors/SimpleCodec/run_test.pl
+++ b/TAO/DevGuideExamples/PortableInterceptors/SimpleCodec/run_test.pl
@@ -1,41 +1,76 @@
+eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
+ & eval 'exec perl -S $0 $argv:q'
+ if 0;
+
# $Id$
+# -*- perl -*-
-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;
-
-# start MessengerServer
-my($iorfile) = 'Messenger.ior';
-unlink($iorfile);
-
-$S = new PerlACE::Process("MessengerServer");
-$S->Spawn();
-if (PerlACE::waitforfile_timed (
- $iorfile,
- $PerlACE::wait_interval_for_process_creation) == -1) {
- print STDERR "ERROR: cannot find file <$iorfile>\n";
- $SV->Kill();
- exit(1);
-}
-
-# start MessengerClient
-select undef, undef, undef, .5;
-$C = new PerlACE::Process("MessengerClient");
+use lib "$ENV{ACE_ROOT}/bin";
+use PerlACE::TestTarget;
+
+$status = 0;
+$debug_level = '0';
-if ($C->SpawnWaitKill(15) != 0) {
- $S->Kill();
- exit (1);
+foreach $i (@ARGV) {
+ if ($i eq '-debug') {
+ $debug_level = '10';
+ }
}
-# clean-up
-$S->Kill();
-unlink($iorfile);
+my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
+my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
+
+my $iorbase = "Messenger.ior";
+my $server_iorfile = $server->LocalFile ($iorbase);
+my $client_iorfile = $client->LocalFile ($iorbase);
+$server->DeleteFile($iorbase);
+$client->DeleteFile($iorbase);
-exit 0;
+$SV = $server->CreateProcess ("MessengerServer", "-ORBdebuglevel $debug_level -o $server_iorfile");
+$CL = $client->CreateProcess ("MessengerClient", "-k file://$client_iorfile");
+$server_status = $SV->Spawn ();
+if ($server_status != 0) {
+ print STDERR "ERROR: server returned $server_status\n";
+ exit 1;
+}
+
+if ($server->WaitForFileTimed ($iorbase,
+ $server->ProcessStartWaitInterval()) == -1) {
+ print STDERR "ERROR: cannot find file <$server_iorfile>\n";
+ $SV->Kill (); $SV->TimedWait (1);
+ exit 1;
+}
+
+if ($server->GetFile ($iorbase) == -1) {
+ print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n";
+ $SV->Kill (); $SV->TimedWait (1);
+ exit 1;
+}
+
+if ($client->PutFile ($iorbase) == -1) {
+ print STDERR "ERROR: cannot set file <$client_iorfile>\n";
+ $SV->Kill (); $SV->TimedWait (1);
+ exit 1;
+}
+
+select undef, undef, undef, .5;
+
+$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval());
+
+if ($client_status != 0) {
+ print STDERR "ERROR: client returned $client_status\n";
+ $status = 1;
+}
+
+$server_status = $SV->Kill ();
+
+if ($server_status != 0) {
+ print STDERR "ERROR: server returned $server_status\n";
+ $status = 1;
+}
+$server->DeleteFile($iorbase);
+$client->DeleteFile($iorbase);
+exit $status;
diff --git a/TAO/DevGuideExamples/RTCORBA/MessengerServer.cpp b/TAO/DevGuideExamples/RTCORBA/MessengerServer.cpp
index f28ba301e8f..e5e97679b4a 100644
--- a/TAO/DevGuideExamples/RTCORBA/MessengerServer.cpp
+++ b/TAO/DevGuideExamples/RTCORBA/MessengerServer.cpp
@@ -113,10 +113,10 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[])
CORBA::Object_var messenger_obj =
client_propagated_poa->id_to_reference( oid.in() );
CORBA::String_var str = orb->object_to_string( messenger_obj.in() );
- std::ofstream iorFile(ior_output_file);
+ std::ofstream iorFile(ACE_TEXT_ALWAYS_CHAR(ior_output_file));
iorFile << str.in() << std::endl;
iorFile.close();
- std::cout << "IOR written to file " << ior_output_file << std::endl;
+ std::cout << "IOR written to file " << ACE_TEXT_ALWAYS_CHAR(ior_output_file) << std::endl;
// Accept requests
orb->run();
diff --git a/TAO/DevGuideExamples/RTCORBA/run_test.pl b/TAO/DevGuideExamples/RTCORBA/run_test.pl
index 48de78c80c1..09f2c3c47ec 100755
--- a/TAO/DevGuideExamples/RTCORBA/run_test.pl
+++ b/TAO/DevGuideExamples/RTCORBA/run_test.pl
@@ -42,6 +42,18 @@ if ($server->WaitForFileTimed ($iorbase,
exit 1;
}
+if ($server->GetFile ($iorbase) == -1) {
+ print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n";
+ $SV->Kill (); $SV->TimedWait (1);
+ exit 1;
+}
+
+if ($client->PutFile ($iorbase) == -1) {
+ print STDERR "ERROR: cannot set file <$client_iorfile>\n";
+ $SV->Kill (); $SV->TimedWait (1);
+ exit 1;
+}
+
$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval());
if ($client_status != 0) {
@@ -49,7 +61,7 @@ if ($client_status != 0) {
$status = 1;
}
-$server_status = $SV->TerminateWaitKill ($server->ProcessStopWaitInterval());
+$server_status = $SV->Kill ();
if ($server_status != 0) {
print STDERR "ERROR: server returned $server_status\n";
diff --git a/TAO/DevGuideExamples/ValueTypes/Bank/client.cpp b/TAO/DevGuideExamples/ValueTypes/Bank/client.cpp
index b1c6b50bc7a..9004be236a5 100644
--- a/TAO/DevGuideExamples/ValueTypes/Bank/client.cpp
+++ b/TAO/DevGuideExamples/ValueTypes/Bank/client.cpp
@@ -6,7 +6,35 @@
#include <iostream>
#include <stdexcept>
+#include "ace/Get_Opt.h"
+const ACE_TCHAR *ior = ACE_TEXT ("file://server.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;
+}
// Note : We use a completely different implementation
// of the Person valuetype for the client side, just to
@@ -28,16 +56,16 @@ private:
}
};
-const char* server_ior = "file://server.ior";
-
-
-int ACE_TMAIN (int ac, ACE_TCHAR* av[]) {
+int ACE_TMAIN (int argc, ACE_TCHAR* argv[]) {
try {
- CORBA::ORB_var orb = CORBA::ORB_init(ac, av);
+ CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
+
+ if (parse_args (argc, argv) != 0)
+ return 1;
- CORBA::Object_var obj = orb->string_to_object(server_ior);
+ CORBA::Object_var obj = orb->string_to_object(ior);
Transaction_var trans = Transaction::_narrow(obj.in());
if (CORBA::is_nil(trans.in()))
throw std::runtime_error("failed to find a valid Transaction IOR");
diff --git a/TAO/DevGuideExamples/ValueTypes/Bank/run_test.pl b/TAO/DevGuideExamples/ValueTypes/Bank/run_test.pl
index 8e9a4f88db0..e01c181a775 100755
--- a/TAO/DevGuideExamples/ValueTypes/Bank/run_test.pl
+++ b/TAO/DevGuideExamples/ValueTypes/Bank/run_test.pl
@@ -1,39 +1,74 @@
+eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
+ & eval 'exec perl -S $0 $argv:q'
+ if 0;
+
# $Id$
+# -*- perl -*-
-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;
-$ior = "server.ior";
-$S = new PerlACE::Process("server");
-$S->Spawn();
-
-if (PerlACE::waitforfile_timed ($ior, $PerlACE::wait_interval_for_process_creation) == -1) {
- print STDERR "ERROR: cannot find file <$ior>\n";
- $S->Kill();
- unlink $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 $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
+my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
+
+my $iorbase = "server.ior";
+my $server_iorfile = $server->LocalFile ($iorbase);
+my $client_iorfile = $client->LocalFile ($iorbase);
+$server->DeleteFile($iorbase);
+$client->DeleteFile($iorbase);
+
+$SV = $server->CreateProcess ("server", "-ORBdebuglevel $debug_level -o $server_iorfile");
+$CL = $client->CreateProcess ("client", "-k file://$client_iorfile");
+$server_status = $SV->Spawn ();
+
+if ($server_status != 0) {
+ print STDERR "ERROR: server returned $server_status\n";
exit 1;
}
-$C = new PerlACE::Process("client");
-$C->Spawn();
+if ($server->WaitForFileTimed ($iorbase,
+ $server->ProcessStartWaitInterval()) == -1) {
+ print STDERR "ERROR: cannot find file <$server_iorfile>\n";
+ $SV->Kill (); $SV->TimedWait (1);
+ exit 1;
+}
-$CRET = $C->WaitKill(15);
-$S->Kill();
+if ($server->GetFile ($iorbase) == -1) {
+ print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n";
+ $SV->Kill (); $SV->TimedWait (1);
+ exit 1;
+}
-# clean-up
+if ($client->PutFile ($iorbase) == -1) {
+ print STDERR "ERROR: cannot set file <$client_iorfile>\n";
+ $SV->Kill (); $SV->TimedWait (1);
+ exit 1;
+}
-unlink $ior;
+$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval());
-if ($CRET != 0) {
- print STDERR "ERROR: Client returned <$CRET>\n";
- exit 1 ;
-}
+if ($client_status != 0) {
+ print STDERR "ERROR: client returned $client_status\n";
+ $status = 1;
+}
-exit 0;
+$server_status = $SV->Kill ();
+if ($server_status != 0) {
+ print STDERR "ERROR: server returned $server_status\n";
+ $status = 1;
+}
+$server->DeleteFile($iorbase);
+$client->DeleteFile($iorbase);
+exit $status;
diff --git a/TAO/DevGuideExamples/ValueTypes/Bank/server.cpp b/TAO/DevGuideExamples/ValueTypes/Bank/server.cpp
index 47fbffe5365..26c3612b9ca 100644
--- a/TAO/DevGuideExamples/ValueTypes/Bank/server.cpp
+++ b/TAO/DevGuideExamples/ValueTypes/Bank/server.cpp
@@ -9,9 +9,35 @@
#include <iostream>
#include <fstream>
#include <fstream>
+#include "ace/Get_Opt.h"
-const char* server_ior_file = "server.ior";
+const ACE_TCHAR *ior_output_file = ACE_TEXT ("server.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:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "usage: %s "
+ "-o <iorfile>"
+ "\n",
+ argv [0]),
+ -1);
+ }
+ // Indicates sucessful parsing of the command line
+ return 0;
+}
class Person_i
: public virtual OBV_Person
@@ -60,42 +86,52 @@ public:
};
void write_ior(const char* ior) {
- std::ofstream out(server_ior_file);
+ std::ofstream out(ACE_TEXT_ALWAYS_CHAR(ior_output_file));
out << ior;
}
-int ACE_TMAIN (int ac, ACE_TCHAR* av[]) {
+int ACE_TMAIN (int argc, ACE_TCHAR* argv[]) {
+ try
+ {
+ CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
- CORBA::ORB_var orb = CORBA::ORB_init(ac, av);
+ if (parse_args (argc, argv) != 0)
+ return 1;
- {
- CORBA::ValueFactoryBase_var factory = new PersonFactory;
- CORBA::String_var id = _tc_Person->id();
- orb->register_value_factory(id.in(), factory.in());
- }
+ {
+ CORBA::ValueFactoryBase_var factory = new PersonFactory;
+ CORBA::String_var id = _tc_Person->id();
+ orb->register_value_factory(id.in(), factory.in());
+ }
- CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
- PortableServer::POA_var poa = PortableServer::POA::_narrow(obj.in());
+ CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
+ PortableServer::POA_var poa = PortableServer::POA::_narrow(obj.in());
- PortableServer::POAManager_var poaman = poa->the_POAManager();
+ PortableServer::POAManager_var poaman = poa->the_POAManager();
- PortableServer::Servant_var<Transaction_i> svt = new Transaction_i;
+ PortableServer::Servant_var<Transaction_i> svt = new Transaction_i;
- {
- PortableServer::ObjectId_var id = poa->activate_object(svt.in());
- obj = poa->id_to_reference(id.in());
- CORBA::String_var ior = orb->object_to_string(obj.in());
- write_ior(ior.in());
- }
+ {
+ PortableServer::ObjectId_var id = poa->activate_object(svt.in());
+ obj = poa->id_to_reference(id.in());
+ CORBA::String_var ior = orb->object_to_string(obj.in());
+ write_ior(ior.in());
+ }
- std::cout << "Server: Running..." << std::endl;
+ std::cout << "Server: Running..." << std::endl;
- poaman->activate();
+ poaman->activate();
- orb->run();
+ orb->run();
- poa->destroy(true, true);
- orb->destroy();
+ poa->destroy(true, true);
+ orb->destroy();
+ }
+ catch (const CORBA::Exception& ex)
+ {
+ ex._tao_print_exception ("Exception caught:");
+ return 1;
+ }
return 0;
}
diff --git a/TAO/DevGuideExamples/ValueTypes/Messenger/MessengerClient.cpp b/TAO/DevGuideExamples/ValueTypes/Messenger/MessengerClient.cpp
index dbd695583a4..7f4da7efa74 100644
--- a/TAO/DevGuideExamples/ValueTypes/Messenger/MessengerClient.cpp
+++ b/TAO/DevGuideExamples/ValueTypes/Messenger/MessengerClient.cpp
@@ -3,21 +3,49 @@
#include "_pch.h"
#include "Message_i.h"
#include <iostream>
+#include "ace/Get_Opt.h"
-const char* server_ior = "file://server.ior";
+const ACE_TCHAR *ior = ACE_TEXT ("file://server.ior");
-int ACE_TMAIN (int ac, ACE_TCHAR* av[]) {
+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 {
- CORBA::ORB_var orb = CORBA::ORB_init(ac, av);
+ CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
+ if (parse_args (argc, argv) != 0)
+ return 1;
// Normally we wouldn't have to register the factory in the client, but
// in this case the valuetype will be returned as an inout parameter, and
// we'll need the factory to support this.
MessageFactory::register_new_factory(* orb.in());
- CORBA::Object_var obj = orb->string_to_object(server_ior);
+ CORBA::Object_var obj = orb->string_to_object(ior);
Messenger_var tst = Messenger::_narrow(obj.in());
ACE_ASSERT(! CORBA::is_nil(tst.in()));
diff --git a/TAO/DevGuideExamples/ValueTypes/Messenger/MessengerServer.cpp b/TAO/DevGuideExamples/ValueTypes/Messenger/MessengerServer.cpp
index e59b0c2ba87..51323ff466d 100644
--- a/TAO/DevGuideExamples/ValueTypes/Messenger/MessengerServer.cpp
+++ b/TAO/DevGuideExamples/ValueTypes/Messenger/MessengerServer.cpp
@@ -8,41 +8,79 @@
#include <iostream>
#include <fstream>
#include <fstream>
-
-const char* server_ior_file = "server.ior";
-
+#include "ace/Get_Opt.h"
+
+const ACE_TCHAR *ior_output_file = ACE_TEXT ("server.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:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "usage: %s "
+ "-o <iorfile>"
+ "\n",
+ argv [0]),
+ -1);
+ }
+ // Indicates sucessful parsing of the command line
+ return 0;
+}
void write_ior(const char* ior) {
- std::ofstream out(server_ior_file);
+ std::ofstream out(ACE_TEXT_ALWAYS_CHAR(ior_output_file));
out << ior;
}
-int ACE_TMAIN (int ac, ACE_TCHAR* av[]) {
+int
+ACE_TMAIN(int argc, ACE_TCHAR *argv[])
+{
+ try
+ {
+ CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);
- CORBA::ORB_var orb = CORBA::ORB_init(ac, av);
+ if (parse_args (argc, argv) != 0)
+ return 1;
- MessageFactory::register_new_factory(* orb.in());
+ MessageFactory::register_new_factory(* orb.in());
- CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
- PortableServer::POA_var poa = PortableServer::POA::_narrow(obj.in());
+ CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
+ PortableServer::POA_var poa = PortableServer::POA::_narrow(obj.in());
- PortableServer::POAManager_var poaman = poa->the_POAManager();
+ PortableServer::POAManager_var poaman = poa->the_POAManager();
- PortableServer::Servant_var<Messenger_i> svt = new Messenger_i;
+ PortableServer::Servant_var<Messenger_i> svt = new Messenger_i;
- PortableServer::ObjectId_var id = poa->activate_object(svt.in());
- obj = poa->id_to_reference(id.in());
- CORBA::String_var ior = orb->object_to_string(obj.in());
- write_ior(ior.in());
+ PortableServer::ObjectId_var id = poa->activate_object(svt.in());
+ obj = poa->id_to_reference(id.in());
+ CORBA::String_var ior = orb->object_to_string(obj.in());
+ write_ior(ior.in());
- std::cout << "Starting server." << std::endl;
+ std::cout << "Starting server." << std::endl;
- poaman->activate();
+ poaman->activate();
- orb->run();
+ orb->run();
- poa->destroy(true, true);
- orb->destroy();
+ poa->destroy(true, true);
+ orb->destroy();
+ }
+ catch (const CORBA::Exception& ex)
+ {
+ ex._tao_print_exception ("Exception caught:");
+ return 1;
+ }
return 0;
}
diff --git a/TAO/DevGuideExamples/ValueTypes/Messenger/run_test.pl b/TAO/DevGuideExamples/ValueTypes/Messenger/run_test.pl
index 279dcaf9d76..319ad0e79b2 100755
--- a/TAO/DevGuideExamples/ValueTypes/Messenger/run_test.pl
+++ b/TAO/DevGuideExamples/ValueTypes/Messenger/run_test.pl
@@ -1,39 +1,74 @@
+eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
+ & eval 'exec perl -S $0 $argv:q'
+ if 0;
+
# $Id$
+# -*- perl -*-
-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;
-$ior = "server.ior";
-$S = new PerlACE::Process("MessengerServer");
-$S->Spawn();
-
-if (PerlACE::waitforfile_timed ($ior, $PerlACE::wait_interval_for_process_creation) == -1) {
- print STDERR "ERROR: cannot find file <$ior>\n";
- $S->Kill();
- unlink $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 $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
+my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
+
+my $iorbase = "server.ior";
+my $server_iorfile = $server->LocalFile ($iorbase);
+my $client_iorfile = $client->LocalFile ($iorbase);
+$server->DeleteFile($iorbase);
+$client->DeleteFile($iorbase);
+
+$SV = $server->CreateProcess ("MessengerServer", "-ORBdebuglevel $debug_level -o $server_iorfile");
+$CL = $client->CreateProcess ("MessengerClient", "-k file://$client_iorfile");
+$server_status = $SV->Spawn ();
+
+if ($server_status != 0) {
+ print STDERR "ERROR: server returned $server_status\n";
exit 1;
}
-$C = new PerlACE::Process("MessengerClient");
-$C->Spawn();
+if ($server->WaitForFileTimed ($iorbase,
+ $server->ProcessStartWaitInterval()) == -1) {
+ print STDERR "ERROR: cannot find file <$server_iorfile>\n";
+ $SV->Kill (); $SV->TimedWait (1);
+ exit 1;
+}
-$CRET = $C->WaitKill(15);
-$S->Kill();
+if ($server->GetFile ($iorbase) == -1) {
+ print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n";
+ $SV->Kill (); $SV->TimedWait (1);
+ exit 1;
+}
-# clean-up
+if ($client->PutFile ($iorbase) == -1) {
+ print STDERR "ERROR: cannot set file <$client_iorfile>\n";
+ $SV->Kill (); $SV->TimedWait (1);
+ exit 1;
+}
-unlink $ior;
+$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval());
-if ($CRET != 0) {
- print STDERR "ERROR: Client returned <$CRET>\n";
- exit 1 ;
-}
+if ($client_status != 0) {
+ print STDERR "ERROR: client returned $client_status\n";
+ $status = 1;
+}
-exit 0;
+$server_status = $SV->Kill ();
+if ($server_status != 0) {
+ print STDERR "ERROR: server returned $server_status\n";
+ $status = 1;
+}
+$server->DeleteFile($iorbase);
+$client->DeleteFile($iorbase);
+exit $status;