diff options
author | sbw1 <sbw1@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-07-15 02:24:57 +0000 |
---|---|---|
committer | sbw1 <sbw1@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-07-15 02:24:57 +0000 |
commit | 368bf4637626dfbf4a2681eeb72cde8fc6dc18b2 (patch) | |
tree | f77e388b8a8da1c13f53b742de8be8251923f16f | |
parent | 6960f65aae63dcbdd829a7841bae8cc32e3d3be5 (diff) | |
download | ATCD-368bf4637626dfbf4a2681eeb72cde8fc6dc18b2.tar.gz |
These tests now copmile with egcs. Added modify and withdraw_using_constraint
tests.
-rw-r--r-- | TAO/orbsvcs/tests/Trading/Makefile | 3 | ||||
-rw-r--r-- | TAO/orbsvcs/tests/Trading/Offer_Exporter.cpp | 183 | ||||
-rw-r--r-- | TAO/orbsvcs/tests/Trading/Offer_Exporter.h | 24 | ||||
-rw-r--r-- | TAO/orbsvcs/tests/Trading/Offer_Importer.cpp | 68 | ||||
-rw-r--r-- | TAO/orbsvcs/tests/Trading/Offer_Importer.h | 16 | ||||
-rw-r--r-- | TAO/orbsvcs/tests/Trading/Service_Type_Exporter.cpp | 38 | ||||
-rw-r--r-- | TAO/orbsvcs/tests/Trading/Service_Type_Exporter.h | 4 | ||||
-rw-r--r-- | TAO/orbsvcs/tests/Trading/TT_Info.cpp | 3 | ||||
-rw-r--r-- | TAO/orbsvcs/tests/Trading/TT_Info.h | 3 | ||||
-rw-r--r-- | TAO/orbsvcs/tests/Trading/colocated_test.cpp | 24 | ||||
-rw-r--r-- | TAO/orbsvcs/tests/Trading/export_test.cpp | 47 | ||||
-rw-r--r-- | TAO/orbsvcs/tests/Trading/import_test.cpp | 29 |
12 files changed, 333 insertions, 109 deletions
diff --git a/TAO/orbsvcs/tests/Trading/Makefile b/TAO/orbsvcs/tests/Trading/Makefile index 21c49273c3c..3412538498c 100644 --- a/TAO/orbsvcs/tests/Trading/Makefile +++ b/TAO/orbsvcs/tests/Trading/Makefile @@ -44,9 +44,6 @@ include $(TAO_ROOT)/rules.tao.GNU include $(ACE_ROOT)/include/makeinclude/rules.common.GNU include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU include $(ACE_ROOT)/include/makeinclude/rules.lib.GNU - -INSTALL= - include $(ACE_ROOT)/include/makeinclude/rules.bin.GNU include $(ACE_ROOT)/include/makeinclude/rules.local.GNU diff --git a/TAO/orbsvcs/tests/Trading/Offer_Exporter.cpp b/TAO/orbsvcs/tests/Trading/Offer_Exporter.cpp index 1698092db48..ffcc9dca083 100644 --- a/TAO/orbsvcs/tests/Trading/Offer_Exporter.cpp +++ b/TAO/orbsvcs/tests/Trading/Offer_Exporter.cpp @@ -3,8 +3,10 @@ TAO_Offer_Exporter:: TAO_Offer_Exporter (CosTrading::Lookup_ptr lookup_if, + CORBA::Boolean verbose, CORBA::Environment& _env) TAO_THROW_SPEC ((CORBA::SystemException)) + : verbose_ (verbose) { // Initialize the offer sequences and structures. this->create_offers (); @@ -66,21 +68,33 @@ TAO_Offer_Exporter::export_to (CosTrading::Register_ptr reg, this->props_plotters_[i], TAO_TRY_ENV); TAO_CHECK_ENV; - ACE_DEBUG ((LM_DEBUG, "Registered offer id: %s.\n", offer_id.in ())); + + if (this->verbose_) + { + ACE_DEBUG ((LM_DEBUG, "Registered offer id: %s.\n", offer_id.in ())); + } offer_id = reg->export (this->printer_[i]._this (TAO_TRY_ENV), TT_Info::INTERFACE_NAMES[2], this->props_printers_[i], TAO_TRY_ENV); TAO_CHECK_ENV; - ACE_DEBUG ((LM_DEBUG, "Registered offer id: %s.\n", offer_id.in ())); + + if (this->verbose_) + { + ACE_DEBUG ((LM_DEBUG, "Registered offer id: %s.\n", offer_id.in ())); + } offer_id = reg->export (this->fs_[i]._this (TAO_TRY_ENV), TT_Info::INTERFACE_NAMES[3], this->props_fs_[i], TAO_TRY_ENV); TAO_CHECK_ENV; - ACE_DEBUG ((LM_DEBUG, "Registered offer id: %s.\n", offer_id.in ())); + + if (this->verbose_) + { + ACE_DEBUG ((LM_DEBUG, "Registered offer id: %s.\n", offer_id.in ())); + } } } TAO_CATCHANY @@ -105,24 +119,40 @@ TAO_Offer_Exporter::export_offers_to_all (CORBA::Environment& _env) CosTrading::DuplicatePropertyName)) { ACE_DEBUG ((LM_DEBUG, "*** TAO_Offer_Exporter::Exporting to all.\n")); + + if (this->verbose_) + { + ACE_DEBUG ((LM_DEBUG, "Obtaining link interface.\n")); + } - ACE_DEBUG ((LM_DEBUG, "Obtaining link interface.\n")); CosTrading::Link_var link_if = this->register_->link_if (_env); TAO_CHECK_ENV_RETURN_VOID (_env); - ACE_DEBUG ((LM_DEBUG, "Obtaining references to traders directly" - " linked to the root trader.\n")); + if (this->verbose_) + { + ACE_DEBUG ((LM_DEBUG, "Obtaining references to traders directly" + " linked to the root trader.\n")); + } + CosTrading::LinkNameSeq_var link_name_seq = link_if->list_links (_env); TAO_CHECK_ENV_RETURN_VOID (_env); - ACE_DEBUG ((LM_DEBUG, "Registering offers with each of the linked" - " traders.\n")); + if (this->verbose_) + { + ACE_DEBUG ((LM_DEBUG, "Registering offers with each of the linked" + " traders.\n")); + } + for (int i = link_name_seq->length () - 1; i >= 0; i--) { TAO_TRY { - ACE_DEBUG ((LM_DEBUG, "Getting link information for %s\n", - ACE_static_cast (const char*, link_name_seq[i]))); + if (this->verbose_) + { + ACE_DEBUG ((LM_DEBUG, "Getting link information for %s\n", + ACE_static_cast (const char*, link_name_seq[i]))); + } + CosTrading::Link::LinkInfo_var link_info = link_if->describe_link (link_name_seq[i], _env); @@ -133,8 +163,11 @@ TAO_Offer_Exporter::export_offers_to_all (CORBA::Environment& _env) this->props_fs_[j][4].value <<= link_name_seq[i]; } - ACE_DEBUG ((LM_DEBUG, "Exporting offers to %s\n", - ACE_static_cast (const char*, link_name_seq[i]))); + if (this->verbose_) + { + ACE_DEBUG ((LM_DEBUG, "Exporting offers to %s\n", + ACE_static_cast (const char*, link_name_seq[i]))); + } CosTrading::Register_ptr remote_reg; #ifdef TAO_HAS_OBJECT_IN_STRUCT_MARSHAL_BUG @@ -211,18 +244,25 @@ TAO_Offer_Exporter::describe_offers (CORBA::Environment& _env) TAO_CHECK_ENV; if (offer_id_seq.ptr () != 0) - { + { length = offer_id_seq->length (); + + if (this->verbose_) + ACE_DEBUG ((LM_DEBUG, "------------------------------\n")); + for (CORBA::ULong i = 0; i < length; i++) { CosTrading::Register::OfferInfo_var offer_info = this->register_->describe (offer_id_seq[i], TAO_TRY_ENV); TAO_CHECK_ENV; - ACE_DEBUG ((LM_DEBUG, "Offer Id: %s\n", (const char *) offer_id_seq[i])); - ACE_DEBUG ((LM_DEBUG, "Service Type: %s\n", offer_info->type.in ())); - TT_Info::dump_properties (offer_info->properties, CORBA::B_FALSE); - ACE_DEBUG ((LM_DEBUG, "------------------------------\n")); + if (this->verbose_) + { + ACE_DEBUG ((LM_DEBUG, "Offer Id: %s\n", (const char *) offer_id_seq[i])); + ACE_DEBUG ((LM_DEBUG, "Service Type: %s\n", offer_info->type.in ())); + TT_Info::dump_properties (offer_info->properties, CORBA::B_FALSE); + ACE_DEBUG ((LM_DEBUG, "------------------------------\n")); + } } } } @@ -248,8 +288,45 @@ TAO_Offer_Exporter::modify_offers (CORBA::Environment& _env) CosTrading::Register::MandatoryProperty, CosTrading::Register::ReadonlyProperty, CosTrading::DuplicatePropertyName)) - { + ACE_DEBUG ((LM_DEBUG, "*** TAO_Offer_Exporter::Modifying all offers.\n")); + + TAO_TRY + { + CORBA::ULong amount = NUM_OFFERS; + CosTrading::OfferIdSeq_var offer_id_seq = this->grab_offerids (_env); + TAO_CHECK_ENV; + + if (offer_id_seq.ptr () != 0) + { + CORBA::ULong length = offer_id_seq->length (); + CosTrading::PropertyNameSeq del_list; + CosTrading::PropertySeq modify_list; + + del_list.length (1); + modify_list.length (2); + del_list[0] = TT_Info::REMOTE_IO_PROPERTY_NAMES[TT_Info::DESCRIPTION]; + modify_list[0].name = TT_Info::REMOTE_IO_PROPERTY_NAMES[TT_Info::LOCATION]; + modify_list[0].value <<= "MODIFIED"; + modify_list[1].name = TT_Info::REMOTE_IO_PROPERTY_NAMES[TT_Info::MISCELLANEOUS]; + modify_list[1].value <<= "MODIFIED"; + + for (CORBA::ULong i = 0; i < length; i++) + { + this->register_->modify (offer_id_seq[i], + del_list, + modify_list, + TAO_TRY_ENV); + TAO_CHECK_ENV; + } + } + } + TAO_CATCHANY + { + TAO_TRY_ENV.print_exception ("TAO_Offer_Exporter::modify_offers"); + TAO_RETHROW; + } + TAO_ENDTRY; } void @@ -261,6 +338,40 @@ withdraw_offers_using_constraints (CORBA::Environment& _env) CosTrading::IllegalConstraint, CosTrading::Register::NoMatchingOffers)) { + ACE_DEBUG ((LM_DEBUG, "*** TAO_Offer_Exporter::Withdrawing with constraint.\n")); + + const char* constraint = + "(not exist Description) and (Location == 'MODIFIED') and (exist Name)"; + + if (this->verbose_) + ACE_DEBUG ((LM_DEBUG, "Constraint: %s\n", constraint)); + + TAO_TRY + { + this->register_-> + withdraw_using_constraint (TT_Info::INTERFACE_NAMES[TT_Info::PLOTTER], + constraint, + TAO_TRY_ENV); + TAO_CHECK_ENV; + + this->register_-> + withdraw_using_constraint (TT_Info::INTERFACE_NAMES[TT_Info::PRINTER], + constraint, + TAO_TRY_ENV); + TAO_CHECK_ENV; + + this->register_-> + withdraw_using_constraint (TT_Info::INTERFACE_NAMES[TT_Info::FILESYSTEM], + constraint, + TAO_TRY_ENV); + TAO_CHECK_ENV; + } + TAO_CATCHANY + { + TAO_TRY_ENV.print_exception ("TAO_Offer_Exporter::withdraw_using_constraint"); + TAO_RETHROW; + } + TAO_ENDTRY; } CosTrading::OfferIdSeq* @@ -268,7 +379,8 @@ TAO_Offer_Exporter::grab_offerids (CORBA::Environment& _env) TAO_THROW_SPEC ((CORBA::SystemException, CosTrading::NotImplemented)) { - ACE_DEBUG ((LM_DEBUG, "\tTAO_Offer_Exporter::Grabbing all offer ids.\n")); + if (this->verbose_) + ACE_DEBUG ((LM_DEBUG, "TAO_Offer_Exporter::Grabbing all offer ids.\n")); CosTrading::OfferIdSeq_ptr offer_id_seq; TAO_TRY @@ -311,9 +423,12 @@ TAO_Offer_Exporter::grab_offerids (CORBA::Environment& _env) TAO_CHECK_ENV; } - ACE_DEBUG ((LM_DEBUG, "\tThe following offer ids are registered:\n")); - for (int len = offer_id_seq->length (), j = 0; j < len; j++) - ACE_DEBUG ((LM_DEBUG, "\tOffer Id: %s\n", (const char *)(*offer_id_seq)[j])); + if (this->verbose_) + { + ACE_DEBUG ((LM_DEBUG, "The following offer ids are registered:\n")); + for (int len = offer_id_seq->length (), j = 0; j < len; j++) + ACE_DEBUG ((LM_DEBUG, "Offer Id: %s\n", (const char *)(*offer_id_seq)[j])); + } } TAO_CATCHANY { @@ -330,7 +445,7 @@ TAO_Offer_Exporter::create_offers (void) { const int QUEUE_SIZE = 4; - int counter = 0; + int counter = 0, i = 0; char name[BUFSIZ]; char description[BUFSIZ]; CORBA::Any extra_info; @@ -348,7 +463,7 @@ TAO_Offer_Exporter::create_offers (void) // Initialize plotters string_seq.length (QUEUE_SIZE); ulong_seq.length (QUEUE_SIZE); - for (int i = 0; i < NUM_OFFERS; i++) + for (i = 0; i < NUM_OFFERS; i++) { ACE_OS::sprintf (name, "Plotter #%d", i); ACE_OS::sprintf (description, @@ -507,15 +622,19 @@ TAO_Offer_Exporter::create_offers (void) } #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Unbounded_Queue<CORBA::Object_var>; -template class TAO_Simple_Dynamic_Property<CosTradingSequences::StringSeq>; -template class TAO_Simple_Dynamic_Property<CosTradingSequences::ULongSeq>; -template class TAO_Simple_Dynamic_Property<CosTradingSequences::ULong>; +template class ACE_Node<TAO_Dynamic_Property*>; +template class ACE_Unbounded_Queue<TAO_Dynamic_Property*>; +template class ACE_Unbounded_Queue_Iterator<TAO_Dynamic_Property*>; +template class TAO_Simple_Dynamic_Property<TAO_Trader_Test::StringSeq>; +template class TAO_Simple_Dynamic_Property<TAO_Trader_Test::ULongSeq>; +template class TAO_Simple_Dynamic_Property<CORBA::ULong>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Unbounded_Queue<CORBA::Object_var> -#pragma instantiate TAO_Simple_Dynamic_Property<CosTradingSequences::StringSeq> -#pragma instantiate TAO_Simple_Dynamic_Property<CosTradingSequences::ULongSeq> -#pragma instantiate TAO_Simple_Dynamic_Property<CosTradingSequences::ULong> +#pragma instantiate ACE_Node<TAO_Dynamic_Property*> +#pragma instantiate ACE_Unbounded_Queue<TAO_Dynamic_Property*> +#pragma instantiate ACE_Unbounded_Queue_Iterator<TAO_Dynamic_Property*> +#pragma instantiate TAO_Simple_Dynamic_Property<TAO_Trader_Test::StringSeq> +#pragma instantiate TAO_Simple_Dynamic_Property<TAO_Trader_Test::ULongSeq> +#pragma instantiate TAO_Simple_Dynamic_Property<CORBA::ULong> #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/orbsvcs/tests/Trading/Offer_Exporter.h b/TAO/orbsvcs/tests/Trading/Offer_Exporter.h index cdb2f190167..17eb8b73e1b 100644 --- a/TAO/orbsvcs/tests/Trading/Offer_Exporter.h +++ b/TAO/orbsvcs/tests/Trading/Offer_Exporter.h @@ -24,6 +24,7 @@ class TAO_Offer_Exporter public: TAO_Offer_Exporter (CosTrading::Lookup_ptr lookup_if, + CORBA::Boolean verbose, CORBA::Environment& env) TAO_THROW_SPEC ((CORBA::SystemException)); @@ -40,7 +41,8 @@ public: CosTrading::ReadonlyDynamicProperty, CosTrading::MissingMandatoryProperty, CosTrading::DuplicatePropertyName)); - + // Export a number of offers to the Trading Service. + void export_offers_to_all (CORBA::Environment& env) TAO_THROW_SPEC ((CORBA::SystemException, CosTrading::Register::InvalidObjectRef, @@ -52,19 +54,22 @@ public: CosTrading::ReadonlyDynamicProperty, CosTrading::MissingMandatoryProperty, CosTrading::DuplicatePropertyName)); - + // Export a number of offers to all traders accessible by the + // bootstrapped trader. void withdraw_offers (CORBA::Environment& env) TAO_THROW_SPEC ((CORBA::SystemException, CosTrading::IllegalOfferId, CosTrading::UnknownOfferId, CosTrading::Register::ProxyOfferId)); + // Withdraw all exported offers. void describe_offers (CORBA::Environment& env) TAO_THROW_SPEC ((CORBA::SystemException, CosTrading::IllegalOfferId, CosTrading::UnknownOfferId, CosTrading::Register::ProxyOfferId)); + // Describe all the offers registered with the bootstrapped trader. void modify_offers (CORBA::Environment& env) TAO_THROW_SPEC ((CORBA::SystemException, @@ -79,13 +84,16 @@ public: CosTrading::Register::MandatoryProperty, CosTrading::Register::ReadonlyProperty, CosTrading::DuplicatePropertyName)); + // Remove some properties and change some properties in each offer. void withdraw_offers_using_constraints (CORBA::Environment& env) TAO_THROW_SPEC ((CORBA::SystemException, CosTrading::IllegalServiceType, CosTrading::UnknownServiceType, CosTrading::IllegalConstraint, - CosTrading::Register::NoMatchingOffers)); + CosTrading::Register::NoMatchingOffers)); + // Withdraw a number of offers based on a constraint string. + private: CosTrading::OfferIdSeq* grab_offerids (CORBA::Environment& env) @@ -93,6 +101,7 @@ private: CosTrading::NotImplemented)); void create_offers (void); + // Fill in each of the offer structures. void export_to (CosTrading::Register_ptr reg, CORBA::Environment& _env) @@ -106,8 +115,12 @@ private: CosTrading::ReadonlyDynamicProperty, CosTrading::MissingMandatoryProperty, CosTrading::DuplicatePropertyName)); + // Export the offers to the give Register interface. typedef ACE_Unbounded_Queue<TAO_Dynamic_Property*> DP_Queue; + + CORBA::Boolean verbose_; + // True if the user wants verbose output. CosTrading::Register_var register_; CosTrading::Admin_var admin_; @@ -115,12 +128,15 @@ private: TT_Info::Printer printer_[NUM_OFFERS]; TT_Info::Plotter plotter_[NUM_OFFERS]; TT_Info::File_System fs_[NUM_OFFERS]; + // The objects being exported. CosTrading::PropertySeq props_plotters_[NUM_OFFERS]; CosTrading::PropertySeq props_printers_[NUM_OFFERS]; CosTrading::PropertySeq props_fs_[NUM_OFFERS]; - + // Property sequences describing each service. + DP_Queue clean_up_; + // A list of dynamic properties to clean up upon destruction. }; #endif /* TAO_OFFER_EXPORTER_H */ diff --git a/TAO/orbsvcs/tests/Trading/Offer_Importer.cpp b/TAO/orbsvcs/tests/Trading/Offer_Importer.cpp index 9679dc50ed7..8141ff27877 100644 --- a/TAO/orbsvcs/tests/Trading/Offer_Importer.cpp +++ b/TAO/orbsvcs/tests/Trading/Offer_Importer.cpp @@ -1,8 +1,10 @@ // $Id$ #include "Offer_Importer.h" -TAO_Offer_Importer::TAO_Offer_Importer (CosTrading::Lookup_ptr lookup_if) - : lookup_ (lookup_if) +TAO_Offer_Importer::TAO_Offer_Importer (CosTrading::Lookup_ptr lookup_if, + CORBA::Boolean verbose) + : verbose_ (verbose), + lookup_ (lookup_if) { } @@ -56,19 +58,27 @@ TAO_Offer_Importer::perform_directed_queries (CORBA::Environment& _env) policies.return_card (16*NUM_OFFERS); policies.link_follow_rule (CosTrading::local_only); - ACE_DEBUG ((LM_DEBUG, "Obtaining link interface.\n")); + if (this->verbose_) + ACE_DEBUG ((LM_DEBUG, "Obtaining link interface.\n")); CosTrading::Link_var link_if = this->lookup_->link_if (_env); TAO_CHECK_ENV_RETURN_VOID (_env); - ACE_DEBUG ((LM_DEBUG, "Obtaining references to traders directly" - " linked to the root trader.\n")); + if (this->verbose_) + { + ACE_DEBUG ((LM_DEBUG, "Obtaining references to traders directly" + " linked to the root trader.\n")); + } CosTrading::LinkNameSeq_var link_name_seq = link_if->list_links (_env); TAO_CHECK_ENV_RETURN_VOID (_env); if (link_name_seq->length () > 0) { - ACE_DEBUG ((LM_DEBUG, "Getting link information for %s\n", - ACE_static_cast (const char*, link_name_seq[0]))); + if (this->verbose_) + { + ACE_DEBUG ((LM_DEBUG, "Getting link information for %s\n", + ACE_static_cast (const char*, link_name_seq[0]))); + } + CosTrading::Link::LinkInfo_var link_info = link_if->describe_link (link_name_seq[0], _env); TAO_CHECK_ENV_RETURN_VOID (_env); @@ -105,9 +115,12 @@ TAO_Offer_Importer::perform_directed_queries (CORBA::Environment& _env) CosTrading::LinkName* trader_name = CosTrading::TraderName::allocbuf (2); - ACE_DEBUG ((LM_DEBUG, "First stop %s, destination %s.\n", - ACE_static_cast (const char*, link_name_seq[0]), - ACE_static_cast (const char*, link_name_seq2[i]))); + if (this->verbose_) + { + ACE_DEBUG ((LM_DEBUG, "First stop %s, destination %s.\n", + ACE_static_cast (const char*, link_name_seq[0]), + ACE_static_cast (const char*, link_name_seq2[i]))); + } trader_name[0] = CORBA::string_dup (link_name_seq[0]); trader_name[1] = CORBA::string_dup (link_name_seq2[i]); @@ -193,19 +206,24 @@ perform_queries_with_policies (const TAO_Policy_Manager& policies, CosTrading::OfferSeq_var offer_seq (offer_seq_ptr); CosTrading::OfferIterator_var offer_iterator (offer_iterator_ptr); CosTrading::PolicyNameSeq_var limits_applied (limits_applied_ptr); - ACE_DEBUG ((LM_DEBUG, "*** Results:\n\n")); - - this->display_results (*offer_seq_ptr, - offer_iterator_ptr, - TAO_TRY_ENV); - TAO_CHECK_ENV; - - if (limits_applied_out->length () > 0) - ACE_DEBUG ((LM_DEBUG, "*** Limits Applied:\n\n")); - - for (int length = limits_applied_out->length (), j = 0; j < length; j++) + + if (this->verbose_) { - ACE_DEBUG ((LM_DEBUG, "%s\n", (const char *)(*limits_applied_out)[j])); + ACE_DEBUG ((LM_DEBUG, "*** Results:\n\n")); + this->display_results (*offer_seq_ptr, + offer_iterator_ptr, + TAO_TRY_ENV); + TAO_CHECK_ENV; + + if (limits_applied_out->length () > 0) + ACE_DEBUG ((LM_DEBUG, "*** Limits Applied:\n\n")); + + for (int length = limits_applied_out->length (), j = 0; j < length; j++) + { + ACE_DEBUG ((LM_DEBUG, "%s\n", + ACE_static_cast (const char *, + (*limits_applied_out)[j]))); + } } } } @@ -225,7 +243,9 @@ TAO_Offer_Importer::display_results (const CosTrading::OfferSeq& offer_seq, { TAO_TRY { - ACE_DEBUG ((LM_DEBUG, " Offers in the sequence:\n")); + ACE_DEBUG ((LM_DEBUG, "------------------------------\n")); + ACE_DEBUG ((LM_DEBUG, "Offers in the sequence:\n")); + ACE_DEBUG ((LM_DEBUG, "------------------------------\n")); for (int length = offer_seq.length (), i = 0; i < length; i++) { // Call back to the exported object. @@ -242,8 +262,10 @@ TAO_Offer_Importer::display_results (const CosTrading::OfferSeq& offer_seq, } ACE_DEBUG ((LM_DEBUG, " Offers in the iterator:\n")); + ACE_DEBUG ((LM_DEBUG, "------------------------------\n")); if (! CORBA::is_nil (offer_iterator)) { + CORBA::ULong length = offer_seq.length (); CORBA::Boolean any_left = CORBA::B_FALSE; do diff --git a/TAO/orbsvcs/tests/Trading/Offer_Importer.h b/TAO/orbsvcs/tests/Trading/Offer_Importer.h index b2d3e3e5260..bda3dc6a1c5 100644 --- a/TAO/orbsvcs/tests/Trading/Offer_Importer.h +++ b/TAO/orbsvcs/tests/Trading/Offer_Importer.h @@ -24,7 +24,8 @@ class TAO_Offer_Importer { public: - TAO_Offer_Importer (CosTrading::Lookup_ptr lookup_if); + TAO_Offer_Importer (CosTrading::Lookup_ptr lookup_if, + CORBA::Boolean verbose = CORBA::B_TRUE); void perform_queries (CORBA::Environment& _env) TAO_THROW_SPEC ((CORBA::SystemException, @@ -38,6 +39,7 @@ public: CosTrading::IllegalPropertyName, CosTrading::DuplicatePropertyName, CosTrading::DuplicatePolicyName)); + // Barrage the bootstrapped-to trader with queries. void perform_directed_queries (CORBA::Environment& _env) TAO_THROW_SPEC ((CORBA::SystemException, @@ -51,6 +53,9 @@ public: CosTrading::IllegalPropertyName, CosTrading::DuplicatePropertyName, CosTrading::DuplicatePolicyName)); + // Direct a query to a trader two graph edges distant from the + // bootstrapped-to trader. + private: void perform_queries_with_policies (const TAO_Policy_Manager& policy_manager, @@ -66,15 +71,20 @@ private: CosTrading::IllegalPropertyName, CosTrading::DuplicatePropertyName, CosTrading::DuplicatePolicyName)); - + // Perform a query on the bootstrapped-to trader given the policies + // pass in <policy_manager>. void display_results (const CosTrading::OfferSeq& offer_seq, CosTrading::OfferIterator_ptr offer_iterator, CORBA::Environment& _env) const TAO_THROW_SPEC ((CORBA::SystemException)); + // Display the results of the query to the screen. - CosTrading::Lookup_var lookup_; + CORBA::Boolean verbose_; + // Output the contents of each returned offer, if true. + CosTrading::Lookup_var lookup_; + // The interface on which to perform all those wonderful queries. }; #endif /* TAO_OFFER_IMPORTER */ diff --git a/TAO/orbsvcs/tests/Trading/Service_Type_Exporter.cpp b/TAO/orbsvcs/tests/Trading/Service_Type_Exporter.cpp index 1cf3a0845cf..d5582e30274 100644 --- a/TAO/orbsvcs/tests/Trading/Service_Type_Exporter.cpp +++ b/TAO/orbsvcs/tests/Trading/Service_Type_Exporter.cpp @@ -3,8 +3,10 @@ TAO_Service_Type_Exporter:: TAO_Service_Type_Exporter (CosTrading::Lookup_ptr lookup_if, + CORBA::Boolean verbose, CORBA::Environment& _env) - : lookup_ (lookup_if) + : verbose_ (verbose), + lookup_ (lookup_if) { // Obtain the Service Type Repository. CosTrading::TypeRepository_ptr obj = lookup_if->type_repos (_env); @@ -221,7 +223,11 @@ TAO_Service_Type_Exporter::list_all_types (CORBA::Environment& _env) for (int i = type_names->length () - 1; i >= 0; i--) { - ACE_DEBUG ((LM_DEBUG, "type name: %s\n", (const char *)type_names[i])); + if (this->verbose_) + { + ACE_DEBUG ((LM_DEBUG, "type name: %s\n", + ACE_static_cast (const char *, type_names[i]))); + } } } TAO_CATCHANY @@ -250,8 +256,11 @@ TAO_Service_Type_Exporter::describe_all_types (CORBA::Environment& _env) TAO_TRY_ENV); TAO_CHECK_ENV; - this->dump_typestruct (TT_Info::INTERFACE_NAMES[i], type_struct.in ()); - ACE_DEBUG ((LM_DEBUG, "------------------------------\n")); + if (this->verbose_) + { + this->dump_typestruct (TT_Info::INTERFACE_NAMES[i], type_struct.in ()); + ACE_DEBUG ((LM_DEBUG, "------------------------------\n")); + } } } TAO_CATCHANY @@ -280,9 +289,12 @@ TAO_Service_Type_Exporter::fully_describe_all_types (CORBA::Environment& _env) TAO_TRY_ENV); TAO_CHECK_ENV; - this->dump_typestruct (TT_Info::INTERFACE_NAMES[i], type_struct.in ()); - ACE_DEBUG ((LM_DEBUG, "------------------------------\n")); - } + if (this->verbose_) + { + this->dump_typestruct (TT_Info::INTERFACE_NAMES[i], type_struct.in ()); + ACE_DEBUG ((LM_DEBUG, "------------------------------\n")); + } + } } TAO_CATCHANY { @@ -328,7 +340,7 @@ void TAO_Service_Type_Exporter::create_types (void) { TT_Info::Remote_Output ro; - this->type_structs_[TT_Info::REMOTE_IO].props.length (5); + this->type_structs_[TT_Info::REMOTE_IO].props.length (6); this->type_structs_[TT_Info::REMOTE_IO].props[0].name = TT_Info::REMOTE_IO_PROPERTY_NAMES[TT_Info::NAME]; this->type_structs_[TT_Info::REMOTE_IO].props[0].value_type = @@ -340,13 +352,13 @@ TAO_Service_Type_Exporter::create_types (void) this->type_structs_[TT_Info::REMOTE_IO].props[1].value_type = CORBA::TypeCode::_duplicate (CORBA::_tc_string); this->type_structs_[TT_Info::REMOTE_IO].props[1].mode = - CosTradingRepos::ServiceTypeRepository::PROP_NORMAL; + CosTradingRepos::ServiceTypeRepository::PROP_MANDATORY; this->type_structs_[TT_Info::REMOTE_IO].props[2].name = TT_Info::REMOTE_IO_PROPERTY_NAMES[TT_Info::DESCRIPTION]; this->type_structs_[TT_Info::REMOTE_IO].props[2].value_type = CORBA::TypeCode::_duplicate (CORBA::_tc_string); this->type_structs_[TT_Info::REMOTE_IO].props[2].mode = - CosTradingRepos::ServiceTypeRepository::PROP_MANDATORY; + CosTradingRepos::ServiceTypeRepository::PROP_NORMAL; this->type_structs_[TT_Info::REMOTE_IO].props[3].name = TT_Info::REMOTE_IO_PROPERTY_NAMES[TT_Info::HOST_NAME]; this->type_structs_[TT_Info::REMOTE_IO].props[3].value_type = @@ -359,6 +371,12 @@ TAO_Service_Type_Exporter::create_types (void) CORBA::TypeCode::_duplicate (CORBA::_tc_string); this->type_structs_[TT_Info::REMOTE_IO].props[4].mode = CosTradingRepos::ServiceTypeRepository::PROP_NORMAL; + this->type_structs_[TT_Info::REMOTE_IO].props[5].name = + TT_Info::REMOTE_IO_PROPERTY_NAMES[TT_Info::MISCELLANEOUS]; + this->type_structs_[TT_Info::REMOTE_IO].props[5].value_type = + CORBA::TypeCode::_duplicate (CORBA::_tc_string); + this->type_structs_[TT_Info::REMOTE_IO].props[5].mode = + CosTradingRepos::ServiceTypeRepository::PROP_NORMAL; this->type_structs_[TT_Info::REMOTE_IO].if_name = ro._interface_repository_id (); diff --git a/TAO/orbsvcs/tests/Trading/Service_Type_Exporter.h b/TAO/orbsvcs/tests/Trading/Service_Type_Exporter.h index b4eb8b5e3fe..6841c713b0f 100644 --- a/TAO/orbsvcs/tests/Trading/Service_Type_Exporter.h +++ b/TAO/orbsvcs/tests/Trading/Service_Type_Exporter.h @@ -23,6 +23,7 @@ class TAO_Service_Type_Exporter public: TAO_Service_Type_Exporter (CosTrading::Lookup_ptr lookup_if, + CORBA::Boolean verbose, CORBA::Environment& _env) TAO_THROW_SPEC ((CORBA::SystemException)); @@ -101,6 +102,9 @@ private: const CosTradingRepos::ServiceTypeRepository::TypeStruct& type_struct) const; // Dump the contents of a service type description to standard // output. + + CORBA::Boolean verbose_; + // True if the user want profuse output. CosTrading::Lookup_var lookup_; // A reference to the lookup interface of the trading service diff --git a/TAO/orbsvcs/tests/Trading/TT_Info.cpp b/TAO/orbsvcs/tests/Trading/TT_Info.cpp index 67699621e00..b70236b3f32 100644 --- a/TAO/orbsvcs/tests/Trading/TT_Info.cpp +++ b/TAO/orbsvcs/tests/Trading/TT_Info.cpp @@ -19,7 +19,8 @@ const char* TT_Info::REMOTE_IO_PROPERTY_NAMES[] = "Location", "Description", "Host_Name", - "Trader_Name" + "Trader_Name", + "Miscellaneous" }; const char* TT_Info::PLOTTER_NAME = "Plotter"; diff --git a/TAO/orbsvcs/tests/Trading/TT_Info.h b/TAO/orbsvcs/tests/Trading/TT_Info.h index be9a16ab238..35a6f90721f 100644 --- a/TAO/orbsvcs/tests/Trading/TT_Info.h +++ b/TAO/orbsvcs/tests/Trading/TT_Info.h @@ -98,7 +98,8 @@ public: LOCATION, DESCRIPTION, HOST_NAME, - TRADER_NAME + TRADER_NAME, + MISCELLANEOUS }; static const char* REMOTE_IO_NAME; diff --git a/TAO/orbsvcs/tests/Trading/colocated_test.cpp b/TAO/orbsvcs/tests/Trading/colocated_test.cpp index 7ba25ffc22d..ac723dfd570 100644 --- a/TAO/orbsvcs/tests/Trading/colocated_test.cpp +++ b/TAO/orbsvcs/tests/Trading/colocated_test.cpp @@ -8,6 +8,21 @@ #include "orbsvcs/Trader/Trader.h" #include "orbsvcs/Trader/Service_Type_Repository.h" +void +parse_args (int argc, char *argv[], + CORBA::Boolean& verbose) +{ + int opt; + ACE_Get_Opt get_opt (argc, argv, "fq"); + + verbose = CORBA::B_TRUE; + while ((opt = get_opt ()) != EOF) + { + if (opt == 'q') + verbose = CORBA::B_FALSE; + } +} + int main (int argc, char** argv) { @@ -17,6 +32,10 @@ main (int argc, char** argv) orb_manager.init (argc, argv, TAO_TRY_ENV); TAO_CHECK_ENV + // Command line argument interpretation. + CORBA::Boolean verbose = CORBA::B_FALSE; + ::parse_args (argc, argv, verbose); + // Initialize ORB. CORBA::ORB_var orb = orb_manager.orb (); @@ -35,6 +54,7 @@ main (int argc, char** argv) ACE_DEBUG ((LM_DEBUG, "Running the Service Type Exporter tests.\n")); TAO_Service_Type_Exporter type_exporter (CosTrading::Lookup::_duplicate (trd_comp.lookup_if ()), + verbose, TAO_TRY_ENV); TAO_CHECK_ENV; @@ -57,6 +77,7 @@ main (int argc, char** argv) ACE_DEBUG ((LM_DEBUG, "Running the Offer Exporter tests.\n")); TAO_Offer_Exporter offer_exporter (CosTrading::Lookup::_duplicate (trd_comp.lookup_if ()), + verbose, TAO_TRY_ENV); TAO_CHECK_ENV; @@ -93,8 +114,7 @@ main (int argc, char** argv) // Run the Offer Importer tests ACE_DEBUG ((LM_DEBUG, "Running the Offer Exporter tests.\n")); TAO_Offer_Importer offer_importer - (CosTrading::Lookup::_duplicate (trd_comp.lookup_if ())); - TAO_CHECK_ENV; + (CosTrading::Lookup::_duplicate (trd_comp.lookup_if ()), verbose); offer_importer.perform_queries (TAO_TRY_ENV); TAO_CHECK_ENV; diff --git a/TAO/orbsvcs/tests/Trading/export_test.cpp b/TAO/orbsvcs/tests/Trading/export_test.cpp index 2dcac7f226e..7868dd9ae76 100644 --- a/TAO/orbsvcs/tests/Trading/export_test.cpp +++ b/TAO/orbsvcs/tests/Trading/export_test.cpp @@ -8,20 +8,23 @@ #include "orbsvcs/Trader/Trader.h" #include "orbsvcs/Trader/Service_Type_Repository.h" -int -is_federated (int argc, char *argv[]) +void +parse_args (int argc, char *argv[], + CORBA::Boolean& federated, + CORBA::Boolean& verbose) { int opt; - ACE_Get_Opt get_opt (argc, argv, "f"); + ACE_Get_Opt get_opt (argc, argv, "fq"); - CORBA::Boolean return_value = CORBA::B_FALSE; + verbose = CORBA::B_TRUE; + federated = CORBA::B_FALSE; while ((opt = get_opt ()) != EOF) { if (opt == 'f') - return_value = CORBA::B_TRUE; + federated = CORBA::B_TRUE; + else if (opt == 'q') + verbose = CORBA::B_FALSE; } - - return return_value; } @@ -34,7 +37,12 @@ main (int argc, char** argv) orb_manager.init (argc, argv, TAO_TRY_ENV); TAO_CHECK_ENV; - CORBA::Boolean federated = ::is_federated (argc, argv); + // Command line argument interpretation. + CORBA::Boolean federated = CORBA::B_FALSE, + verbose = CORBA::B_FALSE; + ::parse_args (argc, argv, federated, verbose); + + // Init the orb and bootstrap to the trading service. CORBA::ORB_var orb = orb_manager.orb (); ACE_DEBUG ((LM_ERROR, "*** Bootstrap to the Lookup interface.\n")); CORBA::Object_var trading_obj = @@ -54,6 +62,7 @@ main (int argc, char** argv) // Run the Service Type Exporter tests ACE_DEBUG ((LM_DEBUG, "*** Running the Service Type Exporter tests.\n")); TAO_Service_Type_Exporter type_exporter (lookup_if.ptr (), + verbose, TAO_TRY_ENV); TAO_CHECK_ENV; @@ -86,9 +95,11 @@ main (int argc, char** argv) // Run the Offer Exporter tests ACE_DEBUG ((LM_DEBUG, "*** Running the Offer Exporter tests.\n")); - TAO_Offer_Exporter offer_exporter (lookup_if, TAO_TRY_ENV); + TAO_Offer_Exporter offer_exporter (lookup_if, verbose, TAO_TRY_ENV); TAO_CHECK_ENV; - + + // = Test series. + offer_exporter.withdraw_offers (TAO_TRY_ENV); TAO_CHECK_ENV; @@ -98,17 +109,17 @@ main (int argc, char** argv) offer_exporter.describe_offers (TAO_TRY_ENV); TAO_CHECK_ENV; - // offer_exporter.modify_offers (TAO_TRY_ENV); - //TAO_CHECK_ENV; + offer_exporter.modify_offers (TAO_TRY_ENV); + TAO_CHECK_ENV; - //offer_exporter.describe_offers (TAO_TRY_ENV); - //TAO_CHECK_ENV; + offer_exporter.describe_offers (TAO_TRY_ENV); + TAO_CHECK_ENV; - //offer_exporter.withdraw_offers_using_constraints (TAO_TRY_ENV); - //TAO_CHECK_ENV; + offer_exporter.withdraw_offers_using_constraints (TAO_TRY_ENV); + TAO_CHECK_ENV; - //offer_exporter.describe_offers (TAO_TRY_ENV); - //TAO_CHECK_ENV; + offer_exporter.describe_offers (TAO_TRY_ENV); + TAO_CHECK_ENV; offer_exporter.withdraw_offers (TAO_TRY_ENV); TAO_CHECK_ENV; diff --git a/TAO/orbsvcs/tests/Trading/import_test.cpp b/TAO/orbsvcs/tests/Trading/import_test.cpp index bb6be388ac3..d1ff66837b4 100644 --- a/TAO/orbsvcs/tests/Trading/import_test.cpp +++ b/TAO/orbsvcs/tests/Trading/import_test.cpp @@ -4,20 +4,23 @@ #include "tao/TAO.h" #include "Offer_Importer.h" -int -is_federated (int argc, char *argv[]) +void +parse_args (int argc, char *argv[], + CORBA::Boolean& federated, + CORBA::Boolean& verbose) { int opt; - ACE_Get_Opt get_opt (argc, argv, "f"); + ACE_Get_Opt get_opt (argc, argv, "fq"); - CORBA::Boolean return_value = CORBA::B_FALSE; + verbose = CORBA::B_TRUE; + federated = CORBA::B_FALSE; while ((opt = get_opt ()) != EOF) { if (opt == 'f') - return_value = CORBA::B_TRUE; + federated = CORBA::B_TRUE; + else if (opt == 'q') + verbose = CORBA::B_FALSE; } - - return return_value; } int @@ -28,12 +31,14 @@ main (int argc, char** argv) TAO_ORB_Manager orb_manager; orb_manager.init (argc, argv, TAO_TRY_ENV); TAO_CHECK_ENV; + + // Command line argument interpretation. + CORBA::Boolean federated = CORBA::B_FALSE, + verbose = CORBA::B_FALSE; + ::parse_args (argc, argv, federated, verbose); - // Initialize ORB. + // Initialize the ORB and bootstrap to the Lookup interface. CORBA::ORB_var orb = orb_manager.orb (); - CORBA::Boolean federated = ::is_federated (argc, argv); - - // Bootstrap to the Lookup interface. ACE_DEBUG ((LM_ERROR, "Bootstrap to the Lookup interface.\n")); CORBA::Object_var trading_obj = orb->resolve_initial_references ("TradingService"); @@ -51,7 +56,7 @@ main (int argc, char** argv) // Run the Offer Importer tests ACE_DEBUG ((LM_DEBUG, "Running the Offer Importer tests.\n")); - TAO_Offer_Importer offer_importer (lookup_if); + TAO_Offer_Importer offer_importer (lookup_if, verbose); offer_importer.perform_queries (TAO_TRY_ENV); TAO_CHECK_ENV; |