diff options
author | msmit <msmit@remedy.nl> | 2011-06-10 11:22:03 +0000 |
---|---|---|
committer | msmit <msmit@remedy.nl> | 2011-06-10 11:22:03 +0000 |
commit | 357bedf8a95cda811b0c2f9fb8cfde6e2b57259d (patch) | |
tree | 646bbfc35b0b5d7d8678a95ad4f0b7c1d202704f | |
parent | ac3fd23ef26d58090a694dd9a221a17801664f75 (diff) | |
download | ATCD-357bedf8a95cda811b0c2f9fb8cfde6e2b57259d.tar.gz |
Fri Jun 10 11:17:36 UTC 2011 Marcel Smit <msmit@remedy.nl>
* connectors/dds4ccm/impl/DDS_TopicBase_Connector_T.h:
* connectors/dds4ccm/impl/DDS_TopicBase_Connector_T.cpp:
* connectors/dds4ccm/impl/ndds/TypeSupport.h:
* connectors/dds4ccm/impl/ndds/TypeSupport.cpp:
Fixed memory leak in the register_type/unregister_type implemenation. This
memory existed because of the fact that two different topics where based
on the same datatype.
To fix this, a new map was created wich contains the DomainParticipant in
combination with the already existing type factories. Type factories
are now stored and removed per DomainParticipant.
* connectors/dds4ccm/tests/MemLeakDetection/TypeRegistration:
* connectors/dds4ccm/tests/MemLeakDetection/TypeRegistration/Base:
* connectors/dds4ccm/tests/MemLeakDetection/TypeRegistration/Base/TypeRegistration_Test_Base.idl:
* connectors/dds4ccm/tests/MemLeakDetection/TypeRegistration/Base/TypeRegistration_Test_Base.mpc:
* connectors/dds4ccm/tests/MemLeakDetection/TypeRegistration/Component:
* connectors/dds4ccm/tests/MemLeakDetection/TypeRegistration/Component/TypeRegistration_Test_Component.idl:
* connectors/dds4ccm/tests/MemLeakDetection/TypeRegistration/Component/TypeRegistration_Test_Component.mpc:
* connectors/dds4ccm/tests/MemLeakDetection/TypeRegistration/Component/TypeRegistration_Test_Component_exec.h:
* connectors/dds4ccm/tests/MemLeakDetection/TypeRegistration/Component/TypeRegistration_Test_Component_exec.cpp:
* connectors/dds4ccm/tests/MemLeakDetection/TypeRegistration/Connector:
* connectors/dds4ccm/tests/MemLeakDetection/TypeRegistration/Connector/TypeRegistration_Test_Connector.idl:
* connectors/dds4ccm/tests/MemLeakDetection/TypeRegistration/Connector/TypeRegistration_Test_Connector.mpc:
* connectors/dds4ccm/tests/MemLeakDetection/TypeRegistration/descriptors:
* connectors/dds4ccm/tests/MemLeakDetection/TypeRegistration/descriptors/Plan.cdp:
* connectors/dds4ccm/tests/MemLeakDetection/TypeRegistration/descriptors/run_test.pl:
Added test to verify whether the memory leak is fixed.
15 files changed, 1581 insertions, 23 deletions
diff --git a/CIAO/ChangeLog b/CIAO/ChangeLog index 70f3715625d..4fda4a0f7cd 100644 --- a/CIAO/ChangeLog +++ b/CIAO/ChangeLog @@ -1,3 +1,33 @@ +Fri Jun 10 11:17:36 UTC 2011 Marcel Smit <msmit@remedy.nl> + + * connectors/dds4ccm/impl/DDS_TopicBase_Connector_T.h: + * connectors/dds4ccm/impl/DDS_TopicBase_Connector_T.cpp: + * connectors/dds4ccm/impl/ndds/TypeSupport.h: + * connectors/dds4ccm/impl/ndds/TypeSupport.cpp: + Fixed memory leak in the register_type/unregister_type implemenation. This + memory existed because of the fact that two different topics where based + on the same datatype. + To fix this, a new map was created wich contains the DomainParticipant in + combination with the already existing type factories. Type factories + are now stored and removed per DomainParticipant. + + * connectors/dds4ccm/tests/MemLeakDetection/TypeRegistration: + * connectors/dds4ccm/tests/MemLeakDetection/TypeRegistration/Base: + * connectors/dds4ccm/tests/MemLeakDetection/TypeRegistration/Base/TypeRegistration_Test_Base.idl: + * connectors/dds4ccm/tests/MemLeakDetection/TypeRegistration/Base/TypeRegistration_Test_Base.mpc: + * connectors/dds4ccm/tests/MemLeakDetection/TypeRegistration/Component: + * connectors/dds4ccm/tests/MemLeakDetection/TypeRegistration/Component/TypeRegistration_Test_Component.idl: + * connectors/dds4ccm/tests/MemLeakDetection/TypeRegistration/Component/TypeRegistration_Test_Component.mpc: + * connectors/dds4ccm/tests/MemLeakDetection/TypeRegistration/Component/TypeRegistration_Test_Component_exec.h: + * connectors/dds4ccm/tests/MemLeakDetection/TypeRegistration/Component/TypeRegistration_Test_Component_exec.cpp: + * connectors/dds4ccm/tests/MemLeakDetection/TypeRegistration/Connector: + * connectors/dds4ccm/tests/MemLeakDetection/TypeRegistration/Connector/TypeRegistration_Test_Connector.idl: + * connectors/dds4ccm/tests/MemLeakDetection/TypeRegistration/Connector/TypeRegistration_Test_Connector.mpc: + * connectors/dds4ccm/tests/MemLeakDetection/TypeRegistration/descriptors: + * connectors/dds4ccm/tests/MemLeakDetection/TypeRegistration/descriptors/Plan.cdp: + * connectors/dds4ccm/tests/MemLeakDetection/TypeRegistration/descriptors/run_test.pl: + Added test to verify whether the memory leak is fixed. + Wed Jun 8 12:32:48 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl> * connectors/dds4ccm/tests/VariousTopicsEvent/Base/VTopic_Base.idl: diff --git a/CIAO/connectors/dds4ccm/impl/DDS_TopicBase_Connector_T.cpp b/CIAO/connectors/dds4ccm/impl/DDS_TopicBase_Connector_T.cpp index e07cf813e3f..3ecfc02155d 100644 --- a/CIAO/connectors/dds4ccm/impl/DDS_TopicBase_Connector_T.cpp +++ b/CIAO/connectors/dds4ccm/impl/DDS_TopicBase_Connector_T.cpp @@ -208,13 +208,19 @@ DDS_TopicBase_Connector_T<CCM_TYPE, DDS_TYPE, SEQ_TYPE>::register_type ( throw ::CORBA::INTERNAL (); } - typedef ::CIAO::NDDS::DDS_TypeFactory_T <DDS_TYPE, SEQ_TYPE> dds_type_factory; - ::CIAO::NDDS::DDS_TypeFactory_i * factory = 0; + dds_type_factory *factory = 0; ACE_NEW_THROW_EX (factory, dds_type_factory (), ::CORBA::NO_MEMORY ()); - ::CIAO::NDDS::DDS_TypeSupport_i::register_type (typesupport_name, factory, participant); + if (! ::CIAO::NDDS::DDS_TypeSupport_i::register_type (typesupport_name, factory, participant)) + { + DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO + ACE_TEXT ("DDS_TopicBase_Connector_T::register_type - ") + ACE_TEXT ("Type <%C> is already registered.\n"), + typesupport_name)); + delete factory; + } retcode = DDS_TYPE::type_support::register_type( part->get_rti_entity (), typesupport_name); @@ -242,9 +248,11 @@ DDS_TopicBase_Connector_T<CCM_TYPE, DDS_TYPE, SEQ_TYPE>::unregister_type ( const char * typesupport_name) { DDS4CCM_TRACE ("DDS_TopicBase_Connector_T::unregister_type"); + #if (CIAO_DDS4CCM_NDDS==1) ::CIAO::NDDS::DDS_TypeFactory_i * factory = ::CIAO::NDDS::DDS_TypeSupport_i::unregister_type (typesupport_name, participant); + delete factory; #else ACE_UNUSED_ARG (participant); diff --git a/CIAO/connectors/dds4ccm/impl/DDS_TopicBase_Connector_T.h b/CIAO/connectors/dds4ccm/impl/DDS_TopicBase_Connector_T.h index 4f19fef2734..30893e23f89 100644 --- a/CIAO/connectors/dds4ccm/impl/DDS_TopicBase_Connector_T.h +++ b/CIAO/connectors/dds4ccm/impl/DDS_TopicBase_Connector_T.h @@ -56,6 +56,8 @@ protected: ::DDS::SubscriberListener_var subscriber_listener_; typedef DDS_Base_Connector_T<CCM_TYPE> BaseConnector; + typedef ::CIAO::NDDS::DDS_TypeFactory_T <DDS_TYPE, SEQ_TYPE> dds_type_factory; + private: bool late_binding_; }; diff --git a/CIAO/connectors/dds4ccm/impl/ndds/TypeSupport.cpp b/CIAO/connectors/dds4ccm/impl/ndds/TypeSupport.cpp index 8833f5b67c4..00f85efb477 100644 --- a/CIAO/connectors/dds4ccm/impl/ndds/TypeSupport.cpp +++ b/CIAO/connectors/dds4ccm/impl/ndds/TypeSupport.cpp @@ -2,7 +2,8 @@ #include "dds4ccm/impl/ndds/TypeSupport.h" -std::map <ACE_CString, ::CIAO::NDDS::DDS_TypeFactory_i*> CIAO::NDDS::DDS_TypeSupport_i::type_factories; +std::map < ::DDS::DomainParticipant_ptr, ::CIAO::NDDS::DDS_TypeSupport_i::typefactories > + CIAO::NDDS::DDS_TypeSupport_i::participant_factories; namespace CIAO { @@ -12,25 +13,155 @@ namespace CIAO { } + DDS_TypeFactory_i* + DDS_TypeSupport_i::get_factory (const char* type, + ::DDS::DomainParticipant_ptr dp) + { + DDS4CCM_TRACE ("DDS_TypeSupport_i::get_factory"); + + participantfactories::iterator entry = participant_factories.find(dp); + if (entry != participant_factories.end()) + { + DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO + "DDS_TypeSupport_i::get_factory - " + "A factory of type <%C> and with DomainParticipant <%@> " + "is registred\n", + type, + dp)); + if (entry->second.size () == 0) + return 0; + + // Return factory belonging to the specified type. + return entry->second[type]; + } + DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO + "DDS_TypeSupport_i::get_factory - " + "A factory of type <%C> and with DomainParticipant <%@> " + "was not registred\n", + type, + dp)); + return 0; + } + + bool + DDS_TypeSupport_i::set_factory (const char* type, + DDS_TypeFactory_i* f, + ::DDS::DomainParticipant_ptr dp) + { + DDS4CCM_TRACE ("DDS_TypeSupport_i::set_factory"); + + participantfactories::iterator dp_entry = participant_factories.find(dp); + if (dp_entry == participant_factories.end()) + { // entry not found -> insert. + // first create a new type factory for this dp. + typefactories tf; + std::pair <typefactories::iterator, bool> tf_ret = + tf.insert(typefactories::value_type (type, f)); + if (tf_ret.second == false) + { + DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO + "DDS_TypeSupport_i::set_factory - " + "Unable to create new Type factory for type <%C>\n", + type)); + return false; + } + + std::pair <participantfactories::iterator, bool> dp_ret = + participant_factories.insert( + std::pair< ::DDS::DomainParticipant_ptr, typefactories > (dp, tf)); + if (dp_ret.second == false) + { + DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO + "DDS_TypeSupport_i::set_factory - " + "Unable to create new DomainParticipant entry type <%C>\n", + type)); + return false; + } + } + return true; + } + void - DDS_TypeSupport_i::register_type (const char* type, DDS_TypeFactory_i* f, ::DDS::DomainParticipant_ptr) + DDS_TypeSupport_i::remove_participant_factory(const char * type, + ::DDS::DomainParticipant_ptr dp) + { + DDS4CCM_TRACE ("DDS_TypeSupport_i::remove_participant_factory"); + + participantfactories::iterator dp_entry = participant_factories.find(dp); + + if (dp_entry != participant_factories.end()) + { + // initialize every factory to nil + typefactories tf = dp_entry->second; + typefactories::iterator it = tf.find(type); + if (it != tf.end()) + { + it->second = 0; + } + else + { + DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO + "DDS_TypeSupport_i::remove_participant_factory - " + "Could not find the correct factory belonging to participant <%@> " + "and type <%C>. Unable to remove.\n", + dp, + type)); + } + + // erase the participant from the map + participant_factories.erase(dp_entry); + + DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO + "DDS_TypeSupport_i::remove_participant_factory - " + "Erased entry for participant <%@>\n", + dp, + type)); + } + else + { + DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO + "DDS_TypeSupport_i::remove_participant_factory - " + "Could not find the correct factory belonging to participant <%@>. " + "Unable to remove.\n", + dp)); + } + } + + + bool + DDS_TypeSupport_i::register_type (const char* type, DDS_TypeFactory_i* f, + ::DDS::DomainParticipant_ptr dp) { + DDS4CCM_TRACE ("DDS_TypeSupport_i::register_type"); + + if (get_factory (type, dp)) + { + DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_INFO, DDS4CCM_INFO + "DDS_TypeSupport_i::register_type - " + "Won't register factory for type %C since it already exist\n", + type)); + return false; + } DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_INFO, DDS4CCM_INFO "DDS_TypeSupport_i::register_type - " - "Registered factory for type %C\n", type)); + "Registered factory for type %C and participant <%@>\n", + type, dp)); - type_factories [type] = f; + return set_factory (type, f, dp); } DDS_TypeFactory_i* - DDS_TypeSupport_i::unregister_type (const char* type, ::DDS::DomainParticipant_ptr) + DDS_TypeSupport_i::unregister_type (const char* type, ::DDS::DomainParticipant_ptr dp) { + DDS4CCM_TRACE ("DDS_TypeSupport_i::unregister_type"); + + DDS_TypeFactory_i * f = get_factory(type, dp); + remove_participant_factory (type, dp); + DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_INFO, DDS4CCM_INFO "DDS_TypeSupport_i::unregister_type - " - "Unregistered factory for type %C\n", type)); - - DDS_TypeFactory_i* f = type_factories [type]; - type_factories [type] = 0; + "Unregistered factory for type %C and participant <%@>\n", + type, dp)); return f; } @@ -39,8 +170,11 @@ namespace CIAO ::DDS::DomainParticipant_ptr dp, ::DDS::Publisher_ptr pub) { + DDS4CCM_TRACE ("DDS_TypeSupport_i::create_datawriter"); + const char* type = dw->get_topic ()->get_type_name(); - DDS_TypeFactory_i *f = type_factories [type]; + + DDS_TypeFactory_i *f = get_factory (type, dp); if (f) { DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_INFO, DDS4CCM_INFO @@ -52,7 +186,7 @@ namespace CIAO DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO "DDS_TypeSupport_i::create_datawriter - " - "Error to create DDSDataWriter for type %C\n", type)); + "Error creating DDSDataWriter for type %C\n", type)); return ::DDS::DataWriter::_nil (); } @@ -62,8 +196,10 @@ namespace CIAO ::DDS::DomainParticipant_ptr dp, ::DDS::Subscriber_ptr sub) { + DDS4CCM_TRACE ("DDS_TypeSupport_i::create_datareader"); + const char* type = dr->get_topicdescription ()->get_type_name(); - DDS_TypeFactory_i *f = type_factories [type]; + DDS_TypeFactory_i *f = get_factory (type, dp); if (f) { DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_INFO, DDS4CCM_INFO @@ -75,7 +211,7 @@ namespace CIAO DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO "DDS_TypeSupport_i::create_datareader - " - "Error to create DDSDataReader for type %C\n", type)); + "Error creating DDSDataReader for type %C\n", type)); return ::DDS::DataReader::_nil (); } @@ -83,12 +219,22 @@ namespace CIAO void DDS_TypeSupport_i::close (void) { - for(typefactories::iterator i = type_factories.begin() ; i != type_factories.end(); ++i ) + DDS4CCM_TRACE ("DDS_TypeSupport_i::close"); + + for(participantfactories::iterator i = participant_factories.begin(); + i != participant_factories.end(); + ++i ) { - delete i->second; - i->second = 0; + typefactories tf = i->second; + for(typefactories::iterator j = tf.begin(); + j != tf.end(); + ++j ) + { + delete j->second; + j->second = 0; + } } - type_factories.clear (); + participant_factories.clear (); } } } diff --git a/CIAO/connectors/dds4ccm/impl/ndds/TypeSupport.h b/CIAO/connectors/dds4ccm/impl/ndds/TypeSupport.h index 50370743000..2f474fb761c 100644 --- a/CIAO/connectors/dds4ccm/impl/ndds/TypeSupport.h +++ b/CIAO/connectors/dds4ccm/impl/ndds/TypeSupport.h @@ -66,8 +66,10 @@ namespace CIAO { public: static void close (void); - static void register_type (const char* type, DDS_TypeFactory_i* factory, ::DDS::DomainParticipant_ptr dp); - static DDS_TypeFactory_i* unregister_type (const char* type, ::DDS::DomainParticipant_ptr dp); + static bool register_type (const char* type, DDS_TypeFactory_i* factory, + ::DDS::DomainParticipant_ptr dp); + static DDS_TypeFactory_i * unregister_type (const char* type, + ::DDS::DomainParticipant_ptr dp); static ::DDS::DataWriter_ptr create_datawriter (DDSDataWriter* dw, ::DDS::DomainParticipant_ptr dp, ::DDS::Publisher_ptr pub); @@ -78,7 +80,20 @@ namespace CIAO DDS_TypeSupport_i (void); ~DDS_TypeSupport_i (void); typedef std::map <ACE_CString, DDS_TypeFactory_i*> typefactories; - static typefactories type_factories; + + typedef std::map< ::DDS::DomainParticipant_ptr, typefactories > participantfactories; + static participantfactories participant_factories; + + static DDS_TypeFactory_i* get_factory (const char* type, + ::DDS::DomainParticipant_ptr dp); + + static bool set_factory (const char* type, + DDS_TypeFactory_i* f, + ::DDS::DomainParticipant_ptr dp); + + static void remove_participant_factory (const char * type, + ::DDS::DomainParticipant_ptr dp); + }; } } diff --git a/CIAO/connectors/dds4ccm/tests/MemLeakDetection/TypeRegistration/Base/TypeRegistration_Test_Base.idl b/CIAO/connectors/dds4ccm/tests/MemLeakDetection/TypeRegistration/Base/TypeRegistration_Test_Base.idl new file mode 100644 index 00000000000..2131535aa70 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/MemLeakDetection/TypeRegistration/Base/TypeRegistration_Test_Base.idl @@ -0,0 +1,23 @@ +// $Id$ + +/** + * @file TypeRegistration_Test_Base.idl + * @author Marcel Smit <msmit@remedy.nl> + */ + +#ifndef MLD_TYPE_REGISTRATION_TEST_BASE_IDL +#define MLD_TYPE_REGISTRATION_TEST_BASE_IDL + +#pragma ndds typesupport "Base/TypeRegistration_Test_BaseSupport.h" +#pragma opendds typesupport "Base/TypeRegistration_Test_BaseTypeSupportImpl.h" + +#pragma DCPS_DATA_TYPE "MLDTypeRegistrationTest" +#pragma DCPS_DATA_KEY "MLDTypeRegistrationTest symbol" + +struct MLDTypeRegistrationTest { + unsigned long key; +}; + +typedef sequence<MLDTypeRegistrationTest> MLDTypeRegistrationTestSeq; + +#endif /* MLD_TYPE_REGISTRATION_TEST_BASE_IDL */ diff --git a/CIAO/connectors/dds4ccm/tests/MemLeakDetection/TypeRegistration/Base/TypeRegistration_Test_Base.mpc b/CIAO/connectors/dds4ccm/tests/MemLeakDetection/TypeRegistration/Base/TypeRegistration_Test_Base.mpc new file mode 100755 index 00000000000..e04c257ed41 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/MemLeakDetection/TypeRegistration/Base/TypeRegistration_Test_Base.mpc @@ -0,0 +1,26 @@ +// $Id$ + +project (MLD_TypeRegistration_Test_Base_stub) : taoidldefaults, dds4ccm_ts_default { + sharedname = MLD_TypeRegistration_Test_Base_stub + dynamicflags += MLD_TYPE_REGISTRATION_TEST_BASE_STUB_BUILD_DLL + libout = ../lib + + idlflags += -SS -Sci \ + -Wb,stub_export_macro=MLD_TYPE_REGISTRATION_TEST_BASE_STUB_Export \ + -Wb,stub_export_include=MLD_TypeRegistration_Test_Base_stub_export.h + + IDL_Files { + idlflags += -Gxhst + TypeRegistration_Test_Base.idl + } + + opendds_ts_flags += --export=MLD_TYPE_REGISTRATION_TEST_BASE_STUB_Export + + DDSGenerator_Files { + TypeRegistration_Test_Base.idl + } + + Source_Files { + } +} + diff --git a/CIAO/connectors/dds4ccm/tests/MemLeakDetection/TypeRegistration/Component/TypeRegistration_Test_Component.idl b/CIAO/connectors/dds4ccm/tests/MemLeakDetection/TypeRegistration/Component/TypeRegistration_Test_Component.idl new file mode 100644 index 00000000000..be1174f1de3 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/MemLeakDetection/TypeRegistration/Component/TypeRegistration_Test_Component.idl @@ -0,0 +1,21 @@ +// $Id$ + +/** + * @author Marcel Smit <msmit@remedy.nl> + */ + +#ifndef COMPONENT_IDL +#define COMPONENT_IDL + +#include "Connector/TypeRegistration_Test_Connector.idl" + +module MLD_TypeRegistration_Test +{ + component CFTTestComponent + { + port MLDTypeRegistrationTestConn::DDS_Write writer; + port MLDTypeRegistrationTestConn::DDS_Listen listener; + }; +}; + +#endif diff --git a/CIAO/connectors/dds4ccm/tests/MemLeakDetection/TypeRegistration/Component/TypeRegistration_Test_Component.mpc b/CIAO/connectors/dds4ccm/tests/MemLeakDetection/TypeRegistration/Component/TypeRegistration_Test_Component.mpc new file mode 100755 index 00000000000..44531d1c2cd --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/MemLeakDetection/TypeRegistration/Component/TypeRegistration_Test_Component.mpc @@ -0,0 +1,148 @@ +// $Id$ + +project(MLD_TypeRegistration_Test_Component_idl_gen) : componentidldefaults, dds4ccm { + custom_only = 1 + after += MLD_TypeRegistration_Test_Connector_idl_gen + idlflags += -Wb,stub_export_macro=COMPONENT_STUB_Export \ + -Wb,stub_export_include=Component_stub_export.h \ + -Wb,skel_export_macro=COMPONENT_SVNT_Export \ + -Wb,skel_export_include=Component_svnt_export.h \ + -Wb,svnt_export_macro=COMPONENT_SVNT_Export \ + -Wb,svnt_export_include=Component_svnt_export.h \ + -Wb,exec_export_macro=COMPONENT_EXEC_Export \ + -Wb,exec_export_include=Component_exec_export.h -I.. + + IDL_Files { + TypeRegistration_Test_Component.idl + } +} + +project(MLD_TypeRegistration_Test_Component_lem_gen) : ciaoidldefaults, dds4ccm { + after += MLD_TypeRegistration_Test_Component_idl_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=COMPONENT_LEM_STUB_Export \ + -Wb,stub_export_include=Component_lem_stub_export.h \ + -SS -Gxhst -I.. + + IDL_Files { + TypeRegistration_Test_ComponentE.idl + } +} + +project(MLD_TypeRegistration_Test_Component_lem_stub) : ccm_svnt, dds4ccm_base { + after += MLD_TypeRegistration_Test_Component_lem_gen MLD_TypeRegistration_Test_Component_stub \ + MLD_TypeRegistration_Test_Connector_stub MLD_TypeRegistration_Test_Base_stub + libs += Component_stub MLD_TypeRegistration_Test_Connector_stub \ + MLD_TypeRegistration_Test_Base_stub + libpaths += ../lib + libout = ../lib + includes += .. + sharedname = Component_lem_stub + dynamicflags += COMPONENT_LEM_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + TypeRegistration_Test_ComponentEC.cpp + } + + Header_Files { + TypeRegistration_Test_ComponentEC.h + Component_lem_stub_export.h + } + + Inline_Files { + TypeRegistration_Test_ComponentEC.inl + } +} + +project(MLD_TypeRegistration_Test_Component_stub) : ccm_stub, dds4ccm_base { + after += MLD_TypeRegistration_Test_Component_idl_gen MLD_TypeRegistration_Test_Connector_stub \ + MLD_TypeRegistration_Test_Base_stub MLD_TypeRegistration_Test_Connector_lem_gen + libs += MLD_TypeRegistration_Test_Connector_stub MLD_TypeRegistration_Test_Base_stub + libpaths += ../lib + libout = ../lib + includes += .. + sharedname = Component_stub + dynamicflags += COMPONENT_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + TypeRegistration_Test_ComponentC.cpp + } + + Header_Files { + TypeRegistration_Test_ComponentC.h + Component_stub_export.h + } + + Inline_Files { + TypeRegistration_Test_ComponentC.inl + } +} + +project(MLD_TypeRegistration_Test_Component_exec) : ciao_executor, dds4ccm_lem_stub { + after += MLD_TypeRegistration_Test_Component_lem_stub MLD_TypeRegistration_Test_Component_stub \ + MLD_TypeRegistration_Test_Base_stub MLD_TypeRegistration_Test_Connector_stub \ + MLD_TypeRegistration_Test_Connector_lem_stub + sharedname = Component_exec + libs += Component_stub Component_lem_stub MLD_TypeRegistration_Test_Base_stub \ + MLD_TypeRegistration_Test_Connector_stub MLD_TypeRegistration_Test_Connector_lem_stub + libpaths += ../lib + libout = ../lib + includes += .. + dynamicflags += COMPONENT_EXEC_BUILD_DLL + + IDL_Files { + } + + Source_Files { + TypeRegistration_Test_Component_exec.cpp + } + + Header_Files { + TypeRegistration_Test_Component_exec.h + Component_exec_export.h + } + + Inline_Files { + } +} + + +project(MLD_TypeRegistration_Test_Component_svnt) : ciao_servant, dds4ccm_lem_stub, dds4ccm_skel { + after += MLD_TypeRegistration_Test_Component_lem_stub MLD_TypeRegistration_Test_Base_stub \ + MLD_TypeRegistration_Test_Connector_stub MLD_TypeRegistration_Test_Connector_svnt \ + MLD_TypeRegistration_Test_Component_exec MLD_TypeRegistration_Test_Connector_lem_stub + sharedname = Component_svnt + libs += Component_stub Component_lem_stub MLD_TypeRegistration_Test_Base_stub \ + MLD_TypeRegistration_Test_Connector_stub MLD_TypeRegistration_Test_Connector_svnt \ + Component_exec MLD_TypeRegistration_Test_Connector_lem_stub + libpaths += ../lib + libout = ../lib + includes += .. + dynamicflags += COMPONENT_SVNT_BUILD_DLL + + IDL_Files { + } + + Source_Files { + TypeRegistration_Test_ComponentS.cpp + TypeRegistration_Test_Component_svnt.cpp + } + + Header_Files { + TypeRegistration_Test_ComponentS.h + TypeRegistration_Test_Component_svnt.h + Component_svnt_export.h + } + + Inline_Files { + TypeRegistration_Test_ComponentS.inl + } +} + + diff --git a/CIAO/connectors/dds4ccm/tests/MemLeakDetection/TypeRegistration/Component/TypeRegistration_Test_Component_exec.cpp b/CIAO/connectors/dds4ccm/tests/MemLeakDetection/TypeRegistration/Component/TypeRegistration_Test_Component_exec.cpp new file mode 100644 index 00000000000..fbd5a5cc43f --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/MemLeakDetection/TypeRegistration/Component/TypeRegistration_Test_Component_exec.cpp @@ -0,0 +1,291 @@ +// -*- C++ -*- +// $Id$ + +/** + * Code generated by the The ACE ORB (TAO) IDL Compiler v2.0.2 + * TAO and the TAO IDL Compiler have been developed by: + * Center for Distributed Object Computing + * Washington University + * St. Louis, MO + * USA + * http://www.cs.wustl.edu/~schmidt/doc-center.html + * and + * Distributed Object Computing Laboratory + * University of California at Irvine + * Irvine, CA + * USA + * and + * Institute for Software Integrated Systems + * Vanderbilt University + * Nashville, TN + * USA + * http://www.isis.vanderbilt.edu/ + * + * Information about TAO is available at: + * http://www.cs.wustl.edu/~schmidt/TAO.html + **/ + +#include "TypeRegistration_Test_Component_exec.h" +#include "tao/ORB_Core.h" +#include "ace/Reactor.h" + +namespace CIAO_MLD_TypeRegistration_Test_CFTTestComponent_Impl +{ + /** + * WriteTicker + */ + WriteTicker::WriteTicker (CFTTestComponent_exec_i &callback) + : callback_ (callback) + { + } + + int + WriteTicker::handle_timeout (const ACE_Time_Value &, const void *) + { + // Notify the subscribers + this->callback_.write_one (); + return 0; + } + + /** + * Facet Executor Implementation Class: listener_data_listener_exec_i + */ + + listener_data_listener_exec_i::listener_data_listener_exec_i ( + ::MLD_TypeRegistration_Test::CCM_CFTTestComponent_Context_ptr ctx) + : ciao_context_ ( + ::MLD_TypeRegistration_Test::CCM_CFTTestComponent_Context::_duplicate (ctx)) + { + } + + listener_data_listener_exec_i::~listener_data_listener_exec_i (void) + { + } + + // Operations from ::MLDTypeRegistrationTestConn::Listener + + void + listener_data_listener_exec_i::on_one_data (const ::MLDTypeRegistrationTest & datum, + const ::CCM_DDS::ReadInfo & /* info */) + { + ACE_DEBUG ((LM_DEBUG, "listener_data_listener_exec_i::on_one_data: " + "key <%u>\n", + datum.key)); + } + + void + listener_data_listener_exec_i::on_many_data (const ::MLDTypeRegistrationTestSeq & /* data */, + const ::CCM_DDS::ReadInfoSeq & /* infos */) + { + /* Your code here. */ + } + + /** + * Facet Executor Implementation Class: listener_status_exec_i + */ + + listener_status_exec_i::listener_status_exec_i ( + ::MLD_TypeRegistration_Test::CCM_CFTTestComponent_Context_ptr ctx) + : ciao_context_ ( + ::MLD_TypeRegistration_Test::CCM_CFTTestComponent_Context::_duplicate (ctx)) + { + } + + listener_status_exec_i::~listener_status_exec_i (void) + { + } + + // Operations from ::CCM_DDS::PortStatusListener + + void + listener_status_exec_i::on_requested_deadline_missed (::DDS::DataReader_ptr /* the_reader */, + const ::DDS::RequestedDeadlineMissedStatus & /* status */) + { + /* Your code here. */ + } + + void + listener_status_exec_i::on_sample_lost (::DDS::DataReader_ptr /* the_reader */, + const ::DDS::SampleLostStatus & /* status */) + { + /* Your code here. */ + } + + /** + * Component Executor Implementation Class: CFTTestComponent_exec_i + */ + + CFTTestComponent_exec_i::CFTTestComponent_exec_i (void) + : ticker_(0) + , iterator(0) + { + ACE_NEW_THROW_EX (this->ticker_, + WriteTicker (*this), + ::CORBA::NO_MEMORY ()); + } + + CFTTestComponent_exec_i::~CFTTestComponent_exec_i (void) + { + delete this->ticker_; + } + + // Supported operations and attributes. + ACE_Reactor* + CFTTestComponent_exec_i::reactor (void) + { + ACE_Reactor* reactor = 0; + ::CORBA::Object_var ccm_object = + this->ciao_context_->get_CCM_object(); + if (! ::CORBA::is_nil (ccm_object.in ())) + { + ::CORBA::ORB_var orb = ccm_object->_get_orb (); + if (! ::CORBA::is_nil (orb.in ())) + { + reactor = orb->orb_core ()->reactor (); + } + } + if (reactor == 0) + { + throw ::CORBA::INTERNAL (); + } + return reactor; + } + + void + CFTTestComponent_exec_i::write_one (void) + { + MLDTypeRegistrationTest new_key; + new_key.key = ++this->iterator; + + MLDTypeRegistrationTestConn::Writer_var writer = + this->ciao_context_->get_connection_writer_data (); + if (::CORBA::is_nil (writer.in ())) + { + ACE_ERROR ((LM_ERROR, "CFTTestComponent_exec_i::write_one - " + "ERROR: Writer seems to be nil\n")); + return; + } + try + { + writer->write_one (new_key, ::DDS::HANDLE_NIL); + } + catch (const CCM_DDS::InternalError& ) + { + ACE_ERROR ((LM_ERROR, "CFTTestComponent_exec_i::write_one - " + "ERROR: caught InternalError exception while writing <%d> to DDS.\n", + this->iterator)); + } + catch (const ::CORBA::Exception& ) + { + ACE_ERROR ((LM_ERROR, "CFTTestComponent_exec_i::write_one - " + "ERROR: caught CORBA exception while writing <%d> to DDS.\n", + this->iterator)); + } + } + + // Component attributes and port operations. + + ::MLDTypeRegistrationTestConn::CCM_Listener_ptr + CFTTestComponent_exec_i::get_listener_data_listener (void) + { + if ( ::CORBA::is_nil (this->ciao_listener_data_listener_.in ())) + { + listener_data_listener_exec_i *tmp = 0; + ACE_NEW_RETURN ( + tmp, + listener_data_listener_exec_i ( + this->ciao_context_.in ()), + ::MLDTypeRegistrationTestConn::CCM_Listener::_nil ()); + + this->ciao_listener_data_listener_ = tmp; + } + + return + ::MLDTypeRegistrationTestConn::CCM_Listener::_duplicate ( + this->ciao_listener_data_listener_.in ()); + } + + ::CCM_DDS::CCM_PortStatusListener_ptr + CFTTestComponent_exec_i::get_listener_status (void) + { + if ( ::CORBA::is_nil (this->ciao_listener_status_.in ())) + { + listener_status_exec_i *tmp = 0; + ACE_NEW_RETURN ( + tmp, + listener_status_exec_i ( + this->ciao_context_.in ()), + ::CCM_DDS::CCM_PortStatusListener::_nil ()); + + this->ciao_listener_status_ = tmp; + } + + return + ::CCM_DDS::CCM_PortStatusListener::_duplicate ( + this->ciao_listener_status_.in ()); + } + + // Operations from Components::SessionComponent. + + void + CFTTestComponent_exec_i::set_session_context ( + ::Components::SessionContext_ptr ctx) + { + this->ciao_context_ = + ::MLD_TypeRegistration_Test::CCM_CFTTestComponent_Context::_narrow (ctx); + + if ( ::CORBA::is_nil (this->ciao_context_.in ())) + { + throw ::CORBA::INTERNAL (); + } + } + + void + CFTTestComponent_exec_i::configuration_complete (void) + { + /* Your code here. */ + } + + void + CFTTestComponent_exec_i::ccm_activate (void) + { + if (this->reactor ()->schedule_timer ( + this->ticker_, + 0, + ACE_Time_Value (5, 50000), + ACE_Time_Value (1, 0)) == -1) + { + ACE_ERROR ((LM_ERROR, ACE_TEXT ("Sender_exec_i::start : ") + ACE_TEXT ("Error scheduling timer"))); + } + + ::CCM_DDS::DataListenerControl_var dlc = + this->ciao_context_->get_connection_listener_data_control(); + dlc->mode (::CCM_DDS::ONE_BY_ONE); + } + + void + CFTTestComponent_exec_i::ccm_passivate (void) + { + this->reactor ()->cancel_timer(this->ticker_); + } + + void + CFTTestComponent_exec_i::ccm_remove (void) + { + /* Your code here. */ + } + + extern "C" COMPONENT_EXEC_Export ::Components::EnterpriseComponent_ptr + create_MLD_TypeRegistration_Test_CFTTestComponent_Impl (void) + { + ::Components::EnterpriseComponent_ptr retval = + ::Components::EnterpriseComponent::_nil (); + + ACE_NEW_NORETURN ( + retval, + CFTTestComponent_exec_i); + + return retval; + } +} diff --git a/CIAO/connectors/dds4ccm/tests/MemLeakDetection/TypeRegistration/Component/TypeRegistration_Test_Component_exec.h b/CIAO/connectors/dds4ccm/tests/MemLeakDetection/TypeRegistration/Component/TypeRegistration_Test_Component_exec.h new file mode 100644 index 00000000000..a89121015a3 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/MemLeakDetection/TypeRegistration/Component/TypeRegistration_Test_Component_exec.h @@ -0,0 +1,188 @@ +// -*- C++ -*- +// $Id$ + +/** + * Code generated by the The ACE ORB (TAO) IDL Compiler v2.0.2 + * TAO and the TAO IDL Compiler have been developed by: + * Center for Distributed Object Computing + * Washington University + * St. Louis, MO + * USA + * http://www.cs.wustl.edu/~schmidt/doc-center.html + * and + * Distributed Object Computing Laboratory + * University of California at Irvine + * Irvine, CA + * USA + * and + * Institute for Software Integrated Systems + * Vanderbilt University + * Nashville, TN + * USA + * http://www.isis.vanderbilt.edu/ + * + * Information about TAO is available at: + * http://www.cs.wustl.edu/~schmidt/TAO.html + **/ +#ifndef CIAO_TYPEREGISTRATION_TEST_COMPONENT_EXEC_0FYVIW_H_ +#define CIAO_TYPEREGISTRATION_TEST_COMPONENT_EXEC_0FYVIW_H_ + +#include /**/ "ace/pre.h" + +#include "TypeRegistration_Test_ComponentEC.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include /**/ "Component_exec_export.h" +#include "tao/LocalObject.h" + +namespace CIAO_MLD_TypeRegistration_Test_CFTTestComponent_Impl +{ + class CFTTestComponent_exec_i; + + /** + * WriteTicker + */ + class WriteTicker : + public ACE_Event_Handler + { + public: + WriteTicker (CFTTestComponent_exec_i &callback); + int handle_timeout (const ACE_Time_Value &, const void *); + private: + /// Maintains a handle that actually process the event + CFTTestComponent_exec_i &callback_; + }; + + /** + * Provider Executor Implementation Class: listener_data_listener_exec_i + */ + + class listener_data_listener_exec_i + : public virtual ::MLDTypeRegistrationTestConn::CCM_Listener, + public virtual ::CORBA::LocalObject + { + public: + listener_data_listener_exec_i ( + ::MLD_TypeRegistration_Test::CCM_CFTTestComponent_Context_ptr ctx); + virtual ~listener_data_listener_exec_i (void); + + /** @name Operations and attributes from MLDTypeRegistrationTestConn::Listener */ + //@{ + + virtual + void on_one_data (const ::MLDTypeRegistrationTest & datum, + const ::CCM_DDS::ReadInfo & info); + + virtual + void on_many_data (const ::MLDTypeRegistrationTestSeq & data, + const ::CCM_DDS::ReadInfoSeq & infos); + //@} + + private: + ::MLD_TypeRegistration_Test::CCM_CFTTestComponent_Context_var ciao_context_; + }; + + /** + * Provider Executor Implementation Class: listener_status_exec_i + */ + + class listener_status_exec_i + : public virtual ::CCM_DDS::CCM_PortStatusListener, + public virtual ::CORBA::LocalObject + { + public: + listener_status_exec_i ( + ::MLD_TypeRegistration_Test::CCM_CFTTestComponent_Context_ptr ctx); + virtual ~listener_status_exec_i (void); + + /** @name Operations and attributes from CCM_DDS::PortStatusListener */ + //@{ + + virtual + void on_requested_deadline_missed (::DDS::DataReader_ptr the_reader, + const ::DDS::RequestedDeadlineMissedStatus & status); + + virtual + void on_sample_lost (::DDS::DataReader_ptr the_reader, + const ::DDS::SampleLostStatus & status); + //@} + + private: + ::MLD_TypeRegistration_Test::CCM_CFTTestComponent_Context_var ciao_context_; + }; + + /** + * Component Executor Implementation Class: CFTTestComponent_exec_i + */ + + class CFTTestComponent_exec_i + : public virtual CFTTestComponent_Exec, + public virtual ::CORBA::LocalObject + { + public: + CFTTestComponent_exec_i (void); + virtual ~CFTTestComponent_exec_i (void); + + /** @name Supported operations and attributes. */ + //@{ + + //@} + + /** @name Component attributes and port operations. */ + //@{ + + virtual ::MLDTypeRegistrationTestConn::CCM_Listener_ptr + get_listener_data_listener (void); + + virtual ::CCM_DDS::CCM_PortStatusListener_ptr + get_listener_status (void); + //@} + + /** @name Operations from Components::SessionComponent. */ + //@{ + virtual void set_session_context (::Components::SessionContext_ptr ctx); + virtual void configuration_complete (void); + virtual void ccm_activate (void); + virtual void ccm_passivate (void); + virtual void ccm_remove (void); + //@} + + /** @name User defined public operations. */ + //@{ + void write_one (void); + //@} + + private: + ::MLD_TypeRegistration_Test::CCM_CFTTestComponent_Context_var ciao_context_; + + /** @name Component attributes. */ + //@{ + ::MLDTypeRegistrationTestConn::CCM_Listener_var ciao_listener_data_listener_; + ::CCM_DDS::CCM_PortStatusListener_var ciao_listener_status_; + //@} + + /** @name User defined members. */ + //@{ + WriteTicker *ticker_; + ::CORBA::ULong iterator; + //@} + + /** @name User defined private operations. */ + //@{ + + //@} + + /// Get the ACE_Reactor + ACE_Reactor* reactor (void); + }; + + extern "C" COMPONENT_EXEC_Export ::Components::EnterpriseComponent_ptr + create_MLD_TypeRegistration_Test_CFTTestComponent_Impl (void); +} + +#include /**/ "ace/post.h" + +#endif /* ifndef */ diff --git a/CIAO/connectors/dds4ccm/tests/MemLeakDetection/TypeRegistration/Connector/TypeRegistration_Test_Connector.idl b/CIAO/connectors/dds4ccm/tests/MemLeakDetection/TypeRegistration/Connector/TypeRegistration_Test_Connector.idl new file mode 100644 index 00000000000..66ec43c68bb --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/MemLeakDetection/TypeRegistration/Connector/TypeRegistration_Test_Connector.idl @@ -0,0 +1,19 @@ +// $Id$ + +/** + * @file TypeRegistration_Test_Connector.idl + * @author Marcel Smit <msmit@remedy.nl> + */ + +#ifndef MLD_TYPE_REGISTRATION_TEST_CONNECTOR_IDL_ +#define MLD_TYPE_REGISTRATION_TEST_CONNECTOR_IDL_ + +#include <Components.idl> +#include <ccm_dds.idl> + +#include "Base/TypeRegistration_Test_Base.idl" + +#pragma ciao lem "Connector/TypeRegistration_Test_ConnectorE.idl" + +module ::CCM_DDS::Typed < ::MLDTypeRegistrationTest, ::MLDTypeRegistrationTestSeq> MLDTypeRegistrationTestConn; +#endif /* MLD_TYPE_REGISTRATION_TEST_CONNECTOR_IDL_ */ diff --git a/CIAO/connectors/dds4ccm/tests/MemLeakDetection/TypeRegistration/Connector/TypeRegistration_Test_Connector.mpc b/CIAO/connectors/dds4ccm/tests/MemLeakDetection/TypeRegistration/Connector/TypeRegistration_Test_Connector.mpc new file mode 100755 index 00000000000..6d0bf55e992 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/MemLeakDetection/TypeRegistration/Connector/TypeRegistration_Test_Connector.mpc @@ -0,0 +1,144 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -p MLD_TypeRegistration_Test_Base -l .. -o ../lib -u DDS MLD_TypeRegistration_Test_Connector" + +project(MLD_TypeRegistration_Test_Connector_idl_gen) : connectoridldefaults, dds4ccm { + after += DDS4CCM_idl_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=MLD_TYPE_REGISTRATION_TEST_CONNECTOR_STUB_Export \ + -Wb,stub_export_include=MLD_TypeRegistration_Test_Connector_stub_export.h \ + -Wb,skel_export_macro=MLD_TYPE_REGISTRATION_TEST_CONNECTOR_SVNT_Export \ + -Wb,skel_export_include=MLD_TypeRegistration_Test_Connector_svnt_export.h \ + -Wb,svnt_export_macro=MLD_TYPE_REGISTRATION_TEST_CONNECTOR_SVNT_Export \ + -Wb,svnt_export_include=MLD_TypeRegistration_Test_Connector_svnt_export.h \ + -Wb,conn_export_macro=MLD_TYPE_REGISTRATION_TEST_CONNECTOR_CONN_Export \ + -Wb,conn_export_include=MLD_TypeRegistration_Test_Connector_conn_export.h \ + -I .. + + IDL_Files { + TypeRegistration_Test_Connector.idl + } +} + +project(MLD_TypeRegistration_Test_Connector_lem_gen) : ciaoidldefaults, dds4ccm { + custom_only = 1 + after += MLD_TypeRegistration_Test_Connector_idl_gen + idlflags += -Wb,stub_export_macro=MLD_TYPE_REGISTRATION_TEST_CONNECTOR_LEM_STUB_Export \ + -Wb,stub_export_include=MLD_TypeRegistration_Test_Connector_lem_stub_export.h \ + -SS -Gxhst \ + -I .. + + IDL_Files { + TypeRegistration_Test_ConnectorE.idl + } +} + +project(MLD_TypeRegistration_Test_Connector_lem_stub) : ccm_svnt, dds4ccm_lem_stub { + after += MLD_TypeRegistration_Test_Connector_lem_gen MLD_TypeRegistration_Test_Connector_stub MLD_TypeRegistration_Test_Base_stub + libs += MLD_TypeRegistration_Test_Base_stub MLD_TypeRegistration_Test_Connector_stub + libpaths += ../lib + libout = ../lib + includes += .. + sharedname = MLD_TypeRegistration_Test_Connector_lem_stub + dynamicflags += MLD_TYPE_REGISTRATION_TEST_CONNECTOR_LEM_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + TypeRegistration_Test_ConnectorEC.cpp + } + + Header_Files { + TypeRegistration_Test_ConnectorEC.h + TypeRegistration_Test_Connector_lem_stub_export.h + } + + Inline_Files { + TypeRegistration_Test_ConnectorEC.inl + } +} + +project(MLD_TypeRegistration_Test_Connector_stub) : ccm_stub, dds4ccm_base { + after += MLD_TypeRegistration_Test_Connector_idl_gen MLD_TypeRegistration_Test_Base_stub + libs += MLD_TypeRegistration_Test_Base_stub + libpaths += ../lib + libout = ../lib + includes += .. + sharedname = MLD_TypeRegistration_Test_Connector_stub + dynamicflags += MLD_TYPE_REGISTRATION_TEST_CONNECTOR_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + TypeRegistration_Test_ConnectorC.cpp + } + + Header_Files { + TypeRegistration_Test_ConnectorC.h + TypeRegistration_Test_Connector_stub_export.h + } + + Inline_Files { + TypeRegistration_Test_ConnectorC.inl + } +} + +project(MLD_TypeRegistration_Test_Connector_exec) : ciao_executor, dds4ccm_impl { + after += MLD_TypeRegistration_Test_Connector_lem_stub MLD_TypeRegistration_Test_Connector_stub MLD_TypeRegistration_Test_Base_stub + sharedname = MLD_TypeRegistration_Test_Connector_exec + libs += MLD_TypeRegistration_Test_Connector_stub MLD_TypeRegistration_Test_Connector_lem_stub MLD_TypeRegistration_Test_Base_stub MLD_TypeRegistration_Test_Base_stub + libpaths += ../lib + libout = ../lib + includes += .. + dynamicflags += MLD_TYPE_REGISTRATION_TEST_CONNECTOR_CONN_BUILD_DLL + + IDL_Files { + } + + Source_Files { + TypeRegistration_Test_Connector_conn.cpp + } + + Header_Files { + TypeRegistration_Test_Connector_conn.h + TypeRegistration_Test_Connector_conn_export.h + } + + Inline_Files { + } +} + + +project(MLD_TypeRegistration_Test_Connector_svnt) : ciao_servant, dds4ccm_impl { + after += MLD_TypeRegistration_Test_Connector_lem_stub MLD_TypeRegistration_Test_Connector_exec MLD_TypeRegistration_Test_Connector_stub + sharedname = MLD_TypeRegistration_Test_Connector_svnt + libs += MLD_TypeRegistration_Test_Connector_stub \ + MLD_TypeRegistration_Test_Connector_lem_stub \ + MLD_TypeRegistration_Test_Base_stub \ + MLD_TypeRegistration_Test_Connector_exec + libpaths += ../lib + libout = ../lib + includes += .. + dynamicflags += MLD_TYPE_REGISTRATION_TEST_CONNECTOR_SVNT_BUILD_DLL + + IDL_Files { + } + + Source_Files { + TypeRegistration_Test_ConnectorS.cpp + TypeRegistration_Test_Connector_svnt.cpp + } + + Header_Files { + TypeRegistration_Test_ConnectorS.h + TypeRegistration_Test_Connector_svnt.h + TypeRegistration_Test_Connector_svnt_export.h + } + + Inline_Files { + TypeRegistration_Test_ConnectorS.inl + } +} + + diff --git a/CIAO/connectors/dds4ccm/tests/MemLeakDetection/TypeRegistration/descriptors/Plan.cdp b/CIAO/connectors/dds4ccm/tests/MemLeakDetection/TypeRegistration/descriptors/Plan.cdp new file mode 100644 index 00000000000..01334066e91 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/MemLeakDetection/TypeRegistration/descriptors/Plan.cdp @@ -0,0 +1,253 @@ +<!-- $Id$ --> +<Deployment:DeploymentPlan + xmlns:Deployment="http://www.omg.org/Deployment" + xmlns:xmi="http://www.omg.org/XMI" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.omg.org/Deployment Deployment.xsd"> + <label>MLDTest_Depl</label> + <UUID>MLDTest_Depl</UUID> + + <implementation xmi:id="ComponentImplementation"> + <name>ComponentImplementation</name> + <source/> + <artifact xmi:idref="Component_ExecArtifact" /> + <artifact xmi:idref="Component_SvntArtifact" /> + <execParameter> + <!-- entrypoint as exec parameter (see 10.6.1) --> + <name>component factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_MLD_TypeRegistration_Test_CFTTestComponent_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_MLD_TypeRegistration_Test_CFTTestComponent_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Component_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Component_exec</string> + </value> + </value> + </execParameter> + </implementation> + + <implementation xmi:id="MLD_TypeRegistration_Test_ConnectorImplementation"> + <name>MLD_TypeRegistration_Test_ConnectorImplementation</name> + <source/> + <artifact xmi:idref="MLD_TypeRegistration_Test_Connector_ExecArtifact" /> + <artifact xmi:idref="MLD_TypeRegistration_Test_Connector_SvntArtifact" /> + <execParameter> + <!-- entrypoint as exec parameter (see 10.6.1) --> + <name>component factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_MLDTypeRegistrationTestConn_DDS_Event_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_MLDTypeRegistrationTestConn_DDS_Event_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>MLD_TypeRegistration_Test_Connector_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>MLD_TypeRegistration_Test_Connector_exec</string> + </value> + </value> + </execParameter> + </implementation> + + + <instance xmi:id="ComponentInstance"> + <name>Component</name> + <node>ComponentNode</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="ComponentImplementation" /> + </instance> + + <instance xmi:id="MLD_TypeRegistration_Test_ConnectorInstance_Writer"> + <name>MLD_TypeRegistration_Test_Connector_Writer</name> + <node>ComponentNode</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="MLD_TypeRegistration_Test_ConnectorImplementation" /> + <configProperty> + <name>topic_name</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>MLDTypeRegistration_Writer</string> + </value> + </value> + </configProperty> + </instance> + + <instance xmi:id="MLD_TypeRegistration_Test_ConnectorInstance_Listener"> + <name>MLD_TypeRegistration_Test_Connector_Listener</name> + <node>ComponentNode</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="MLD_TypeRegistration_Test_ConnectorImplementation" /> + <configProperty> + <name>topic_name</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>MLDTypeRegistration_Listener</string> + </value> + </value> + </configProperty> + </instance> + + <connection> + <name>listener_data</name> + <deployRequirement> + <name>edu.dre.vanderbilt.DAnCE.ConnectionType</name> + <resourceType>Local_Interface</resourceType> + </deployRequirement> + <internalEndpoint> + <portName>listener_data_listener</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="ComponentInstance" /> + </internalEndpoint> + <internalEndpoint> + <portName>push_consumer_data_listener</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="MLD_TypeRegistration_Test_ConnectorInstance_Listener" /> + </internalEndpoint> + </connection> + + <connection> + <name>listener_data_control</name> + <deployRequirement> + <name>edu.dre.vanderbilt.DAnCE.ConnectionType</name> + <resourceType>Local_Interface</resourceType> + </deployRequirement> + <internalEndpoint> + <portName>listener_data_control</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="ComponentInstance" /> + </internalEndpoint> + <internalEndpoint> + <portName>push_consumer_data_control</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="MLD_TypeRegistration_Test_ConnectorInstance_Listener" /> + </internalEndpoint> + </connection> + + <connection> + <name>writer_connection</name> + <deployRequirement> + <name>edu.dre.vanderbilt.DAnCE.ConnectionType</name> + <resourceType>Local_Interface</resourceType> + </deployRequirement> + <internalEndpoint> + <portName>writer_data</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="ComponentInstance" /> + </internalEndpoint> + <internalEndpoint> + <portName>supplier_data</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="MLD_TypeRegistration_Test_ConnectorInstance_Writer" /> + </internalEndpoint> + </connection> + + + <artifact xmi:id="MLD_TypeRegistration_Test_Connector_ExecArtifact"> + <name>MLD_TypeRegistration_Test_Connector_exec</name> + <source/> + <node/> + <location>MLD_TypeRegistration_Test_Connector_exec</location> + </artifact> + <artifact xmi:id="MLD_TypeRegistration_Test_Connector_SvntArtifact"> + <name>MLD_TypeRegistration_Test_Connector_svnt</name> + <source/> + <node/> + <location>MLD_TypeRegistration_Test_Connector_svnt</location> + </artifact> + <artifact xmi:id="MLD_TypeRegistration_Test_Connector_StubArtifact"> + <name>MLD_TypeRegistration_Test_Connector_stub</name> + <source/> + <node/> + <location>MLD_TypeRegistration_Test_Connector_stub</location> + </artifact> + + <artifact xmi:id="Component_ExecArtifact"> + <name>Component_exec</name> + <source/> + <node/> + <location>Component_exec</location> + </artifact> + <artifact xmi:id="Component_SvntArtifact"> + <name>Component_svnt</name> + <source/> + <node/> + <location>Component_svnt</location> + </artifact> +</Deployment:DeploymentPlan> diff --git a/CIAO/connectors/dds4ccm/tests/MemLeakDetection/TypeRegistration/descriptors/run_test.pl b/CIAO/connectors/dds4ccm/tests/MemLeakDetection/TypeRegistration/descriptors/run_test.pl new file mode 100755 index 00000000000..7bae1fb4f2e --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/MemLeakDetection/TypeRegistration/descriptors/run_test.pl @@ -0,0 +1,244 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "$ENV{'ACE_ROOT'}/bin"; +use PerlACE::TestTarget; + +$CIAO_ROOT = "$ENV{'CIAO_ROOT'}"; +$TAO_ROOT = "$ENV{'TAO_ROOT'}"; +$DANCE_ROOT = "$ENV{'DANCE_ROOT'}"; + +$daemons_running = 0; +$em_running = 0; +$ns_running = 0; + +$nr_daemon = 1; +@ports = ( 60001 ); +@iorbases = ( "Component.ior" ); +@iorfiles = 0; +@nodenames = ( "ComponentNode" ); + +# ior files other than daemon +# ior files other than daemon +$ior_nsbase = "ns.ior"; +$ior_nsfile = 0; +$ior_embase = "EM.ior"; +$ior_emfile = 0; + +# Processes +$E = 0; +$EM = 0; +$NS = 0; +@DEAMONS = 0; + +# targets +@tg_daemons = 0; +$tg_naming = 0; +$tg_exe_man = 0; +$tg_executor = 0; + +$status = 0; +$cdp_file = "Plan.cdp"; + +sub create_targets { + # naming service + $tg_naming = PerlACE::TestTarget::create_target (1) || die "Create target for ns failed\n"; + $tg_naming->AddLibPath ('../lib'); + # daemon + for ($i = 0; $i < $nr_daemon; ++$i) { + $tg_daemons[$i] = PerlACE::TestTarget::create_target ($i+1) || die "Create target for daemon $i failed\n"; + $tg_daemons[$i]->AddLibPath ('../lib'); + } + # execution manager + $tg_exe_man = PerlACE::TestTarget::create_target (1) || die "Create target for EM failed\n"; + $tg_exe_man->AddLibPath ('../lib'); + # executor (plan_launcher) + $tg_executor = PerlACE::TestTarget::create_target (1) || die "Create target for executor failed\n"; + $tg_executor->AddLibPath ('../lib'); +} + +sub init_ior_files { + $ior_nsfile = $tg_naming->LocalFile ($ior_nsbase); + $ior_emfile = $tg_exe_man->LocalFile ($ior_embase); + for ($i = 0; $i < $nr_daemon; ++$i) { + $iorfiles[$i] = $tg_daemons[$i]->LocalFile ($iorbases[$i]); + } + delete_ior_files (); +} + +# Delete if there are any .ior files. +sub delete_ior_files { + for ($i = 0; $i < $nr_daemon; ++$i) { + $tg_daemons[$i]->DeleteFile ($iorbases[$i]); + } + $tg_naming->DeleteFile ($ior_nsbase); + $tg_exe_man->DeleteFile ($ior_embase); + for ($i = 0; $i < $nr_daemon; ++$i) { + $iorfiles[$i] = $tg_daemons[$i]->LocalFile ($iorbases[$i]); + } +} + +sub kill_node_daemon { + for ($i = 0; $i < $nr_daemon; ++$i) { + $DEAMONS[$i]->Kill (); $DEAMONS[$i]->TimedWait (1); + } +} + +sub kill_open_processes { + if ($daemons_running == 1) { + kill_node_daemon (); + } + + if ($em_running == 1) { + $EM->Kill (); $EM->TimedWait (1); + } + + if ($ns_running == 1) { + $NS->Kill (); $NS->TimedWait (1); + } + # in case shutdown did not perform as expected + $tg_executor->KillAll ('dance_locality_manager'); +} + +sub run_node_daemons { + for ($i = 0; $i < $nr_daemon; ++$i) { + $iorbase = $iorbases[$i]; + $iorfile = $iorfiles[$i]; + $port = $ports[$i]; + $nodename = $nodenames[$i]; + $iiop = "iiop://localhost:$port"; + $node_app = $tg_daemons[$i]->GetArchDir("$DANCE_ROOT/bin/") . "dance_locality_manager"; + + $d_cmd = "$DANCE_ROOT/bin/dance_node_manager"; + $d_param = "-ORBEndpoint $iiop -s $node_app -n $nodename=$iorfile -t 30 --domain-nc corbaloc:rir:/NameService"; + + print "Run dance_node_manager with $d_param\n"; + + $DEAMONS[$i] = $tg_daemons[$i]->CreateProcess ($d_cmd, $d_param); + $DEAMONS[$i]->Spawn (); + + if ($tg_daemons[$i]->WaitForFileTimed($iorbase, + $tg_daemons[$i]->ProcessStartWaitInterval ()) == -1) { + print STDERR + "ERROR: The ior $iorfile file of node daemon $i could not be found\n"; + for (; $i >= 0; --$i) { + $DEAMONS[$i]->Kill (); $DEAMONS[$i]->TimedWait (1); + } + return -1; + } + } + return 0; +} + +create_targets (); +init_ior_files (); + +# Invoke naming service + +$NS = $tg_naming->CreateProcess ("$TAO_ROOT/orbsvcs/Naming_Service/tao_cosnaming", " -ORBEndpoint iiop://localhost:60003 -o $ior_nsfile"); + +$ns_status = $NS->Spawn (); + +if ($ns_status != 0) { + print STDERR "ERROR: Unable to execute the naming service\n"; + kill_open_processes (); + exit 1; +} + +print STDERR "Starting Naming Service with -ORBEndpoint iiop://localhost:60003 -o ns.ior\n"; + +if ($tg_naming->WaitForFileTimed ($ior_nsbase, + $tg_naming->ProcessStartWaitInterval ()) == -1) { + print STDERR "ERROR: cannot find naming service IOR file\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} + +$ns_running = 1; +# Set up NamingService environment +$ENV{"NameServiceIOR"} = "corbaloc:iiop:localhost:60003/NameService"; + +# Invoke node daemon. +print "Invoking node daemon\n"; +$status = run_node_daemons (); + +if ($status != 0) { + print STDERR "ERROR: Unable to execute the node daemon\n"; + kill_open_processes (); + exit 1; +} + +$daemons_running = 1; + +# Invoke execution manager. +print "Invoking execution manager (dance_execution_manager.exe) with -e$ior_emfile\n"; +$EM = $tg_exe_man->CreateProcess ("$DANCE_ROOT/bin/dance_execution_manager", + "-e$ior_emfile --domain-nc corbaloc:rir:/NameService"); +$em_status = $EM->Spawn (); + +if ($em_status != 0) { + print STDERR "ERROR: dance_execution_manager returned $em_status"; + exit 1; +} + +if ($tg_exe_man->WaitForFileTimed ($ior_embase, + $tg_exe_man->ProcessStartWaitInterval ()) == -1) { + print STDERR + "ERROR: The ior file of execution manager could not be found\n"; + kill_open_processes (); + exit 1; +} + +$em_running = 1; + +# Invoke executor - start the application -. +print "Invoking executor - launch the application -\n"; + +print "Start dance_plan_launcher.exe with -x $cdp_file -k file://$ior_emfile\n"; +$E = $tg_executor->CreateProcess ("$DANCE_ROOT/bin/dance_plan_launcher", + "-x $cdp_file -k file://$ior_emfile"); +$pl_status = $E->SpawnWaitKill (2 * $tg_executor->ProcessStartWaitInterval ()); + +if ($pl_status != 0) { + print STDERR "ERROR: dance_plan_launcher returned $pl_status\n"; + kill_open_processes (); + exit 1; +} + +for ($i = 0; $i < $nr_daemon; ++$i) { + if ($tg_daemons[$i]->WaitForFileTimed ($iorbases[$i], + $tg_daemons[$i]->ProcessStopWaitInterval ()) == -1) { + print STDERR "ERROR: The ior file of daemon $i could not be found\n"; + kill_open_processes (); + exit 1; + } +} + +print "Sleeping 2 seconds to allow task to complete\n"; +sleep (2); + +# Invoke executor - stop the application -. +print "Invoking executor - stop the application -\n"; +print "by running dance_plan_launcher.exe with -k file://$ior_emfile -x $cdp_file\n"; + +$E = $tg_executor->CreateProcess ("$DANCE_ROOT/bin/dance_plan_launcher", + "-k file://$ior_emfile -x $cdp_file -s"); +$pl_status = $E->SpawnWaitKill ($tg_executor->ProcessStartWaitInterval ()); + +if ($pl_status != 0) { + print STDERR "ERROR: dance_plan_launcher returned $pl_status\n"; + kill_open_processes (); + exit 1; +} + +print "Executor returned.\n"; +print "Shutting down rest of the processes.\n"; + +delete_ior_files (); +kill_open_processes (); + +exit $status; |