diff options
author | hibbs_c <hibbs_c@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-10-02 16:24:50 +0000 |
---|---|---|
committer | hibbs_c <hibbs_c@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-10-02 16:24:50 +0000 |
commit | da5730e81ed9baebd6e8e6f42c688d56552a03d6 (patch) | |
tree | ef54d6ecff56263a8bbbc21debdd78f724116c06 | |
parent | 39a0bf134b94b4a38466366ccffe2be498665c5a (diff) | |
download | ATCD-da5730e81ed9baebd6e8e6f42c688d56552a03d6.tar.gz |
Thu Oct 2 11:23:02 2003 Curt Hibbs <hibbs_c@ociweb.com>
-rw-r--r-- | TAO/ChangeLog | 22 | ||||
-rw-r--r-- | TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.cpp | 155 | ||||
-rw-r--r-- | TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.h | 56 | ||||
-rw-r--r-- | TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager_Main.cpp | 109 | ||||
-rw-r--r-- | TAO/orbsvcs/tests/FT_App/FT_Client_Unit.cpp | 6 | ||||
-rw-r--r-- | TAO/orbsvcs/tests/FT_App/FT_UnitTests.cpp | 70 | ||||
-rw-r--r-- | TAO/orbsvcs/tests/FT_App/FT_UnitTests.h | 2 |
7 files changed, 225 insertions, 195 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index cd30c27fef6..efa542bc102 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,15 @@ +Thu Oct 2 11:23:02 2003 Curt Hibbs <hibbs_c@ociweb.com> + + * TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.cpp + * TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.h + * TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager_Main.cpp + * TAO/orbsvcs/tests/FT_App/FT_Client_Unit.cpp + * TAO/orbsvcs/tests/FT_App/FT_UnitTests.cpp + * TAO/orbsvcs/tests/FT_App/FT_UnitTests.h + Minor style and name changes to make the code following the ACE guidelines. + + These changes were made in the oci_haft branch. + Wed Oct 1 08:12:32 2003 Steve Totten <totten_s@ociweb.com> * orbsvcs/orbsvcs/PortableGroup/PG_ObjectGroupManager.cpp: @@ -27,6 +39,8 @@ Tue Sep 30 16:31:12 2003 Curt Hibbs <hibbs_c@ociweb.com> Minor changes to correct the way properties were being constructed and extracted. + These changes were made in the oci_haft branch. + Tue Sep 30 15:58:42 2003 Dale Wilson <wilson_d@ociweb.com> * orbsvcs/Fault_Detector/Fault_Detector_i.cpp: @@ -143,6 +157,8 @@ Mon Sep 29 16:15:55 2003 Curt Hibbs <hibbs_c@ociweb.com> The Replication Manager's unit tests were removed from the FT test App and moved into its own module. + These changes were made in the oci_haft branch. + Mon Sep 29 07:22:35 2003 Curt Hibbs <hibbs_c@ociweb.com> * CIAO/CIDLC/cidlc.vcproj: @@ -151,6 +167,8 @@ Mon Sep 29 07:22:35 2003 Curt Hibbs <hibbs_c@ociweb.com> * CIAO/CIDLC/parser_examples/cidl/idl3.vcproj: Removed generated files that should not have been checked in. + These changes were made in the oci_haft branch. + Fri Sep 26 19:31:11 2003 Balachandran Natarajan <bala@dre.vanderbilt.edu> * orbsvcs/orbsvcs/PortableGroup/PG_Utils.cpp (TAO): @@ -220,6 +238,8 @@ Wed Sep 24 17:05:00 2003 Curt Hibbs <hibbs_c@ociweb.com> * orbsvcs/orbsvcs/FaultTolerance/FT_Service_Callbacks.cpp: Explicitly cast to ULong to eliminate compiler warning on VC++ 7. + These changes were made in the oci_haft branch. + Wed Sep 24 11:41:48 2003 Balachandran Natarajan <bala@dre.vanderbilt.edu> * orbsvcs/tests/FaultTolerance/IOGR/Manager.cpp: @@ -264,6 +284,8 @@ Tue Sep 23 21:30:00 2003 Curt Hibbs <hibbs_c@ociweb.com> * orbsvcs/tests/FaultTolerance/IOGRManipulation/IOGRTest.cpp: Changed to eliminate compile errors due to merging changes. + These changes were made in the oci_haft branch. + Tue Sep 23 17:19:48 2003 Steve Totten <totten_s@ociweb.com> * orbsvcs/FT_ReplicationManager/FT_ReplicationManager.mpc: diff --git a/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.cpp b/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.cpp index d69e2133ad3..9be01b99237 100644 --- a/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.cpp +++ b/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.cpp @@ -37,11 +37,11 @@ ACE_RCSID (FT_ReplicationManager, TAO::FT_ReplicationManager::FT_ReplicationManager () : ior_output_file_(0) - , nsName_(0) + , ns_name_(0) , internals_ () , object_group_manager_ () - , property_manager_ (object_group_manager_) - , generic_factory_ (object_group_manager_, property_manager_) + , property_manager_ (this->object_group_manager_) + , generic_factory_ (this->object_group_manager_, this->property_manager_) { // @note "this->init()" is not called here (in the constructor) // since it may thrown an exception. Throwing an exception in @@ -55,12 +55,13 @@ TAO::FT_ReplicationManager::~FT_ReplicationManager (void) { } + ////////////////////////////////////////////////////// // FT_ReplicationManager public, non-CORBA methods int TAO::FT_ReplicationManager::parse_args (int argc, char * argv[]) { - ACE_Get_Opt get_opts (argc, argv, "o:q"); + ACE_Get_Opt get_opts (argc, argv, "n:o:q"); int c; while ((c = get_opts ()) != -1) @@ -68,7 +69,11 @@ int TAO::FT_ReplicationManager::parse_args (int argc, char * argv[]) switch (c) { case 'o': - ior_output_file_ = get_opts.opt_arg (); + this->ior_output_file_ = get_opts.opt_arg (); + break; + + case 'n': + this->ns_name_ = get_opts.opt_arg (); break; case '?': @@ -77,6 +82,7 @@ int TAO::FT_ReplicationManager::parse_args (int argc, char * argv[]) ACE_ERROR_RETURN ((LM_ERROR, "usage: %s" " -o <iorfile>" + " -n <name-to-bind-in-NameService>" "\n", argv [0]), -1); @@ -89,35 +95,14 @@ int TAO::FT_ReplicationManager::parse_args (int argc, char * argv[]) const char * TAO::FT_ReplicationManager::identity () const { - return identity_.c_str(); -} - -int TAO::FT_ReplicationManager::write_IOR() -{ - int result = -1; - FILE* out = ACE_OS::fopen (ior_output_file_, "w"); - if (out) - { - ACE_OS::fprintf (out, "%s", static_cast<const char *>(ior_)); - ACE_OS::fclose (out); - result = 0; - } - else - { - ACE_ERROR ((LM_ERROR, - "Open failed for %s\n", ior_output_file_ - )); - } - return result; + return this->identity_.c_str(); } -int -TAO::FT_ReplicationManager::init (TAO_ORB_Manager & orbManager - ACE_ENV_ARG_DECL) +int TAO::FT_ReplicationManager::init (TAO_ORB_Manager & orbManager + ACE_ENV_ARG_DECL) { - InternalGuard guard (internals_); int result = 0; - orb_ = orbManager.orb(); + this->orb_ = orbManager.orb(); // set our property validator FT_Property_Validator * property_validator; @@ -130,65 +115,65 @@ TAO::FT_ReplicationManager::init (TAO_ORB_Manager & orbManager this->property_manager_.init (property_validator); - // Register with the ORB. - ior_ = orbManager.activate (this - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); - //TODO - the poa should be externally settable - this->object_group_manager_.init (orb_, orbManager.root_poa()); + this->object_group_manager_.init (this->orb_, orbManager.root_poa()); // Get an object reference for the ORBs IORManipulation object! CORBA::Object_var IORM = - orb_->resolve_initial_references (TAO_OBJID_IORMANIPULATION, + this->orb_->resolve_initial_references (TAO_OBJID_IORMANIPULATION, 0 ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; - iorm_ = TAO_IOP::TAO_IOR_Manipulation::_narrow (IORM.in () + this->iorm_ = TAO_IOP::TAO_IOR_Manipulation::_narrow (IORM.in () ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; - if (ior_output_file_ != 0) + // Register with the ORB. + this->ior_ = orbManager.activate (this + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + if (this->ior_output_file_ != 0) { - identity_ = "file:"; - identity_ += ior_output_file_; - result = write_IOR(); + this->identity_ = "file:"; + this->identity_ += this->ior_output_file_; + result = this->write_ior(); } else { // if no IOR file specified, // then always try to register with name service - nsName_ = "ReplicationManager"; + this->ns_name_ = "ReplicationManager"; } - if (nsName_ != 0) + if (this->ns_name_ != 0) { - identity_ = "name:"; - identity_ += nsName_; + this->identity_ = "name:"; + this->identity_ += this->ns_name_; CORBA::Object_var naming_obj = - orb_->resolve_initial_references ("NameService" ACE_ENV_ARG_PARAMETER); + this->orb_->resolve_initial_references ("NameService" ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; if (CORBA::is_nil(naming_obj.in ())){ ACE_ERROR_RETURN ((LM_ERROR, - "%T %n (%P|%t) Unable to find the Naming Service\n"), + "%T %n (%P|%t) Unable to find the Naming Service\n"), 1); } - naming_context_ = + this->naming_context_ = CosNaming::NamingContext::_narrow (naming_obj.in () ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; - this_name_.length (1); - this_name_[0].id = CORBA::string_dup (nsName_); + this->this_name_.length (1); + this->this_name_[0].id = CORBA::string_dup (this->ns_name_); //@@ Do NOT use _this() here. Need to use the POA with which we // were activated to get the IOR. Another reason not to use the // TAO_ORB_Manager; it does not give us much flexibility w.r.t. // POA usage. -- Steve Totten - naming_context_->rebind (this_name_, _this() + this->naming_context_->rebind (this->this_name_, _this() ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; } @@ -196,6 +181,52 @@ TAO::FT_ReplicationManager::init (TAO_ORB_Manager & orbManager return result; } +int TAO::FT_ReplicationManager::idle (int & result) +{ + ACE_UNUSED_ARG (result); + int quit = 0; // never quit + return quit; +} + + +int TAO::FT_ReplicationManager::fini (ACE_ENV_SINGLE_ARG_DECL) +{ + if (this->ior_output_file_ != 0) + { + ACE_OS::unlink (this->ior_output_file_); + this->ior_output_file_ = 0; + } + if (this->ns_name_ != 0) + { + this->naming_context_->unbind (this->this_name_ + ACE_ENV_ARG_PARAMETER); + this->ns_name_ = 0; + } + return 0; +} + +//////////////////////////////////////////// +// FT_ReplicationManager private methods + +int TAO::FT_ReplicationManager::write_ior() +{ + int result = -1; + FILE* out = ACE_OS::fopen (this->ior_output_file_, "w"); + if (out) + { + ACE_OS::fprintf (out, "%s", static_cast<const char *>(this->ior_)); + ACE_OS::fclose (out); + result = 0; + } + else + { + ACE_ERROR ((LM_ERROR, + "Open failed for %s\n", this->ior_output_file_ + )); + } + return result; +} + ////////////////////////////////////////////////////// // FT::ReplicationManager methods @@ -220,7 +251,7 @@ ACE_THROW_SPEC (( , FT::InterfaceNotFound )) { - return FT::FaultNotifier::_duplicate (fault_notifier_.in()); + return FT::FaultNotifier::_duplicate (this->fault_notifier_.in()); } ////////////////////////////////////////////////////// @@ -535,7 +566,7 @@ TAO::FT_ReplicationManager::create_test_iogr (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAU const char * domain_id = "TestFTDomains"; // Object group id - test_iogr_group_id_ = (CORBA::ULongLong) 10; + this->test_iogr_group_id_ = (CORBA::ULongLong) 10; // create a property set TAO_PG::Properties_Encoder encoder; @@ -559,26 +590,26 @@ TAO::FT_ReplicationManager::create_test_iogr (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAU // Create a few fictitious IORs //@@ Corrected to use corbaloc ObjectURL syntax. -- Steve Totten CORBA::Object_var name1 = - orb_->string_to_object ("corbaloc:iiop:acme.cs.wustl.edu:6060/xyz" + this->orb_->string_to_object ("corbaloc:iiop:acme.cs.wustl.edu:6060/xyz" ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; CORBA::Object_var name2 = - orb_->string_to_object ("corbaloc::iiop:tango.cs.wustl.edu:7070/xyz" + this->orb_->string_to_object ("corbaloc::iiop:tango.cs.wustl.edu:7070/xyz" ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; // Create IOR list for use with merge_iors. TAO_IOP::TAO_IOR_Manipulation::IORList iors (3); iors.length (3); - iors [0] = object_group_manager_.create_object_group( - test_iogr_group_id_, + iors [0] = this->object_group_manager_.create_object_group( + this->test_iogr_group_id_, domain_id, "my-dummy-type-id", props_in); iors [1] = name1; iors [2] = name2; - test_iogr_ = iorm_->merge_iors (iors ACE_ENV_ARG_PARAMETER); + this->test_iogr_ = this->iorm_->merge_iors (iors ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; // we only need this so we can call IORManipulation's set_primary @@ -587,7 +618,7 @@ TAO::FT_ReplicationManager::create_test_iogr (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAU // set primary CORBA::Boolean retval = - iorm_->set_primary (&ft_prop, name2.in (), test_iogr_.in () ACE_ENV_ARG_PARAMETER); + this->iorm_->set_primary (&ft_prop, name2.in (), this->test_iogr_.in () ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; if (retval != 0) @@ -632,8 +663,8 @@ TAO::FT_ReplicationManager::create_test_iogr (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAU ACE_DEBUG ((LM_DEBUG, "---------------------------------------------\n")); - //@@ Object_var (test_iogr_) must give up ownership to return IOGR + //@@ Object_var (this->test_iogr_) must give up ownership to return IOGR // as an Object_ptr. -- Steve Totten - return test_iogr_._retn(); + return this->test_iogr_._retn(); } diff --git a/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.h b/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.h index a9f689d1e53..7489119d68a 100644 --- a/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.h +++ b/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.h @@ -68,27 +68,41 @@ namespace TAO public: - /** - * Initialize the replication manager, publish it's IOR, - * and otherwise start things rolling. - * @param orbManager our ORB -- we keep var to it. - * @return zero for success; nonzero is process return code for failure. - */ - int init (TAO_ORB_Manager & orbManager ACE_ENV_ARG_DECL_WITH_DEFAULTS); + /** + * Parse command line arguments. + * @param argc traditional C argc + * @param argv traditional C argv + * @return zero for success; nonzero is process return code for failure. + */ + int parse_args (int argc, char * argv[]); - /** - * Parse command line arguments. - * @param argc traditional C argc - * @param argv traditional C argv - * @return zero for success; nonzero is process return code for failure. - */ - int parse_args (int argc, char * argv[]); + /** + * Initialize this object. + * @param orbManager our ORB -- we keep var to it. + * @return zero for success; nonzero is process return code for failure. + */ + int init (TAO_ORB_Manager & orbManager ACE_ENV_ARG_DECL_WITH_DEFAULTS); - /** - * Identify this replication manager. - * @return a string to identify this object for logging/console message purposes. - */ - const char * identity () const; + /** + * Prepare to exit. + * @return zero for success; nonzero is process return code for failure. + */ + int fini (ACE_ENV_SINGLE_ARG_DECL); + + /** + * Idle-time activity. + * + * @param result is set to process return code if return value is non-zero. + * @return zero to continue; nonzero to exit + */ + int idle(int & result); + + + /** + * Identify this fault detector factory. + * @return a string to identify this object for logging/console message purposes. + */ + const char * identity () const; ///////////////////////// // Implementation methods @@ -96,7 +110,7 @@ namespace TAO /** * Write this factory's IOR to a file */ - int write_IOR (void); + int write_ior (void); /** * Extract the value of the InitialNumberReplicas property from @@ -409,7 +423,7 @@ namespace TAO /// A name to be used to register the factory with the name service. - const char * nsName_; + const char * ns_name_; CosNaming::NamingContext_var naming_context_; CosNaming::Name this_name_; diff --git a/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager_Main.cpp b/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager_Main.cpp index c8ce94c72b7..318168c6e50 100644 --- a/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager_Main.cpp +++ b/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager_Main.cpp @@ -13,105 +13,22 @@ */ //============================================================================= -#include "ace/pre.h" - -#include "tao/PortableServer/ORB_Manager.h" -#include "orbsvcs/FT_ReplicationManager/FT_ReplicationManager.h" -#include "orbsvcs/FT_ReplicationManagerS.h" -#include "tao/ORB_Core.h" -#include "ace/Get_Opt.h" - -#include "ace/Argv_Type_Converter.h" -#include "tao/PortableServer/ORB_Manager.h" - -#ifdef PG_PS_UNIT_TEST -# include "orbsvcs/PortableGroup/PG_Properties_Encoder.h" -# include "orbsvcs/PortableGroup/PG_Properties_Decoder.h" -#endif // PG_PS_UNIT_TEST - - +#include <tao/Utils/ServantMain.h> +#include "FT_ReplicationManager.h" int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { - // Copy command line parameter. - // and hide it's unicodeness. - ACE_Argv_Type_Converter command_line(argc, argv); - - char ** asciiArgv = command_line.get_ASCII_argv(); - - // create an instance of the replication manager and give it the first - // chance at the arguments. - TAO::FT_ReplicationManager rm; - int result = rm.parse_args (argc, asciiArgv); - if (result == 0) - { - ACE_TRY_NEW_ENV - { - - // Create an object that manages all the - // details of being a server. It, too, gets to see the command line. - TAO_ORB_Manager orbManager; + TAO::Utils::ServantMain<TAO::FT_ReplicationManager> servantMain("ReplicationManager"); + return servantMain.Main(argc, argv); +} - result = orbManager.init (argc, asciiArgv - ACE_ENV_ARG_PARAMETER); - if(result == 0) - { - ACE_CHECK_RETURN (-1); +/////////////////////////////////// +// Template instantiation for +// inept compilers. -// property set helper test -#ifdef PG_PS_UNIT_TEST - if ( Portable_Group::Properties::test_encode_decode () ) - { - ACE_ERROR ((LM_ERROR, - "%n\n%T: Passed property set self-test.\n " - )); - } -#endif - - // initialize the replication manager - result = rm.init(orbManager); - if (result == 0) - { - ACE_ERROR ((LM_ERROR, - "%n\n%T: ReplicationManager Ready %s\n", rm.identity() - )); +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) + template TAO::Utils::ServantMain<FT_FaultDetectorFactory_i>; +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +# pragma instantiate TAO::Utils::ServantMain<FT_FaultDetectorFactory_i> +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ - // Run the main event loop for the ORB. - result = orbManager.run (ACE_ENV_SINGLE_ARG_PARAMETER); - if (result == -1) - { - ACE_ERROR_RETURN ( - (LM_ERROR, "%n\n%T: FT::run error"), - -1); - } - ACE_TRY_CHECK; - ACE_ERROR ((LM_ERROR, - "%n\n%T: Terminated normally. %s\n", rm.identity() - )); - } - else - { - ACE_ERROR ((LM_ERROR, - "%n\n%T: FT_ReplicationManager init failed: %p\n" - )); - result = -1; - } - } - else - { - ACE_ERROR ((LM_ERROR, - "%n\n%T: ORB manager init failed\n" - )); - result = -1; - } - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, - "FT_ReplicationManager::main\t\n"); - result = -1; - } - ACE_ENDTRY; - } - return result; -} diff --git a/TAO/orbsvcs/tests/FT_App/FT_Client_Unit.cpp b/TAO/orbsvcs/tests/FT_App/FT_Client_Unit.cpp index f66d9ff81ae..f0bd5ffc9d8 100644 --- a/TAO/orbsvcs/tests/FT_App/FT_Client_Unit.cpp +++ b/TAO/orbsvcs/tests/FT_App/FT_Client_Unit.cpp @@ -47,7 +47,6 @@ private: int argc_; char ** argv_; const char * inFileName_; - const char * inRepMgrIor_; std::ifstream inFile_; std::istream *commandIn_; CORBA::ORB_var orb_; @@ -174,7 +173,7 @@ FTClientUnitMain::parse_args (int argc, char *argv[]) break; case 'r': - inRepMgrIor_ = get_opts.opt_arg (); + // ignore: process by FT_UnitTests break; default: @@ -193,8 +192,9 @@ FTClientUnitMain::parse_args (int argc, char *argv[]) void FTClientUnitMain::usage(ostream & out)const { - out << "usage" + out << "Usage:" << " -c <command file>" + << " -f <rep-factory-ior>,<rep-factory-ior>, ..." << " -r <ior of ReplicationManager>" << " -d (debug)" << std::endl; diff --git a/TAO/orbsvcs/tests/FT_App/FT_UnitTests.cpp b/TAO/orbsvcs/tests/FT_App/FT_UnitTests.cpp index 7466bde1a7c..c65183c97aa 100644 --- a/TAO/orbsvcs/tests/FT_App/FT_UnitTests.cpp +++ b/TAO/orbsvcs/tests/FT_App/FT_UnitTests.cpp @@ -498,21 +498,18 @@ int FT_UnitTests::test_004 (int run_test, ACE_ERROR((LM_ERROR, "Error cannot allocate properties.\n" )); - result = 1; + return 1; } - else - { - encoder.encode(props_in); - PortableGroup::GenericFactory::FactoryCreationId_var fcid; - CORBA::Object_var my_object_group = - rm_->create_object (type_id, - props_in, - fcid.out() - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + encoder.encode(props_in); - } + PortableGroup::GenericFactory::FactoryCreationId_var fcid; + CORBA::Object_var my_object_group = + rm_->create_object (type_id, + props_in, + fcid.out() + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; } } ACE_CATCHANY @@ -740,7 +737,7 @@ int FT_UnitTests::parse_args (int argc, char * argv[]) int result = 0; char * rm_ior = 0; - ACE_Get_Opt get_opts (argc, argv, "r:"); + ACE_Get_Opt get_opts (argc, argv, "f:r:"); int c; while ((c = get_opts ()) != -1) { @@ -767,6 +764,53 @@ int FT_UnitTests::parse_args (int argc, char * argv[]) } break; } + case 'f': + { + // use this list of iors to construct a list of + // FactoryInfos for the unit tests + char * file_list = get_opts.opt_arg (); + char * delim; + char * ior_file; + int count = 0; + int i; + do + { + delim = ACE_OS::strchr (file_list, ';'); + ior_file = file_list; + if (delim != 0) + { + *delim = '\0'; + file_list = delim + 1; + } + std::cout << "Using factory ior-file: '" << ior_file << "'" << std::endl; + + CORBA::String_var ior; + if (!readIORFile(ior_file, ior)) + { + std::cerr << "Can't read file " << ior_file << std::endl; + result = -1; + break; + } + + CORBA::Object_var obj = orb_->string_to_object(ior); + FT::GenericFactory_var factory = factory.in(); + if (CORBA::is_nil(factory)) + { + std::cerr << "Can't resolve GenericFactory IOR in " << ior_file << std::endl; + result = -1; + break; + } + + // create a dummy FactoryInfo for testing. + i = count++; + factories_[i].the_factory = FT::GenericFactory::_narrow(obj); + factories_.length(count); + factories_[i].the_location.length (1); + factories_[i].the_location[0].id = ior_file; // use filename as location + factories_[i].the_criteria = 0; + } while (delim != 0); + break; + } } } return result; diff --git a/TAO/orbsvcs/tests/FT_App/FT_UnitTests.h b/TAO/orbsvcs/tests/FT_App/FT_UnitTests.h index f0d77f22578..3a425db7921 100644 --- a/TAO/orbsvcs/tests/FT_App/FT_UnitTests.h +++ b/TAO/orbsvcs/tests/FT_App/FT_UnitTests.h @@ -95,6 +95,8 @@ private: // an iogr for use in the unit tests CORBA::Object_var test_iogr_; + // A list of FactoryInfos ofr the unit tests + FT::FactoryInfos factories_; }; |