diff options
Diffstat (limited to 'modules/CIAO/connectors/dds4ccm/tests/SLOneByOne')
14 files changed, 1984 insertions, 0 deletions
diff --git a/modules/CIAO/connectors/dds4ccm/tests/SLOneByOne/Base/SL_OneByOne_Base.idl b/modules/CIAO/connectors/dds4ccm/tests/SLOneByOne/Base/SL_OneByOne_Base.idl new file mode 100644 index 00000000000..eae516f7136 --- /dev/null +++ b/modules/CIAO/connectors/dds4ccm/tests/SLOneByOne/Base/SL_OneByOne_Base.idl @@ -0,0 +1,23 @@ +// $Id$ + +/** + * @file SL_OneByOne_Base.idl + * @author Marijke Hengstmengel <mhengstmengel@remedy.nl> + */ + +#ifndef SL_ONEBYONE_BASE_IDL +#define SL_ONEBYONE_BASE_IDL + +#pragma ndds typesupport "Base/SL_OneByOne_BaseSupport.h" + +#pragma DCPS_DATA_TYPE "TestTopic" +#pragma DCPS_DATA_KEY "TestTopic key" + +struct TestTopic { + string key; //@key + long x; +}; + +typedef sequence<TestTopic> TestTopicSeq; + +#endif diff --git a/modules/CIAO/connectors/dds4ccm/tests/SLOneByOne/Base/SL_OneByOne_Base.mpc b/modules/CIAO/connectors/dds4ccm/tests/SLOneByOne/Base/SL_OneByOne_Base.mpc new file mode 100644 index 00000000000..96f81db664a --- /dev/null +++ b/modules/CIAO/connectors/dds4ccm/tests/SLOneByOne/Base/SL_OneByOne_Base.mpc @@ -0,0 +1,26 @@ +// $Id$ + +project (DDS_SL_OneByOne_Base_stub) : taoidldefaults, anytypecode, dds4ccm_ts_default { + sharedname = DDS_SL_OneByOne_Base_stub + dynamicflags += SL_ONEBYONE_BASE_STUB_BUILD_DLL + libout = ../lib + + idlflags += -SS -Sci \ + -Wb,stub_export_macro=SL_ONEBYONE_BASE_STUB_Export \ + -Wb,stub_export_include=SL_OneByOne_Base_stub_export.h + + IDL_Files { + idlflags += -Gxhst + SL_OneByOne_Base.idl + } + + opendds_ts_flags += --export=SL_ONEBYONE_BASE_STUB_Export + + DDSGenerator_Files { + SL_OneByOne_Base.idl + } + + Source_Files { + } +} + diff --git a/modules/CIAO/connectors/dds4ccm/tests/SLOneByOne/Connector/SLOneByOne_Connector.mpc b/modules/CIAO/connectors/dds4ccm/tests/SLOneByOne/Connector/SLOneByOne_Connector.mpc new file mode 100644 index 00000000000..381ffe38c3e --- /dev/null +++ b/modules/CIAO/connectors/dds4ccm/tests/SLOneByOne/Connector/SLOneByOne_Connector.mpc @@ -0,0 +1,145 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -p DDS_SL_OneByOne_Base -l .. -o ../lib -u DDS SL_OneByOne_Connector" + +project(DDS_SL_OBO_Connector_idl_gen) : connectoridldefaults, dds4ccm { + after += DDS4CCM_idl_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=SL_ONEBYONE_CONNECTOR_STUB_Export \ + -Wb,stub_export_include=SL_OneByOne_Connector_stub_export.h \ + -Wb,skel_export_macro=SL_ONEBYONE_CONNECTOR_SVNT_Export \ + -Wb,skel_export_include=SL_OneByOne_Connector_svnt_export.h \ + -Wb,svnt_export_macro=SL_ONEBYONE_CONNECTOR_SVNT_Export \ + -Wb,svnt_export_include=SL_OneByOne_Connector_svnt_export.h \ + -Wb,conn_export_macro=SL_ONEBYONE_CONNECTOR_CONN_Export \ + -Wb,conn_export_include=SL_OneByOne_Connector_conn_export.h \ + -I .. + + IDL_Files { + SL_OneByOne_Connector.idl + } +} + +project(DDS_SL_OBO_Connector_lem_gen) : ciaoidldefaults, dds4ccm { + custom_only = 1 + after += DDS_SL_OBO_Connector_idl_gen + idlflags += -Wb,stub_export_macro=SL_ONEBYONE_CONNECTOR_LEM_STUB_Export \ + -Wb,stub_export_include=SL_OneByOne_Connector_lem_stub_export.h \ + -SS -Gxhst \ + -I .. + + IDL_Files { + SL_OneByOne_ConnectorE.idl + } +} + +project(DDS_SL_OBO_Connector_lem_stub) : ccm_svnt, dds4ccm_base { + after += DDS_SL_OBO_Connector_lem_gen DDS_SL_OneByOne_Connector_stub DDS_SL_OneByOne_Base_stub DDS4CCM_lem_stub + libs += DDS_SL_OneByOne_Base_stub DDS_SL_OneByOne_Connector_stub DDS4CCM_lem_stub + libpaths += ../lib + libout = ../lib + includes += .. + sharedname = DDS_SL_OBO_Connector_lem_stub + dynamicflags = SL_ONEBYONE_CONNECTOR_LEM_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + SL_OneByOne_ConnectorEC.cpp + } + + Header_Files { + SL_OneByOne_ConnectorEC.h + SL_OneByOne_Connector_lem_stub_export.h + } + + Inline_Files { + SL_OneByOne_ConnectorEC.inl + } +} + +project(DDS_SL_OneByOne_Connector_stub) : ccm_stub, dds4ccm_base { + after += DDS_SL_OBO_Connector_idl_gen DDS_SL_OneByOne_Base_stub + libs += DDS_SL_OneByOne_Base_stub + libpaths += ../lib + libout = ../lib + includes += .. + sharedname = DDS_SL_OneByOne_Connector_stub + dynamicflags = SL_ONEBYONE_CONNECTOR_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + SL_OneByOne_ConnectorC.cpp + } + + Header_Files { + SL_OneByOne_ConnectorC.h + SL_OneByOne_Connector_stub_export.h + } + + Inline_Files { + SL_OneByOne_ConnectorC.inl + } +} + +project(DDS_SL_OneByOne_Connector_exec) : ciao_executor, dds4ccm_impl { + after += DDS_SL_OBO_Connector_lem_stub DDS_SL_OneByOne_Connector_stub DDS4CCM_lem_stub DDS_SL_OneByOne_Base_stub + sharedname = DDS_SL_OneByOne_Connector_exec + libs += DDS_SL_OneByOne_Connector_stub DDS_SL_OBO_Connector_lem_stub DDS_SL_OneByOne_Base_stub DDS4CCM_lem_stub DDS_SL_OneByOne_Base_stub + libpaths += ../lib + libout = ../lib + includes += .. + dynamicflags = SL_ONEBYONE_CONNECTOR_CONN_BUILD_DLL + + IDL_Files { + } + + Source_Files { + SL_OneByOne_Connector_conn.cpp + } + + Header_Files { + SL_OneByOne_Connector_conn.h + SL_OneByOne_Connector_conn_export.h + } + + Inline_Files { + } +} + + +project(DDS_SL_OneByOne_Connector_svnt) : ciao_servant, dds4ccm_impl { + after += DDS_SL_OBO_Connector_lem_stub DDS_SL_OneByOne_Connector_exec DDS_SL_OneByOne_Connector_stub DDS4CCM_lem_stub + sharedname = DDS_SL_OneByOne_Connector_svnt + libs += DDS_SL_OneByOne_Connector_stub \ + DDS_SL_OBO_Connector_lem_stub \ + DDS_SL_OneByOne_Base_stub \ + DDS_SL_OneByOne_Connector_exec \ + DDS4CCM_lem_stub + libpaths += ../lib + libout = ../lib + includes += .. + dynamicflags = SL_ONEBYONE_CONNECTOR_SVNT_BUILD_DLL + + IDL_Files { + } + + Source_Files { + SL_OneByOne_ConnectorS.cpp + SL_OneByOne_Connector_svnt.cpp + } + + Header_Files { + SL_OneByOne_ConnectorS.h + SL_OneByOne_Connector_svnt.h + SL_OneByOne_Connector_svnt_export.h + } + + Inline_Files { + SL_OneByOne_ConnectorS.inl + } +} + + diff --git a/modules/CIAO/connectors/dds4ccm/tests/SLOneByOne/Connector/SL_OneByOne_Connector.idl b/modules/CIAO/connectors/dds4ccm/tests/SLOneByOne/Connector/SL_OneByOne_Connector.idl new file mode 100644 index 00000000000..d522a746ef6 --- /dev/null +++ b/modules/CIAO/connectors/dds4ccm/tests/SLOneByOne/Connector/SL_OneByOne_Connector.idl @@ -0,0 +1,29 @@ +// $Id$ + +/** + * @file SL_OneByOne_Connector.idl + * @author Marijke Hengstmengel <mhengstmengel@remedy.nl> + */ + +#ifndef SL_ONEBYONE_CONNECTOR_IDL_ +#define SL_ONEBYONE_CONNECTOR_IDL_ + +#include <Components.idl> +#include "Base/SL_OneByOne_Base.idl" +#include "connectors/dds4ccm/idl/ccm_dds.idl" + +#pragma ciao lem "Connector/SL_OneByOne_ConnectorE.idl" + +module CCM_DDS +{ + module ::CCM_DDS::Typed < ::TestTopic, ::TestTopicSeq> TestTopic; +}; + +module SL_OneByOne +{ + connector SL_OneByOne_Connector : ::CCM_DDS::TestTopic::DDS_State + { + }; +}; + +#endif /* SL_OneByOne_CONNECTOR_IDL_ */ diff --git a/modules/CIAO/connectors/dds4ccm/tests/SLOneByOne/Receiver/SL_OneByOne_Receiver.idl b/modules/CIAO/connectors/dds4ccm/tests/SLOneByOne/Receiver/SL_OneByOne_Receiver.idl new file mode 100644 index 00000000000..88f9e6bec6a --- /dev/null +++ b/modules/CIAO/connectors/dds4ccm/tests/SLOneByOne/Receiver/SL_OneByOne_Receiver.idl @@ -0,0 +1,21 @@ +// $Id$ + +/** + * @file + * @author Marijke Hengstmengel <mhengstmengel@remedy.nl> + */ + +#ifndef RECEIVER_IDL +#define RECEIVER_IDL + +#include "Connector/SL_OneByOne_Connector.idl" + +module SL_OneByOne +{ + component Receiver + { + port CCM_DDS::TestTopic::DDS_StateListen info_out; + }; +}; + +#endif diff --git a/modules/CIAO/connectors/dds4ccm/tests/SLOneByOne/Receiver/SL_OneByOne_Receiver.mpc b/modules/CIAO/connectors/dds4ccm/tests/SLOneByOne/Receiver/SL_OneByOne_Receiver.mpc new file mode 100644 index 00000000000..4ff2ea80094 --- /dev/null +++ b/modules/CIAO/connectors/dds4ccm/tests/SLOneByOne/Receiver/SL_OneByOne_Receiver.mpc @@ -0,0 +1,138 @@ +// $Id$ + +project(DDS_SL_OneByOne_Receiver_idl_gen) : componentidldefaults, dds4ccm { + custom_only = 1 + after += DDS_SL_OBO_Connector_idl_gen + idlflags += -Wb,stub_export_macro=RECEIVER_STUB_Export \ + -Wb,stub_export_include=Receiver_stub_export.h \ + -Wb,skel_export_macro=RECEIVER_SVNT_Export \ + -Wb,skel_export_include=Receiver_svnt_export.h \ + -Wb,svnt_export_macro=RECEIVER_SVNT_Export \ + -Wb,svnt_export_include=Receiver_svnt_export.h \ + -Wb,exec_export_macro=RECEIVER_EXEC_Export \ + -Wb,exec_export_include=Receiver_exec_export.h -I.. + + IDL_Files { + SL_OneByOne_Receiver.idl + } +} + +project(DDS_SL_OneByOne_Receiver_lem_gen) : ciaoidldefaults, dds4ccm { + after += DDS_SL_OneByOne_Receiver_idl_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=RECEIVER_LEM_STUB_Export \ + -Wb,stub_export_include=Receiver_lem_stub_export.h \ + -SS -Gxhst -I.. + + IDL_Files { + SL_OneByOne_ReceiverE.idl + } +} + +project(DDS_SL_OBO_Receiver_lem_stub) : ccm_svnt, dds4ccm_base { + after += DDS_SL_OneByOne_Receiver_lem_gen DDS_SL_OneByOne_Receiver_stub DDS_SL_OneByOne_Connector_stub DDS_SL_OneByOne_Base_stub + libs += Receiver_stub DDS_SL_OneByOne_Connector_stub DDS_SL_OneByOne_Base_stub + libpaths += ../lib + libout = ../lib + includes += .. + sharedname = Receiver_lem_stub + dynamicflags = RECEIVER_LEM_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + SL_OneByOne_ReceiverEC.cpp + } + + Header_Files { + SL_OneByOne_ReceiverEC.h + Receiver_lem_stub_export.h + } + + Inline_Files { + SL_OneByOne_ReceiverEC.inl + } +} + +project(DDS_SL_OneByOne_Receiver_stub) : ccm_stub, dds4ccm_base { + after += DDS_SL_OneByOne_Receiver_idl_gen DDS_SL_OneByOne_Connector_stub DDS_SL_OneByOne_Base_stub DDS_SL_OBO_Connector_lem_gen + libs += DDS_SL_OneByOne_Connector_stub DDS_SL_OneByOne_Base_stub + libpaths += ../lib + libout = ../lib + includes += .. + sharedname = Receiver_stub + dynamicflags = RECEIVER_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + SL_OneByOne_ReceiverC.cpp + } + + Header_Files { + SL_OneByOne_ReceiverC.h + Receiver_stub_export.h + } + + Inline_Files { + SL_OneByOne_ReceiverC.inl + } +} + +project(DDS_SL_OneByOne_Receiver_exec) : ciao_executor, dds4ccm_base { + after += DDS_SL_OBO_Receiver_lem_stub DDS_SL_OneByOne_Receiver_stub DDS_SL_OneByOne_Base_stub DDS_SL_OneByOne_Connector_stub DDS_SL_OBO_Connector_lem_stub DDS4CCM_lem_stub + sharedname = Receiver_exec + libs += Receiver_stub Receiver_lem_stub DDS_SL_OneByOne_Base_stub DDS_SL_OneByOne_Connector_stub DDS_SL_OBO_Connector_lem_stub DDS4CCM_lem_stub + libpaths += ../lib + libout = ../lib + includes += .. + dynamicflags = RECEIVER_EXEC_BUILD_DLL + + IDL_Files { + } + + Source_Files { + SL_OneByOne_Receiver_exec.cpp + } + + Header_Files { + SL_OneByOne_Receiver_exec.h + Receiver_exec_export.h + } + + Inline_Files { + } +} + + +project(DDS_SL_OneByOne_Receiver_svnt) : ciao_servant, dds4ccm_base { + after += DDS_SL_OBO_Receiver_lem_stub DDS_SL_OneByOne_Base_stub DDS_SL_OneByOne_Connector_stub DDS_SL_OneByOne_Connector_svnt DDS_SL_OneByOne_Receiver_exec DDS_SL_OBO_Connector_lem_stub DDS4CCM_lem_stub DDS4CCM_skel + sharedname = Receiver_svnt + libs += Receiver_stub Receiver_lem_stub DDS_SL_OneByOne_Base_stub DDS_SL_OneByOne_Connector_stub DDS_SL_OneByOne_Connector_svnt Receiver_exec DDS_SL_OBO_Connector_lem_stub DDS4CCM_lem_stub DDS4CCM_skel + libpaths += ../lib + libout = ../lib + includes += .. + dynamicflags = RECEIVER_SVNT_BUILD_DLL + + IDL_Files { + } + + Source_Files { + SL_OneByOne_ReceiverS.cpp + SL_OneByOne_Receiver_svnt.cpp + } + + Header_Files { + SL_OneByOne_ReceiverS.h + SL_OneByOne_Receiver_svnt.h + Receiver_svnt_export.h + } + + Inline_Files { + SL_OneByOne_ReceiverS.inl + } +} + + diff --git a/modules/CIAO/connectors/dds4ccm/tests/SLOneByOne/Receiver/SL_OneByOne_Receiver_exec.cpp b/modules/CIAO/connectors/dds4ccm/tests/SLOneByOne/Receiver/SL_OneByOne_Receiver_exec.cpp new file mode 100644 index 00000000000..25fc7a95945 --- /dev/null +++ b/modules/CIAO/connectors/dds4ccm/tests/SLOneByOne/Receiver/SL_OneByOne_Receiver_exec.cpp @@ -0,0 +1,278 @@ +// -*- C++ -*- +// +// $Id$ + +// Test for statelistener: ONE_BY_ONE. Expect the operations on_creation, on_deletion, on_one_update + +#include "SL_OneByOne_Receiver_exec.h" +#include "ace/Log_Msg.h" +#include "tao/ORB_Core.h" +#include "ace/OS_NS_time.h" +#include "dds4ccm/impl/dds/Utils.h" +#include "dds4ccm/impl/dds/TimeUtilities.h" + +#include "dds4ccm/impl/dds4ccm_conf.h" + +namespace CIAO_SL_OneByOne_Receiver_Impl +{ + //============================================================ + // StateListener_exec_i + //============================================================ + StateListener_exec_i::StateListener_exec_i (Atomic_Boolean &on_many_updates, + Atomic_Boolean &on_creation, + Atomic_Boolean &on_one_update, + Atomic_Boolean &on_deletion, + Atomic_ThreadId &thread_id) + : on_many_updates_ (on_many_updates), + on_creation_ (on_creation), + on_one_update_ (on_one_update), + on_deletion_ (on_deletion), + thread_id_ (thread_id) + { + } + + StateListener_exec_i::~StateListener_exec_i (void) + { + } + + // Operations from ::CCM_DDS::StateListener + void + StateListener_exec_i::on_creation (const ::TestTopic & datum, + const ::CCM_DDS::ReadInfo & info) + { + this->thread_id_ = ACE_Thread::self (); + if (!datum.key.in() == 0 && info.instance_status == CCM_DDS::INSTANCE_CREATED) + { + this->on_creation_ = true; + } + ACE_DEBUG ((LM_DEBUG, "StateListener_exec_i::on_creation - " + "Received sample: key <%C> - iteration <%d>\n", + datum.key.in (), + datum.x)); + } + + void + StateListener_exec_i::on_one_update (const ::TestTopic & datum, + const ::CCM_DDS::ReadInfo & info) + { + if (info.instance_status != CCM_DDS::INSTANCE_UPDATED) + { + ACE_ERROR ((LM_ERROR, ACE_TEXT ("ERROR: did not receive the expected info.status ") + ACE_TEXT ("'CCM_DDS::INSTANCE_UPDATED'") + ACE_TEXT (" with operation 'on_one_update' from StateListener in Receiver\n") + )); + + } + + ACE_DEBUG ((LM_DEBUG, "StateListener_exec_i::on_one_update - " + "Received sample: key <%C> - iteration <%d>\n", + datum.key.in (), + datum.x)); + + if (!datum.key.in() == 0 && info.instance_status == CCM_DDS::INSTANCE_UPDATED) + { + this->on_one_update_ = true; + } + } + + void + StateListener_exec_i::on_many_updates (const ::TestTopicSeq & /*data*/, + const ::CCM_DDS::ReadInfoSeq & /*infos*/) + { + this->on_many_updates_ = true; + } + + void + StateListener_exec_i::on_deletion (const ::TestTopic & datum, + const ::CCM_DDS::ReadInfo & info) + { + if (info.instance_status != CCM_DDS::INSTANCE_DELETED) + { + ACE_ERROR ((LM_ERROR, ACE_TEXT ("ERROR: did not receive the expected info.status ") + ACE_TEXT ("'CCM_DDS::INSTANCE_DELETED' ") + ACE_TEXT ("with operation 'on_deletion' from StateListener in Receiver\n") + )); + + } + if (!datum.key.in() == 0 && info.instance_status == CCM_DDS::INSTANCE_DELETED) + { + this->on_deletion_ = true; + } + ACE_DEBUG ((LM_DEBUG, "StateListener_exec_i::on_deletion - " + "Received sample: key <%C> - iteration <%d>\n", + datum.key.in (), + datum.x)); + } + + //============================================================ + // Receiver_exec_i + //============================================================ + Receiver_exec_i::Receiver_exec_i (void) + : on_many_updates_ (false), + updater_data_ (false), + on_creation_ (false), + on_one_update_ (false), + on_deletion_ (false), + thread_id_listener_ (0) + { + } + + Receiver_exec_i::~Receiver_exec_i (void) + { + } + + // Component attributes. + // Port operations. + ::CCM_DDS::CCM_PortStatusListener_ptr + Receiver_exec_i::get_info_out_status (void) + { + return ::CCM_DDS::CCM_PortStatusListener::_nil (); + } + + ::CCM_DDS::TestTopic::CCM_StateListener_ptr + Receiver_exec_i::get_info_out_data_listener (void) + { + return new StateListener_exec_i (this->on_many_updates_, + this->on_creation_, + this->on_one_update_, + this->on_deletion_, + this->thread_id_listener_); + } + + // Operations from Components::SessionComponent. + void + Receiver_exec_i::set_session_context ( + ::Components::SessionContext_ptr ctx) + { + this->context_ = + ::SL_OneByOne::CCM_Receiver_Context::_narrow (ctx); + if ( ::CORBA::is_nil (this->context_.in ())) + { + throw ::CORBA::INTERNAL (); + } + } + + void + Receiver_exec_i::configuration_complete (void) + { + } + + void + Receiver_exec_i::ccm_activate (void) + { + ::CCM_DDS::StateListenerControl_var lc = + this->context_->get_connection_info_out_data_control (); + + if (::CORBA::is_nil (lc.in ())) + { + ACE_ERROR ((LM_ERROR, ACE_TEXT ("Error: Listener control receptacle is null!\n"))); + throw CORBA::INTERNAL (); + } + lc->mode (::CCM_DDS::ONE_BY_ONE); + } + + void + Receiver_exec_i::ccm_passivate (void) + { + } + + void + Receiver_exec_i::ccm_remove (void) + { + CORBA::Boolean no_error = true; + if (this->on_many_updates_.value ()) + { + no_error = false; + ACE_ERROR ((LM_ERROR, ACE_TEXT ("ERROR: Received unexpected ") + ACE_TEXT ("operation 'on_many_updates' from StateListener in Receiver\n") + )); + } + + if (!this->on_creation_.value ()) + { + no_error = false; + ACE_ERROR ((LM_ERROR, ACE_TEXT ("ERROR: didn't receive the expected ") + ACE_TEXT (" operation 'on_creation' from StateListener in Receiver\n") + )); + } + if (!this->on_one_update_.value ()) + { + no_error = false; + ACE_ERROR ((LM_ERROR, ACE_TEXT ("ERROR: didn't receive the expected ") + ACE_TEXT (" operation 'on_one_update' from StateListener in Receiver\n") + )); + } + if (!this->on_deletion_.value ()) + { + no_error = false; + ACE_ERROR ((LM_ERROR, ACE_TEXT ("ERROR: didn't receive the expected ") + ACE_TEXT (" operation 'on_deletion' from StateListener in Receiver\n") + )); + } + + if (no_error) + { + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("OK: Have received the expected ") + ACE_TEXT (" operations for ONE_BY_ONE from StateListener in Receiver\n") + )); + } + + if (this->thread_id_listener_.value () == 0) + { + ACE_ERROR ((LM_ERROR, "ERROR: " + "Thread ID for StatusListener not set!\n")); + } + #if (CIAO_DDS4CCM_CONTEXT_SWITCH == 1) + else if (ACE_OS::thr_equal (this->thread_id_listener_.value (), + ACE_Thread::self ())) + { + ACE_DEBUG ((LM_DEBUG, "OK: " + "Thread switch for StatusListener seems OK. " + "(DDS uses the CCM thread for its callback) " + "listener <%u> - component <%u>\n", + this->thread_id_listener_.value (), + ACE_Thread::self ())); + } + else + { + ACE_ERROR ((LM_ERROR, "ERROR: " + "Thread switch for StatusListener " + "doesn't seem to work! " + "listener <%u> - component <%u>\n", + this->thread_id_listener_.value (), + ACE_Thread::self ())); + } + #else + else if (ACE_OS::thr_equal (this->thread_id_listener_.value (), + ACE_Thread::self ())) + { + ACE_ERROR ((LM_ERROR, "ERROR: StatusListener: " + "DDS seems to use a CCM thread for its callback: " + "listener <%u> - component <%u>\n", + this->thread_id_listener_.value (), + ACE_Thread::self ())); + } + else + { + ACE_DEBUG ((LM_DEBUG, "OK: StatusListener: " + "DDS seems to use its own thread for its callback: " + "listener <%u> - component <%u>\n", + this->thread_id_listener_.value (), + ACE_Thread::self ())); + } + #endif + } + + extern "C" RECEIVER_EXEC_Export ::Components::EnterpriseComponent_ptr + create_SL_OneByOne_Receiver_Impl (void) + { + ::Components::EnterpriseComponent_ptr retval = + ::Components::EnterpriseComponent::_nil (); + + ACE_NEW_NORETURN ( + retval, + Receiver_exec_i); + + return retval; + } +} diff --git a/modules/CIAO/connectors/dds4ccm/tests/SLOneByOne/Receiver/SL_OneByOne_Receiver_exec.h b/modules/CIAO/connectors/dds4ccm/tests/SLOneByOne/Receiver/SL_OneByOne_Receiver_exec.h new file mode 100644 index 00000000000..4eb7a3d13d2 --- /dev/null +++ b/modules/CIAO/connectors/dds4ccm/tests/SLOneByOne/Receiver/SL_OneByOne_Receiver_exec.h @@ -0,0 +1,108 @@ +// -*- C++ -*- +// $Id$ + +#ifndef CIAO_RECEIVER_EXEC_H_ +#define CIAO_RECEIVER_EXEC_H_ + +#include "SL_OneByOne_ReceiverEC.h" + +#include /**/ "Receiver_exec_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/LocalObject.h" +#include "ace/OS_NS_Thread.h" +#include "ace/Reactor.h" +#include "ace/Task.h" + +namespace CIAO_SL_OneByOne_Receiver_Impl +{ + typedef ACE_Atomic_Op <TAO_SYNCH_MUTEX, CORBA::Boolean> Atomic_Boolean; + typedef ACE_Atomic_Op <TAO_SYNCH_MUTEX, ACE_thread_t> Atomic_ThreadId; + + class Receiver_exec_i; + + //============================================================ + // StateListener_exec_i + //============================================================ + class RECEIVER_EXEC_Export StateListener_exec_i + : public virtual ::CCM_DDS::TestTopic::CCM_StateListener, + public virtual ::CORBA::LocalObject + { + public: + StateListener_exec_i (Atomic_Boolean &, + Atomic_Boolean &, + Atomic_Boolean &, + Atomic_Boolean &, + Atomic_ThreadId &); + virtual ~StateListener_exec_i (void); + + virtual void + on_creation ( + const ::TestTopic & datum, + const ::CCM_DDS::ReadInfo & info); + virtual void + on_one_update ( + const ::TestTopic & datum, + const ::CCM_DDS::ReadInfo & info); + virtual void + on_many_updates ( + const ::TestTopicSeq & data, + const ::CCM_DDS::ReadInfoSeq & infos); + virtual void + on_deletion ( + const ::TestTopic & datum, + const ::CCM_DDS::ReadInfo & info); + private: + Atomic_Boolean &on_many_updates_; + Atomic_Boolean &on_creation_; + Atomic_Boolean &on_one_update_; + Atomic_Boolean &on_deletion_; + Atomic_ThreadId &thread_id_; + }; + + //============================================================ + // Receiver_exec_i + //============================================================ + class RECEIVER_EXEC_Export Receiver_exec_i + : public virtual Receiver_Exec, + public virtual ::CORBA::LocalObject + { + public: + Receiver_exec_i (void); + virtual ~Receiver_exec_i (void); + + // Port operations. + virtual ::CCM_DDS::TestTopic::CCM_StateListener_ptr + get_info_out_data_listener (void); + + virtual ::CCM_DDS::CCM_PortStatusListener_ptr + get_info_out_status (void); + + // 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); + + private: + ::SL_OneByOne::CCM_Receiver_Context_var context_; + + Atomic_Boolean on_many_updates_; + Atomic_Boolean updater_data_; + Atomic_Boolean on_creation_; + Atomic_Boolean on_one_update_; + Atomic_Boolean on_deletion_; + Atomic_ThreadId thread_id_listener_; + }; + extern "C" RECEIVER_EXEC_Export ::Components::EnterpriseComponent_ptr + create_SL_OneByOne_Receiver_Impl (void); +} + +#endif /* ifndef */ diff --git a/modules/CIAO/connectors/dds4ccm/tests/SLOneByOne/Sender/SL_OneByOne_Sender.idl b/modules/CIAO/connectors/dds4ccm/tests/SLOneByOne/Sender/SL_OneByOne_Sender.idl new file mode 100644 index 00000000000..3408f28190a --- /dev/null +++ b/modules/CIAO/connectors/dds4ccm/tests/SLOneByOne/Sender/SL_OneByOne_Sender.idl @@ -0,0 +1,23 @@ +// $Id$ + +/** + * @file + * @author Marijke Hengstmengel <mhengstmengel@remedy.nl> + * + * by-hand idl3 translation of sender components. + */ + +#ifndef DDS_SL_ONEBYONE_SENDER_IDL +#define DDS_SL_ONEBYONE_SENDER_IDL + +#include "Connector/SL_OneByOne_Connector.idl" + +module SL_OneByOne +{ + component Sender + { + port CCM_DDS::TestTopic::DDS_Update test_topic_update; + }; +}; + +#endif diff --git a/modules/CIAO/connectors/dds4ccm/tests/SLOneByOne/Sender/SL_OneByOne_Sender.mpc b/modules/CIAO/connectors/dds4ccm/tests/SLOneByOne/Sender/SL_OneByOne_Sender.mpc new file mode 100644 index 00000000000..347d73bca4e --- /dev/null +++ b/modules/CIAO/connectors/dds4ccm/tests/SLOneByOne/Sender/SL_OneByOne_Sender.mpc @@ -0,0 +1,140 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -p DDS_SL_OneByOne_Base -l ../lib -o ../lib -c controller -u DDS Sender" + +project(DDS_SL_OneByOne_Sender_idl_gen) : componentidldefaults, dds4ccm { + after += DDS_SL_OBO_Connector_idl_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=SENDER_STUB_Export \ + -Wb,stub_export_include=Sender_stub_export.h \ + -Wb,skel_export_macro=SENDER_SVNT_Export \ + -Wb,skel_export_include=Sender_svnt_export.h \ + -Wb,svnt_export_macro=SENDER_SVNT_Export \ + -Wb,svnt_export_include=Sender_svnt_export.h \ + -Wb,exec_export_macro=SENDER_EXEC_Export \ + -Wb,exec_export_include=Sender_exec_export.h \ + -I .. + + IDL_Files { + SL_OneByOne_Sender.idl + } +} + +project(DDS_SL_OneByOne_Sender_lem_gen) : ciaoidldefaults, dds4ccm { + after += DDS_SL_OneByOne_Sender_idl_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=SENDER_LEM_STUB_Export \ + -Wb,stub_export_include=Sender_lem_stub_export.h \ + -SS -Gxhst -I $CIAO_ROOT/connectors -I .. + + IDL_Files { + SL_OneByOne_SenderE.idl + } +} + +project(DDS_SL_OneByOne_Sender_lem_stub) : ccm_svnt, dds4ccm_base { + after += DDS_SL_OneByOne_Sender_lem_gen DDS_SL_OneByOne_Sender_stub DDS_SL_OneByOne_Base_stub + libs += DDS_SL_OneByOne_Base_stub Sender_stub + libpaths += ../lib + libout = ../lib + includes += .. + sharedname = Sender_lem_stub + dynamicflags = SENDER_LEM_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + SL_OneByOne_SenderEC.cpp + } + + Header_Files { + SL_OneByOne_SenderEC.h + Sender_lem_stub_export.h + } + + Inline_Files { + SL_OneByOne_SenderEC.inl + } +} + +project(DDS_SL_OneByOne_Sender_stub) : ccm_stub, dds4ccm_base { + after += DDS_SL_OneByOne_Sender_idl_gen DDS_SL_OneByOne_Base_stub DDS_SL_OneByOne_Connector_stub + libs += DDS_SL_OneByOne_Base_stub DDS_SL_OneByOne_Connector_stub + includes += .. + libpaths += ../lib + libout = ../lib + sharedname = Sender_stub + dynamicflags = SENDER_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + SL_OneByOne_SenderC.cpp + } + + Header_Files { + SL_OneByOne_SenderC.h + Sender_stub_export.h + } + + Inline_Files { + SL_OneByOne_SenderC.inl + } +} + +project(DDS_SL_OneByOne_Sender_exec) : ciao_executor, dds4ccm_base { + after += DDS_SL_OneByOne_Sender_lem_stub DDS_SL_OneByOne_Sender_stub DDS_SL_OBO_Connector_lem_stub DDS_SL_OneByOne_Connector_stub DDS4CCM_lem_stub + sharedname = Sender_exec + libs += Sender_stub Sender_lem_stub DDS_SL_OneByOne_Base_stub DDS_SL_OBO_Connector_lem_stub DDS_SL_OneByOne_Connector_stub DDS4CCM_lem_stub + libpaths += ../lib + includes += .. + libout = ../lib + dynamicflags = SENDER_EXEC_BUILD_DLL + + IDL_Files { + } + + Source_Files { + SL_OneByOne_Sender_exec.cpp + } + + Header_Files { + SL_OneByOne_Sender_exec.h + Sender_exec_export.h + } + + Inline_Files { + } +} + + +project(DDS_SL_OneByOne_Sender_svnt) : ciao_servant, dds4ccm_base { + after += DDS_SL_OneByOne_Base_stub DDS_SL_OneByOne_Sender_lem_stub DDS4CCM_lem_stub DDS4CCM_skel DDS_SL_OneByOne_Connector_stub DDS_SL_OneByOne_Connector_svnt DDS_SL_OBO_Connector_lem_stub + sharedname = Sender_svnt + libs += Sender_stub Sender_lem_stub \ + DDS_SL_OneByOne_Base_stub DDS4CCM_lem_stub DDS4CCM_skel DDS_SL_OneByOne_Connector_stub DDS_SL_OneByOne_Connector_svnt DDS_SL_OBO_Connector_lem_stub + libpaths += ../lib + libout = ../lib + includes += .. + dynamicflags = SENDER_SVNT_BUILD_DLL + + IDL_Files { + } + + Source_Files { + SL_OneByOne_SenderS.cpp + SL_OneByOne_Sender_svnt.cpp + } + + Header_Files { + SL_OneByOne_SenderS.h + SL_OneByOne_Sender_svnt.h + Sender_svnt_export.h + } + + Inline_Files { + SL_OneByOne_SenderS.inl + } +} + diff --git a/modules/CIAO/connectors/dds4ccm/tests/SLOneByOne/Sender/SL_OneByOne_Sender_exec.cpp b/modules/CIAO/connectors/dds4ccm/tests/SLOneByOne/Sender/SL_OneByOne_Sender_exec.cpp new file mode 100644 index 00000000000..8885fd86841 --- /dev/null +++ b/modules/CIAO/connectors/dds4ccm/tests/SLOneByOne/Sender/SL_OneByOne_Sender_exec.cpp @@ -0,0 +1,358 @@ +// -*- C++ -*- +// $Id$ + +#include "SL_OneByOne_Sender_exec.h" +#include "ace/Guard_T.h" +#include "ace/Log_Msg.h" +#include "tao/ORB_Core.h" +#include "ace/Reactor.h" + +namespace CIAO_SL_OneByOne_Sender_Impl +{ + //============================================================ + // Pulse generator + //============================================================ + pulse_Generator::pulse_Generator (Sender_exec_i &callback) + : pulse_callback_ (callback) + { + } + + int + pulse_Generator::handle_timeout (const ACE_Time_Value &, const void *) + { + // Notify the subscribers + this->pulse_callback_.tick (); + return 0; + } + //============================================================ + // Component Executor Implementation Class: Sender_exec_i + //============================================================ + Sender_exec_i::Sender_exec_i (void) + : test_nr_(UPDATE_CREATE), + test_ok_(true) + { + this->ticker_ = new pulse_Generator (*this); + } + + Sender_exec_i::~Sender_exec_i (void) + { + } + + // Supported operations and attributes. + CORBA::Boolean + Sender_exec_i::create_one(void) + { + CORBA::Boolean result = true; + TestTopic i = this->topic_seq_one_[0]; + try + { + if (! ::CORBA::is_nil (this->updater_) ) + { + this->updater_->create_one(i); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("SL_OneByOne: create_one with instance key <%C>\n"), + i.key.in())); + } + else + { + ACE_ERROR ((LM_ERROR, ACE_TEXT ("ERROR: updater_ is nil"))); + result = false; + } + } + catch (const CCM_DDS::AlreadyCreated &) + { + ACE_ERROR ((LM_ERROR, ACE_TEXT ("Unexpected exception: AlreadyCreated with test updater create_one <%C>.\n"), + i.key.in())); + result = false; + } + catch (const CCM_DDS::InternalError& ) + { + ACE_ERROR ((LM_ERROR, ACE_TEXT ("Internal Error while create_one for <%C>.\n"), + i.key.in())); + result = false; + } + return result; + } + + CORBA::Boolean + Sender_exec_i::update_one() + { + //update already created instance with handle nil + CORBA::Boolean result = true; + TestTopic i = this->topic_seq_one_[0]; + try + { + this->updater_->update_one(i, DDS::HANDLE_NIL); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Updater: update_one with already existing instance with DDS::HANDLE_NIL, key <%C>\n"), + i.key.in())); + } + catch (const CCM_DDS::NonExistent &) + { + ACE_ERROR ((LM_ERROR, ACE_TEXT ("Unexpected exception: NonExistent with test updater update_one <%C>.\n"), + i.key.in())); + result = false; + } + catch (const CCM_DDS::InternalError& ) + { + ACE_ERROR ((LM_ERROR, ACE_TEXT ("Internal Error while update_one for <%C>.\n"), + i.key.in())); + result = false; + } + return result; + } + + CORBA::Boolean + Sender_exec_i::delete_one() + { + //delete registered instance with DDS::HANDLE_NIL + CORBA::Boolean result = true; + TestTopic i = this->topic_seq_one_[0]; + try + { + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Updater: delete_one with registered instance with DDS::HANDLE_NIL, key <%C>\n"), + i.key.in())); + this->updater_->delete_one(i, DDS::HANDLE_NIL); + } + catch (const CCM_DDS::NonExistent &) + { + ACE_ERROR ((LM_ERROR, ACE_TEXT ("Unexpected exception: NonExistent with test updater delete_one <%C>.\n"), + i.key.in())); + result = false; + } + catch (const CCM_DDS::InternalError& ) + { + ACE_ERROR ((LM_ERROR, ACE_TEXT ("Internal Error while delete_one for <%C>.\n"), + i.key.in())); + result = false; + } + return result; + } + + CORBA::Boolean + Sender_exec_i::create_many() + { + //create many with no exception + CORBA::Boolean result = false; + try + { + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("create_many : <%u> samples\n"), + this->topic_seq_many_.length ())); + this->updater_->create_many (this->topic_seq_many_); + result = true; + } + catch (const CCM_DDS::NonExistent& ) + { + ACE_ERROR ((LM_ERROR, ACE_TEXT ("Unexpected exception: NonExistent with test updater create_many\n"))); + } + catch (const CCM_DDS::InternalError& ex) + { + ACE_ERROR ((LM_ERROR, ACE_TEXT ("ERROR: Internal Error ") + ACE_TEXT ("in updater: create_many: index <%d> - retval <%d>\n"), + ex.index, ex.error_code)); + + } + return result; + } + + CORBA::Boolean + Sender_exec_i::update_many() + { + CORBA::Boolean result = false; + try + { + this->updater_->update_many (this->topic_seq_many_); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("update_many : written <%u> samples\n"), + this->topic_seq_many_.length ())); + result = true; + } + catch (const CCM_DDS::NonExistent& ) + { + ACE_ERROR ((LM_ERROR, ACE_TEXT ("Unexpected exception: NonExistent with test updater update_many.\n"))); + result = false; + } + catch (const CCM_DDS::InternalError& ex) + { + ACE_ERROR ((LM_ERROR, ACE_TEXT ("ERROR: Internal Error ") + ACE_TEXT ("whit update_many: index <%d> - retval <%d>\n"), + ex.index, ex.error_code)); + result = false; + } + return result; + } + + CORBA::Boolean + Sender_exec_i::delete_many() + { + CORBA::Boolean result = false; + result = false; + try + { + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("delete_many : deleted <%u> samples\n"), + this->topic_seq_many_.length ())); + this->updater_->delete_many (this->topic_seq_many_); + result = true; + } + catch (const CCM_DDS::NonExistent& ) + { + ACE_ERROR ((LM_ERROR, ACE_TEXT ("Unexpected exception: NonExistent with test updater delete_many\n"))); + result = false; + } + catch (const CCM_DDS::InternalError& ex) + { + ACE_ERROR ((LM_ERROR, ACE_TEXT ("ERROR: Internal Error ") + ACE_TEXT ("with test updater delete_many: index <%d> - retval <%d>\n"), + ex.index, ex.error_code)); + result = false; + } + + return result; + } + + void + Sender_exec_i::add_instances_of_topic () + { + CORBA::UShort total = 3; + this->topic_seq_one_.length (total); + //sequence for tests with .._one + for (int i = 1; i < (total + 1); i++) + { + char key[7]; + TestTopic new_key; + ACE_OS::sprintf (key, "KEY_%d", i); + new_key.key = CORBA::string_dup(key); + new_key.x = i; + this->topic_seq_one_[i-1] = new_key; + } + //sequence for tests with .._many + this->topic_seq_many_.length (total); + for (int i = 1; i < (total + 1); i++) + { + char key[7]; + TestTopic new_key; + ACE_OS::sprintf (key, "many_%d", i); + new_key.key = CORBA::string_dup(key); + new_key.x = i; + this->topic_seq_many_[i-1] = new_key; + } + } + + void + Sender_exec_i::tick () + { + if(this->test_ok_.value()) + { + switch (this->test_nr_) + { + case UPDATE_CREATE: + this->test_ok_ = this->create_one(); + if(this->test_ok_.value()) + { + this->test_nr_ = UPDATE_ONE; + } + else + { + this->test_nr_ = END_TEST; + } + break; + case UPDATE_ONE: + this->test_ok_ = this->update_one(); + this->test_nr_ = DELETE_ONE; + break; + case DELETE_ONE: + this->test_ok_ = this->delete_one(); + this->test_nr_ = CREATE_MANY; + case CREATE_MANY: + this->test_ok_ = this->create_many(); + if(this->test_ok_.value()) + { + this->test_nr_ = UPDATE_MANY; + } + else + { + this->test_nr_ = END_TEST; + } + this->test_nr_ = UPDATE_MANY; + break; + case UPDATE_MANY: + this->test_ok_ = this->update_many(); + this->test_nr_ = DELETE_MANY; + break; + case DELETE_MANY: + this->test_ok_ = this->delete_many(); + this->test_nr_ = END_TEST; + break; + default: + break; + } + } + } + void + Sender_exec_i::start (void) + { + long sec = 1L; + long usec = 0L; + if (this->context_->get_CCM_object()->_get_orb ()->orb_core ()->reactor ()->schedule_timer ( + this->ticker_, + 0, + ACE_Time_Value (sec, usec), + ACE_Time_Value (sec, usec)) == -1) + { + ACE_ERROR ((LM_ERROR, ACE_TEXT ("Sender_exec_i::start : ") + ACE_TEXT ("Error scheduling timer"))); + } + } + + void + Sender_exec_i::stop (void) + { + this->context_->get_CCM_object()->_get_orb ()->orb_core ()->reactor ()->cancel_timer (this->ticker_); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Sender_exec_i::stop : Timer canceled.\n"))); + delete this->ticker_; + } + + void + Sender_exec_i::set_session_context (::Components::SessionContext_ptr ctx) + { + this->context_ = ::SL_OneByOne::CCM_Sender_Context::_narrow (ctx); + + if ( ::CORBA::is_nil (this->context_.in ())) + { + throw ::CORBA::INTERNAL (); + } + } + + void + Sender_exec_i::configuration_complete (void) + { + this->updater_= this->context_->get_connection_test_topic_update_data (); + } + void + Sender_exec_i::ccm_activate (void) + { + this->add_instances_of_topic (); + this->start (); + } + + void + Sender_exec_i::ccm_passivate (void) + { + this->stop (); + } + + void + Sender_exec_i::ccm_remove (void) + { + } + + extern "C" SENDER_EXEC_Export ::Components::EnterpriseComponent_ptr + create_SL_OneByOne_Sender_Impl (void) + { + ::Components::EnterpriseComponent_ptr retval = + ::Components::EnterpriseComponent::_nil (); + + ACE_NEW_NORETURN ( + retval, + Sender_exec_i); + + return retval; + } +} diff --git a/modules/CIAO/connectors/dds4ccm/tests/SLOneByOne/Sender/SL_OneByOne_Sender_exec.h b/modules/CIAO/connectors/dds4ccm/tests/SLOneByOne/Sender/SL_OneByOne_Sender_exec.h new file mode 100644 index 00000000000..629317869b6 --- /dev/null +++ b/modules/CIAO/connectors/dds4ccm/tests/SLOneByOne/Sender/SL_OneByOne_Sender_exec.h @@ -0,0 +1,86 @@ +// -*- C++ -*- +// $Id$ + +#ifndef CIAO_SENDER_EXEC_H_ +#define CIAO_SENDER_EXEC_H_ + + +#include "SL_OneByOne_SenderEC.h" + +#include /**/ "Sender_exec_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/LocalObject.h" + +#include <map> + +namespace CIAO_SL_OneByOne_Sender_Impl +{ + typedef ACE_Atomic_Op <TAO_SYNCH_MUTEX, CORBA::Boolean > Atomic_Boolean; + + class Sender_exec_i; + + enum UPDATER_TEST { + UPDATE_CREATE, + UPDATE_ONE, + DELETE_ONE, + CREATE_MANY, + UPDATE_MANY, + DELETE_MANY, + END_TEST + }; + + class pulse_Generator : + public ACE_Event_Handler + { + public: + pulse_Generator (Sender_exec_i &callback); + /// Handle the timeout. + virtual int handle_timeout (const ACE_Time_Value &tv, + const void *arg); + private: + /// Maintains a handle that actually process the event + Sender_exec_i &pulse_callback_; + }; + + class Sender_exec_i + : public virtual Sender_Exec, + public virtual ::CORBA::LocalObject + { + public: + Sender_exec_i (void); + virtual ~Sender_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); + void tick (void); + + private: + void start (void); + void stop (void); + void add_instances_of_topic (void); + CORBA::Boolean create_one(void); + CORBA::Boolean update_one(void); + CORBA::Boolean delete_one(void); + CORBA::Boolean create_many(void); + CORBA::Boolean update_many(void); + CORBA::Boolean delete_many(void); + + pulse_Generator * ticker_; + ::SL_OneByOne::CCM_Sender_Context_var context_; + CCM_DDS::TestTopic::Updater_var updater_; + UPDATER_TEST test_nr_; + Atomic_Boolean test_ok_; + TestTopicSeq topic_seq_one_; + TestTopicSeq topic_seq_many_; + }; + extern "C" SENDER_EXEC_Export ::Components::EnterpriseComponent_ptr + create_SL_OneByOne_Sender_Impl (void); +} + +#endif /* ifndef */ diff --git a/modules/CIAO/connectors/dds4ccm/tests/SLOneByOne/descriptors/Plan.cdp b/modules/CIAO/connectors/dds4ccm/tests/SLOneByOne/descriptors/Plan.cdp new file mode 100644 index 00000000000..a794a8b59a1 --- /dev/null +++ b/modules/CIAO/connectors/dds4ccm/tests/SLOneByOne/descriptors/Plan.cdp @@ -0,0 +1,365 @@ +<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>SL_OneByOne_Depl_1</label> + <UUID>SL_OneByOne_Depl_1</UUID> + + <implementation xmi:id="ReceiverComponentImplementation"> + <name>ReceiverComponentImplementation</name> + <source/> + <artifact xmi:idref="Receiver_ExecArtifact" /> + <artifact xmi:idref="Receiver_SvntArtifact" /> + <execParameter> + <!-- entrypoint as exec parameter (see 10.6.1) --> + <name>component factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_SL_OneByOne_Receiver_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_SL_OneByOne_Receiver_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Receiver_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Receiver_exec</string> + </value> + </value> + </execParameter> + </implementation> + + <implementation xmi:id="SL_OneByOne_ConnectorComponentImplementation"> + <name>SL_OneByOne_ConnectorComponentImplementation</name> + <source/> + <artifact xmi:idref="SL_OneByOne_Connector_ExecArtifact" /> + <artifact xmi:idref="SL_OneByOne_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_SL_OneByOne_SL_OneByOne_Connector_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_SL_OneByOne_SL_OneByOne_Connector_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SL_OneByOne_Connector_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SL_OneByOne_Connector_exec</string> + </value> + </value> + </execParameter> + </implementation> + + <implementation xmi:id="SenderComponentImplementation"> + <name>SenderComponentImplementation</name> + <source/> + <artifact xmi:idref="Sender_ExecArtifact" /> + <artifact xmi:idref="Sender_SvntArtifact" /> + <execParameter> + <!-- entrypoint as exec parameter (see 10.6.1) --> + <name>component factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_SL_OneByOne_Sender_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_SL_OneByOne_Sender_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Sender_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Sender_exec</string> + </value> + </value> + </execParameter> + </implementation> + <instance xmi:id="ReceiverComponentInstance"> + <name>ReceiverComponent</name> + <node>ReceiverNode</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="ReceiverComponentImplementation" /> + </instance> + <instance xmi:id="SL_OneByOne_ConnectorComponentInstance"> + <name>SL_OneByOne_ConnectorComponent</name> + <node>SenderNode</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SL_OneByOne_ConnectorComponentImplementation" /> + <configProperty> + <name>topic_name</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>TestQoS</string> + </value> + </value> + </configProperty> + </instance> + <instance xmi:id="SL_OneByOne_ConnectorComponentInstance2"> + <name>SL_OneByOne_ConnectorComponent2</name> + <node>ReceiverNode</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SL_OneByOne_ConnectorComponentImplementation" /> + <configProperty> + <name>topic_name</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>TestQoS</string> + </value> + </value> + </configProperty> + </instance> + <instance xmi:id="SenderComponentInstance"> + <name>SenderComponent</name> + <node>SenderNode</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SenderComponentImplementation" /> + </instance> + + <connection> + <name>_listenercontrol</name> + <deployRequirement> + <name>edu.dre.vanderbilt.DAnCE.ConnectionType</name> + <resourceType>Local_Interface</resourceType> + </deployRequirement> + <internalEndpoint> + <portName>info_out_data_control</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="ReceiverComponentInstance" /> + </internalEndpoint> + <internalEndpoint> + <portName>push_state_observer_data_control</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="SL_OneByOne_ConnectorComponentInstance2" /> + </internalEndpoint> + </connection> + <connection> + <name>_statelistener</name> + <deployRequirement> + <name>edu.dre.vanderbilt.DAnCE.ConnectionType</name> + <resourceType>Local_Interface</resourceType> + </deployRequirement> + <internalEndpoint> + <portName>info_out_data_listener</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="ReceiverComponentInstance" /> + </internalEndpoint> + <internalEndpoint> + <portName>push_state_observer_data_listener</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="SL_OneByOne_ConnectorComponentInstance2" /> + </internalEndpoint> + </connection> + <connection> + <name>_portstatuslistener</name> + <deployRequirement> + <name>edu.dre.vanderbilt.DAnCE.ConnectionType</name> + <resourceType>Local_Interface</resourceType> + </deployRequirement> + <internalEndpoint> + <portName>info_out_status</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="ReceiverComponentInstance" /> + </internalEndpoint> + <internalEndpoint> + <portName>push_state_observer_status</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="SL_OneByOne_ConnectorComponentInstance2" /> + </internalEndpoint> + </connection> + <connection> + <name>info_out_data</name> + <deployRequirement> + <name>edu.dre.vanderbilt.DAnCE.ConnectionType</name> + <resourceType>Local_Interface</resourceType> + </deployRequirement> + <internalEndpoint> + <portName>info_out_data</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="ReceiverComponentInstance" /> + </internalEndpoint> + <internalEndpoint> + <portName>push_state_observer_data</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="SL_OneByOne_ConnectorComponentInstance2" /> + </internalEndpoint> + </connection> + <connection> + <name>updater_connection</name> + <deployRequirement> + <name>edu.dre.vanderbilt.DAnCE.ConnectionType</name> + <resourceType>Local_Interface</resourceType> + </deployRequirement> + <internalEndpoint> + <portName>test_topic_update_data</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="SenderComponentInstance" /> + </internalEndpoint> + <internalEndpoint> + <portName>observable_data</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="SL_OneByOne_ConnectorComponentInstance" /> + </internalEndpoint> + </connection> + + <artifact xmi:id="Sender_ExecArtifact"> + <name>Sender_exec</name> + <source/> + <node/> + <location>Sender_exec</location> + </artifact> + <artifact xmi:id="Sender_SvntArtifact"> + <name>Sender_svnt</name> + <source/> + <node/> + <location>Sender_svnt</location> + </artifact> + <artifact xmi:id="Sender_StubArtifact"> + <name>Sender_stub</name> + <source/> + <node/> + <location>Sender_stub</location> + </artifact> + <artifact xmi:id="SL_OneByOne_Connector_ExecArtifact"> + <name>SL_OneByOne_Connector_exec</name> + <source/> + <node/> + <location>DDS_SL_OneByOne_Connector_exec</location> + </artifact> + <artifact xmi:id="SL_OneByOne_Connector_SvntArtifact"> + <name>SL_OneByOne_Connector_svnt</name> + <source/> + <node/> + <location>DDS_SL_OneByOne_Connector_svnt</location> + </artifact> + <artifact xmi:id="SL_OneByOne_Connector_StubArtifact"> + <name>SL_OneByOne_Connector_stub</name> + <source/> + <node/> + <location>DDS_SL_OneByOne_Connector_stub</location> + </artifact> + <artifact xmi:id="Receiver_ExecArtifact"> + <name>Receiver_exec</name> + <source/> + <node/> + <location>Receiver_exec</location> + </artifact> + <artifact xmi:id="Receiver_SvntArtifact"> + <name>Receiver_svnt</name> + <source/> + <node/> + <location>Receiver_svnt</location> + </artifact> + <artifact xmi:id="Receiver_StubArtifact"> + <name>Receiver_stub</name> + <source/> + <node/> + <location>Receiver_stub</location> + </artifact> +</Deployment:DeploymentPlan> diff --git a/modules/CIAO/connectors/dds4ccm/tests/SLOneByOne/descriptors/run_test.pl b/modules/CIAO/connectors/dds4ccm/tests/SLOneByOne/descriptors/run_test.pl new file mode 100755 index 00000000000..66cc403a1fb --- /dev/null +++ b/modules/CIAO/connectors/dds4ccm/tests/SLOneByOne/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 = 2; +@ports = ( 60001, 60002 ); +@iorbases = ( "NodeApp1.ior", "NodeApp2.ior" ); +@iorfiles = 0; +@nodenames = ( "SenderNode", "ReceiverNode" ); + +# 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 deamon $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 ('ciao_componentserver'); +} + +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 = "$CIAO_ROOT/bin/ciao_componentserver"; + + $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/Naming_Service", "-m 1 -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 -m 1 -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 20 seconds to allow task to complete\n"; +sleep (20); + +# 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 -q\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; |