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/Collocation_Opportunities | |
parent | 0e555b9150d38e3b3473ba325b56db2642e6352b (diff) | |
download | ATCD-6b846cf03c0bcbd8c276cb0af61a181e5f98eaae.tar.gz |
Repo restructuring
Diffstat (limited to 'TAO/tests/Collocation_Opportunities')
7 files changed, 0 insertions, 397 deletions
diff --git a/TAO/tests/Collocation_Opportunities/.cvsignore b/TAO/tests/Collocation_Opportunities/.cvsignore deleted file mode 100644 index 3189327922a..00000000000 --- a/TAO/tests/Collocation_Opportunities/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -Collocation_Opportunities diff --git a/TAO/tests/Collocation_Opportunities/Collocation_Opportunities.cpp b/TAO/tests/Collocation_Opportunities/Collocation_Opportunities.cpp deleted file mode 100644 index 28aa663f7aa..00000000000 --- a/TAO/tests/Collocation_Opportunities/Collocation_Opportunities.cpp +++ /dev/null @@ -1,326 +0,0 @@ -// $Id$ - -#include "testS.h" -#include "ace/Task.h" -#include "tao/PortableServer/Object_Adapter.h" -#include "tao/PortableServer/POA_Current.h" -#include "tao/PortableServer/POA_Current_Impl.h" - -ACE_RCSID(Collocation_Opportunities, Collocation_Opportunities, "$Id$") - -class test_i : - public POA_test -{ -public: - - test_i (CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa - ACE_ENV_ARG_DECL); - - void set_other (test_ptr test); - - void method (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - PortableServer::POA_ptr _default_POA (ACE_ENV_SINGLE_ARG_DECL); - - CORBA::ORB_var orb_; - - PortableServer::POA_var poa_; - - test_var other_; - - PortableServer::Current_var poa_current_; -}; - -test_i::test_i (CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa - ACE_ENV_ARG_DECL) - : orb_ (CORBA::ORB::_duplicate (orb)), - poa_ (PortableServer::POA::_duplicate (poa)) -{ - CORBA::Object_var object; - - object = - this->orb_->resolve_initial_references ("POACurrent" - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - this->poa_current_ = - PortableServer::Current::_narrow (object.in () - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; -} - -void -test_i::set_other (test_ptr test) -{ - this->other_ = test::_duplicate (test); -} - -void -test_i::method (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - if (this->other_.in () != test::_nil ()) - { - this->other_->method (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - } - else - { - TAO::Portable_Server::POA_Current &tao_poa_current = - dynamic_cast <TAO::Portable_Server::POA_Current &> - (*(this->poa_current_.in ())); - - TAO::Portable_Server::POA_Current_Impl &tao_poa_current_implementation = - *tao_poa_current.implementation (); - - const char *upcall = 0; - if (tao_poa_current_implementation.previous ()) - upcall = "collocated"; - else - upcall = "remote"; - - PortableServer::ObjectId_var id = - this->poa_current_->get_object_id (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - CORBA::String_var id_string = - PortableServer::ObjectId_to_string (id.in ()); - - ACE_DEBUG ((LM_DEBUG, - "%s method() invoked for %s servant in thread %t\n", - upcall, - id_string.in ())); - } -} - -PortableServer::POA_ptr -test_i::_default_POA (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) -{ - return PortableServer::POA::_duplicate (this->poa_.in ()); -} - -class Task : public ACE_Task_Base -{ -public: - - Task (CORBA::ORB_ptr orb); - - int svc (void); - - CORBA::ORB_var orb_; - -}; - -Task::Task (CORBA::ORB_ptr orb) - : orb_ (CORBA::ORB::_duplicate (orb)) -{ -} - -int -Task::svc (void) -{ - ACE_TRY_NEW_ENV - { - this->orb_->run (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - } - ACE_ENDTRY; - - return 0; -} - -int -main (int argc, char *argv[]) -{ - ACE_TRY_NEW_ENV - { - CORBA::ORB_var orb = - CORBA::ORB_init (argc, - argv, - 0 - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - 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; - - PortableServer::POAManager_var poa_manager = - root_poa->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - poa_manager->activate (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - Task task (orb.in ()); - - int result = - task.activate (); - ACE_ASSERT (result != -1); - ACE_UNUSED_ARG (result); - - CORBA::PolicyList policies (1); - policies.length (1); - - policies[0] = - root_poa->create_id_assignment_policy (PortableServer::USER_ID - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - PortableServer::POA_var child_poa = - root_poa->create_POA ("child_poa", - poa_manager.in (), - policies - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - test_i *base_servant = - new test_i (orb.in (), - child_poa.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - PortableServer::ServantBase_var safe_base_servant (base_servant); - - PortableServer::ObjectId_var base_oid = - PortableServer::string_to_ObjectId ("base"); - - child_poa->activate_object_with_id (base_oid.in (), - base_servant - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - test_var base_test = - base_servant->_this (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - test_i *first_servant = - new test_i (orb.in (), - child_poa.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - PortableServer::ServantBase_var safe_first_servant (first_servant); - - PortableServer::ObjectId_var first_oid = - PortableServer::string_to_ObjectId ("first"); - - child_poa->activate_object_with_id (first_oid.in (), - first_servant - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - test_var first_test = - first_servant->_this (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - base_servant->set_other (first_test.in ()); - - base_test->method (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - PortableServer::ObjectId_var second_oid = - PortableServer::string_to_ObjectId ("second"); - - object = - child_poa->create_reference_with_id (second_oid.in (), - "IDL:test:1.0" - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - test_var second_test = - test::_narrow (object.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - test_i *second_servant = - new test_i (orb.in (), - child_poa.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - PortableServer::ServantBase_var safe_second_servant (second_servant); - - child_poa->activate_object_with_id (second_oid.in (), - second_servant - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - base_servant->set_other (second_test.in ()); - - base_test->method (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - PortableServer::ObjectId_var third_oid = - PortableServer::string_to_ObjectId ("third"); - - object = - child_poa->create_reference_with_id (third_oid.in (), - "IDL:test:1.0" - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - CORBA::String_var third_ior = - orb->object_to_string (object.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - object = - orb->string_to_object (third_ior.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - test_var third_test = - test::_narrow (object.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - test_i *third_servant = - new test_i (orb.in (), - child_poa.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - PortableServer::ServantBase_var safe_third_servant (third_servant); - - child_poa->activate_object_with_id (third_oid.in (), - third_servant - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - base_servant->set_other (third_test.in ()); - - base_test->method (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - orb->shutdown (1 - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - result = - task.wait (); - ACE_ASSERT (result != -1); - ACE_UNUSED_ARG (result); - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, - "Caught exception:"); - return -1; - } - ACE_ENDTRY; - - return 0; -} diff --git a/TAO/tests/Collocation_Opportunities/Collocation_Opportunities.mpc b/TAO/tests/Collocation_Opportunities/Collocation_Opportunities.mpc deleted file mode 100644 index 6abbe5ef004..00000000000 --- a/TAO/tests/Collocation_Opportunities/Collocation_Opportunities.mpc +++ /dev/null @@ -1,6 +0,0 @@ -// -*- MPC -*- -// $Id$ - -project(Collocation Opportunities): taoserver { - exename = Collocation_Opportunities -} diff --git a/TAO/tests/Collocation_Opportunities/README b/TAO/tests/Collocation_Opportunities/README deleted file mode 100644 index b5a02b94815..00000000000 --- a/TAO/tests/Collocation_Opportunities/README +++ /dev/null @@ -1,30 +0,0 @@ -# $Id$ - -Description: - -A test for making sure the ORB avails all collocation opportunities it -is presented with. - -This test has three collocated objects. The first object is -collocated since the POA created this object and marked it -collocated. In addition, endpoints in the object reference match the -local endpoints and the servant is available. - -The second object is collocated since the POA created this object and -marked it collocated. In addition, endpoints in the object reference -match the local endpoints even though the servant is not available at -the time the object was created. - -The third object is collocated even though the collocated flag set by -the POA was lost when the second object was converted into a string -and then back. Endpoints in the object reference match the local -endpoints even though the servant is not available at the time the -object was created. - -This test checks for POA currents to see if an upcall was collocated -or remote. If remote, there will be only one POA current since the -upcall will be handled by ORB Task thread. We ensure that the main -thread does not handle the upcall by setting the -ORBClientConnectionHandler option to RW. If collocated, there will be -a <previous> POA current since the first POA current would be setup -with a call to the <base> servant. diff --git a/TAO/tests/Collocation_Opportunities/run_test.pl b/TAO/tests/Collocation_Opportunities/run_test.pl deleted file mode 100755 index bb3e5277ea9..00000000000 --- a/TAO/tests/Collocation_Opportunities/run_test.pl +++ /dev/null @@ -1,25 +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; - -if (PerlACE::is_vxworks_test()) { - $T = new PerlACE::ProcessVX ("Collocation_Opportunities"); -} -else { - $T = new PerlACE::Process ("Collocation_Opportunities"); -} - -$test = $T->SpawnWaitKill (60); - -if ($test != 0) { - print STDERR "ERROR: test returned $test\n"; - exit 1; -} - -exit 0; diff --git a/TAO/tests/Collocation_Opportunities/svc.conf b/TAO/tests/Collocation_Opportunities/svc.conf deleted file mode 100644 index 6e589381660..00000000000 --- a/TAO/tests/Collocation_Opportunities/svc.conf +++ /dev/null @@ -1 +0,0 @@ -static Client_Strategy_Factory "-ORBClientConnectionHandler RW" diff --git a/TAO/tests/Collocation_Opportunities/test.idl b/TAO/tests/Collocation_Opportunities/test.idl deleted file mode 100644 index 41f0d3e8e94..00000000000 --- a/TAO/tests/Collocation_Opportunities/test.idl +++ /dev/null @@ -1,8 +0,0 @@ -// -// $Id$ -// - -interface test -{ - void method (); -}; |