diff options
author | dbudko <dbudko@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2009-11-17 11:49:09 +0000 |
---|---|---|
committer | dbudko <dbudko@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2009-11-17 11:49:09 +0000 |
commit | d7b8cd35b5db3469ba42125b6b020cf271351fce (patch) | |
tree | 15fb819ad66de214ff073b7e6e13809edcb1ab42 /TAO/orbsvcs/DevGuideExamples | |
parent | 474b7a561c829553b7218c5b4680bbb396e60f54 (diff) | |
download | ATCD-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/orbsvcs/DevGuideExamples')
3 files changed, 134 insertions, 27 deletions
diff --git a/TAO/orbsvcs/DevGuideExamples/Security/ParticipatingApp/MessengerClient.cpp b/TAO/orbsvcs/DevGuideExamples/Security/ParticipatingApp/MessengerClient.cpp index 7e6551a08a8..d82acd54ce4 100644 --- a/TAO/orbsvcs/DevGuideExamples/Security/ParticipatingApp/MessengerClient.cpp +++ b/TAO/orbsvcs/DevGuideExamples/Security/ParticipatingApp/MessengerClient.cpp @@ -2,6 +2,7 @@ #include "orbsvcs/SecurityC.h" #include "MessengerC.h" +#include "ace/Get_Opt.h" #if 0 The servers service configuration file @@ -33,6 +34,34 @@ static Resource_Factory "-ORBProtocolFactory SSLIOP_Factory" --------------------------------------- #endif +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[]) { @@ -41,8 +70,11 @@ 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->string_to_object( "file://Messenger.ior" ); + orb->string_to_object( ior ); Messenger_var messenger = Messenger::_narrow( obj.in() ); diff --git a/TAO/orbsvcs/DevGuideExamples/Security/ParticipatingApp/MessengerServer.cpp b/TAO/orbsvcs/DevGuideExamples/Security/ParticipatingApp/MessengerServer.cpp index c88ead4fc53..7fcc7dc1b97 100644 --- a/TAO/orbsvcs/DevGuideExamples/Security/ParticipatingApp/MessengerServer.cpp +++ b/TAO/orbsvcs/DevGuideExamples/Security/ParticipatingApp/MessengerServer.cpp @@ -3,6 +3,36 @@ #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[]) { @@ -10,6 +40,8 @@ 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" ); @@ -37,13 +69,13 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) 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; orb->run(); poa->destroy (1, 1); diff --git a/TAO/orbsvcs/DevGuideExamples/Security/ParticipatingApp/run_test.pl b/TAO/orbsvcs/DevGuideExamples/Security/ParticipatingApp/run_test.pl index 95c461a7f20..e4de857f914 100755 --- a/TAO/orbsvcs/DevGuideExamples/Security/ParticipatingApp/run_test.pl +++ b/TAO/orbsvcs/DevGuideExamples/Security/ParticipatingApp/run_test.pl @@ -1,40 +1,83 @@ +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'; + +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} -$ENV{'SSL_CERT_FILE'} = 'cacert.pem'; +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"; -$file = PerlACE::LocalFile("Messenger.ior"); +my $iorbase = "Messenger.ior"; +my $server_conf = "server.conf"; +my $client_conf = "client.conf"; +my $certificate = "cacert.pem"; -unlink $file; +my $server_iorfile = $server->LocalFile ($iorbase); +my $client_iorfile = $client->LocalFile ($iorbase); +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); -# start MessengerServer -$S = new PerlACE::Process("MessengerServer", - "-ORBSvcConf server.conf"); -$S->Spawn(); -if (PerlACE::waitforfile_timed ($file, 15) == -1) { - print STDERR "ERROR: cannot find file <$file>\n"; - $S->Kill (); +$ENV{'SSL_CERT_FILE'} = $certificate; + +$SV = $server->CreateProcess ("MessengerServer", "-ORBdebuglevel $debug_level ". + " -o $server_iorfile ". + "-ORBSvcConf $server_conf"); +$CL = $client->CreateProcess ("MessengerClient", "-k file://$client_iorfile ". + "-ORBSvcConf $client_conf"); +$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", - "-ORBSvcConf client.conf"); +if ($server->WaitForFileTimed ($iorbase, + $server->ProcessStartWaitInterval()) == -1) { + print STDERR "ERROR: cannot find file <$server_iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} -if ($C->SpawnWaitKill(10) != 0) { - 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; } -if ($S->WaitKill(10) == -1) { - $S->Kill(); +$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval()); + +if ($client_status != 0) { + print STDERR "ERROR: client returned $client_status\n"; + $status = 1; +} + +$server_status = $SV->WaitKill ($server->ProcessStopWaitInterval()); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + $status = 1; } -exit 0; +$server->DeleteFile($iorbase); +$client->DeleteFile($iorbase); +exit $status; |