diff options
author | William R. Otte <wotte@dre.vanderbilt.edu> | 2006-07-24 15:50:11 +0000 |
---|---|---|
committer | William R. Otte <wotte@dre.vanderbilt.edu> | 2006-07-24 15:50:11 +0000 |
commit | 6b846cf03c0bcbd8c276cb0af61a181e5f98eaae (patch) | |
tree | da50d054f9c761c3f6a5923f6979e93306c56d68 /TAO/tests/RTCORBA/Private_Connection | |
parent | 0e555b9150d38e3b3473ba325b56db2642e6352b (diff) | |
download | ATCD-6b846cf03c0bcbd8c276cb0af61a181e5f98eaae.tar.gz |
Repo restructuring
Diffstat (limited to 'TAO/tests/RTCORBA/Private_Connection')
-rw-r--r-- | TAO/tests/RTCORBA/Private_Connection/.cvsignore | 2 | ||||
-rw-r--r-- | TAO/tests/RTCORBA/Private_Connection/README | 132 | ||||
-rw-r--r-- | TAO/tests/RTCORBA/Private_Connection/RTCORBA_Private_Connection.mpc | 17 | ||||
-rw-r--r-- | TAO/tests/RTCORBA/Private_Connection/client.cpp | 179 | ||||
-rwxr-xr-x | TAO/tests/RTCORBA/Private_Connection/run_test.pl | 55 | ||||
-rw-r--r-- | TAO/tests/RTCORBA/Private_Connection/server.cpp | 211 | ||||
-rw-r--r-- | TAO/tests/RTCORBA/Private_Connection/test.idl | 12 |
7 files changed, 0 insertions, 608 deletions
diff --git a/TAO/tests/RTCORBA/Private_Connection/.cvsignore b/TAO/tests/RTCORBA/Private_Connection/.cvsignore deleted file mode 100644 index f2ad85300eb..00000000000 --- a/TAO/tests/RTCORBA/Private_Connection/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -client -server diff --git a/TAO/tests/RTCORBA/Private_Connection/README b/TAO/tests/RTCORBA/Private_Connection/README deleted file mode 100644 index 8ba353b0f57..00000000000 --- a/TAO/tests/RTCORBA/Private_Connection/README +++ /dev/null @@ -1,132 +0,0 @@ -$Id$ - -This is a unit test for RTCORBA::PrivateConnectionPolicy. - -Description. --------- -The server creates two servants, registers them with the Root POA, -prints out their IORs and waits for the requests from the client. The -client obtains the IORs, makes several invocations on the objects, -then sets RTCORBA::PrivateConnectionPolicy on PolicyCurrent (i.e., -thread-level) and makes a few more invocations on the objects. - -The goal of the test is to check that new connections are established -only when expected, and that appropriate connection is used for each -invocation. Since what we are trying to verify are the internal -workings of the ORB, we are relying on ORB debug messages to do it. - -Client makes a total of 8 invocations (not counting the shutdown -request at the end). A message containing invocation number, whether -the new connection is to be established, and, if not, which one should -be reused, is printed out before each invocation. ORB debug messages -that follow allow us to verify whether things worked as expected. See -Expected output section below for more information. - -To run (on Unix): -------- -$./server [-o <ior_output_file1> -p <ior_output_file2>] -$./client [-o <ior1> -p <ior2>] -ORBdebuglevel 3 - - -Options: --------- - Server: - --o <ior_output_file1> Default: test1.ior - Filename for output of the IOR of the first - testing object. - --p <ior_output_file2> Default: test2.ior - Filename for output of the IOR of the - second testing object. - - Client: - --o <ior1> Default: file://test1.ior - IOR of the first test object. - --p <ior2> Default: file://test2.ior - IOR of the second test object. - --ORBdebuglevel 3 Default: none - Recommended debug level is 3 or higher. - -Expected output: ----------------- -Below is a sample output from run_test.pl on NT. Please note that -since in this test we are relying on ORB debug messages - -1) test output may look different from that shown below as ORB debug - messages are modified -2) the output may contain some debug information irrelevant to this - test, e.g., parsed header info in the output below - - -********** RTCORBA Private Connection Unit Test - -<IOR:010000000d00000049444c3a546573743a312e300000000001000000000000007e00000001 -102cd050000006865726100cdc3051b00000014010f0052535422181a3a88bb0600000000000100 -00001000000cd03000000000000000800000001cdcdcd004f4154010000001400000001cdcdcd01 -00100000000000901010000000000024f41541600000001cdcdcd01000000050000006865726100 -dc305ffff> - -<IOR:010000000d00000049444c3a546573743a312e300000000001000000000000007e00000001 -102cd050000006865726100cdc3051b00000014010f0052535422181a3a88bb0600010000000100 -00002000000cd03000000000000000800000001cdcdcd004f4154010000001400000001cdcdcd01 -00100000000000901010000000000024f41541600000001cdcdcd01000000050000006865726100 -dc305ffff> - -TAO (976|1072) Loaded default protocol <IIOP_Factory> -TAO (976|1072) created new ORB <> - - Invocation 1 --> new connection -(976|1072) IIOP_Connector::connect - making a new connection -(976|1072) IIOP_Connector::connect - new connection on HANDLE 296 -Server: test_method invoked. -TAO (976|1072) Parsed header = <1,2,1,1,12> - - Invocation 2 --> use connection from invocation 1 -(976|1072) IIOP_Connector::connect - got an existing connection on HANDLE 296 -Server: test_method invoked. -TAO (976|1072) Parsed header = <1,2,1,1,12> - - Invocation 3 --> use connection from invocation 1 -(976|1072) IIOP_Connector::connect - got an existing connection on HANDLE 296 -Server: test_method invoked. -TAO (976|1072) Parsed header = <1,2,1,1,12> - - Invocation 4 --> use connection from invocation 1 -(976|1072) IIOP_Connector::connect - got an existing connection on HANDLE 296 -Server: test_method invoked. -TAO (976|1072) Parsed header = <1,2,1,1,12> - - Invocation 5 --> new connection -(976|1072) IIOP_Connector::connect - making a new connection -(976|1072) IIOP_Connector::connect - new connection on HANDLE 316 -Server: test_method invoked. -TAO (976|1072) Parsed header = <1,2,1,1,12> - - Invocation 6 --> new connection -(976|1072) IIOP_Connector::connect - making a new connection -(976|1072) IIOP_Connector::connect - new connection on HANDLE 328 -Server: test_method invoked. -TAO (976|1072) Parsed header = <1,2,1,1,12> - - Invocation 7 --> use connection from invocation 5 -(976|1072) IIOP_Connector::connect - got an existing connection on HANDLE 316 -Server: test_method invoked. -TAO (976|1072) Parsed header = <1,2,1,1,12> - - Invocation 8 --> use connection from invocation 6 -(976|1072) IIOP_Connector::connect - got an existing connection on HANDLE 328 -Server: test_method invoked. -TAO (976|1072) Parsed header = <1,2,1,1,12> - - Testing over - shutting down -(976|1072) IIOP_Connector::connect - got an existing connection on HANDLE 316 -Server ORB event loop finished -Destroying ORB <> -TAO (976|1072) IIOP_Client_Connection_Handler::handle_close (296, 511) -TAO (976|1072) IIOP_Client_Connection_Handler::handle_close (328, 511) -TAO (976|1072) IIOP_Client_Connection_Handler::handle_close (316, 511) - diff --git a/TAO/tests/RTCORBA/Private_Connection/RTCORBA_Private_Connection.mpc b/TAO/tests/RTCORBA/Private_Connection/RTCORBA_Private_Connection.mpc deleted file mode 100644 index 87178218057..00000000000 --- a/TAO/tests/RTCORBA/Private_Connection/RTCORBA_Private_Connection.mpc +++ /dev/null @@ -1,17 +0,0 @@ -// -*- MPC -*- -// $Id$ - -project(*Server): rt_server, minimum_corba { - Source_Files { - server.cpp - } -} - -project(*Client): rt_client, minimum_corba { - after += *Server - Source_Files { - testC.cpp - client.cpp - } -} - diff --git a/TAO/tests/RTCORBA/Private_Connection/client.cpp b/TAO/tests/RTCORBA/Private_Connection/client.cpp deleted file mode 100644 index a1b7369b55d..00000000000 --- a/TAO/tests/RTCORBA/Private_Connection/client.cpp +++ /dev/null @@ -1,179 +0,0 @@ -// $Id$ - -#include "testC.h" -#include "tao/RTCORBA/RTCORBA.h" -#include "ace/Get_Opt.h" - -const char *ior1 = "file://test1.ior"; -const char *ior2 = "file://test2.ior"; - -int -parse_args (int argc, char *argv[]) -{ - ACE_Get_Opt get_opts (argc, argv, "o:p:"); - int c; - - while ((c = get_opts ()) != -1) - switch (c) - { - case 'o': - ior1 = get_opts.opt_arg (); - break; - case 'p': - ior2 = get_opts.opt_arg (); - break; - case '?': - default: - ACE_ERROR_RETURN ((LM_ERROR, - "usage: %s " - "-o <ior1> " - "-p <ior2> " - "\n", - argv [0]), - -1); - } - - return 0; -} - -int -check_for_nil (CORBA::Object_ptr obj, const char *msg) -{ - if (CORBA::is_nil (obj)) - ACE_ERROR_RETURN ((LM_ERROR, - "ERROR: Object reference <%s> is nil\n", - msg), - -1); - else - return 0; -} - -int -main (int argc, char *argv[]) -{ - ACE_TRY_NEW_ENV - { - // Initialize the ORB, resolve references and parse arguments. - - // ORB. - CORBA::ORB_var orb = - CORBA::ORB_init (argc, argv, "" ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - // Parse arguments. - if (parse_args (argc, argv) != 0) - return -1; - - // RTORB. - CORBA::Object_var object = - orb->resolve_initial_references ("RTORB" ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - RTCORBA::RTORB_var rt_orb = RTCORBA::RTORB::_narrow (object.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - if (check_for_nil (rt_orb.in (), "RTORB") == -1) - return -1; - - // PolicyCurrent. - object = orb->resolve_initial_references ("PolicyCurrent" - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - CORBA::PolicyCurrent_var policy_current = - CORBA::PolicyCurrent::_narrow (object.in () ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - if (check_for_nil (policy_current.in (), "PolicyCurrent") - == -1) - return -1; - - // Test object 1. - object = orb->string_to_object (ior1 ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - Test_var server1 = Test::_narrow (object.in () ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - if (check_for_nil (server1.in (), "server1") == -1) - return -1; - - // Test object 2. - object = orb->string_to_object (ior2 ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - Test_var server2 = Test::_narrow (object.in () ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - if (check_for_nil (server2.in (), "server2") == -1) - return -1; - - // Make four invocations on test objects. Expected: connection - // established on the first invocation, and reused in the - // following three. - ACE_DEBUG ((LM_DEBUG, - "\n Invocation 1 --> new connection\n")); - server1->test_method (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - ACE_DEBUG ((LM_DEBUG, - "\n Invocation 2 --> use connection from invocation 1\n")); - server2->test_method (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - ACE_DEBUG ((LM_DEBUG, - "\n Invocation 3 --> use connection from invocation 1\n")); - server1->test_method (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - ACE_DEBUG ((LM_DEBUG, - "\n Invocation 4 --> use connection from invocation 1\n")); - server2->test_method (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - // Set RTCORBA::PrivateConnectionPolicy on PolicyCurrent. - CORBA::PolicyList policy_list; - policy_list.length (1); - policy_list[0] = - rt_orb->create_private_connection_policy (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - policy_current->set_policy_overrides (policy_list, - CORBA::SET_OVERRIDE - ACE_ENV_ARG_PARAMETER); - - // Make four invocations on test objects again. This time, - // since RTCORBA::PrivateConnectionPolicy is set, we expect a - // connection to be established for <server1> during the first - // invocation, a connection to be established for <server2> during - // the second invocation, <server1>'s connection reused on - // third, and <server2>'s reused on fourth. - ACE_DEBUG ((LM_DEBUG, - "\n Invocation 5 --> new connection\n")); - server1->test_method (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - ACE_DEBUG ((LM_DEBUG, - "\n Invocation 6 --> new connection\n")); - server2->test_method (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - ACE_DEBUG ((LM_DEBUG, - "\n Invocation 7 --> use connection from invocation 5\n")); - server1->test_method (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - ACE_DEBUG ((LM_DEBUG, - "\n Invocation 8 --> use connection from invocation 6\n")); - server2->test_method (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - // Testing over. Shut down Server ORB. - ACE_DEBUG ((LM_DEBUG, - "\n Testing over - shutting down\n")); - server1->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, - "Unexpected exception caught in Private_Connection test client:"); - return -1; - } - ACE_ENDTRY; - - return 0; -} diff --git a/TAO/tests/RTCORBA/Private_Connection/run_test.pl b/TAO/tests/RTCORBA/Private_Connection/run_test.pl deleted file mode 100755 index 537c5b0fca6..00000000000 --- a/TAO/tests/RTCORBA/Private_Connection/run_test.pl +++ /dev/null @@ -1,55 +0,0 @@ -eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' - & eval 'exec perl -S $0 $argv:q' - if 0; - -# $Id$ -# -*- perl -*- - -use lib '../../../../bin'; -use PerlACE::Run_Test; - -$status = 0; - -$iorfile1 = PerlACE::LocalFile ("test1.ior"); -$iorfile2 = PerlACE::LocalFile ("test2.ior"); - -unlink $iorfile1; -unlink $iorfile2; - -print STDERR "\n********** RTCORBA Private Connection Unit Test\n\n"; - -if (PerlACE::is_vxworks_test()) { - $SV = new PerlACE::ProcessVX ("server", "-o test1.ior -p test2.ior"); -} -else { - $SV = new PerlACE::Process ("server", "-o $iorfile1 -p $iorfile2"); -} -$CL = new PerlACE::Process ("client", "-o file://$iorfile1 -p file://$iorfile2 -ORBdebuglevel 3 "); - -$SV->Spawn (); - -if (PerlACE::waitforfile_timed ($iorfile2, 10) == -1) -{ - print STDERR "ERROR: cannot find file <$iorfile2>\n"; - $SV->Kill (); - exit 1; -} - -$client = $CL->SpawnWaitKill (60); - -if ($client != 0) { - print STDERR "ERROR: client returned $client\n"; - $status = 1; -} - -$server = $SV->WaitKill (60); - -if ($server != 0) { - print STDERR "ERROR: server returned $server \n"; - $status = 1; -} - -unlink $iorfile1; -unlink $iorfile2; - -exit $status; diff --git a/TAO/tests/RTCORBA/Private_Connection/server.cpp b/TAO/tests/RTCORBA/Private_Connection/server.cpp deleted file mode 100644 index 07a844b3abb..00000000000 --- a/TAO/tests/RTCORBA/Private_Connection/server.cpp +++ /dev/null @@ -1,211 +0,0 @@ -// $Id$ - -#include "testS.h" -#include "tao/RTCORBA/RTCORBA.h" -#include "tao/RTPortableServer/RTPortableServer.h" -#include "ace/Get_Opt.h" -#include "ace/OS_NS_stdio.h" - -class Test_i : public POA_Test -{ - // = TITLE - // An implementation for the Test interface in test.idl - // -public: - Test_i (CORBA::ORB_ptr orb); - // ctor - - // = The Test methods. - void test_method (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)); - - void shutdown (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)); - -private: - CORBA::ORB_var orb_; - // The ORB -}; - -Test_i::Test_i (CORBA::ORB_ptr orb) - : orb_ (CORBA::ORB::_duplicate (orb)) -{ -} - -void -Test_i::test_method (ACE_ENV_SINGLE_ARG_DECL_NOT_USED/* ACE_ENV_SINGLE_ARG_PARAMETER */) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - ACE_DEBUG ((LM_DEBUG, - "Server: test_method invoked.\n")); -} - -void -Test_i::shutdown (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - this->orb_->shutdown (0 ACE_ENV_ARG_PARAMETER); -} - -//************************************************************************* - -const char *ior_output_file1 = "test1.ior"; -const char *ior_output_file2 = "test2.ior"; - -// Parse command-line arguments. -int -parse_args (int argc, char *argv[]) -{ - ACE_Get_Opt get_opts (argc, argv, "o:p:"); - int c; - - while ((c = get_opts ()) != -1) - switch (c) - { - case 'o': - ior_output_file1 = get_opts.opt_arg (); - break; - - case 'p': - ior_output_file2 = get_opts.opt_arg (); - break; - - case '?': - default: - ACE_ERROR_RETURN ((LM_ERROR, - "usage: %s " - "-o <iorfile1>" - "-p <iorfile2>" - "\n", - argv [0]), - -1); - } - - return 0; -} - -int -check_for_nil (CORBA::Object_ptr obj, const char *msg) -{ - if (CORBA::is_nil (obj)) - ACE_ERROR_RETURN ((LM_ERROR, - "ERROR: Object reference <%s> is nil\n", - msg), - -1); - else - return 0; -} - -int -create_object (PortableServer::POA_ptr poa, - CORBA::ORB_ptr orb, - Test_i *server_impl, - const char *filename - ACE_ENV_ARG_DECL) -{ - // Register with poa. - PortableServer::ObjectId_var id = - poa->activate_object (server_impl ACE_ENV_ARG_PARAMETER); - - ACE_CHECK_RETURN (-1); - - CORBA::Object_var server = - poa->id_to_reference (id.in () - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); - - // Print out the IOR. - CORBA::String_var ior = - orb->object_to_string (server.in () ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); - - ACE_DEBUG ((LM_DEBUG, "<%s>\n\n", ior.in ())); - - // Print ior to the file. - if (filename != 0) - { - FILE *output_file= ACE_OS::fopen (filename, "w"); - if (output_file == 0) - ACE_ERROR_RETURN ((LM_ERROR, - "Cannot open output file for writing IOR: %s", - filename), - -1); - ACE_OS::fprintf (output_file, "%s", ior.in ()); - ACE_OS::fclose (output_file); - } - - return 0; -} - -int -main (int argc, char *argv[]) -{ - ACE_TRY_NEW_ENV - { - // ORB. - CORBA::ORB_var orb = - CORBA::ORB_init (argc, argv, "" ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - // Parse arguments. - if (parse_args (argc, argv) != 0) - return -1; - - // RootPOA. - CORBA::Object_var object = - orb->resolve_initial_references("RootPOA" ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - PortableServer::POA_var root_poa = - PortableServer::POA::_narrow (object.in () ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - if (check_for_nil (root_poa.in (), "RootPOA") == -1) - return -1; - - // POAManager. - PortableServer::POAManager_var poa_manager = - root_poa->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - // Servants. - Test_i server_impl1 (orb.in ()); - Test_i server_impl2 (orb.in ()); - - // Create Objects. - int result; - result = create_object (root_poa.in (), - orb.in (), - &server_impl1, - ior_output_file1 - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - if (result == -1) - return -1; - - result = create_object (root_poa.in (), - orb.in (), - &server_impl2, - ior_output_file2 - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - if (result == -1) - return -1; - - // Run ORB Event loop. - poa_manager->activate (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - orb->run (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - ACE_DEBUG ((LM_DEBUG, "Server ORB event loop finished\n")); - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, - "Unexpected exception caught in Private_Connection test server:"); - return -1; - } - ACE_ENDTRY; - - return 0; -} diff --git a/TAO/tests/RTCORBA/Private_Connection/test.idl b/TAO/tests/RTCORBA/Private_Connection/test.idl deleted file mode 100644 index b50f6cfef47..00000000000 --- a/TAO/tests/RTCORBA/Private_Connection/test.idl +++ /dev/null @@ -1,12 +0,0 @@ -// -// $Id$ -// - -interface Test -{ - void test_method (); - // Print out a message. - - oneway void shutdown (); - // Shut down the ORB. -}; |