diff options
author | wilson_d <wilson_d@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-11-25 23:56:39 +0000 |
---|---|---|
committer | wilson_d <wilson_d@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-11-25 23:56:39 +0000 |
commit | b35342a6bac6a3372496f0106d5789f08af374b9 (patch) | |
tree | daa51dcc84611b9aeed587dc7564c7043d18889f | |
parent | f57af24b92b0b9df8d3674be80e3aaaf2a4568ac (diff) | |
download | ATCD-b35342a6bac6a3372496f0106d5789f08af374b9.tar.gz |
ChangeLogTag: Tue Nov 25 17:40:01 2003 Dale Wilson <wilson_d@ociweb.com>
-rw-r--r-- | TAO/ChangeLog | 34 | ||||
-rw-r--r-- | TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.cpp | 45 | ||||
-rw-r--r-- | TAO/orbsvcs/Fault_Detector/FT_FaultDetectorFactory_i.cpp | 8 | ||||
-rw-r--r-- | TAO/orbsvcs/Fault_Notifier/FT_Notifier_i.cpp | 12 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/PortableGroup/PG_Object_Group.cpp | 62 | ||||
-rw-r--r-- | TAO/orbsvcs/tests/FT_App/FT_ReplicaFactory_i.cpp | 12 | ||||
-rw-r--r-- | TAO/orbsvcs/tests/FT_App/README | 9 | ||||
-rw-r--r-- | TAO/orbsvcs/tests/FT_App/TAO_Object_Group_Creator.cpp | 137 | ||||
-rw-r--r-- | TAO/orbsvcs/tests/FT_App/run_test_iogr.pl | 395 | ||||
-rwxr-xr-x | TAO/orbsvcs/tests/FT_App/run_test_notifier.pl | 7 | ||||
-rwxr-xr-x | TAO/orbsvcs/tests/FT_App/run_test_replication_mgr.pl | 302 | ||||
-rwxr-xr-x | TAO/orbsvcs/tests/FT_App/run_test_rmregistry.pl | 5 |
12 files changed, 208 insertions, 820 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index 9d888ef97cc..d98ab6e1e70 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,37 @@ +Tue Nov 25 17:40:01 2003 Dale Wilson <wilson_d@ociweb.com> + + * orbsvcs/FT_ReplicationManager/FT_ReplicationManager.cpp: + Add METHO_ENTRY/METHOD_RETURN to help debug Object_Group problem. + + * orbsvcs/Fault_Detector/FT_FaultDetectorFactory_i.cpp: + Support -r meaning don't register with ReplicationManager. + + * orbsvcs/Fault_Notifier/FT_Notifier_i.cpp: + Check TAO_debug_level on error messages. + + * orbsvcs/orbsvcs/PortableGroup/PG_Object_Group.cpp: + Build errors on linux. + Object reference count mismanagement. + Add TAO_debug_level controlled debug info. + + * orbsvcs/tests/FT_App/FT_ReplicaFactory_i.cpp: + Remove unnecessary messages. + + * orbsvcs/tests/FT_App/TAO_Object_Group_Creator.cpp: + Improve messages. Remove some unneeded ones. + + * orbsvcs/tests/FT_App/run_test_notifier.pl: + * orbsvcs/tests/FT_App/run_test_rmregistry.pl: + Update command line options to reflect recent changes. + + * orbsvcs/tests/FT_App/README: + Document test scripts. + + * orbsvcs/tests/FT_App/run_test_iogr.pl: + * orbsvcs/tests/FT_App/run_test_replication_mgr.pl: + Retire these tests. + Removed these files. + Tue Nov 25 12:10:24 2003 Dale Wilson <wilson_d@ociweb.com> * orbsvcs/FT_ReplicationManager/FT_ReplicationManager.cpp: diff --git a/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.cpp b/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.cpp index 10373e1c466..e8538bc17fd 100644 --- a/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.cpp +++ b/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.cpp @@ -32,6 +32,38 @@ ACE_RCSID (FT_ReplicationManager, FT_ReplicationManager, "$Id$") + +// Use this macro at the beginning of CORBA methods +// to aid in debugging. +#define METHOD_ENTRY(name) \ + if (TAO_debug_level > 6) \ + { \ + ACE_DEBUG (( LM_DEBUG, \ + "Enter %s\n", #name \ + )); \ + } + +// Use this macro to return from CORBA methods +// to aid in debugging. Note that you can specify +// the return value after the macro, for example: +// METHOD_RETURN(Plugh::plover) xyzzy; is equivalent +// to return xyzzy; +// METHOD_RETURN(Plugh::troll); is equivalent to +// return; +// WARNING: THIS GENERATES TWO STATEMENTS!!! THE FOLLOWING +// will not do what you want it to: +// if (cave_is_closing) METHOD_RETURN(Plugh::pirate) aarrggh; +// Moral: Always use braces. +#define METHOD_RETURN(name) \ + if (TAO_debug_level > 6) \ + { \ + ACE_DEBUG (( LM_DEBUG, \ + "Leave %s\n", #name \ + )); \ + } \ + return /* value goes here */ + + TAO::FT_ReplicationManager::FT_ReplicationManager () : orb_ (CORBA::ORB::_nil ()) , poa_ (PortableServer::POA::_nil ()) @@ -673,6 +705,7 @@ TAO::FT_ReplicationManager::add_member ( PortableGroup::MemberAlreadyPresent, PortableGroup::ObjectNotAdded)) { + METHOD_ENTRY (TAO::FT_ReplicationManager::add_member); PortableGroup::ObjectGroup_var result = PortableGroup::ObjectGroup::_nil (); // Find the object group corresponding to this IOGR @@ -698,7 +731,9 @@ TAO::FT_ReplicationManager::add_member ( member ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (CORBA::Object::_nil ()); + result = group->reference (); + } else { @@ -710,7 +745,7 @@ TAO::FT_ReplicationManager::add_member ( } ACE_THROW_RETURN (PortableGroup::ObjectGroupNotFound (), result); } - return result._retn (); + METHOD_RETURN (TAO::FT_ReplicationManager::add_member) result._retn (); } @@ -843,6 +878,8 @@ TAO::FT_ReplicationManager::create_object ( PortableGroup::InvalidProperty, PortableGroup::CannotMeetCriteria)) { + METHOD_ENTRY (TAO::FT_ReplicationManager::create_object) + // Start with the LB-oriented create_object // which actually creates an object group CORBA::Object_var obj = this->generic_factory_.create_object ( @@ -891,8 +928,7 @@ TAO::FT_ReplicationManager::create_object ( } - - return obj._retn (); + METHOD_RETURN (TAO::FT_ReplicationManager::create_object) obj._retn (); } void @@ -909,6 +945,3 @@ TAO::FT_ReplicationManager::delete_object ( int todo; ACE_CHECK; } - - - diff --git a/TAO/orbsvcs/Fault_Detector/FT_FaultDetectorFactory_i.cpp b/TAO/orbsvcs/Fault_Detector/FT_FaultDetectorFactory_i.cpp index 0d145325908..12f485b965d 100644 --- a/TAO/orbsvcs/Fault_Detector/FT_FaultDetectorFactory_i.cpp +++ b/TAO/orbsvcs/Fault_Detector/FT_FaultDetectorFactory_i.cpp @@ -124,7 +124,7 @@ int TAO::FT_FaultDetectorFactory_i::write_ior() int TAO::FT_FaultDetectorFactory_i::parse_args (int argc, char * argv[]) { - ACE_Get_Opt get_opts (argc, argv, "d:l:o:q"); + ACE_Get_Opt get_opts (argc, argv, "d:l:o:qr"); int c; while ((c = get_opts ()) != -1) @@ -132,15 +132,21 @@ int TAO::FT_FaultDetectorFactory_i::parse_args (int argc, char * argv[]) switch (c) { case 'd': + { this->domain_ = CORBA::string_dup (get_opts.opt_arg ()); break; + } case 'l': + { this->location_.length(1); this->location_[0].id = CORBA::string_dup(get_opts.opt_arg ()); break; + } case 'o': + { this->ior_output_file_ = get_opts.opt_arg (); break; + } case 'r': { this->rm_register_ = ! this->rm_register_; diff --git a/TAO/orbsvcs/Fault_Notifier/FT_Notifier_i.cpp b/TAO/orbsvcs/Fault_Notifier/FT_Notifier_i.cpp index 28af788d55a..f561ca45bc9 100644 --- a/TAO/orbsvcs/Fault_Notifier/FT_Notifier_i.cpp +++ b/TAO/orbsvcs/Fault_Notifier/FT_Notifier_i.cpp @@ -17,9 +17,12 @@ // Use this macro at the beginning of CORBA methods // to aid in debugging. #define METHOD_ENTRY(name) \ + if (TAO_debug_level > 6) \ + { \ ACE_DEBUG (( LM_DEBUG, \ "Enter %s\n", #name \ - )); + )); \ + } // Use this macro to return from CORBA methods // to aid in debugging. Note that you can specify @@ -33,10 +36,13 @@ // if (cave_is_closing) METHOD_RETURN(Plugh::pirate) aarrggh; // Moral: Always use braces. #define METHOD_RETURN(name) \ + if (TAO_debug_level > 6) \ + { \ ACE_DEBUG (( LM_DEBUG, \ "Leave %s\n", #name \ )); \ - return /* value goes here */ + } \ + return /* value goes here */ // Implementation skeleton constructor @@ -419,7 +425,7 @@ int TAO::FT_FaultNotifier_i::init (CORBA::ORB_ptr orb ACE_ENV_ARG_DECL ) ACE_CATCHANY { ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, - "ReplicaFactory: Exception resolving ReplicationManager, and no -f option was given. Factory will not be registered.\n" ); + "FaultNotifier: Exception resolving ReplicationManager. Notifier will not be registered.\n" ); } ACE_ENDTRY; } diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Object_Group.cpp b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Object_Group.cpp index 0592eb3f38e..6c845b8f3bc 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Object_Group.cpp +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Object_Group.cpp @@ -126,7 +126,7 @@ TAO::PG_Object_Group * TAO::PG_Object_Group::create ( objectGroup, TAO::PG_Object_Group ( orb, - iorm, + iorm.in(), empty_group, tagged_component, type_id, @@ -152,7 +152,7 @@ TAO::PG_Object_Group::~PG_Object_Group () void dump_ior (const char * base, const char * ext, unsigned long version, const char * iogr) { char filename[1000]; - sprintf(filename, "%this->s_%lu.%s", base, version, ext ); + sprintf(filename, "%s_%lu.%s", base, version, ext ); FILE * iorfile = fopen(filename, "w"); fwrite (iogr, 1, strlen(iogr), iorfile); @@ -235,6 +235,14 @@ void TAO::PG_Object_Group::add_member ( { InternalGuard guard(this->internals_); + + if (TAO_debug_level > 6) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT("PG (%P|%t) enter Object_Group add_member \n") + )); + } + ///////////////////////////////////////// // Convert the new member to a string IOR // This keeps a clean IOR (not and IOGR!) @@ -253,7 +261,7 @@ void TAO::PG_Object_Group::add_member ( // This can be avoided when we get support for TAG_MULTIPLE_COMPONENTS // For now, we already have a copy of the tagGroupTagged component and we're going to use // it below wen we increment the group version so we can clean out the dummy entry. - PortableGroup::ObjectGroup_var cleaned = this->reference_; + PortableGroup::ObjectGroup_var cleaned = PortableGroup::ObjectGroup::_duplicate (this->reference_); if (this->empty_) { // remove the original profile. It's a dummy entry supplied by create_object. @@ -266,8 +274,8 @@ void TAO::PG_Object_Group::add_member ( // create a list of references to be merged TAO_IOP::TAO_IOR_Manipulation::IORList iors (2); iors.length (2); - iors [0] = cleaned.in(); - iors [1] = member; + iors [0] = CORBA::Object::_duplicate (cleaned.in()); + iors [1] = CORBA::Object::_duplicate (member); // Now merge the list into one new IOGR PortableGroup::ObjectGroup_var new_reference = @@ -278,7 +286,7 @@ void TAO::PG_Object_Group::add_member ( ACE_CHECK; MemberInfo * info = 0; - ACE_NEW_THROW_EX (info, MemberInfo(member_ior, the_location), + ACE_NEW_THROW_EX (info, MemberInfo(member_ior.in(), the_location), CORBA::NO_MEMORY()); if (this->members_.bind (the_location, info) != 0) @@ -287,7 +295,6 @@ void TAO::PG_Object_Group::add_member ( } this->reference_ = new_reference; // note var-to-var assignment does a duplicate - if (increment_version ()) { distribute_iogr (ACE_ENV_SINGLE_ARG_PARAMETER); @@ -297,6 +304,13 @@ void TAO::PG_Object_Group::add_member ( { ACE_THROW (PortableGroup::ObjectNotAdded()); } + + if (TAO_debug_level > 6) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT("PG (%P|%t) exit Object_Group add_member \n") + )); + } } int TAO::PG_Object_Group::set_primary_member ( @@ -325,15 +339,15 @@ int TAO::PG_Object_Group::set_primary_member ( info->is_primary_ = 1; //remove primary - int sts = this->iorm_->is_primary_set (prop, this->reference_ ACE_ENV_ARG_PARAMETER); + int sts = this->iorm_->is_primary_set (prop, this->reference_.in () ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (0); if (sts) { - (void)this->iorm_->remove_primary_tag (prop, this->reference_ ACE_ENV_ARG_PARAMETER); + (void)this->iorm_->remove_primary_tag (prop, this->reference_.in () ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (0); } - sts = this->iorm_->set_primary (prop, info->member_.in (), this->reference_ ACE_ENV_ARG_PARAMETER); + sts = this->iorm_->set_primary (prop, info->member_.in (), this->reference_.in () ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (0); if (! sts) { @@ -499,22 +513,26 @@ void TAO::PG_Object_Group::distribute_iogr (ACE_ENV_ARG_DECL) // TAO-FT (2996|976) - Wrong version information within the interceptor [1 | 0] // TAO_Perfect_Hash_OpTable:find for operation 'tao_update_object_group' (length=23) failed // back to using _narrow - PortableGroup::TAO_UpdateObjectGroup_var uog = PortableGroup::TAO_UpdateObjectGroup::_narrow ( info->member_); + PortableGroup::TAO_UpdateObjectGroup_var uog = PortableGroup::TAO_UpdateObjectGroup::_narrow ( info->member_.in ()); if (! CORBA::is_nil (uog.in ()) ) { ACE_TRY_NEW_ENV { - ACE_DEBUG ((LM_DEBUG, - "PG (%P|%t) - Object_Group pushing IOGR to %s member: %s@%s.\n", - (info->is_primary_ ? "Primary" : "Backup"), - this->role_.c_str(), - ACE_static_cast(const char *, info->location_[0].id) - )); - dump_ior ("group", "iogr", this->tagged_component_.object_group_ref_version, iogr); - CORBA::String_var replica_ior = this->orb_->object_to_string(uog.in() ACE_ENV_ARG_PARAMETER); - dump_ior (info->location_[0].id, "ior", (this->tagged_component_.object_group_ref_version * 100) + n_rep++, replica_ior); + if (TAO_debug_level > 3) + { + ACE_DEBUG ((LM_DEBUG, + "PG (%P|%t) - Object_Group pushing IOGR to %s member: %s@%s.\n", + (info->is_primary_ ? "Primary" : "Backup"), + this->role_.c_str(), + ACE_static_cast(const char *, info->location_[0].id) + )); + } +// dump_ior ("group", "iogr", this->tagged_component_.object_group_ref_version, iogr); +// CORBA::String_var replica_ior = this->orb_->object_to_string(uog.in() ACE_ENV_ARG_PARAMETER); +// dump_ior (info->location_[0].id, "ior", (this->tagged_component_.object_group_ref_version * 100) + n_rep++, replica_ior); + uog->tao_update_object_group (iogr, this->tagged_component_.object_group_ref_version, info->is_primary_ ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; - uog->tao_update_object_group (iogr, this->tagged_component_.object_group_ref_version, info->is_primary_); } ACE_CATCHANY { @@ -526,7 +544,7 @@ void TAO::PG_Object_Group::distribute_iogr (ACE_ENV_ARG_DECL) else { ACE_ERROR ((LM_ERROR, - "TAO::PG_Object_Group::set_reference can't narrow member reference to PortableGroup::TAO_UpdateObjectGroup.\n" + "TAO::PG_Object_Group::distribute iogr can't narrow member reference to PortableGroup::TAO_UpdateObjectGroup.\n" )); } } diff --git a/TAO/orbsvcs/tests/FT_App/FT_ReplicaFactory_i.cpp b/TAO/orbsvcs/tests/FT_App/FT_ReplicaFactory_i.cpp index 79da867d91a..7f748e140bd 100644 --- a/TAO/orbsvcs/tests/FT_App/FT_ReplicaFactory_i.cpp +++ b/TAO/orbsvcs/tests/FT_App/FT_ReplicaFactory_i.cpp @@ -273,9 +273,6 @@ int FT_ReplicaFactory_i::init (CORBA::ORB_ptr orb ACE_ENV_ARG_DECL) { int result = 0; - // ugly but effective - TAO_debug_level++; - this->orb_ = CORBA::ORB::_duplicate (orb); // Use the ROOT POA for now @@ -375,14 +372,17 @@ int FT_ReplicaFactory_i::init (CORBA::ORB_ptr orb ACE_ENV_ARG_DECL) } else { - ACE_ERROR ((LM_ERROR,"ReplicaFactory: Can't resolve ReplicationManager, and no -f option was given.\n" )); + ACE_ERROR ((LM_ERROR,"ReplicaFactory: Can't resolve ReplicationManager.\n" )); } } } ACE_CATCHANY { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, - "ReplicaFactory: Exception resolving ReplicationManager, and no -f option was given. Factory will not be registered.\n" ); + if (this->test_output_file_ == 0) // ignore if this is a test run + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "ReplicaFactory: Exception resolving ReplicationManager. Factory will not be registered.\n" ); + } } ACE_ENDTRY; diff --git a/TAO/orbsvcs/tests/FT_App/README b/TAO/orbsvcs/tests/FT_App/README index be5edb96589..33b790044b6 100644 --- a/TAO/orbsvcs/tests/FT_App/README +++ b/TAO/orbsvcs/tests/FT_App/README @@ -77,12 +77,11 @@ Unit Tests based on this application: implementation in the ReplicationManager. -// todo: DOCUMENT AND TEST THESE + run_test_rmnotifier.pl + uses ft_client, ft_replica, Fault_Detector to test the connection between + the Fault_Notifier and the ReplicationManager -[]run_test_replication_mgr.pl -[]run_test_rmnotifier.pl - -[] demo.pl + demo.pl tests the entire FT system. diff --git a/TAO/orbsvcs/tests/FT_App/TAO_Object_Group_Creator.cpp b/TAO/orbsvcs/tests/FT_App/TAO_Object_Group_Creator.cpp index 233474efd6b..160f83c6580 100644 --- a/TAO/orbsvcs/tests/FT_App/TAO_Object_Group_Creator.cpp +++ b/TAO/orbsvcs/tests/FT_App/TAO_Object_Group_Creator.cpp @@ -23,9 +23,9 @@ TAO::Object_Group_Creator::Object_Group_Creator () - : registry_(0) - , replication_manager_(0) - , have_replication_manager_(0) + : registry_ (0) + , replication_manager_ (0) + , have_replication_manager_ (0) , detector_infos_ (0) { } @@ -37,14 +37,14 @@ TAO::Object_Group_Creator::~Object_Group_Creator () int TAO::Object_Group_Creator::set_factory_registry (PortableGroup::FactoryRegistry_ptr factory) { this->registry_ = PortableGroup::FactoryRegistry::_duplicate (factory); - return CORBA::is_nil (this->registry_.in()) ? -1 : 0 ; + return CORBA::is_nil (this->registry_.in ()) ? -1 : 0 ; } int TAO::Object_Group_Creator::init (CORBA::ORB_ptr orb ACE_ENV_ARG_DECL) { int result = 0; - this->orb_ = CORBA::ORB::_duplicate(orb); + this->orb_ = CORBA::ORB::_duplicate (orb); if (CORBA::is_nil (this->registry_)) { @@ -52,44 +52,43 @@ int TAO::Object_Group_Creator::init (CORBA::ORB_ptr orb ACE_ENV_ARG_DECL) // Find the ReplicationManager ACE_TRY_NEW_ENV { - CORBA::Object_var rm_obj = orb->resolve_initial_references("ReplicationManager" ACE_ENV_ARG_PARAMETER); + CORBA::Object_var rm_obj = orb->resolve_initial_references ("ReplicationManager" ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; - this->replication_manager_ = ::FT::ReplicationManager::_narrow(rm_obj.in() ACE_ENV_ARG_PARAMETER); + this->replication_manager_ = ::FT::ReplicationManager::_narrow (rm_obj.in () ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; if (!CORBA::is_nil (this->replication_manager_)) { this->have_replication_manager_ = 1; // empty criteria ::PortableGroup::Criteria criteria; - this->registry_ = this->replication_manager_->get_factory_registry(criteria ACE_ENV_ARG_PARAMETER); + this->registry_ = this->replication_manager_->get_factory_registry (criteria ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; if (!CORBA::is_nil (this->registry_)) { - this->detector_infos_ = this->registry_->list_factories_by_role (FT::FAULT_DETECTOR_ROLE_NAME, this->detector_type_id_.out() + this->detector_infos_ = this->registry_->list_factories_by_role (FT::FAULT_DETECTOR_ROLE_NAME, this->detector_type_id_.out () ACE_ENV_ARG_PARAMETER) ACE_TRY_CHECK; - CORBA::ULong count = this->detector_infos_->length(); - ACE_DEBUG ((LM_DEBUG, + CORBA::ULong count = this->detector_infos_->length (); + ACE_DEBUG ( (LM_DEBUG, "%T %n (%P|%t)Object_Group_Creator: found %u factories for FaultDetectors\n", ACE_static_cast (unsigned, count) )); - result = 0; } else { - ACE_ERROR ((LM_ERROR, + ACE_ERROR ( (LM_ERROR, "%T %n (%P|%t) Object_Group_Creator: ReplicationManager failed to return FactoryRegistry.\n" )); - ACE_TRY_THROW (CORBA::NO_IMPLEMENT()); + ACE_TRY_THROW (CORBA::NO_IMPLEMENT ()); } } else { - ACE_ERROR ((LM_ERROR, + ACE_ERROR ( (LM_ERROR, "%T %n (%P|%t) Object_Group_Creator: resolve_initial_references for ReplicationManager failed.\n" )); - ACE_TRY_THROW (CORBA::OBJECT_NOT_EXIST()); + ACE_TRY_THROW (CORBA::OBJECT_NOT_EXIST ()); } } ACE_CATCHANY @@ -105,10 +104,10 @@ int TAO::Object_Group_Creator::init (CORBA::ORB_ptr orb ACE_ENV_ARG_DECL) return result; } -int TAO::Object_Group_Creator::unregister_role(const char * role ACE_ENV_ARG_DECL) +int TAO::Object_Group_Creator::unregister_role (const char * role ACE_ENV_ARG_DECL) { int result = 0; - ACE_ERROR ((LM_INFO, + ACE_ERROR ( (LM_INFO, "%T %n (%P|%t) Object_Group_Creator: Unregistering all factories for %s\n", role )); @@ -131,7 +130,7 @@ int TAO::Object_Group_Creator::create_detector_for_replica ( if (this->have_replication_manager_) { - CORBA::ULong detector_count = this->detector_infos_->length(); + CORBA::ULong detector_count = this->detector_infos_->length (); for (CORBA::ULong n_detector = 0; result == 0 && n_detector < detector_count; ++n_detector) { PortableGroup::FactoryInfo & info = (*this->detector_infos_)[n_detector]; @@ -141,15 +140,6 @@ int TAO::Object_Group_Creator::create_detector_for_replica ( PortableGroup::Value value; -/* - ////////////////// - // FaultDetectorFactory gets picky about FaultNotifier's object type. - // coddle it. - ::FT::FaultNotifier_var notifier = ::FT::FaultNotifier::_narrow(this_obj); - value <<= notifier; - encoder.add(::FT::FT_NOTIFIER, value); -*/ - FT::PullMonitorable_ptr monitorable = FT::PullMonitorable::_narrow (replica); value <<= monitorable; encoder.add (::FT::FT_MONITORABLE, value); @@ -174,21 +164,21 @@ int TAO::Object_Group_Creator::create_detector_for_replica ( PortableGroup::Criteria_var criteria; ACE_NEW_NORETURN (criteria, PortableGroup::Criteria); - if (criteria.ptr() == 0) + if (criteria.ptr () == 0) { - ACE_ERROR((LM_ERROR, + ACE_ERROR ( (LM_ERROR, "%T %n (%P|%t)Object_Group_Creater: Error cannot allocate criteria.\n" )); result = -1; } else { - encoder.encode(criteria); + encoder.encode (criteria); PortableGroup::GenericFactory::FactoryCreationId_var factory_creation_id; info.the_factory->create_object ( type_id, - criteria.in(), + criteria.in (), factory_creation_id ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; @@ -200,27 +190,26 @@ int TAO::Object_Group_Creator::create_detector_for_replica ( return result; } -CORBA::Object_ptr TAO::Object_Group_Creator::create_group( +CORBA::Object_ptr TAO::Object_Group_Creator::create_group ( const char * role, int write_iors ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException )) + ACE_THROW_SPEC ( (CORBA::SystemException )) { - int result = 0; - CORBA::Object_var group; + CORBA::Object_var group = CORBA::Object::_nil (); PortableGroup::ObjectGroupId group_id = 0; CORBA::String_var type_id; ::PortableGroup::FactoryInfos_var infos = this->registry_->list_factories_by_role (role, type_id ACE_ENV_ARG_PARAMETER) - ACE_CHECK_RETURN (CORBA::Object::_nil()); + ACE_CHECK_RETURN (CORBA::Object::_nil ()); - CORBA::ULong count = infos->length(); - ACE_ERROR ((LM_INFO, + CORBA::ULong count = infos->length (); + ACE_ERROR ( (LM_INFO, "%T %n (%P|%t): Object_Group_Creator: found %u factories for %s : %s\n", ACE_static_cast (unsigned, count), role, - ACE_static_cast(const char *, type_id) + ACE_static_cast (const char *, type_id) )); if (count > 0) @@ -230,19 +219,19 @@ CORBA::Object_ptr TAO::Object_Group_Creator::create_group( ::PortableGroup::GenericFactory::FactoryCreationId_var creation_id; if (this->have_replication_manager_) { - PortableGroup::Criteria criteria(1); - criteria.length(1); - criteria[0].nam.length(1); + PortableGroup::Criteria criteria (1); + criteria.length (1); + criteria[0].nam.length (1); criteria[0].nam[0].id = PortableGroup::PG_MEMBERSHIP_STYLE; criteria[0].val <<= PortableGroup::MEMB_APP_CTRL; - group = this->replication_manager_->create_object( - type_id.in(), + group = this->replication_manager_->create_object ( + type_id.in (), criteria, creation_id ACE_ENV_ARG_PARAMETER ); - ACE_CHECK_RETURN (CORBA::Object::_nil()); + ACE_CHECK_RETURN (CORBA::Object::_nil ()); //@@ this is a bit of a hack creation_id >>= group_id; @@ -256,7 +245,7 @@ CORBA::Object_ptr TAO::Object_Group_Creator::create_group( ::PortableGroup::FactoryInfo & info = infos[nFact]; const char * loc_name = info.the_location[0].id; - ACE_ERROR ((LM_INFO, + ACE_ERROR ( (LM_INFO, "%T %n (%P|%t) Object_Group_Creator: Creating %s@%s\n", role, loc_name @@ -264,28 +253,30 @@ CORBA::Object_ptr TAO::Object_Group_Creator::create_group( PortableGroup::GenericFactory::FactoryCreationId_var factory_creation_id; CORBA::Object_var created_obj = info.the_factory->create_object ( - type_id.in(), + type_id.in (), info.the_criteria, - factory_creation_id.out() + factory_creation_id.out () ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (CORBA::Object::_nil()); - if ( !CORBA::is_nil(created_obj) ) + ACE_CHECK_RETURN (CORBA::Object::_nil ()); + if ( !CORBA::is_nil (created_obj) ) { // that which was first shall now be last if (nFact == 0) { first_location = & info.the_location; } - create_detector_for_replica ( + + // try to create a detector, but don't worry if it doesn't happen + (void) create_detector_for_replica ( created_obj, role, - type_id.in(), + type_id.in (), group_id, info.the_location ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (CORBA::Object::_nil()); + ACE_CHECK_RETURN (CORBA::Object::_nil ()); const char * replica_ior = orb_->object_to_string (created_obj ACE_ENV_ARG_PARAMETER ); - ACE_CHECK_RETURN (CORBA::Object::_nil()); + ACE_CHECK_RETURN (CORBA::Object::_nil ()); if (write_iors) @@ -301,32 +292,32 @@ CORBA::Object_ptr TAO::Object_Group_Creator::create_group( } else if (factory_creation_id >>= long_id) { - ulong_id = ACE_static_cast(CORBA::ULong, long_id); + ulong_id = ACE_static_cast (CORBA::ULong, long_id); } else { - ACE_ERROR ((LM_ERROR, + ACE_ERROR ( (LM_ERROR, "%T %n (%P|%t) Object_Group_Creator: Can't decypher factory creation id.\n" )); // Guessed wrong. Just use default value } - char replica_ior_filename[200]; // "${role}_$(location)_${factory_id}.ior" + char replica_ior_filename[200]; // "${role}_$ (location)_${factory_id}.ior" - ACE_OS::snprintf(replica_ior_filename, sizeof(replica_ior_filename)-1, "%s_%s_%lu.ior", + ACE_OS::snprintf (replica_ior_filename, sizeof (replica_ior_filename)-1, "%s_%s_%lu.ior", role, loc_name, - ACE_static_cast(unsigned long, ulong_id)); - replica_ior_filename[sizeof(replica_ior_filename)-1] = '\0'; + ACE_static_cast (unsigned long, ulong_id)); + replica_ior_filename[sizeof (replica_ior_filename)-1] = '\0'; - ACE_ERROR ((LM_INFO, + ACE_ERROR ( (LM_INFO, "%T %n (%P|%t) Object_Group_Creator: Writing ior for created object to %s\n", replica_ior_filename )); - if (write_ior_file(replica_ior_filename, replica_ior) != 0) + if (write_ior_file (replica_ior_filename, replica_ior) != 0) { - ACE_ERROR ((LM_ERROR, + ACE_ERROR ( (LM_ERROR, "%T %n (%P|%t) Object_Group_Creator: Error writing ior [%s] to %s\n", replica_ior, replica_ior_filename @@ -340,12 +331,12 @@ CORBA::Object_ptr TAO::Object_Group_Creator::create_group( info.the_location, created_obj ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (CORBA::Object::_nil()); + ACE_CHECK_RETURN (CORBA::Object::_nil ()); } } else { - ACE_ERROR ((LM_ERROR, + ACE_ERROR ( (LM_ERROR, "%T %n (%P|%t) Object_Group_Creator: create_object returned nil????\n" )); } @@ -353,19 +344,19 @@ CORBA::Object_ptr TAO::Object_Group_Creator::create_group( if (first_location != 0 && this->have_replication_manager_) { - group = this->replication_manager_->set_primary_member (group.in(), * first_location ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (CORBA::Object::_nil()); + group = this->replication_manager_->set_primary_member (group.in (), * first_location ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (CORBA::Object::_nil ()); } - ACE_ERROR ((LM_INFO, + ACE_ERROR ( (LM_INFO, "%T %n (%P|%t) Object_Group_Creator: Successfully created group of %s\n", role )); const char * group_iogr = orb_->object_to_string (group ACE_ENV_ARG_PARAMETER ); - ACE_CHECK_RETURN (CORBA::Object::_nil()); + ACE_CHECK_RETURN (CORBA::Object::_nil ()); } - return group._retn(); + return group._retn (); } @@ -374,7 +365,7 @@ int TAO::Object_Group_Creator::fini () return 0; } -int TAO::Object_Group_Creator::write_ior_file(const char * outputFile, const char * ior) +int TAO::Object_Group_Creator::write_ior_file (const char * outputFile, const char * ior) { int result = -1; FILE* out = ACE_OS::fopen (outputFile, "w"); @@ -386,7 +377,7 @@ int TAO::Object_Group_Creator::write_ior_file(const char * outputFile, const cha } else { - ACE_ERROR ((LM_ERROR, + ACE_ERROR ( (LM_ERROR, "%T %n (%P|%t) Object_Group_Creator: Open failed for %s\n", outputFile )); } diff --git a/TAO/orbsvcs/tests/FT_App/run_test_iogr.pl b/TAO/orbsvcs/tests/FT_App/run_test_iogr.pl deleted file mode 100644 index 62608d4ae74..00000000000 --- a/TAO/orbsvcs/tests/FT_App/run_test_iogr.pl +++ /dev/null @@ -1,395 +0,0 @@ -eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' - & eval 'exec perl -S $0 $argv:q' - if 0; - -# $Id$ -# -*- perl -*- - -# Purpose: -# To test the FactoryRegistry as a component of ReplicationManager -# -# Process being tested: -# FT_ReplicationManager -# implements PortableGroup::FactoryRegistry interface. -# Processes used in test: -# FT_Replica * 3 -# implements GenericFactory interface to create TestReplicas -# TestReplica implements TestReplica interface. -# TestReplica implements PullMonitorable interface. -# FT_Client -# client for TestReplica interface. -# client for PullMonitorable. -# Object Group Creator -# Creates groups of objects. -# -# Test Scenario (***Test: marks behavior being tested): -# -# First the test starts The ReplicationManager, -# Then starts three factories. Each factory exists at a separate location. -# The locations are named shire, bree, and rivendell. In a "real" system -# these locations would be on separate computers. -# -# The factory at the shire location knows how to create hobbits. -# The factory at the bree location knows how to create hobbits, elves, and humans. -# The factory at rivendell can create elves. -# Hobbits, elves, and humans are roles for TestReplica objects. A creation parameter -# included as part of the registration information specifies which role they are playing. -# -# ***Test: The factories register themselves with the factory registry in the ReplicationManager. -# Registration information includes: -# the role, -# the type of object created, -# the location, -# an object reference to the factory and -# a set of parameters to be passed to the factory's create_object method. -# -# An object group creator is started and asked to create three object groups: -# a group of hobbits, a group of elves; and another group of hobbits. -# -# ***Test: the object group creator asks the ReplicationManager::FactoryRegistry -# for the set of factories that can create objects for the desired role. -# Then it uses the create_object method for each factory to create the actual object. -# -# [temporary until IOGR's are working: The object group creator writes the -# IOR's of the create objects to files -- using a file naming convention to -# distinguish members of the group. It will be enhanced to assemble these -# IORs into an IOGR and either write the IOGR to a file or register it with -# the Naming Service.] -# -# The object group creator is also told to unregister all factories that create humans. -# ***Test: It does so using the unregister_factory_by_role method. -# -# Three clients are started, one at a time. Each client is given a reference -# to an object group -# -# [temporary until IOGRs and transparent reinvocaton work: each client is -# given references to the members of the group and manages its own recovery -# (client mediated fault tolerance)] -# -# Each client sends a few requests to first member of the object group. Eventually -# this member fails and the requests are then rerouted to the second (and last) -# member of the group. -# -# When a clients job is done, it exits and asks the remaining group member to -# exit, too. -# -# The factories are run with the quit-on-idle option so when the last object -# created at that location goes away, the factory exits. -# -# ***Test: As it exits the factory unregisters itself with the ReplicationManager::FactoryRegistry. -# ***Test: A command line option determines whether it uses a single -# unregister_factory_by_location call, or separate unregister_factory calles for -# each type of object created. In this test, the shire location uses unregister_factory, -# and bree and rivendell use unregister_factory_by_location. -# -# The factory registry is also run with the quit-on-idle option so when the last -# factory unregisters itself. -# The ReplicationManager is killed because it doesn't have a quit-on-idle option. - -use lib '../../../../bin'; -#use lib '$ENV{ACE_ROOT}/bin'; -use PerlACE::Run_Test; - -######################## -#command line options -#set defaults: -my($verbose) = 0; # 1: report perl actions before executing them -my($debug_builds) = 0; # 0: use exes from Release directories -my($simulated) = 0; # 1: use "client simulated" fault tolerance - -foreach $i (@ARGV) { - if ($i eq "--debug_build") - { - $debug_builds = 1; - } - elsif ($i eq "--simulate") - { - $simulated = ! $simulated0; - } - elsif ($i eq "-v") - { - $verbose += 1; - } -} - -my($build_directory) = "/Release"; -if ( $debug_builds ) { - $build_directory = ""; -} - -if ( $verbose > 1) { - print "verbose: $verbose\n"; - print "debug_builds: $debug_builds -> $build_directory\n"; - print "simulated: $simulated\n"; -} - -my($role1) = "hobbit"; -my($role2) = "elf"; -my($role3) = "human"; - -my($location1) = "shire"; -my($location2) = "bree"; -my($location3) = "rivendell"; -my($location4) = "rohan"; - -#define temp files -my($rm_ior) = PerlACE::LocalFile ("rm.ior"); -my($factory1_ior) = PerlACE::LocalFile ("factory1.ior"); -my($factory2_ior) = PerlACE::LocalFile ("factory2.ior"); -my($factory3_ior) = PerlACE::LocalFile ("factory3.ior"); -my($replica1_ior) = PerlACE::LocalFile ("${role1}_${location1}_0.ior"); -my($replica2_ior) = PerlACE::LocalFile ("${role1}_${location2}_0.ior"); -my($replica3_ior) = PerlACE::LocalFile ("${role2}_${location2}_1.ior"); -my($replica4_ior) = PerlACE::LocalFile ("${role2}_${location3}_0.ior"); -my($replica5_ior) = PerlACE::LocalFile ("${role1}_${location1}_1.ior"); -my($replica6_ior) = PerlACE::LocalFile ("${role1}_${location2}_2.ior"); - -my($replica1_iogr) = PerlACE::LocalFile ("${role1}_0.iogr"); -my($replica2_iogr) = PerlACE::LocalFile ("${role2}_1.iogr"); -my($replica3_iogr) = PerlACE::LocalFile ("${role1}_2.iogr"); - -my($client_data) = PerlACE::LocalFile ("persistent.dat"); - -#discard junk from previous tests -if (10) { -unlink $rm_ior; -unlink $factory1_ior; -unlink $factory2_ior; -unlink $factory3_ior; -unlink $replica1_ior; -unlink $replica2_ior; -unlink $replica3_ior; -unlink $replica4_ior; -unlink $replica5_ior; -unlink $replica6_ior; -unlink $replica1_iogr; -unlink $replica2_iogr; - -unlink $client_data; -} -my($status) = 0; - -my($RM) = new PerlACE::Process ("$ENV{'TAO_ROOT'}/orbsvcs/FT_ReplicationManager$build_directory/FT_ReplicationManager", "-o $rm_ior"); -my($RMC) = new PerlACE::Process (".$build_directory/replmgr_controller", "-k file://$rm_ior -x"); -my($FAC1) = new PerlACE::Process (".$build_directory/ft_replica", "-o $factory1_ior -ORBInitRef ReplicationManager=file://$rm_ior -l $location1 -i $role1 -q"); -my($FAC2) = new PerlACE::Process (".$build_directory/ft_replica", "-o $factory2_ior -ORBInitRef ReplicationManager=file://$rm_ior -l $location2 -i $role1 -i $role2 -i $role3 -q -u"); -my($FAC3) = new PerlACE::Process (".$build_directory/ft_replica", "-o $factory3_ior -ORBInitRef ReplicationManager=file://$rm_ior -l $location3 -i $role2 -q -u"); -my($CTR); - -my($CL1); -my($CL2); -my($CL3); -if ($simulated) { - print "\nTEST: Preparing Client Mediated Fault Tolerance test.\n" if ($verbose); - $CTR = new PerlACE::Process (".$build_directory/ft_create", "-ORBInitRef ReplicationManager=file://$rm_ior -r $role1 -r $role2 -r $role1 -u $role3"); - $CL1 = new PerlACE::Process (".$build_directory/ft_client", "-f file://$replica1_ior -f file://$replica2_ior -c testscript"); - $CL2 = new PerlACE::Process (".$build_directory/ft_client", "-f file://$replica3_ior -f file://$replica4_ior -c testscript"); - $CL3 = new PerlACE::Process (".$build_directory/ft_client", "-f file://$replica5_ior -f file://$replica6_ior -c testscript"); -}else{ - print "\nTEST: Preparing IOGR based test.\n" if ($verbose); - $CTR = new PerlACE::Process (".$build_directory/ft_create", "-ORBInitRef ReplicationManager=file://$rm_ior -r $role1 -r $role2 -r $role1 -u $role3 -g -i"); - $CL1 = new PerlACE::Process (".$build_directory/ft_client", "-f file://$replica1_iogr -c testscript"); - $CL2 = new PerlACE::Process (".$build_directory/ft_client", "-f file://$replica2_iogr -c testscript"); - $CL3 = new PerlACE::Process (".$build_directory/ft_client", "-f file://$replica3_iogr -c testscript"); -} - -####################### -# Start ReplicationManager -if (10) { -print "\nTEST: starting ReplicationManager " . $RM->CommandLine . "\n" if ($verbose); -$RM->Spawn (); - -print "TEST: waiting for registry's IOR\n" if ($verbose); -if (PerlACE::waitforfile_timed ($rm_ior, 5) == -1) { - print STDERR "ERROR: cannot find file <$rm_ior>\n"; - $RM->Kill (); $RM->TimedWait (1); - exit 1; -} -} -################# -# Start Factories - -print "\nTEST: starting factory 1 " . $FAC1->CommandLine . "\n" if ($verbose); -$FAC1->Spawn (); - -print "TEST: waiting for factory 1's IOR\n" if ($verbose); -if (PerlACE::waitforfile_timed ($factory1_ior, 5) == -1) { - print STDERR "ERROR: cannot find file <$factory1_ior>\n"; - $RM->Kill (); $RM->TimedWait (1); - $FAC1->Kill (); $FAC1->TimedWait (1); - exit 1; -} - -print "\nTEST: starting factory 2 " . $FAC2->CommandLine . "\n" if ($verbose); -$FAC2->Spawn (); - -print "TEST: waiting for factory 2's IOR\n" if ($verbose); -if (PerlACE::waitforfile_timed ($factory2_ior, 5) == -1) { - print STDERR "ERROR: cannot find file <$factory2_ior>\n"; - $FAC1->Kill (); $FAC1->TimedWait (1); - $RM->Kill (); $RM->TimedWait (1); - $FAC2->Kill (); $FAC2->TimedWait (1); - exit 1; -} - -print "\nTEST: starting factory 3 " . $FAC3->CommandLine . "\n" if ($verbose); -$FAC3->Spawn (); - -print "TEST: waiting for factory 3's IOR\n" if ($verbose); -if (PerlACE::waitforfile_timed ($factory3_ior, 5) == -1) { - print STDERR "ERROR: cannot find file <$factory3_ior>\n"; - $FAC1->Kill (); $FAC1->TimedWait (1); - $FAC2->Kill (); $FAC2->TimedWait (1); - $RM->Kill (); $RM->TimedWait (1); - $FAC3->Kill (); $FAC3->TimedWait (1); - exit 1; -} - -###################### -# Create object groups - -print "\nTEST: starting object group creator " . $CTR->CommandLine . "\n" if ($verbose); -$CTR->Spawn (); -if ($simulated){ - print "TEST: waiting for Replica IOR files from object group creator\n" if ($verbose); - if (PerlACE::waitforfile_timed ($replica1_ior, 5) == -1){ - print STDERR "ERROR: cannot find file <$replica1_ior>\n"; - $status = 1; - } - elsif (PerlACE::waitforfile_timed ($replica2_ior, 5) == -1){ - print STDERR "ERROR: cannot find file <$replica2_ior> \n"; - $status = 1; - } - elsif (PerlACE::waitforfile_timed ($replica3_ior, 5) == -1){ - print STDERR "ERROR: cannot find file <$replica3_ior> \n"; - $status = 1; - } - elsif (PerlACE::waitforfile_timed ($replica4_ior, 5) == -1){ - print STDERR "ERROR: cannot find file <$replica4_ior> \n"; - $status = 1; - } - elsif (PerlACE::waitforfile_timed ($replica5_ior, 5) == -1){ - print STDERR "ERROR: cannot find file <$replica5_ior> \n"; - $status = 1; - } - elsif (PerlACE::waitforfile_timed ($replica6_ior, 5) == -1){ - print STDERR "ERROR: cannot find file <$replica6_ior> \n"; - $status = 1; - } -}else{ - if (PerlACE::waitforfile_timed ($replica1_iogr, 5) == -1){ - print STDERR "ERROR: cannot find file <$replica1_iogr>\n"; - $status = 1; - } - elsif (PerlACE::waitforfile_timed ($replica2_iogr, 5) == -1){ - print STDERR "ERROR: cannot find file <$replica2_iogr> \n"; - $status = 1; - } -} - -if($status != 0){ - $FAC3->Kill (); $FAC3->TimedWait (1); - $FAC2->Kill (); $FAC2->TimedWait (1); - $FAC1->Kill (); $FAC1->TimedWait (1); - $RM->Kill (); $RM->TimedWait (1); - $CTR->Kill (); $CTR->TimedWait(1); - exit 1; -} - -print "\nTEST: wait for object group creator.\n" if ($verbose); -my($config) = $CTR->WaitKill (5); -if ($config != 0) { - print STDERR "ERROR: configuration manager returned $config\n"; - $FAC3->Kill (); $FAC3->TimedWait (1); - $FAC2->Kill (); $FAC2->TimedWait (1); - $FAC1->Kill (); $FAC1->TimedWait (1); - $RM->Kill (); $RM->TimedWait (1); - exit 1; -} - - -############# -# Run clients - -print "\nTEST: starting client " . $CL1->CommandLine . "\n" if ($verbose); -$client = $CL1->SpawnWaitKill (60); - -if ($client != 0) { - print STDERR "ERROR: client returned $client\n"; - $status = 1; -} - -print "\nTEST: starting client again " . $CL2->CommandLine . "\n" if ($verbose); -$client2 = $CL2->SpawnWaitKill (60); - -if ($client2 != 0) { - print STDERR "ERROR: client returned $client2\n"; - $status = 1; -} - -print "\nTEST: starting client, one more time with feeling " . $CL3->CommandLine . "\n" if ($verbose); -$client3 = $CL3->SpawnWaitKill (60); - -if ($client3 != 0) { - print STDERR "ERROR: client returned $client3\n"; - $status = 1; -} - -###################### -# Clean house and exit - -print "\nTEST: wait for factory 1.\n" if ($verbose); -$factory1 = $FAC1->WaitKill (30); -if ($factory1 != 0) { - print STDERR "ERROR: replica returned $factory 1\n"; - $status = 1; -} - -print "\nTEST: wait for factory 2.\n" if ($verbose); -$factory2 = $FAC2->WaitKill (30); -if ($factory2 != 0) { - print STDERR "ERROR: factory 2 returned $factory2\n"; - $status = 1; -} - -print "\nTEST: wait for factory 3.\n" if ($verbose); -$factory3 = $FAC3->WaitKill (30); -if ($factory3 != 0) { - print STDERR "ERROR: factory 3 returned $factory3\n"; - $status = 1; -} - -#if (10) { -print "\nTEST: shutting down the replication manager.\n" if ($verbose); -$controller = $RMC->SpawnWaitKill (300); -if ($controller != 0) { - print STDERR "ERROR: replication manager controller returned $controller\n"; - $status = 1; - -print "\nTEST: wait for ReplicationManager.\n" if ($verbose); -$repmgr = $RM->WaitKill (30); -if ($repmgr != 0) { - print STDERR "ERROR: ReplicationManager returned $repmgr\n"; - $status = 1; -} -} - - -print "\nTEST: releasing scratch files.\n" if ($verbose); -unlink $rm_ior; -unlink $factory1_ior; -unlink $factory2_ior; -unlink $factory3_ior; -unlink $replica1_ior; -unlink $replica2_ior; -unlink $replica3_ior; -unlink $replica4_ior; -unlink $replica5_ior; -unlink $replica6_ior; -unlink $replica1_iogr; -unlink $replica2_iogr; - -unlink $client_data; - - -exit $status; diff --git a/TAO/orbsvcs/tests/FT_App/run_test_notifier.pl b/TAO/orbsvcs/tests/FT_App/run_test_notifier.pl index 2e8e591f6cb..3d853e86187 100755 --- a/TAO/orbsvcs/tests/FT_App/run_test_notifier.pl +++ b/TAO/orbsvcs/tests/FT_App/run_test_notifier.pl @@ -131,15 +131,12 @@ unlink $notifier_ior; unlink $ready_file; unlink $client_data; -my ($rm_endpoint) = "-ORBEndpoint iiop://localhost:2833"; -my ($rm_initref) = "-ORBInitRef ReplicationManager=corbaloc::localhost:2833/ReplicationManager"; - my($status) = 0; my($REP1) = new PerlACE::Process (".$build_directory/ft_replica", "-o $factory1_ior -f none -t $replica1_ior -l loc1 -i type1 -q"); my($REP2) = new PerlACE::Process (".$build_directory/ft_replica", "-o $factory2_ior -f none -t $replica2_ior -l loc2 -i type1 -q"); -my($DET) = new PerlACE::Process ("$ENV{'TAO_ROOT'}/orbsvcs/Fault_Detector$build_directory/Fault_Detector", "$rm_initref -o $detector_ior -q"); -my($NOT) = new PerlACE::Process ("$ENV{'TAO_ROOT'}/orbsvcs/Fault_Notifier$build_directory/Fault_Notifier", "$rm_initref -o $notifier_ior -q"); +my($DET) = new PerlACE::Process ("$ENV{'TAO_ROOT'}/orbsvcs/Fault_Detector$build_directory/Fault_Detector", "-r -o $detector_ior -q"); +my($NOT) = new PerlACE::Process ("$ENV{'TAO_ROOT'}/orbsvcs/Fault_Notifier$build_directory/Fault_Notifier", "-r -o $notifier_ior -q"); my($ANA) = new PerlACE::Process (".$build_directory/ft_analyzer", "-o $ready_file -n file://$notifier_ior -d file://$detector_ior -r file://$replica1_ior -r file://$replica2_ior -q"); my($CL); diff --git a/TAO/orbsvcs/tests/FT_App/run_test_replication_mgr.pl b/TAO/orbsvcs/tests/FT_App/run_test_replication_mgr.pl deleted file mode 100755 index c63310c565e..00000000000 --- a/TAO/orbsvcs/tests/FT_App/run_test_replication_mgr.pl +++ /dev/null @@ -1,302 +0,0 @@ -eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' - & eval 'exec perl -S $0 $argv:q' - if 0; - -# $Id$ -# -*- perl -*- - -# Purpose: -# To test the FT_ReplicationManager -# -# Process being tested: -# FT_ReplicationManager -# implements the FT::ReplicationManager and -# CosNotifyComm::StructuredPushConsumer interfaces. -# Processes used in test: -# FT_Replica -# implements TestReplica interface. -# implements PullMonitorable. -# Fault_Detector -# implements FaultDetectorFactory interface -# implements PullMonitorable interface -# FT_Client -# client for TestReplica interface. -# client for PullMonitorable. -# Fault_Notifier -# implements the FaultNotifier interface. -# propagates fault reports to the FaultConsumer. -# -# Test Scenario (***Test: marks behavior being tested): -# Phase 1: -# Start two FT_Replicas -# FT_Replicas write TestReplica IORs (FR#1 and FR#2) to files -# Start the Fault_Detector -# Fault_Detector writes its IOR (FDF) to a file -# Start the Fault_Notifier -# Fault_Notifier writes its IOR (FN) to a file. -# Start the Fault_Consumer -# Subscribes to the Fault_Notifier for fault reports. -# Phase 2: -# Wait for IORs: FR#1, FR#2, FDF, and FN -# Start the StubAnalyzer giving it IORS: FR#1, FR#2 FDF, FN -# StubAnalyzer calls FDF to create a FaultDetector -# for each Replica. -# StubAnalyzer subscribes to Fault_Notifier -# StubAnalyzer writes dummy message(READY) to a file. -# Phase 3: -# Wait for READY -# Start FT_Client giving it IORS: FR#1 and FR#2. [1] -# FT_Client interacts with FR#1. -# FT_Client asks FR#1 to fault. It does so. -# FT_Client notices fault and switches to FR#2. [1] -# FD#1 notices fault and notifies Fault_Notifier -# FD#1 terminates -# ***Test: Fault_Notifier forwards notification to StubAnalyzer -# StubAnalyzer prints notification. -# FT_Client interacts with FR#2. -# FT_Client asks FR#2 to shut down. -# FT_Client shuts down. -# FD#2 notices FR2 is gone, interprets this -# as a fault, and sends notification to Fault_Notifier -# FD#2 terminates. -# ***Test: Fault_Notifier forwards notification to StubAnalyzer -# StubAnalyzer prints notification. -# Phase 4: shutting down. -# All FaultDetectors have terminated so the FaultDetectorFactory -# honors the "quit-on-idle" option on it's command line and exits. -# StubAnalyzer compares # fault notifications to # replicas. When -# they match, it "knows" that the test is over, so it shuts down. -# As it does so, it disconnects its fault consumers from the FaultNotifier. -# FaultNotifier notices the last fault consumer disconnecting and exits because -# the "quit-on-idle" option was specified on the command line. -# Phase 5: housekeeping -# Wait for all processes to terminate. -# Check termination status. -# Delete temp files. -# -# [1] Client mediated fault tolerance. These points will -# change when IOGR support is available. -use lib '../../../../bin'; -#use lib '$ENV{ACE_ROOT}/bin'; -use PerlACE::Run_Test; - -######################## -#command line options -#set defaults: -my($verbose) = 0; # 1: report perl actions before executing them -my($debug_builds) = 0; # 0: use exes from Release directories -my($simulated) = 1; # 1: use "client simulated" fault tolerance - -foreach $i (@ARGV) { - if ($i eq "--debug_build") - { - $debug_builds = 1; - } - elsif ($i eq "--no_simulate") # reverse this once we have FT ORB support - { - $simulated = 0; - } - elsif ($i eq "-v") - { - $verbose += 1; - } -} - - -my($build_directory) = "/Release"; -if ( $debug_builds ) { - $build_directory = ""; -} - -if ( $verbose > 1) { - print "verbose: $verbose\n"; - print "debug_builds: $debug_builds -> $build_directory\n"; - print "simulated: $simulated\n"; -} - -#define temp files -my($factory1_ior) = PerlACE::LocalFile ("factory1.ior"); -my($factory2_ior) = PerlACE::LocalFile ("factory2.ior"); -my($replica1_ior) = PerlACE::LocalFile ("replica1.ior"); -my($replica2_ior) = PerlACE::LocalFile ("replica2.ior"); -my($detector_ior) = PerlACE::LocalFile ("detector.ior"); -my($notifier_ior) = PerlACE::LocalFile ("notifier.ior"); -my($ready_file) = PerlACE::LocalFile ("ready.file"); -my($client_data) = PerlACE::LocalFile ("persistent.dat"); - -#discard junk from previous tests -unlink $factory1_ior; -unlink $factory2_ior; -unlink $replica1_ior; -unlink $replica2_ior; -unlink $detector_ior; -unlink $notifier_ior; -unlink $ready_file; -unlink $client_data; - -my ($rm_endpoint) = "-ORBEndpoint iiop://localhost:2833"; -my ($rm_initref) = "-ORBInitRef ReplicationManager=corbaloc::localhost:2833/ReplicationManager"; - -my($status) = 0; - -my($REP1) = new PerlACE::Process (".$build_directory/ft_replica", "-f none -o $factory1_ior -t $replica1_ior -l loc1 -i type1 -q -ORBInitRef ReplicationManager=corbaloc::localhost:2833/ReplicationManager"); -my($REP2) = new PerlACE::Process (".$build_directory/ft_replica", "-f none -o $factory2_ior -t $replica2_ior -l loc2 -i type1 -q -ORBInitRef ReplicationManager=corbaloc::localhost:2833/ReplicationManager"); -my($DET) = new PerlACE::Process ("$ENV{'TAO_ROOT'}/orbsvcs/Fault_Detector$build_directory/Fault_Detector", "$rm_initref -o $detector_ior -q"); -my($NOT) = new PerlACE::Process ("$ENV{'TAO_ROOT'}/orbsvcs/Fault_Notifier$build_directory/Fault_Notifier", "$rm_initref -o $notifier_ior -q"); -my($CONS) = new PerlACE::Process (".$build_directory/ft_fault_consumer", "-o $ready_file -n file://$notifier_ior -q -d file://$detector_ior -r file://$replica1_ior -r file://$replica2_ior"); -my($REPLM) = new PerlACE::Process ("$ENV{'TAO_ROOT'}/orbsvcs/FT_ReplicationManager$build_directory/FT_ReplicationManager", "$rm_endpoint -f file://$notifier_ior -ORBEndpoint iiop://localhost:2833"); -my($REPLM_CTRL) = new PerlACE::Process (".$build_directory/replmgr_controller", "$rm_initref -x"); - -my($CL); -if ($simulated) { - print "\nTEST: Preparing Client Mediated Fault Tolerance test.\n" if ($verbose); - $CL = new PerlACE::Process (".$build_directory/ft_client", "-f file://$replica1_ior -f file://$replica2_ior -c testscript"); -}else{ - print "\nTEST: Preparing IOGR based test.\n" if ($verbose); - $CL = new PerlACE::Process (".$build_directory/ft_client", "-f -f file://$replica1_iogr -c testscript"); -} - -print "\nTEST: starting detector factory " . $DET->CommandLine . "\n" if ($verbose); -$DET->Spawn (); - -print "TEST: waiting for detector's IOR\n" if ($verbose); -if (PerlACE::waitforfile_timed ($detector_ior, 5) == -1) { - print STDERR "ERROR: cannot find file <$detector_ior>\n"; - $DET->Kill (); $DET->TimedWait(1); - exit 1; -} - -print "\nTEST: starting notifier " . $NOT->CommandLine . "\n" if ($verbose); -$NOT->Spawn (); - -print "TEST: waiting for notifier's IOR\n" if ($verbose); -if (PerlACE::waitforfile_timed ($notifier_ior, 5) == -1) { - print STDERR "ERROR: cannot find file <$notifier_ior>\n"; - $DET->Kill (); $DET->TimedWait(1); - $NOT->Kill (); $NOT->TimedWait(1); - exit 1; -} - -print "\nTEST: starting replication manager " . $REPLM->CommandLine . "\n" if ($verbose); -$REPLM->Spawn (); - -print "TEST: waiting for Replication Manager's IOR file\n" if ($verbose); -if (PerlACE::waitforfile_timed ($replmgr_ior, 5) == -1) { - print STDERR "ERROR: cannot find file <$replmgr_ior>\n"; - $DET->Kill (); $DET->TimedWait(1); - $NOT->Kill (); $NOT->TimedWait(1); - $REPLM->Kill (); $REPLM->TimedWait(1); - exit 1; -} - -print "TEST: starting replica1 " . $REP1->CommandLine . "\n" if ($verbose); -$REP1->Spawn (); - -print "TEST: waiting for replica 1's IOR\n" if ($verbose); -if (PerlACE::waitforfile_timed ($replica1_ior, 5) == -1) { - print STDERR "ERROR: cannot find file <$replica1_ior>\n"; - $DET->Kill (); $DET->TimedWait(1); - $NOT->Kill (); $NOT->TimedWait(1); - $REPLM->Kill (); $REPLM->TimedWait(1); - $REP1->Kill (); $REP1->TimedWait (1); - exit 1; -} - -print "\nTEST: starting replica2 " . $REP2->CommandLine . "\n" if ($verbose); -$REP2->Spawn (); - -print "TEST: waiting for replica 2's IOR\n" if ($verbose); -if (PerlACE::waitforfile_timed ($replica2_ior, 5) == -1) { - print STDERR "ERROR: cannot find file <$replica2_ior>\n"; - $DET->Kill (); $DET->TimedWait(1); - $NOT->Kill (); $NOT->TimedWait(1); - $REPLM->Kill (); $REPLM->TimedWait(1); - $REP1->Kill (); $REP1->TimedWait (1); - $REP2->Kill (); $REP2->TimedWait (1); - exit 1; -} - -print "\nTEST: starting fault consumer " . $CONS->CommandLine . "\n" if ($verbose); -$CONS->Spawn (); - -print "TEST: waiting for READY.FILE from fault consumer\n" if ($verbose); -if (PerlACE::waitforfile_timed ($ready_file, 5) == -1) { - print STDERR "ERROR: cannot find file <$ready_file>\n"; - $DET->Kill (); $DET->TimedWait(1); - $NOT->Kill (); $NOT->TimedWait(1); - $REPLM->Kill (); $REPLM->TimedWait(1); - $REP1->Kill (); $REP1->TimedWait (1); - $REP2->Kill (); $REP2->TimedWait (1); - $CONS->Kill (); $CONS->TimedWait(1); - exit 1; -} - -print "\nTEST: starting client " . $CL->CommandLine . "\n" if ($verbose); -$client = $CL->SpawnWaitKill (60); - -if ($client != 0) { - print STDERR "ERROR: client returned $client\n"; - $status = 1; -} - -print "\nTEST: wait for replica 1.\n" if ($verbose); -$replica1 = $REP1->WaitKill (5); -if ($replica1 != 0) { - print STDERR "ERROR: replica returned $replica1\n"; - $status = 1; -} - -print "\nTEST: wait for replica 2.\n" if ($verbose); -$replica2 = $REP2->WaitKill (5); -if ($replica2 != 0) { - print STDERR "ERROR: replica returned $replica2\n"; - $status = 1; -} - -print "\nTEST: wait for detector factory to leave.\n" if ($verbose); -$detector = $DET->WaitKill (20); -if ($detector != 0) { - print STDERR "ERROR: detector returned $detector\n"; - $status = 1; -} - -print "\nTEST: wait for fault consumer to leave.\n" if ($verbose); -$consumer = $CONS->WaitKill (20); -if ($consumer != 0) { - print STDERR "ERROR: fault consumer returned $consumer\n"; - $status = 1; -} - -print "\nTEST: shutting down the replication manager.\n" if ($verbose); -$controller = $REPLM_CTRL->SpawnWaitKill (300); -if ($controller != 0) { - print STDERR "ERROR: replication manager controller returned $controller\n"; - $status = 1; -} - -print "\nTEST: wait for replication manager to leave.\n" if ($verbose); -$rm = $REPLM->WaitKill (30); -if ($rm != 0) { - print STDERR "ERROR: replication manager returned $rm\n"; - $status = 1; -} - -print "\nTEST: wait for notifier to leave.\n" if ($verbose); -$notifier = $NOT->WaitKill (20); -if ($notifier != 0) { - print STDERR "ERROR: notifier returned $notifier\n"; - $status = 1; -} - -print "\nTEST: releasing scratch files.\n" if ($verbose); -unlink $replica1_ior; -unlink $replica2_ior; -unlink $detector_ior; -unlink $notifier_ior; -unlink $replmgr_ior; -unlink $ready_file; - -#client's work file -unlink $client_data; - -exit $status; diff --git a/TAO/orbsvcs/tests/FT_App/run_test_rmregistry.pl b/TAO/orbsvcs/tests/FT_App/run_test_rmregistry.pl index f3022171159..9cb98e106b4 100755 --- a/TAO/orbsvcs/tests/FT_App/run_test_rmregistry.pl +++ b/TAO/orbsvcs/tests/FT_App/run_test_rmregistry.pl @@ -171,12 +171,12 @@ unlink $client_data; my($status) = 0; -my($RM) = new PerlACE::Process ("$ENV{'TAO_ROOT'}/orbsvcs/FT_ReplicationManager$build_directory/FT_ReplicationManager", "-o $rm_ior $rm_endpoint"); +my($RM) = new PerlACE::Process ("$ENV{'TAO_ROOT'}/orbsvcs/FT_ReplicationManager$build_directory/FT_ReplicationManager", "-ORBDebugLevel 0 -o $rm_ior $rm_endpoint"); my($RMC) = new PerlACE::Process (".$build_directory/replmgr_controller", "$rm_initref -x"); my($FAC1) = new PerlACE::Process (".$build_directory/ft_replica", "-o $factory1_ior $rm_initref -l $location1 -i $role1 -q"); my($FAC2) = new PerlACE::Process (".$build_directory/ft_replica", "-o $factory2_ior $rm_initref -l $location2 -i $role1 -i $role2 -i $role3 -q -u"); my($FAC3) = new PerlACE::Process (".$build_directory/ft_replica", "-o $factory3_ior $rm_initref -l $location3 -i $role2 -q -u"); -my($CTR) = new PerlACE::Process (".$build_directory/ft_create", "$rm_initref -r $role1 -r $role2 -r $role1 -u $role3"); +my($CTR) = new PerlACE::Process (".$build_directory/ft_create", "$rm_initref -n -r $role1 -r $role2 -r $role1 -u $role3 -i"); my($CL1); my($CL2); @@ -206,6 +206,7 @@ if (PerlACE::waitforfile_timed ($rm_ior, 5) == -1) { exit 1; } + ################# # Start Factories |