From 2c83c611209391e54c013d7eb6e3af1c8bddc3d7 Mon Sep 17 00:00:00 2001 From: msmit Date: Mon, 12 Dec 2011 15:39:58 +0000 Subject: Mon Dec 12 15:37:43 UTC 2011 Marcel Smit * connectors/dds4ccm/impl/ndds/DomainParticipantFactory.cpp: * connectors/dds4ccm/impl/ndds/DomainParticipantManager.h: * connectors/dds4ccm/impl/ndds/DomainParticipantManager.cpp: Domain partipants should be created per domain ID and QOS profile. * bin/ciao_tests.lst: * connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID: * connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Base: * connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Base/Base.idl: * connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Base/Base.mpc: * connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Component: * connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Component/Component.idl: * connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Component/Component.mpc: * connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Component/Component_exec.h: * connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Component/Component_exec.cpp: * connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Connector1: * connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Connector1/Connector1.idl: * connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Connector1/Connector1.mpc: * connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Connector2: * connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Connector2/Connector2.idl: * connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Connector2/Connector2.mpc: * connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Connector3: * connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Connector3/Connector3.idl: * connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Connector3/Connector3.mpc: * connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/descriptors: * connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/descriptors/Plan.cdp: * connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/descriptors/USER_QOS_PROFILES.xml: * connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/descriptors/run_test.pl: Added test to verify this. --- CIAO/ChangeLog.BRANCH | 33 ++ CIAO/bin/ciao_tests.lst | 1 + .../dds4ccm/impl/ndds/DomainParticipantFactory.cpp | 4 +- .../dds4ccm/impl/ndds/DomainParticipantManager.cpp | 163 +++++-- .../dds4ccm/impl/ndds/DomainParticipantManager.h | 23 +- .../DifferentDomainID/Base/Base.idl | 41 ++ .../DifferentDomainID/Base/Base.mpc | 26 ++ .../DifferentDomainID/Component/Component.idl | 26 ++ .../DifferentDomainID/Component/Component.mpc | 154 +++++++ .../DifferentDomainID/Component/Component_exec.cpp | 262 +++++++++++ .../DifferentDomainID/Component/Component_exec.h | 51 +++ .../DifferentDomainID/Connector1/Connector1.idl | 25 ++ .../DifferentDomainID/Connector1/Connector1.mpc | 142 ++++++ .../DifferentDomainID/Connector2/Connector2.idl | 23 + .../DifferentDomainID/Connector2/Connector2.mpc | 142 ++++++ .../DifferentDomainID/Connector3/Connector3.idl | 23 + .../DifferentDomainID/Connector3/Connector3.mpc | 142 ++++++ .../DifferentDomainID/descriptors/Plan.cdp | 478 +++++++++++++++++++++ .../descriptors/USER_QOS_PROFILES.xml | 80 ++++ .../DifferentDomainID/descriptors/run_test.pl | 242 +++++++++++ 20 files changed, 2038 insertions(+), 43 deletions(-) create mode 100644 CIAO/connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Base/Base.idl create mode 100644 CIAO/connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Base/Base.mpc create mode 100644 CIAO/connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Component/Component.idl create mode 100644 CIAO/connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Component/Component.mpc create mode 100644 CIAO/connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Component/Component_exec.cpp create mode 100644 CIAO/connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Component/Component_exec.h create mode 100644 CIAO/connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Connector1/Connector1.idl create mode 100644 CIAO/connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Connector1/Connector1.mpc create mode 100644 CIAO/connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Connector2/Connector2.idl create mode 100644 CIAO/connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Connector2/Connector2.mpc create mode 100644 CIAO/connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Connector3/Connector3.idl create mode 100644 CIAO/connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Connector3/Connector3.mpc create mode 100644 CIAO/connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/descriptors/Plan.cdp create mode 100644 CIAO/connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/descriptors/USER_QOS_PROFILES.xml create mode 100755 CIAO/connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/descriptors/run_test.pl diff --git a/CIAO/ChangeLog.BRANCH b/CIAO/ChangeLog.BRANCH index 0e0e6e9c1d3..711f2cd06b8 100644 --- a/CIAO/ChangeLog.BRANCH +++ b/CIAO/ChangeLog.BRANCH @@ -1,3 +1,36 @@ +Mon Dec 12 15:37:43 UTC 2011 Marcel Smit + + + * connectors/dds4ccm/impl/ndds/DomainParticipantFactory.cpp: + * connectors/dds4ccm/impl/ndds/DomainParticipantManager.h: + * connectors/dds4ccm/impl/ndds/DomainParticipantManager.cpp: + Domain partipants should be created per domain ID and QOS profile. + + * bin/ciao_tests.lst: + * connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID: + * connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Base: + * connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Base/Base.idl: + * connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Base/Base.mpc: + * connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Component: + * connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Component/Component.idl: + * connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Component/Component.mpc: + * connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Component/Component_exec.h: + * connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Component/Component_exec.cpp: + * connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Connector1: + * connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Connector1/Connector1.idl: + * connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Connector1/Connector1.mpc: + * connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Connector2: + * connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Connector2/Connector2.idl: + * connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Connector2/Connector2.mpc: + * connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Connector3: + * connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Connector3/Connector3.idl: + * connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Connector3/Connector3.mpc: + * connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/descriptors: + * connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/descriptors/Plan.cdp: + * connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/descriptors/USER_QOS_PROFILES.xml: + * connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/descriptors/run_test.pl: + Added test to verify this. + Local Variables: mode: change-log diff --git a/CIAO/bin/ciao_tests.lst b/CIAO/bin/ciao_tests.lst index db4b920ba80..0c2a43ae0f7 100644 --- a/CIAO/bin/ciao_tests.lst +++ b/CIAO/bin/ciao_tests.lst @@ -108,6 +108,7 @@ TAO/CIAO/connectors/dds4ccm/tests/VariousTopicsState/descriptors/run_test.pl: !S TAO/CIAO/connectors/dds4ccm/tests/SharedDomainParticipant/SameDatatype/descriptors/run_test.pl: !STATIC !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !NOXERCES !ACE_FOR_TAO !ST NDDS TAO/CIAO/connectors/dds4ccm/tests/SharedDomainParticipant/SameDatatype/descriptors/run_test_default_qos.pl: !STATIC !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !NOXERCES !ACE_FOR_TAO !ST NDDS TAO/CIAO/connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDatatype/descriptors/run_test.pl: !STATIC !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !NOXERCES !ACE_FOR_TAO !ST NDDS +TAO/CIAO/connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/descriptors/run_test.pl: !STATIC !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !NOXERCES !ACE_FOR_TAO !ST NDDS TAO/CIAO/connectors/dds4ccm/tests/QueryCondition/ReadGet/descriptors/run_test.pl: !STATIC !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !NOXERCES !ACE_FOR_TAO !ST NDDS TAO/CIAO/connectors/dds4ccm/tests/InstanceHandle/descriptors/run_test.pl: !STATIC !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !NOXERCES !ACE_FOR_TAO !ST NDDS TAO/CIAO/connectors/dds4ccm/tests/TimeConversion/run_test.pl: !STATIC !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !NOXERCES !ACE_FOR_TAO !ST NDDS diff --git a/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipantFactory.cpp b/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipantFactory.cpp index 0d09876af44..dc22ba31724 100644 --- a/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipantFactory.cpp +++ b/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipantFactory.cpp @@ -48,7 +48,7 @@ namespace CIAO ACE_CString qos_profile = "default"; DDSDomainParticipant *dds_dp = - DPMANAGER->get_participant (qos_profile.c_str ()); + DPMANAGER->get_participant (domain_id, qos_profile.c_str ()); if (!dds_dp) { @@ -147,7 +147,7 @@ namespace CIAO } DDSDomainParticipant *dds_dp = - DPMANAGER->get_participant (qos_profile); + DPMANAGER->get_participant (domain_id, qos_profile); if (!dds_dp) { diff --git a/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipantManager.cpp b/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipantManager.cpp index 43c7b648f02..0eb707c757c 100644 --- a/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipantManager.cpp +++ b/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipantManager.cpp @@ -139,123 +139,205 @@ namespace CIAO bool DomainParticipantManager::add_topic (DDSDomainParticipant * dp, - DDSTopic * tp) + DDSTopic * tp) { DDS4CCM_TRACE ("DomainParticipantManager::add_topic"); + + DomainParticipantIDs::iterator it = this->dps_.find(dp->get_domain_id ()); + if (it == this->dps_.end ()) + { + DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO + "DomainParticipantManager::add_topic- " + "Error: List of domain participants for domain id <%d> not found\n", + dp->get_domain_id ())); + return false; + } + DomainParticipants_iterator iter = - this->get_participanttopic_by_participant (dp); - if (iter != this->dps_.end ()) + this->get_participanttopic_by_participant (it, dp); + if (iter != it->second.end ()) { return iter->second->add_topic (tp); } DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO "DomainParticipantManager::add_topic - " - "Unable to find provided DomainParticipant.\n")); + "Unable to find provided DomainParticipant for.\n")); return false; } bool DomainParticipantManager::remove_topic (DDSDomainParticipant * dp, - DDSTopic * tp) + DDSTopic * tp) { DDS4CCM_TRACE ("DomainParticipantManager::remove_topic"); + + DomainParticipantIDs::iterator it = this->dps_.find(dp->get_domain_id ()); + if (it == this->dps_.end ()) + { + DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO + "DomainParticipantManager::remove_topic- " + "Error: List of domain participants for domain id <%d> not found\n", + dp->get_domain_id ())); + return false; + } + DomainParticipants_iterator iter = - this->get_participanttopic_by_participant (dp); - if (iter != this->dps_.end ()) + this->get_participanttopic_by_participant (it, dp); + if (iter != it->second.end ()) { return iter->second->remove_topic (tp); } + return false; } DDSDomainParticipant * - DomainParticipantManager::get_participant ( + DomainParticipantManager::get_participant (const DDS_DomainId_t domain_id, const char * qos_profile) { DDS4CCM_TRACE ("DomainParticipantManager::get_participant"); ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, _guard, this->dps_mutex_, CORBA::INTERNAL ()); - DDSParticipantTopic * dpt = this->dps_[qos_profile]; + + DomainParticipantIDs::iterator it = this->dps_.find(domain_id); + if (it == this->dps_.end ()) + { + DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO + "DomainParticipantManager::get_participant- " + "List of domain participants for domain id <%d> not found\n", + domain_id)); + return 0; + } + + DDSParticipantTopic * dpt = it->second[qos_profile]; if (dpt) { dpt->_inc_ref (); DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO "DomainParticipantManager::get_participant - " - "DomainParticipant found. profile <%C> - ref_count <%d>\n", + "DomainParticipant found. domain <%d> - " + "profile <%C> - ref_count <%d>\n", + domain_id, qos_profile, dpt->_ref_count ())); return dpt->get_participant (); } DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO "DomainParticipantManager::get_participant - " - "DomainParticipant with profile <%C> does not exist.\n", - qos_profile)); + "DomainParticipant for domain <%d> with profile <%C> " + "does not exist.\n", + domain_id, qos_profile)); return 0; } bool - DomainParticipantManager::add_participant ( - const char * qos_profile, + DomainParticipantManager::add_participant (const char * qos_profile, DDSDomainParticipant * dp) { DDS4CCM_TRACE ("DomainParticipantManager::add_participant"); ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, _guard, this->dps_mutex_, CORBA::INTERNAL ()); + + const DDS_DomainId_t domain_id = dp->get_domain_id (); + DomainParticipantIDs::iterator it_found = this->dps_.find(domain_id); + + if (it_found == this->dps_.end()) + { + DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO + "DomainParticipantManager::add_participant - " + "List of DomainParticipants not yet available for " + "domain ID <%d>\n", + domain_id)); + DomainParticipants dps; + std::pair it_new = + this->dps_.insert( + std::pair< DDS_DomainId_t, DomainParticipants>(domain_id, dps)); + if (!it_new.second) + { + DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO + "DomainParticipantManager::add_participant - " + "Unable to insert a new domain id <%d>.\n", + domain_id)); + return false; + } + DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO + "DomainParticipantManager::add_participant - " + "Succesfully created entry for domain ID <%d>\n", + domain_id)); + // reassing the iterator + it_found = this->dps_.find (domain_id); + } + DomainParticipants_iterator iter = - this->get_participanttopic_by_participant (dp); - if (iter == this->dps_.end ()) + this->get_participanttopic_by_participant (it_found, dp); + if (iter == it_found->second.end()) { + DDSParticipantTopic * dpt = 0; ACE_NEW_THROW_EX (dpt, DDSParticipantTopic (dp), ::CORBA::NO_MEMORY ()); - this->dps_[qos_profile] = dpt; + + it_found->second[qos_profile] = dpt; + DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO "DomainParticipantManager::add_participant - " - "Added participant with profile <%C>.\n", - qos_profile)); + "Added participant for domain <%d> with profile <%C>.\n", + domain_id, qos_profile)); return true; } DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO "DomainParticipantManager::add_participant - " - "Don't add participant with profile <%C> since it already " + "Don't add participant for domain <%d> with profile <%C> since it already " "exists.\n", - qos_profile)); + domain_id, qos_profile)); return false; } bool - DomainParticipantManager::remove_participant ( - DDSDomainParticipant * dp) + DomainParticipantManager::remove_participant (DDSDomainParticipant * dp) { DDS4CCM_TRACE ("DomainParticipantManager::remove_participant"); ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, _guard, this->dps_mutex_, CORBA::INTERNAL ()); + const DDS_DomainId_t domain_id = dp->get_domain_id (); + DomainParticipantIDs::iterator it = this->dps_.find(domain_id); + if (it == this->dps_.end ()) + { + DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO + "DomainParticipantManager::remove_participant- " + "Error: List of domain participants for domain id <%d> not found\n", + domain_id)); + return false; + } + DomainParticipants_iterator iter = - this->get_participanttopic_by_participant (dp); - if (iter != this->dps_.end ()) + this->get_participanttopic_by_participant (it, dp); + if (iter != it->second.end ()) { if (iter->second->_ref_count () == 1) { DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_UNIMP_ACTION, (LM_TRACE, DDS4CCM_INFO "DomainParticipantManager::remove_participant - " - "Delete participant since ref_count is one. \n")); + "Delete participant for domain <%d> since ref_count is one. \n", + domain_id)); delete iter->second; // Save to remove from list - this->dps_.erase (iter); + it->second.erase (iter); } else { iter->second->_dec_ref (); DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_UNIMP_ACTION, (LM_TRACE, DDS4CCM_INFO "DomainParticipantManager::remove_participant - " - "Don't delete participant since " + "Don't delete participant for domain <%d> since " "it's still used - ref_count is still <%d>\n", + domain_id, iter->second->_ref_count ())); return false; } @@ -265,25 +347,38 @@ namespace CIAO void DomainParticipantManager::_inc_ref (DDSDomainParticipant * dp, - DDSTopic * tp) + DDSTopic * tp) { DDS4CCM_TRACE ("DomainParticipantManager::_inc_ref"); + + DomainParticipantIDs::iterator it = this->dps_.find(dp->get_domain_id ()); + if (it == this->dps_.end ()) + { + DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO + "DomainParticipantManager::_inc_ref- " + "Error: List of domain participants for domain id <%d> not found. " + "Unable to increment reference count\n", + dp->get_domain_id ())); + return; + } + + DomainParticipants_iterator iter = - this->get_participanttopic_by_participant (dp); - if (iter != this->dps_.end ()) + this->get_participanttopic_by_participant (it, dp); + if (iter != it->second.end ()) { iter->second->_inc_ref_topic (tp); } } DomainParticipantManager::DomainParticipants_iterator - DomainParticipantManager::get_participanttopic_by_participant ( + DomainParticipantManager::get_participanttopic_by_participant (DomainParticipantIDs::iterator it, DDSDomainParticipant * dp) { DDS4CCM_TRACE ("DomainParticipantManager::get_participanttopic_by_participant"); - DomainParticipants_iterator pos = this->dps_.begin(); - while (pos != this->dps_.end()) + DomainParticipants_iterator pos = it->second.begin(); + while (pos != it->second.end()) { if (pos->second && pos->second->get_participant () == dp) { diff --git a/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipantManager.h b/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipantManager.h index 495f4e162f2..5d32d11f561 100644 --- a/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipantManager.h +++ b/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipantManager.h @@ -61,27 +61,36 @@ namespace CIAO /// Destructor ~DomainParticipantManager (void); - bool add_topic (DDSDomainParticipant *dp, DDSTopic * tp); + bool add_topic (DDSDomainParticipant *dp, + DDSTopic * tp); - bool remove_topic (DDSDomainParticipant * dp, DDSTopic *tp); + bool remove_topic (DDSDomainParticipant * dp, + DDSTopic *tp); - DDSDomainParticipant * get_participant (const char * qos_profile); + DDSDomainParticipant * get_participant (const DDS_DomainId_t domain_id, + const char * qos_profile); bool - add_participant (const char * qos_profile, DDSDomainParticipant * dp); + add_participant (const char * qos_profile, + DDSDomainParticipant * dp); bool remove_participant (DDSDomainParticipant * dp); - void _inc_ref (DDSDomainParticipant * dp, DDSTopic * tp); + void _inc_ref (DDSDomainParticipant * dp, + DDSTopic * tp); private: TAO_SYNCH_MUTEX dps_mutex_; typedef std::map DomainParticipants; + + typedef std::map < DDS_DomainId_t, DomainParticipants > DomainParticipantIDs; + DomainParticipantIDs dps_; + typedef DomainParticipants::iterator DomainParticipants_iterator; - DomainParticipants dps_; DomainParticipants_iterator - get_participanttopic_by_participant (DDSDomainParticipant * dp); + get_participanttopic_by_participant (const DomainParticipantIDs::iterator it, + DDSDomainParticipant * dp); }; typedef ACE_Singleton + */ + +#ifndef BASE_IDL +#define BASE_IDL + +#pragma ndds typesupport "Base/BaseSupport.h" +#pragma opendds typesupport "Base/BaseTypeSupportImpl.h" + +#pragma DCPS_DATA_TYPE "SharedDPTest1" +#pragma DCPS_DATA_KEY "SharedDPTest1 key1" + +#pragma DCPS_DATA_TYPE "SharedDPTest2" +#pragma DCPS_DATA_KEY "SharedDPTest2 key2" + +#pragma DCPS_DATA_TYPE "SharedDPTest3" +#pragma DCPS_DATA_KEY "SharedDPTest3 key3" + +struct SharedDPTest1 { + string key1; + long iteration1; +}; +typedef sequence SharedDPTest1Seq; + +struct SharedDPTest2 { + string key2; + long iteration2; +}; +typedef sequence SharedDPTest2Seq; + +struct SharedDPTest3 { + string key3; + long iteration3; +}; +typedef sequence SharedDPTest3Seq; + +#endif diff --git a/CIAO/connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Base/Base.mpc b/CIAO/connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Base/Base.mpc new file mode 100644 index 00000000000..5b782c99c59 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Base/Base.mpc @@ -0,0 +1,26 @@ +// $Id$ + +project (SharedDP_Diff_ID_Base_stub) : taoidldefaults, dds4ccm_ts_default { + sharedname = SharedDP_Diff_ID_Base_stub + dynamicflags += BASE_STUB_BUILD_DLL + libout = ../lib + + idlflags += -SS -Sci \ + -Wb,stub_export_macro=BASE_STUB_Export \ + -Wb,stub_export_include=Base_stub_export.h + + IDL_Files { + idlflags += -Gxhst + Base.idl + } + + opendds_ts_flags += --export=BASE_STUB_Export + + DDSGenerator_Files { + Base.idl + } + + Source_Files { + } +} + diff --git a/CIAO/connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Component/Component.idl b/CIAO/connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Component/Component.idl new file mode 100644 index 00000000000..719580a2827 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Component/Component.idl @@ -0,0 +1,26 @@ +// $Id$ + +/** + * @file + * @author Marcel Smit + * + */ + +#ifndef DDS_SHARED_DP_COMPONENT_IDL +#define DDS_SHARED_DP_COMPONENT_IDL + +#include "Connector1/Connector1.idl" +#include "Connector2/Connector2.idl" +#include "Connector3/Connector3.idl" + +module SharedDP +{ + component SharedDPComponent + { + port SharedDP_Connector1::SharedDPTest1Connector::DDS_Write write1; + port SharedDP_Connector2::SharedDPTest2Connector::DDS_Write write2; + port SharedDP_Connector3::SharedDPTest3Connector::DDS_Write write3; + }; +}; + +#endif diff --git a/CIAO/connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Component/Component.mpc b/CIAO/connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Component/Component.mpc new file mode 100644 index 00000000000..1edb3a60ae4 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Component/Component.mpc @@ -0,0 +1,154 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -p DDS_SharedDPBase -l ../lib -o ../lib -c controller -u DDS Component" + +project(SharedDP_Diff_ID_Component_idl_gen) : componentidldefaults, dds4ccm { + after += SharedDP_Diff_ID_Connector1_idl_gen SharedDP_Diff_ID_Connector2_idl_gen \ + SharedDP_Diff_ID_Connector3_idl_gen + custom_only = 1 + 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 { + Component.idl + } +} + +project(SharedDP_Diff_ID_Component_lem_gen) : ciaoidldefaults, dds4ccm { + after += SharedDP_Diff_ID_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 $CIAO_ROOT/connectors -I .. + + IDL_Files { + ComponentE.idl + } +} + +project(SharedDP_Diff_ID_Component_lem_stub) : ccm_svnt, dds4ccm_base { + after += SharedDP_Diff_ID_Component_lem_gen SharedDP_Diff_ID_Component_stub SharedDP_Diff_ID_Base_stub + libs += SharedDP_Diff_ID_Base_stub Component_stub + libpaths += ../lib + libout = ../lib + includes += .. + sharedname = Component_lem_stub + dynamicflags += COMPONENT_LEM_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + ComponentEC.cpp + } + + Header_Files { + ComponentEC.h + Component_lem_stub_export.h + } + + Inline_Files { + ComponentEC.inl + } +} + +project(SharedDP_Diff_ID_Component_stub) : ccm_stub, dds4ccm_base { + after += SharedDP_Diff_ID_Component_idl_gen SharedDP_Diff_ID_Base_stub \ + SharedDP_Diff_ID_Connector1_stub SharedDP_Diff_ID_Connector2_stub SharedDP_Diff_ID_Connector3_stub \ + SharedDP_Diff_ID_Connector1_lem_gen SharedDP_Diff_ID_Connector2_lem_gen SharedDP_Diff_ID_Connector3_lem_gen + libs += SharedDP_Diff_ID_Base_stub DDS_Connector1_stub DDS_Connector2_stub DDS_Connector3_stub + includes += .. + libpaths += ../lib + libout = ../lib + sharedname = Component_stub + dynamicflags += COMPONENT_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + ComponentC.cpp + } + + Header_Files { + ComponentC.h + Component_stub_export.h + } + + Inline_Files { + ComponentC.inl + } +} + +project(SharedDP_Diff_ID_Component_exec) : ciao_executor, dds4ccm_impl { + after += SharedDP_Diff_ID_Component_lem_stub SharedDP_Diff_ID_Component_stub \ + SharedDP_Diff_ID_Connector1_lem_stub SharedDP_Diff_ID_Connector1_stub \ + SharedDP_Diff_ID_Connector2_lem_stub SharedDP_Diff_ID_Connector2_stub \ + SharedDP_Diff_ID_Connector3_lem_stub SharedDP_Diff_ID_Connector3_stub + sharedname = Component_exec + libs += Component_stub Component_lem_stub SharedDP_Diff_ID_Base_stub \ + DDS_Connector1_lem_stub DDS_Connector1_stub \ + DDS_Connector2_lem_stub DDS_Connector2_stub \ + DDS_Connector3_lem_stub DDS_Connector3_stub + libpaths += ../lib + includes += .. + libout = ../lib + dynamicflags += COMPONENT_EXEC_BUILD_DLL + requires += ndds + + IDL_Files { + } + + Source_Files { + Component_exec.cpp + } + + Header_Files { + Component_exec.h + Component_exec_export.h + } + + Inline_Files { + } +} + +project(SharedDP_Diff_ID_Component_svnt) : ciao_servant, dds4ccm_lem_stub, dds4ccm_skel { + after += SharedDP_Diff_ID_Base_stub SharedDP_Diff_ID_Component_lem_stub \ + SharedDP_Diff_ID_Connector1_stub SharedDP_Diff_ID_Connector1_svnt SharedDP_Diff_ID_Connector1_lem_stub \ + SharedDP_Diff_ID_Connector2_stub SharedDP_Diff_ID_Connector2_svnt SharedDP_Diff_ID_Connector2_lem_stub \ + SharedDP_Diff_ID_Connector3_stub SharedDP_Diff_ID_Connector3_svnt SharedDP_Diff_ID_Connector3_lem_stub + sharedname = Component_svnt + libs += Component_stub Component_lem_stub \ + SharedDP_Diff_ID_Base_stub \ + DDS_Connector1_stub DDS_Connector1_svnt DDS_Connector1_lem_stub \ + DDS_Connector2_stub DDS_Connector2_svnt DDS_Connector2_lem_stub \ + DDS_Connector3_stub DDS_Connector3_svnt DDS_Connector3_lem_stub + libpaths += ../lib + libout = ../lib + includes += .. + dynamicflags += COMPONENT_SVNT_BUILD_DLL + + IDL_Files { + } + + Source_Files { + ComponentS.cpp + Component_svnt.cpp + } + + Header_Files { + ComponentS.h + Component_svnt.h + Component_svnt_export.h + } + + Inline_Files { + } +} + diff --git a/CIAO/connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Component/Component_exec.cpp b/CIAO/connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Component/Component_exec.cpp new file mode 100644 index 00000000000..5c51eeb283c --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Component/Component_exec.cpp @@ -0,0 +1,262 @@ +// -*- C++ -*- +// $Id$ + +#include "Component_exec.h" +#include "ace/Log_Msg.h" + +#include "Base/BaseSupport.h" +#include "Connector1/Connector1_conn.h" +#include "Connector2/Connector2_conn.h" +#include "Connector3/Connector3_conn.h" + +#include "dds4ccm/impl/ndds/DataWriter_T.h" + +namespace CIAO_SharedDP_SharedDPComponent_Impl +{ + //============================================================ + // Component Executor Implementation Class: Component_exec_i + //============================================================ + + Component_exec_i::Component_exec_i (void) + { + } + + Component_exec_i::~Component_exec_i (void) + { + } + + void + Component_exec_i::set_session_context (::Components::SessionContext_ptr ctx) + { + this->context_ = + ::SharedDP::CCM_SharedDPComponent_Context::_narrow (ctx); + + if ( ::CORBA::is_nil (this->context_.in ())) + { + throw ::CORBA::INTERNAL (); + } + } + + void + Component_exec_i::configuration_complete (void) + { + } + + void + Component_exec_i::ccm_activate (void) + { + typedef ::CIAO::NDDS::DDS_DataWriter_Base DataWriter_type; + try + { + ::DDS::DataWriter_var dw1 = + this->context_->get_connection_write1_dds_entity (); + + if (::CORBA::is_nil (dw1.in ())) + { + ACE_ERROR ((LM_ERROR, "ERROR : Component_exec_i::ccm_activate - " + "Datawriter 1 connection is NIL.\n")); + throw ::CORBA::INTERNAL (); + } + + ::CIAO::DDS4CCM::CCM_DataWriter * ccm_dw1 = + dynamic_cast < ::CIAO::DDS4CCM::CCM_DataWriter * > (dw1.in ()); + + if (ccm_dw1) + { + ::DDS::DataWriter_var tmp = ccm_dw1->get_dds_entity (); + if (! ::CORBA::is_nil (tmp.in ())) + { + DataWriter_type * typed_ccm_dw = + dynamic_cast (tmp.in ()); + if (typed_ccm_dw) + { + DDSDataWriter * dds_dw1 = typed_ccm_dw->get_rti_entity (); + DDSPublisher * dds_p1 = dds_dw1->get_publisher (); + this->dds_dp1_ = dds_p1->get_participant (); + } + else + { + ACE_ERROR ((LM_ERROR, "ERROR : Component_exec_i::ccm_activate - " + "Error casting DataWriter 1 to typed DataWriter 1\n")); + throw ::CORBA::INTERNAL (); + } + } + else + { + ACE_ERROR ((LM_ERROR, "ERROR : Receiver_exec_i::ccm_activate - " + "Error getting DDS DataWriter 1.\n")); + throw ::CORBA::INTERNAL (); + } + } + else + { + ACE_ERROR ((LM_ERROR, "ERROR : Component_exec_i::ccm_activate - " + "Error casting DataWriter 1 to CCM DataWriter 1\n")); + throw ::CORBA::INTERNAL (); + } + } + catch (...) + { + ACE_ERROR ((LM_ERROR, "ERROR: Unable to create dds_entity for writer1\n")); + } + + try + { + ::DDS::DataWriter_var dw2 = + this->context_->get_connection_write2_dds_entity (); + + if (::CORBA::is_nil (dw2.in ())) + { + ACE_ERROR ((LM_ERROR, "ERROR : Component_exec_i::ccm_activate - " + "Datawriter 2 connection is NIL.\n")); + throw ::CORBA::INTERNAL (); + } + + ::CIAO::DDS4CCM::CCM_DataWriter * ccm_dw2 = + dynamic_cast < ::CIAO::DDS4CCM::CCM_DataWriter * > (dw2.in ()); + + if (ccm_dw2) + { + ::DDS::DataWriter_var tmp = ccm_dw2->get_dds_entity (); + if (! ::CORBA::is_nil (tmp.in ())) + { + DataWriter_type * typed_ccm_dw = + dynamic_cast (tmp.in ()); + if (typed_ccm_dw) + { + DDSDataWriter * dds_dw2 = typed_ccm_dw->get_rti_entity (); + DDSPublisher * dds_p2 = dds_dw2->get_publisher (); + this->dds_dp2_ = dds_p2->get_participant (); + } + else + { + ACE_ERROR ((LM_ERROR, "ERROR : Component_exec_i::ccm_activate - " + "Error casting DataWriter 2 to typed DataWriter 2\n")); + throw ::CORBA::INTERNAL (); + } + } + else + { + ACE_ERROR ((LM_ERROR, "ERROR : Receiver_exec_i::ccm_activate - " + "Error getting DDS DataWriter 2.\n")); + throw ::CORBA::INTERNAL (); + } + } + else + { + ACE_ERROR ((LM_ERROR, "ERROR : Component_exec_i::ccm_activate - " + "Error casting DataWriter 2 to CCM DataWriter 2\n")); + throw ::CORBA::INTERNAL (); + } + } + catch (...) + { + ACE_ERROR ((LM_ERROR, "ERROR: Unable to create dds_entity for writer2\n")); + } + + try + { + ::DDS::DataWriter_var dw3 = + this->context_->get_connection_write3_dds_entity (); + + if (::CORBA::is_nil (dw3.in ())) + { + ACE_ERROR ((LM_ERROR, "ERROR : Component_exec_i::ccm_activate - " + "Datawriter 3 connection is NIL.\n")); + throw ::CORBA::INTERNAL (); + } + + ::CIAO::DDS4CCM::CCM_DataWriter * ccm_dw3 = + dynamic_cast < ::CIAO::DDS4CCM::CCM_DataWriter * > (dw3.in ()); + + if (ccm_dw3) + { + ::DDS::DataWriter_var tmp = ccm_dw3->get_dds_entity (); + if (! ::CORBA::is_nil (tmp.in ())) + { + DataWriter_type * typed_ccm_dw = + dynamic_cast (tmp.in ()); + if (typed_ccm_dw) + { + DDSDataWriter * dds_dw3 = typed_ccm_dw->get_rti_entity (); + DDSPublisher * dds_p3 = dds_dw3->get_publisher (); + this->dds_dp3_ = dds_p3->get_participant (); + } + else + { + ACE_ERROR ((LM_ERROR, "ERROR : Component_exec_i::ccm_activate - " + "Error casting DataWriter 3 to typed DataWriter 3\n")); + throw ::CORBA::INTERNAL (); + } + } + else + { + ACE_ERROR ((LM_ERROR, "ERROR : Receiver_exec_i::ccm_activate - " + "Error getting DDS DataWriter 3.\n")); + throw ::CORBA::INTERNAL (); + } + } + else + { + ACE_ERROR ((LM_ERROR, "ERROR : Component_exec_i::ccm_activate - " + "Error casting DataWriter 3 to CCM DataWriter 3\n")); + throw ::CORBA::INTERNAL (); + } + } + catch (...) + { + ACE_ERROR ((LM_ERROR, "ERROR: Unable to create dds_entity for writer3\n")); + } + } + + void + Component_exec_i::ccm_passivate (void) + { + if (!this->dds_dp1_) + ACE_ERROR ((LM_ERROR, "ERROR: DomainParticipant for Connector 1 seems to be NIL\n")); + if (!this->dds_dp2_) + ACE_ERROR ((LM_ERROR, "ERROR: DomainParticipant for Connector 2 seems to be NIL\n")); + if (!this->dds_dp3_) + ACE_ERROR ((LM_ERROR, "ERROR: DomainParticipant for Connector 3 seems to be NIL\n")); + } + + void + Component_exec_i::ccm_remove (void) + { + if (this->dds_dp1_ == this->dds_dp2_) + { + ACE_ERROR ((LM_ERROR, "ERROR: Connector 1 and 2 seem to " + "share the same DomainParticipant. Based on the domain_id the " + "domain participants should be different\n")); + } + else + { + ACE_DEBUG ((LM_DEBUG, "Connector 1 and 2 don't seems to " + "share the same DomainParticipant\n")); + } + if (this->dds_dp1_ == this->dds_dp3_) + { + ACE_ERROR ((LM_ERROR, "ERROR: Connector 1 and 3 seem to " + "share the same DomainParticipant\n")); + } + if (this->dds_dp2_ == this->dds_dp3_) + { + ACE_ERROR ((LM_ERROR, "ERROR: Connector 2 and 3 seem to " + "share the same DomainParticipant\n")); + } + } + + extern "C" COMPONENT_EXEC_Export ::Components::EnterpriseComponent_ptr + create_Component_Impl (void) + { + ::Components::EnterpriseComponent_ptr retval = + ::Components::EnterpriseComponent::_nil (); + + ACE_NEW_NORETURN ( + retval, + Component_exec_i); + + return retval; + } +} + diff --git a/CIAO/connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Component/Component_exec.h b/CIAO/connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Component/Component_exec.h new file mode 100644 index 00000000000..3229ce1a259 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Component/Component_exec.h @@ -0,0 +1,51 @@ +// -*- C++ -*- +// $Id$ + +#ifndef CIAO_COMPONENT_EXEC_H_ +#define CIAO_COMPONENT_EXEC_H_ + + +#include "ComponentEC.h" + +#include /**/ "Component_exec_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/LocalObject.h" + +class DDSDomainParticipant; + +namespace CIAO_SharedDP_SharedDPComponent_Impl +{ + class Component_exec_i + : public virtual SharedDPComponent_Exec, + public virtual ::CORBA::LocalObject + { + public: + Component_exec_i (void); + virtual ~Component_exec_i (void); + + 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); + + private: + ::SharedDP::CCM_SharedDPComponent_Context_var context_; + + DDSDomainParticipant * dds_dp1_; + DDSDomainParticipant * dds_dp2_; + DDSDomainParticipant * dds_dp3_; + }; + + extern "C" COMPONENT_EXEC_Export ::Components::EnterpriseComponent_ptr + create_Component_Impl (void); +} + +#endif /* ifndef */ + diff --git a/CIAO/connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Connector1/Connector1.idl b/CIAO/connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Connector1/Connector1.idl new file mode 100644 index 00000000000..edbb93d61f1 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Connector1/Connector1.idl @@ -0,0 +1,25 @@ +// $Id$ + +/** + * @file Connector1.idl + * @author Marcel Smit + */ + +#ifndef SHARED_DP_CONNECTOR1_IDL_ +#define SHARED_DP_CONNECTOR1_IDL_ + +#include +#include + +#include "Base/Base.idl" + +#pragma ciao lem "Connector1/Connector1E.idl" + +module SharedDP_Connector1 +{ + module ::CCM_DDS::Typed < ::SharedDPTest1, ::SharedDPTest1Seq> SharedDPTest1Connector; +}; + + + +#endif /* SHARED_DP_CONNECTOR1_IDL_ */ diff --git a/CIAO/connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Connector1/Connector1.mpc b/CIAO/connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Connector1/Connector1.mpc new file mode 100644 index 00000000000..6f218318d68 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Connector1/Connector1.mpc @@ -0,0 +1,142 @@ +// $Id$ + +project(SharedDP_Diff_ID_Connector1_idl_gen) : connectoridldefaults, dds4ccm { + after += DDS4CCM_idl_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=SHAREDDP_CONNECTOR1_STUB_Export \ + -Wb,stub_export_include=Connector1_stub_export.h \ + -Wb,skel_export_macro=SHAREDDP_CONNECTOR1_SVNT_Export \ + -Wb,skel_export_include=Connector1_svnt_export.h \ + -Wb,svnt_export_macro=SHAREDDP_CONNECTOR1_SVNT_Export \ + -Wb,svnt_export_include=Connector1_svnt_export.h \ + -Wb,conn_export_macro=SHAREDDP_CONNECTOR1_CONN_Export \ + -Wb,conn_export_include=Connector1_conn_export.h \ + -I .. + + IDL_Files { + Connector1.idl + } +} + +project(SharedDP_Diff_ID_Connector1_lem_gen) : ciaoidldefaults, dds4ccm { + custom_only = 1 + after += SharedDP_Diff_ID_Connector1_idl_gen + idlflags += -Wb,stub_export_macro=SHAREDDP_CONNECTOR1_LEM_STUB_Export \ + -Wb,stub_export_include=Connector1_lem_stub_export.h \ + -SS -Gxhst \ + -I .. + + IDL_Files { + Connector1E.idl + } +} + +project(SharedDP_Diff_ID_Connector1_lem_stub) : ccm_svnt, dds4ccm_lem_stub { + after += SharedDP_Diff_ID_Connector1_lem_gen SharedDP_Diff_ID_Connector1_stub SharedDP_Diff_ID_Base_stub + libs += SharedDP_Diff_ID_Base_stub DDS_Connector1_stub + libpaths += ../lib + libout = ../lib + includes += .. + sharedname = DDS_Connector1_lem_stub + dynamicflags += SHAREDDP_CONNECTOR1_LEM_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + Connector1EC.cpp + } + + Header_Files { + Connector1EC.h + Connector1_lem_stub_export.h + } + + Inline_Files { + Connector1EC.inl + } +} + +project(SharedDP_Diff_ID_Connector1_stub) : ccm_stub, dds4ccm_base { + after += SharedDP_Diff_ID_Connector1_idl_gen SharedDP_Diff_ID_Base_stub + libs += SharedDP_Diff_ID_Base_stub + libpaths += ../lib + libout = ../lib + includes += .. + sharedname = DDS_Connector1_stub + dynamicflags += SHAREDDP_CONNECTOR1_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + Connector1C.cpp + } + + Header_Files { + Connector1C.h + Connector1_stub_export.h + } + + Inline_Files { + Connector1C.inl + } +} + +project(SharedDP_Diff_ID_Connector1_exec) : ciao_executor, dds4ccm_impl { + after += SharedDP_Diff_ID_Connector1_lem_stub SharedDP_Diff_ID_Connector1_stub SharedDP_Diff_ID_Base_stub + sharedname = DDS_Connector1_exec + libs += DDS_Connector1_stub DDS_Connector1_lem_stub SharedDP_Diff_ID_Base_stub SharedDP_Diff_ID_Base_stub + libpaths += ../lib + libout = ../lib + includes += .. + dynamicflags += SHAREDDP_CONNECTOR1_CONN_BUILD_DLL + + IDL_Files { + } + + Source_Files { + Connector1_conn.cpp + } + + Header_Files { + Connector1_conn.h + Connector1_conn_export.h + } + + Inline_Files { + } +} + + +project(SharedDP_Diff_ID_Connector1_svnt) : ciao_servant, dds4ccm_impl { + after += SharedDP_Diff_ID_Connector1_lem_stub SharedDP_Diff_ID_Connector1_exec SharedDP_Diff_ID_Connector1_stub + sharedname = DDS_Connector1_svnt + libs += DDS_Connector1_stub \ + DDS_Connector1_lem_stub \ + SharedDP_Diff_ID_Base_stub \ + DDS_Connector1_exec + libpaths += ../lib + libout = ../lib + includes += .. + dynamicflags += SHAREDDP_CONNECTOR1_SVNT_BUILD_DLL + + IDL_Files { + } + + Source_Files { + Connector1S.cpp + Connector1_svnt.cpp + } + + Header_Files { + Connector1S.h + Connector1_svnt.h + Connector1_svnt_export.h + } + + Inline_Files { + } +} + + diff --git a/CIAO/connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Connector2/Connector2.idl b/CIAO/connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Connector2/Connector2.idl new file mode 100644 index 00000000000..51a1fbcb3b0 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Connector2/Connector2.idl @@ -0,0 +1,23 @@ +// $Id$ + +/** + * @file Connector2.idl + * @author Marcel Smit + */ + +#ifndef SHARED_DP_CONNECTOR2_IDL_ +#define SHARED_DP_CONNECTOR2_IDL_ + +#include +#include + +#include "Base/Base.idl" + +#pragma ciao lem "Connector2/Connector2E.idl" + +module SharedDP_Connector2 +{ + module ::CCM_DDS::Typed < ::SharedDPTest2, ::SharedDPTest2Seq> SharedDPTest2Connector; +}; + +#endif /* SHARED_DP_CONNECTOR2_IDL_ */ diff --git a/CIAO/connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Connector2/Connector2.mpc b/CIAO/connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Connector2/Connector2.mpc new file mode 100644 index 00000000000..ccdcea2424f --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Connector2/Connector2.mpc @@ -0,0 +1,142 @@ +// $Id$ + +project(SharedDP_Diff_ID_Connector2_idl_gen) : connectoridldefaults, dds4ccm { + after += DDS4CCM_idl_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=SHAREDDP_CONNECTOR2_STUB_Export \ + -Wb,stub_export_include=Connector2_stub_export.h \ + -Wb,skel_export_macro=SHAREDDP_CONNECTOR2_SVNT_Export \ + -Wb,skel_export_include=Connector2_svnt_export.h \ + -Wb,svnt_export_macro=SHAREDDP_CONNECTOR2_SVNT_Export \ + -Wb,svnt_export_include=Connector2_svnt_export.h \ + -Wb,conn_export_macro=SHAREDDP_CONNECTOR2_CONN_Export \ + -Wb,conn_export_include=Connector2_conn_export.h \ + -I .. + + IDL_Files { + Connector2.idl + } +} + +project(SharedDP_Diff_ID_Connector2_lem_gen) : ciaoidldefaults, dds4ccm { + custom_only = 1 + after += SharedDP_Diff_ID_Connector2_idl_gen + idlflags += -Wb,stub_export_macro=SHAREDDP_CONNECTOR2_LEM_STUB_Export \ + -Wb,stub_export_include=Connector2_lem_stub_export.h \ + -SS -Gxhst \ + -I .. + + IDL_Files { + Connector2E.idl + } +} + +project(SharedDP_Diff_ID_Connector2_lem_stub) : ccm_svnt, dds4ccm_lem_stub { + after += SharedDP_Diff_ID_Connector2_lem_gen SharedDP_Diff_ID_Connector2_stub SharedDP_Diff_ID_Base_stub + libs += SharedDP_Diff_ID_Base_stub DDS_Connector2_stub + libpaths += ../lib + libout = ../lib + includes += .. + sharedname = DDS_Connector2_lem_stub + dynamicflags += SHAREDDP_CONNECTOR2_LEM_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + Connector2EC.cpp + } + + Header_Files { + Connector2EC.h + Connector2_lem_stub_export.h + } + + Inline_Files { + Connector2EC.inl + } +} + +project(SharedDP_Diff_ID_Connector2_stub) : ccm_stub, dds4ccm_base { + after += SharedDP_Diff_ID_Connector2_idl_gen SharedDP_Diff_ID_Base_stub + libs += SharedDP_Diff_ID_Base_stub + libpaths += ../lib + libout = ../lib + includes += .. + sharedname = DDS_Connector2_stub + dynamicflags += SHAREDDP_CONNECTOR2_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + Connector2C.cpp + } + + Header_Files { + Connector2C.h + Connector2_stub_export.h + } + + Inline_Files { + Connector2C.inl + } +} + +project(SharedDP_Diff_ID_Connector2_exec) : ciao_executor, dds4ccm_impl { + after += SharedDP_Diff_ID_Connector2_lem_stub SharedDP_Diff_ID_Connector2_stub SharedDP_Diff_ID_Base_stub + sharedname = DDS_Connector2_exec + libs += DDS_Connector2_stub DDS_Connector2_lem_stub SharedDP_Diff_ID_Base_stub SharedDP_Diff_ID_Base_stub + libpaths += ../lib + libout = ../lib + includes += .. + dynamicflags += SHAREDDP_CONNECTOR2_CONN_BUILD_DLL + + IDL_Files { + } + + Source_Files { + Connector2_conn.cpp + } + + Header_Files { + Connector2_conn.h + Connector2_conn_export.h + } + + Inline_Files { + } +} + + +project(SharedDP_Diff_ID_Connector2_svnt) : ciao_servant, dds4ccm_impl { + after += SharedDP_Diff_ID_Connector2_lem_stub SharedDP_Diff_ID_Connector2_exec SharedDP_Diff_ID_Connector2_stub + sharedname = DDS_Connector2_svnt + libs += DDS_Connector2_stub \ + DDS_Connector2_lem_stub \ + SharedDP_Diff_ID_Base_stub \ + DDS_Connector2_exec + libpaths += ../lib + libout = ../lib + includes += .. + dynamicflags += SHAREDDP_CONNECTOR2_SVNT_BUILD_DLL + + IDL_Files { + } + + Source_Files { + Connector2S.cpp + Connector2_svnt.cpp + } + + Header_Files { + Connector2S.h + Connector2_svnt.h + Connector2_svnt_export.h + } + + Inline_Files { + } +} + + diff --git a/CIAO/connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Connector3/Connector3.idl b/CIAO/connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Connector3/Connector3.idl new file mode 100644 index 00000000000..13e64e91aed --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Connector3/Connector3.idl @@ -0,0 +1,23 @@ +// $Id$ + +/** + * @file Connector3.idl + * @author Marcel Smit + */ + +#ifndef SHARED_DP_CONNECTOR3_IDL_ +#define SHARED_DP_CONNECTOR3_IDL_ + +#include +#include + +#include "Base/Base.idl" + +#pragma ciao lem "Connector3/Connector3E.idl" + +module SharedDP_Connector3 +{ + module ::CCM_DDS::Typed < ::SharedDPTest3, ::SharedDPTest3Seq> SharedDPTest3Connector; +}; + +#endif /* SHARED_DP_CONNECTOR3_IDL_ */ diff --git a/CIAO/connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Connector3/Connector3.mpc b/CIAO/connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Connector3/Connector3.mpc new file mode 100644 index 00000000000..394c759f680 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/Connector3/Connector3.mpc @@ -0,0 +1,142 @@ +// $Id$ + +project(SharedDP_Diff_ID_Connector3_idl_gen) : connectoridldefaults, dds4ccm { + after += DDS4CCM_idl_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=SHAREDDP_CONNECTOR3_STUB_Export \ + -Wb,stub_export_include=Connector3_stub_export.h \ + -Wb,skel_export_macro=SHAREDDP_CONNECTOR3_SVNT_Export \ + -Wb,skel_export_include=Connector3_svnt_export.h \ + -Wb,svnt_export_macro=SHAREDDP_CONNECTOR3_SVNT_Export \ + -Wb,svnt_export_include=Connector3_svnt_export.h \ + -Wb,conn_export_macro=SHAREDDP_CONNECTOR3_CONN_Export \ + -Wb,conn_export_include=Connector3_conn_export.h \ + -I .. + + IDL_Files { + Connector3.idl + } +} + +project(SharedDP_Diff_ID_Connector3_lem_gen) : ciaoidldefaults, dds4ccm { + custom_only = 1 + after += SharedDP_Diff_ID_Connector3_idl_gen + idlflags += -Wb,stub_export_macro=SHAREDDP_CONNECTOR3_LEM_STUB_Export \ + -Wb,stub_export_include=Connector3_lem_stub_export.h \ + -SS -Gxhst \ + -I .. + + IDL_Files { + Connector3E.idl + } +} + +project(SharedDP_Diff_ID_Connector3_lem_stub) : ccm_svnt, dds4ccm_lem_stub { + after += SharedDP_Diff_ID_Connector3_lem_gen SharedDP_Diff_ID_Connector3_stub SharedDP_Diff_ID_Base_stub + libs += SharedDP_Diff_ID_Base_stub DDS_Connector3_stub + libpaths += ../lib + libout = ../lib + includes += .. + sharedname = DDS_Connector3_lem_stub + dynamicflags += SHAREDDP_CONNECTOR3_LEM_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + Connector3EC.cpp + } + + Header_Files { + Connector3EC.h + Connector3_lem_stub_export.h + } + + Inline_Files { + Connector3EC.inl + } +} + +project(SharedDP_Diff_ID_Connector3_stub) : ccm_stub, dds4ccm_base { + after += SharedDP_Diff_ID_Connector3_idl_gen SharedDP_Diff_ID_Base_stub + libs += SharedDP_Diff_ID_Base_stub + libpaths += ../lib + libout = ../lib + includes += .. + sharedname = DDS_Connector3_stub + dynamicflags += SHAREDDP_CONNECTOR3_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + Connector3C.cpp + } + + Header_Files { + Connector3C.h + Connector3_stub_export.h + } + + Inline_Files { + Connector3C.inl + } +} + +project(SharedDP_Diff_ID_Connector3_exec) : ciao_executor, dds4ccm_impl { + after += SharedDP_Diff_ID_Connector3_lem_stub SharedDP_Diff_ID_Connector3_stub SharedDP_Diff_ID_Base_stub + sharedname = DDS_Connector3_exec + libs += DDS_Connector3_stub DDS_Connector3_lem_stub SharedDP_Diff_ID_Base_stub SharedDP_Diff_ID_Base_stub + libpaths += ../lib + libout = ../lib + includes += .. + dynamicflags += SHAREDDP_CONNECTOR3_CONN_BUILD_DLL + + IDL_Files { + } + + Source_Files { + Connector3_conn.cpp + } + + Header_Files { + Connector3_conn.h + Connector3_conn_export.h + } + + Inline_Files { + } +} + + +project(SharedDP_Diff_ID_Connector3_svnt) : ciao_servant, dds4ccm_impl { + after += SharedDP_Diff_ID_Connector3_lem_stub SharedDP_Diff_ID_Connector3_exec SharedDP_Diff_ID_Connector3_stub + sharedname = DDS_Connector3_svnt + libs += DDS_Connector3_stub \ + DDS_Connector3_lem_stub \ + SharedDP_Diff_ID_Base_stub \ + DDS_Connector3_exec + libpaths += ../lib + libout = ../lib + includes += .. + dynamicflags += SHAREDDP_CONNECTOR3_SVNT_BUILD_DLL + + IDL_Files { + } + + Source_Files { + Connector3S.cpp + Connector3_svnt.cpp + } + + Header_Files { + Connector3S.h + Connector3_svnt.h + Connector3_svnt_export.h + } + + Inline_Files { + } +} + + diff --git a/CIAO/connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/descriptors/Plan.cdp b/CIAO/connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/descriptors/Plan.cdp new file mode 100644 index 00000000000..2e1309494a2 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/descriptors/Plan.cdp @@ -0,0 +1,478 @@ + + + + SharedDPTest_Depl_1 + + + Connector1Implementation + + + + + component factory + + + tk_string + + + create_SharedDP_Connector1_SharedDPTest1Connector_DDS_Event_Impl + + + + + edu.vanderbilt.dre.CIAO.ServantEntrypoint + + + tk_string + + + create_SharedDP_Connector1_SharedDPTest1Connector_DDS_Event_Servant + + + + + edu.vanderbilt.dre.CIAO.ServantArtifact + + + tk_string + + + DDS_Connector1_svnt + + + + + edu.vanderbilt.dre.CIAO.ExecutorArtifact + + + tk_string + + + DDS_Connector1_exec + + + + + + + Connector2Implementation + + + + + component factory + + + tk_string + + + create_SharedDP_Connector2_SharedDPTest2Connector_DDS_Event_Impl + + + + + edu.vanderbilt.dre.CIAO.ServantEntrypoint + + + tk_string + + + create_SharedDP_Connector2_SharedDPTest2Connector_DDS_Event_Servant + + + + + edu.vanderbilt.dre.CIAO.ServantArtifact + + + tk_string + + + DDS_Connector2_svnt + + + + + edu.vanderbilt.dre.CIAO.ExecutorArtifact + + + tk_string + + + DDS_Connector2_exec + + + + + + + Connector3Implementation + + + + + component factory + + + tk_string + + + create_SharedDP_Connector3_SharedDPTest3Connector_DDS_Event_Impl + + + + + edu.vanderbilt.dre.CIAO.ServantEntrypoint + + + tk_string + + + create_SharedDP_Connector3_SharedDPTest3Connector_DDS_Event_Servant + + + + + edu.vanderbilt.dre.CIAO.ServantArtifact + + + tk_string + + + DDS_Connector3_svnt + + + + + edu.vanderbilt.dre.CIAO.ExecutorArtifact + + + tk_string + + + DDS_Connector3_exec + + + + + + + ComponentImplementation + + + + + + component factory + + + tk_string + + + create_Component_Impl + + + + + edu.vanderbilt.dre.CIAO.ServantEntrypoint + + + tk_string + + + create_SharedDP_SharedDPComponent_Servant + + + + + edu.vanderbilt.dre.CIAO.ServantArtifact + + + tk_string + + + Component_svnt + + + + + edu.vanderbilt.dre.CIAO.ExecutorArtifact + + + tk_string + + + Component_exec + + + + + + + Connector1Instance + ComponentNode + + + + domain_id + + + tk_long + + + 97 + + + + + topic_name + + + tk_string + + + SharedDP + + + + + qos_profile + + + tk_string + + + Shared_Library#Shared_Profile + + + + + + + Connector2Instance + ComponentNode + + + + domain_id + + + tk_long + + + 98 + + + + + topic_name + + + tk_string + + + SharedDP2 + + + + + qos_profile + + + tk_string + + + Shared_Library#Shared_Profile + + + + + + + Connector3Instance + ComponentNode + + + + domain_id + + + tk_long + + + 99 + + + + + topic_name + + + tk_string + + + SharedDP + + + + + qos_profile + + + tk_string + + + Shared_Library#Shared_Profile + + + + + + + Component + ComponentNode + + + + + + writer_connection1 + + edu.dre.vanderbilt.DAnCE.ConnectionType + Local_Interface + + + write1_dds_entity + false + SimplexReceptacle + + + + supplier_dds_entity + true + Facet + + + + + + writer_connection2 + + edu.dre.vanderbilt.DAnCE.ConnectionType + Local_Interface + + + write2_dds_entity + false + SimplexReceptacle + + + + supplier_dds_entity + true + Facet + + + + + + writer_connection3 + + edu.dre.vanderbilt.DAnCE.ConnectionType + Local_Interface + + + write3_dds_entity + false + SimplexReceptacle + + + + supplier_dds_entity + true + Facet + + + + + + Component_exec + + + Component_exec + + + Component_svnt + + + Component_svnt + + + Component_stub + + + Component_stub + + + + DDS_Connector1_exec + + + DDS_Connector1_exec + + + DDS_Connector1_svnt + + + DDS_Connector1_svnt + + + DDS_Connector1_stub + + + DDS_Connector1_stub + + + + DDS_Connector2_exec + + + DDS_Connector2_exec + + + DDS_Connector2_svnt + + + DDS_Connector2_svnt + + + DDS_Connector2_stub + + + DDS_Connector2_stub + + + + DDS_Connector3_exec + + + DDS_Connector3_exec + + + DDS_Connector3_svnt + + + DDS_Connector3_svnt + + + DDS_Connector3_stub + + + DDS_Connector3_stub + + + diff --git a/CIAO/connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/descriptors/USER_QOS_PROFILES.xml b/CIAO/connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/descriptors/USER_QOS_PROFILES.xml new file mode 100644 index 00000000000..90aaf3e5ce4 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/descriptors/USER_QOS_PROFILES.xml @@ -0,0 +1,80 @@ + + + + + + + + + + RELIABLE_RELIABILITY_QOS + + 10 + 0 + + + + TRANSIENT_DURABILITY_QOS + + + KEEP_LAST_HISTORY_QOS + 20 + + + + 10 + + + + + + RELIABLE_RELIABILITY_QOS + + + KEEP_LAST_HISTORY_QOS + 20 + + + TRANSIENT_LOCAL_DURABILITY_QOS + + + + + + + + + RELIABLE_RELIABILITY_QOS + + 10 + 0 + + + + TRANSIENT_DURABILITY_QOS + + + KEEP_LAST_HISTORY_QOS + 20 + + + + 10 + + + + + + RELIABLE_RELIABILITY_QOS + + + KEEP_LAST_HISTORY_QOS + 20 + + + TRANSIENT_LOCAL_DURABILITY_QOS + + + + + \ No newline at end of file diff --git a/CIAO/connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/descriptors/run_test.pl b/CIAO/connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/descriptors/run_test.pl new file mode 100755 index 00000000000..fa41f4d76ff --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/SharedDomainParticipant/DifferentDomainID/descriptors/run_test.pl @@ -0,0 +1,242 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +BEGIN { + undef $ENV{'DDS4CCM_DEFAULT_DOMAIN_ID'}; +} + +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 = ( "NodeApp1.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 1 seconds to allow task to complete\n"; +sleep (1); + +# 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 -s\n"; + +$E = $tg_executor->CreateProcess ("$DANCE_ROOT/bin/dance_plan_launcher", + "-k file://$ior_emfile -x $cdp_file -s"); +$E->SpawnWaitKill (2 * $tg_executor->ProcessStartWaitInterval ()); + +print "Executor returned.\n"; +print "Shutting down rest of the processes.\n"; + +delete_ior_files (); +kill_open_processes (); + +exit $status; -- cgit v1.2.1