diff options
author | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2011-10-03 21:02:32 +0000 |
---|---|---|
committer | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2011-10-03 21:02:32 +0000 |
commit | 4dcca24c609008f9fe8a4e01966702b8f4c08e61 (patch) | |
tree | 6bf00b87749636ef3ea7ec22a9b13d4dd2597378 /orbsvcs/tests/Bug_2112_Regression/client.cpp | |
parent | 8c7cc4d18ddf28a18a01fef53aaea68422b2fff2 (diff) | |
download | ATCD-4dcca24c609008f9fe8a4e01966702b8f4c08e61.tar.gz |
Merged version 94552 from main trunk into this branchalt_mapping_SAIC
Diffstat (limited to 'orbsvcs/tests/Bug_2112_Regression/client.cpp')
-rw-r--r-- | orbsvcs/tests/Bug_2112_Regression/client.cpp | 82 |
1 files changed, 45 insertions, 37 deletions
diff --git a/orbsvcs/tests/Bug_2112_Regression/client.cpp b/orbsvcs/tests/Bug_2112_Regression/client.cpp index 64b1aa5d13f..76822cee502 100644 --- a/orbsvcs/tests/Bug_2112_Regression/client.cpp +++ b/orbsvcs/tests/Bug_2112_Regression/client.cpp @@ -9,54 +9,62 @@ int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { int retval = 0; - // Initialise ORB - CORBA::ORB_var Orb = CORBA::ORB_init(argc, argv); + try + { + // Initialise ORB + CORBA::ORB_var Orb = CORBA::ORB_init(argc, argv); - // Set round-trip timeout - const int timeout_secs = 5; + // Set round-trip timeout + const int timeout_secs = 5; - CORBA::Object_var obj = Orb->resolve_initial_references ("ORBPolicyManager"); - CORBA::PolicyManager_var policy_manager = - CORBA::PolicyManager::_narrow (obj.in()); + CORBA::Object_var obj = Orb->resolve_initial_references ("ORBPolicyManager"); + CORBA::PolicyManager_var policy_manager = + CORBA::PolicyManager::_narrow (obj.in()); - CORBA::PolicyList policy_list; - policy_list.length(0); - policy_manager->set_policy_overrides(policy_list, CORBA::SET_OVERRIDE); + CORBA::PolicyList policy_list; + policy_list.length(0); + policy_manager->set_policy_overrides(policy_list, CORBA::SET_OVERRIDE); - TimeBase::TimeT timeout = timeout_secs * 10000000; - CORBA::Any orb_timeout; - orb_timeout <<= timeout; - policy_list.length(1); - policy_list[0] = Orb->create_policy( - Messaging::RELATIVE_RT_TIMEOUT_POLICY_TYPE, orb_timeout); + TimeBase::TimeT timeout = timeout_secs * 10000000; + CORBA::Any orb_timeout; + orb_timeout <<= timeout; + policy_list.length(1); + policy_list[0] = Orb->create_policy( + Messaging::RELATIVE_RT_TIMEOUT_POLICY_TYPE, orb_timeout); - policy_manager->set_policy_overrides(policy_list, CORBA::SET_OVERRIDE); + policy_manager->set_policy_overrides(policy_list, CORBA::SET_OVERRIDE); - // Now try to contact a server. - // Use a remote machine that is unreachable on the network. - const char * obj_ref = "corbaloc:iiop:1.0@123.123.123.123:4567/NameService"; + // Now try to contact a server. + // Use a remote machine that is unreachable on the network. + const char * obj_ref = "corbaloc:iiop:1.0@123.123.123.123:4567/NameService"; - obj = Orb->string_to_object(obj_ref); + obj = Orb->string_to_object(obj_ref); - CosNaming::NamingContext_var inc; - if(!CORBA::is_nil(obj.in ())) - { - ACE_DEBUG(( LM_INFO, "Attempting to contact %C\n", obj_ref )); - try - { - inc = CosNaming::NamingContext::_narrow(obj.in()); - ACE_DEBUG(( LM_INFO, "OK\n" )); - } - catch(const CORBA::TRANSIENT &) + CosNaming::NamingContext_var inc; + if(!CORBA::is_nil(obj.in ())) { - ACE_ERROR ((LM_ERROR, "Error, caught transient exception\n")); - retval = 1; - } - catch(const CORBA::TIMEOUT &) - { - ACE_DEBUG ((LM_DEBUG, "Caught correct timeout\n")); + ACE_DEBUG(( LM_INFO, "Attempting to contact %C\n", obj_ref )); + try + { + inc = CosNaming::NamingContext::_narrow(obj.in()); + ACE_DEBUG(( LM_INFO, "OK\n" )); + } + catch(const CORBA::TRANSIENT &) + { + ACE_ERROR ((LM_ERROR, "Error, caught transient exception\n")); + retval = 1; + } + catch(const CORBA::TIMEOUT &) + { + ACE_DEBUG ((LM_DEBUG, "Caught correct timeout\n")); + } } } + catch (const ::CORBA::Exception &ex) + { + ex._tao_print_exception("ERROR : unexpected CORBA exception caugth :"); + ++retval; + } return retval; } |