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/Client_Protocol | |
parent | 0e555b9150d38e3b3473ba325b56db2642e6352b (diff) | |
download | ATCD-6b846cf03c0bcbd8c276cb0af61a181e5f98eaae.tar.gz |
Repo restructuring
Diffstat (limited to 'TAO/tests/RTCORBA/Client_Protocol')
-rw-r--r-- | TAO/tests/RTCORBA/Client_Protocol/.cvsignore | 2 | ||||
-rw-r--r-- | TAO/tests/RTCORBA/Client_Protocol/README | 141 | ||||
-rw-r--r-- | TAO/tests/RTCORBA/Client_Protocol/RTCORBA_Client_Protocol.mpc | 17 | ||||
-rw-r--r-- | TAO/tests/RTCORBA/Client_Protocol/client.cpp | 269 | ||||
-rwxr-xr-x | TAO/tests/RTCORBA/Client_Protocol/run_test.pl | 78 | ||||
-rw-r--r-- | TAO/tests/RTCORBA/Client_Protocol/server.cpp | 255 | ||||
-rw-r--r-- | TAO/tests/RTCORBA/Client_Protocol/svc.conf | 3 | ||||
-rw-r--r-- | TAO/tests/RTCORBA/Client_Protocol/svc.conf.xml | 6 | ||||
-rw-r--r-- | TAO/tests/RTCORBA/Client_Protocol/test.idl | 13 |
9 files changed, 0 insertions, 784 deletions
diff --git a/TAO/tests/RTCORBA/Client_Protocol/.cvsignore b/TAO/tests/RTCORBA/Client_Protocol/.cvsignore deleted file mode 100644 index f2ad85300eb..00000000000 --- a/TAO/tests/RTCORBA/Client_Protocol/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -client -server diff --git a/TAO/tests/RTCORBA/Client_Protocol/README b/TAO/tests/RTCORBA/Client_Protocol/README deleted file mode 100644 index 6f377eb2bd5..00000000000 --- a/TAO/tests/RTCORBA/Client_Protocol/README +++ /dev/null @@ -1,141 +0,0 @@ -$Id$ - -This is a unit test for RTCORBA::ClientProtocolPolicy. - -Description: ---------- -This test consists of five mini-tests, each exercising -ClientProtocolPolicy in a different configuration: - -1. Invoke an operation on the object that had ClientProtocolPolicy set - on the server side. Make sure the protocol dictated by the policy is - used for communication. - -2. Set ORB-level ClientProtocolPolicy override on the client ORB, and - invoke an operation on an object that had ClientProtocolPolicy set - on the server side. Should receive CORBA::INV_POLICY exception - since the policy is set on both client and server sides. - -3. Set ORB-level ClientProtocolPolicy override on the client ORB, and - invoke an operation on an object that did *not* have - ClientProtocolPolicy set on the server side. Make sure the - protocol dictated by the policy override is used for communication. - -4. Set ClientProtocolPolicy override on the Current level in the - client ORB, and invoke an operation on an object that did *not* - have ClientProtocolPolicy set on the server. The override value is - a sequence of protocols none of which are available in the server - ORB. Should receive CORBA::INV_POLICY exception since none of the - protocols specified in the policy are available for communication. - -5. Set ClientProtocolPolicy override on the Current level in the - client ORB, and invoke an operation on an object that did *not* - have ClientProtocolPolicy set on the server. The override value is - a sequence of two protocols, in which the first protocol isn't - available in the server ORB, and the second protocol is available - in both client and server ORBs. Make sure the second protocol - specified in the override is used for communication. - - -Scenario: - -The server creates two objects: one with ClientProtocolPolicy set and -the other one without the policy being set. The value of the -ClientProtocolPolicy is a single protocol specified using server -command-line option (see Options section below). The client obtains -two object references and uses them to run five tests decribed -above. Finally, the client invokes <shutdown> method on the server to -terminate the processes. - -To run (on Unix): -------- -$./server [-s <ior_output_file1> -c <ior_output_file2> -p <profile_id>] -$./client [-s <ior1> -c <ior2> -p <profile_id>] -ORBdebuglevel 1 - - -Options: --------- - Server: - --s <ior_output_file1> Default: test1.ior - Filename for output of IOR for the object that - had ClientProtocolPolicy set on the server. - --c <ior_output_file2> Default: test2.ior - Filename for output of IOR for the object that - did not have ClientProtocolPolicy set on the - server. - --p <profile_id> Default: 0 (IIOP) - Protocol used as a ClientProtocolPolicy value - for one of the server's objects. - - Client: - --s <ior_output_file1> Default: file://test1.ior - IOR for the object that had - ClientProtocolPolicy set on the server. - --c <ior_output_file2> Default: file://test2.ior - IOR for the object that did not have - ClientProtocolPolicy set on the server. - --p <profile_id> Default: 0 (IIOP) - Protocol used as a ClientProtocolPolicy value - on the client. - --ORBdebuglevel 1 Recommended ORB option for the client in order to see - which protocols are being used in each - mini-test for client-server communication. - - - -Expected output: ----------------- -Test 1: invocation should succeed using the protocol specified with - <-p> option to the server. -Tests 2 and 4: should produce INV_POLICY exception. -Tests 3 and 5: invocation should succeed using the protocol specified - with <-p> option to the client. - -Below is the expected output from run_test.pl on a Unix platform. See -run_test.pl for command-line options used for client and server. -NOTE: expected output differs on windows due to UIOP not being -available. - - -********** RTCORBA Client Protocol Policy Unit Test - - -Activated object one as <IOR:000000000000000d49444c3a546573743a312e30000000000000000012000010200000000116163652e63732e777573746c2e6564750000c62d00000023439e940eb000e405a000000010000000100000000000000010000000100000000040000000000054414f000000000100000014000000000001000100000000000101090000000054414f0200000000004000000116163652e63732e777573746c2e6564750000c62d00000000000000116167573746c2e6564750000c62d00000000000000116163652e63732e777573746c2e656475000000000126163652e646f632e777573746c2e65647500c62d0000000000000002000000240000041000500000014000000000000000154414f00000100000001000054414f00000000d0000102661722f746d702f54414f414141514d614f53580000000000002314010f004e535439e940eb00100000001000000000000000100000001000000000400000000000000080000000054414f00014000000000001000100000000000101090000000054414f020000002400000000000000010722f746d702f54414f414141514d614f535800000000000002000000240000000000000001544000000000000000154414f00000100000001000054414f02000000cc00010200000000116167573746c2e6564750061c62e0000002314010f004e535439e940eb000e405a000000010000000000100000001000000000400000000000000080000000054414f00000000010000001400000000000000101090000000054414f02000000220000000000000001000000116163652e63732e564750000c62e00004f5300000002000000240000000000000001544100050000001400000004f000001000000010000> - - -Activated object two as <IOR:000000000000000d49444c3a546573743a312e3000000000000000000ea00010200000000116163652e63732e777573746c2e6564750000c62d0000001b439e940eb000e257a000000000000000100000001000000000300000000000000080000000050100000014000000000001000100000000000101090000000054414f0200000076000000000016163652e63732e777573746c2e6564750000c62d00000000000000116163652e63732e777570009c62d0000cb40000000116163652e63732e777573746c2e6564750000c62d00000000000046f632e777573746c2e65647500c62d0000000054414f000000009c00010200000000162f76654414f414141514d614f535800001b0000001b14010f0052535439e940eb000e257a00000000001030000000300000000000000080000000054414f00000000010000001400000000000100001090000000054414f02000000240000000000000001000000162f7661722f746d702f54414ff535800000054414f020000009600010200000000116163652e63732e777573746c2e65647501b14010f0052535439e940eb000e257a00000000000000010000000100000000030000000000054414f000000000100000014000000000001000100000000000101090000000054414f0200000000001000000116163652e63732e777573746c2e6564750063c62e0000> - -TAO (25450|1) Loaded default protocol <IIOP_Factory> -TAO (25450|1) Loaded default protocol <UIOP_Factory> -TAO (25450|1) Loaded default protocol <SHMIOP_Factory> - - Test 1 -TAO (25450|1) Connector::connect - looking for UIOP connection. -TAO (25450|1) UIOP connection to server <> on 8 -Test method invoked on the sever - - Test 2 -INV_POLICY exception is caught as expected. - - Test 3 -TAO (25450|1) Connector::connect - looking for SHMIOP connection. -TAO (25450|1) SHMIOP connection to server <127.0.0.1:50734> on 9 -Test method invoked on the sever - - Test 4 -INV_POLICY exception is caught as expected. - - Test 5 -TAO (25450|1) Connector::connect - looking for SHMIOP connection. -Test method invoked on the sever - - Testing over -TAO (25450|1) Connector::connect - looking for SHMIOP connection. -Server ORB event loop finished diff --git a/TAO/tests/RTCORBA/Client_Protocol/RTCORBA_Client_Protocol.mpc b/TAO/tests/RTCORBA/Client_Protocol/RTCORBA_Client_Protocol.mpc deleted file mode 100644 index e51a077e7fe..00000000000 --- a/TAO/tests/RTCORBA/Client_Protocol/RTCORBA_Client_Protocol.mpc +++ /dev/null @@ -1,17 +0,0 @@ -// -*- MPC -*- -// $Id$ - -project(*Server): strategies, rt_server { - Source_Files { - server.cpp - } -} - -project(*Client): strategies, rt_client { - after += *Server - Source_Files { - testC.cpp - client.cpp - } -} - diff --git a/TAO/tests/RTCORBA/Client_Protocol/client.cpp b/TAO/tests/RTCORBA/Client_Protocol/client.cpp deleted file mode 100644 index 2ef31055c8f..00000000000 --- a/TAO/tests/RTCORBA/Client_Protocol/client.cpp +++ /dev/null @@ -1,269 +0,0 @@ -// $Id$ - -#include "testC.h" -#include "ace/Get_Opt.h" -#include "ace/OS_NS_unistd.h" -#include "tao/RTCORBA/RTCORBA.h" - -#include "tao/Strategies/advanced_resource.h" - -const char *ior1 = "file://test1.ior"; -const char *ior2 = "file://test2.ior"; -CORBA::ULong protocol_type = 0; - -int -parse_args (int argc, char *argv[]) -{ - ACE_Get_Opt get_opts (argc, argv, "s:c:p:"); - int c, result; - - while ((c = get_opts ()) != -1) - switch (c) - { - case 's': - ior1 = get_opts.opt_arg (); - break; - case 'c': - ior2 = get_opts.opt_arg (); - break; - case 'p': - result = ::sscanf (get_opts.opt_arg (), - "%u", - &protocol_type); - if (result == 0 || result == EOF) - ACE_ERROR_RETURN ((LM_ERROR, - "Unable to process <-p> option"), - -1); - break; - case '?': - default: - ACE_ERROR_RETURN ((LM_ERROR, - "usage: %s " - "-s <ior> " - "-c <ior> " - "-p <protocol_type> " - "\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; -} - -void -exception_test (Test_ptr server, - const char *msg - ACE_ENV_ARG_DECL) -{ - ACE_TRY - { - server->test_method (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCH (CORBA::INV_POLICY, ex) - { - ACE_DEBUG ((LM_DEBUG, - "INV_POLICY exception is caught as expected.\n")); - } - ACE_CATCHANY - { - ACE_DEBUG ((LM_DEBUG, msg)); - ACE_RE_THROW; - } - ACE_ENDTRY; - ACE_CHECK; -} - -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; - - // PolicyManager. - object = orb->resolve_initial_references ("ORBPolicyManager" - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - CORBA::PolicyManager_var policy_manager = - CORBA::PolicyManager::_narrow (object.in () ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - if (check_for_nil (policy_manager.in (), "PolicyManager") - == -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 (ClientProtocolPolicy set on server). - 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 (no client-exposed ClientProtocolPolicy). - 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; - - // Do testing. - - // Test 1: Invoke operation on the object that has - // ClientProtocolPolicy set on the server side. - ACE_DEBUG ((LM_DEBUG, - "\n Test 1\n")); - server1->test_method (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - // Test 2: Set the ORB-level ClientProtocolPolicy override, and - // attempt the same invocation again. Should get - // CORBA::INV_POLICY exception since the policy is set on both - // client and server sides. - ACE_DEBUG ((LM_DEBUG, - "\n Test 2\n")); - RTCORBA::ProtocolList protocols; - protocols.length (1); - protocols[0].protocol_type = protocol_type; - protocols[0].transport_protocol_properties = - RTCORBA::ProtocolProperties::_nil (); - protocols[0].orb_protocol_properties = - RTCORBA::ProtocolProperties::_nil (); - - CORBA::PolicyList policy_list; - policy_list.length (1); - policy_list[0] = - rt_orb->create_client_protocol_policy (protocols - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - policy_manager->set_policy_overrides (policy_list, - CORBA::SET_OVERRIDE - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - exception_test (server1.in (), - "ERROR: Test 2 failed\n" ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - // Test 3: Attempt the invocation on the second object reference - // (the one that didn't have ClientProtocolPolicy set on the - // server side). This should succeed since there are no - // conflicts. - ACE_DEBUG ((LM_DEBUG, - "\n Test 3\n")); - server2->test_method (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - // Test 4: Override ClientProtocolPolicy on the Current level. - // For the override value, use the sequence of protocols, none - // of which are available in the server ORB. Attempt an - // invocation on the second object. Should get - // CORBA::INV_POLICY exception since none of the protocols - // specified in the policy are available. - ACE_DEBUG ((LM_DEBUG, - "\n Test 4\n")); - // Hardcode a sequence of nonexistent protocols. - protocols.length (3); - protocols[0].protocol_type = 3; - protocols[1].protocol_type = 4; - protocols[2].protocol_type = 5; - policy_list[0] = - rt_orb->create_client_protocol_policy (protocols - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - policy_current->set_policy_overrides (policy_list, - CORBA::SET_OVERRIDE - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - exception_test (server2.in (), - "ERROR: Test 4 failed\n" ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - // Test 5: Override ClientProtocolPolicy on the Current level - // again. This time use the sequence in which the first - // protocol isn't available and the second one is. The - // invocation should succeed through using the second protocol. - ACE_DEBUG ((LM_DEBUG, - "\n Test 5\n")); - protocols.length (2); - protocols[0].protocol_type = 3; - protocols[1].protocol_type = protocol_type; - policy_list[0] = - rt_orb->create_client_protocol_policy (protocols - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - policy_current->set_policy_overrides (policy_list, - CORBA::SET_OVERRIDE - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - server2->test_method (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - // Testing over. Shut down server ORB. - ACE_DEBUG ((LM_DEBUG, - "\n Testing over\n")); - server2->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - // Needed for SHMIOP to work fine. Please dont remove. Please - // see Bug 1197 for details. - ACE_OS::sleep (5); - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, - "Unexpected exception caught in ClientProtocolPolicy test client:"); - return -1; - } - ACE_ENDTRY; - - return 0; -} diff --git a/TAO/tests/RTCORBA/Client_Protocol/run_test.pl b/TAO/tests/RTCORBA/Client_Protocol/run_test.pl deleted file mode 100755 index 9b548f0ff8b..00000000000 --- a/TAO/tests/RTCORBA/Client_Protocol/run_test.pl +++ /dev/null @@ -1,78 +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 Client Protocol Policy Unit Test\n\n"; - -# Arguments are platform-dependent (UIOP not available on Windows). -$server_args = - (PerlACE::is_vxworks_test() ? "" : (($^O eq "MSWin32") ? "-p 1413566210 " : "-p 1413566208 ")) - ."-ORBendpoint iiop:// " - .(PerlACE::is_vxworks_test() ? "" : "-ORBendpoint shmiop:// ") - .(($^O eq "MSWin32") ? "" : "-ORBEndpoint uiop:// "); -$client_args = - "-s file://$iorfile1 -c file://$iorfile2 " - .(($^O eq "MSWin32") ? "" : "-p 1413566210 ") - ."-ORBdebuglevel 1 "; - -#if ($^O eq "MSWin32") { -# $server_args = -# "-p 1413566210 " -# ."-ORBendpoint iiop:// -ORBendpoint shmiop:// "; -# $client_args = -# "-s file://$iorfile1 -c file://$iorfile2 -ORBdebuglevel 1"; -#} - -# Start server. -if (PerlACE::is_vxworks_test()) { - $SV = new PerlACE::ProcessVX ("server", "-s test1.ior -c test2.ior $server_args"); -} -else { - $SV = new PerlACE::Process ("server", "-s $iorfile1 -c $iorfile2 $server_args"); -} -$CL = new PerlACE::Process ("client", $client_args); - -$SV->Spawn (); - -if (PerlACE::waitforfile_timed ($iorfile2, $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find file <$iorfile2>\n"; - $SV->Kill (); - exit 1; -} - -# Start client. -$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; - -# Clean up SHMIOP files -PerlACE::check_n_cleanup_files ("server_shmiop_*"); - -exit $status; diff --git a/TAO/tests/RTCORBA/Client_Protocol/server.cpp b/TAO/tests/RTCORBA/Client_Protocol/server.cpp deleted file mode 100644 index 6b4cc59125f..00000000000 --- a/TAO/tests/RTCORBA/Client_Protocol/server.cpp +++ /dev/null @@ -1,255 +0,0 @@ -// $Id$ - -#include "testS.h" -#include "ace/Get_Opt.h" -#include "tao/RTCORBA/RTCORBA.h" -#include "tao/RTCORBA/RT_Policy_i.h" -#include "tao/RTPortableServer/RTPortableServer.h" -#include "tao/Strategies/advanced_resource.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 - - void test_method (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)); - - void shutdown (ACE_ENV_SINGLE_ARG_DECL) - 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, - "Test method invoked on the sever\n")); -} - -void -Test_i::shutdown (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) Shutting down \n")); - this->orb_->shutdown (0 ACE_ENV_ARG_PARAMETER); -} - -//************************************************************************* - -const char *ior_output_file1 = "test1.ior"; -const char *ior_output_file2 = "test2.ior"; -CORBA::ULong protocol_type = 0; - -// Parse command-line arguments. -int -parse_args (int argc, char *argv[]) -{ - ACE_Get_Opt get_opts (argc, argv, "s:c:p:"); - int c, result; - - while ((c = get_opts ()) != -1) - switch (c) - { - case 's': - ior_output_file1 = get_opts.opt_arg (); - break; - - case 'c': - ior_output_file2 = get_opts.opt_arg (); - break; - - case 'p': - result = ::sscanf (get_opts.opt_arg (), - "%u", - &protocol_type); - if (result == 0 || result == EOF) - ACE_ERROR_RETURN ((LM_ERROR, - "Unable to process <-p> option"), - -1); - break; - - case '?': - default: - ACE_ERROR_RETURN ((LM_ERROR, - "usage: %s " - "-s <iorfile> " - "-c <iorfile> " - "-p <protocol_type> " - "\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; - - // 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; - - // RootPOA. - 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; - - // Create child POA with RTCORBA::ClientProtocolPolicy set. - RTCORBA::ProtocolList protocols; - protocols.length (1); - protocols[0].protocol_type = protocol_type; - protocols[0].orb_protocol_properties = - TAO_Protocol_Properties_Factory::create_orb_protocol_property - (protocol_type); - protocols[0].transport_protocol_properties = - TAO_Protocol_Properties_Factory::create_transport_protocol_property - (protocol_type, orb->orb_core ()); - - CORBA::PolicyList poa_policy_list; - poa_policy_list.length (1); - poa_policy_list[0] = - rt_orb->create_client_protocol_policy (protocols - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - PortableServer::POA_var poa = - root_poa->create_POA ("Child_POA", - poa_manager.in (), - poa_policy_list - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - // Servant. - Test_i server_impl (orb.in ()); - - // Create object 1. - int result; - ACE_DEBUG ((LM_DEBUG, "\nActivated object one as ")); - result = create_object (poa.in (), orb.in (), &server_impl, - ior_output_file1 ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - if (result == -1) - return -1; - - // Create object 2. - ACE_DEBUG ((LM_DEBUG, "\nActivated object two as ")); - result = create_object (root_poa.in (), orb.in (), &server_impl, - 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\n")); - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, - "Unexpected exception caught in ClientProtocolPolicy: test server"); - return -1; - } - ACE_ENDTRY; - - return 0; -} diff --git a/TAO/tests/RTCORBA/Client_Protocol/svc.conf b/TAO/tests/RTCORBA/Client_Protocol/svc.conf deleted file mode 100644 index 16b29a6e009..00000000000 --- a/TAO/tests/RTCORBA/Client_Protocol/svc.conf +++ /dev/null @@ -1,3 +0,0 @@ -# Options for SHMIOP protocol -static SHMIOP_Factory "-MMAPFilePrefix server_shmiop" - diff --git a/TAO/tests/RTCORBA/Client_Protocol/svc.conf.xml b/TAO/tests/RTCORBA/Client_Protocol/svc.conf.xml deleted file mode 100644 index 0c3f02e1362..00000000000 --- a/TAO/tests/RTCORBA/Client_Protocol/svc.conf.xml +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version='1.0'?> -<!-- Converted from svc.conf by svcconf-convert.pl --> -<ACE_Svc_Conf> - <!-- Options for SHMIOP protocol --> - <static id="SHMIOP_Factory" params="-MMAPFilePrefix server_shmiop"/> -</ACE_Svc_Conf> diff --git a/TAO/tests/RTCORBA/Client_Protocol/test.idl b/TAO/tests/RTCORBA/Client_Protocol/test.idl deleted file mode 100644 index 4a73b5f42e6..00000000000 --- a/TAO/tests/RTCORBA/Client_Protocol/test.idl +++ /dev/null @@ -1,13 +0,0 @@ -// -// $Id$ -// - -interface Test -{ - void test_method (); - // Test method. - - oneway void shutdown (); - // Shut down the ORB. - -}; |