diff options
Diffstat (limited to 'CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet')
19 files changed, 2805 insertions, 0 deletions
diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Base/RG_ResetTopic_Base.idl b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Base/RG_ResetTopic_Base.idl new file mode 100644 index 00000000000..5a7452f2015 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Base/RG_ResetTopic_Base.idl @@ -0,0 +1,23 @@ +// $Id$ + +/** + * @file RG_ResetTopic_Base.idl + * @author Marcel Smit <msmit@remedy.nl> + */ + +#ifndef RG_RESETTOPIC_BASE_IDL +#define RG_RESETTOPIC_BASE_IDL + +#pragma ndds typesupport "Base/RG_ResetTopic_BaseSupport.h" + +#pragma DCPS_DATA_TYPE "RG_ResetTopicSample" +#pragma DCPS_DATA_KEY "RG_ResetTopicSample key" + +struct RG_ResetTopicSample { + string key; //@key + long iteration; +}; + +typedef sequence<RG_ResetTopicSample> RG_ResetTopicSampleSeq; + +#endif diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Base/RG_ResetTopic_Base.mpc b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Base/RG_ResetTopic_Base.mpc new file mode 100644 index 00000000000..36560836af9 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Base/RG_ResetTopic_Base.mpc @@ -0,0 +1,26 @@ +// $Id$ + +project (RG_ResetTopicBase_stub) : taoidldefaults, dds4ccm_ts_default { + sharedname = RG_ResetTopicBase_stub + dynamicflags += RG_RESETTOPIC_BASE_STUB_BUILD_DLL + libout = ../lib + + idlflags += -SS -Sci \ + -Wb,stub_export_macro=RG_RESETTOPIC_BASE_STUB_Export \ + -Wb,stub_export_include=LateBinding_Base_stub_export.h + + IDL_Files { + idlflags += -Gxhst + RG_ResetTopic_Base.idl + } + + opendds_ts_flags += --export=RG_RESETTOPIC_BASE_STUB_Export + + DDSGenerator_Files { + RG_ResetTopic_Base.idl + } + + Source_Files { + } +} + diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Base/Reader_Starter.idl b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Base/Reader_Starter.idl new file mode 100644 index 00000000000..bf198b37ea7 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Base/Reader_Starter.idl @@ -0,0 +1,20 @@ +// $Id$ + +/** + * @file Reader_Starter.idl + * @author Marcel Smit <msmit@remedy.nl> + */ + +#ifndef READER_STARTER_IDL +#define READER_STARTER_IDL + +#pragma ciao lem "Base/Reader_StarterE.idl" + +interface ReaderStarter +{ + void start_read (in string topic_name); + void set_reader_properties (in unsigned short nr_keys, + in unsigned short nr_iterations); +}; + +#endif /* READER_STARTER_IDL */ diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Base/Reader_Starter.mpc b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Base/Reader_Starter.mpc new file mode 100755 index 00000000000..050904fd873 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Base/Reader_Starter.mpc @@ -0,0 +1,113 @@ +// $Id$ + +project(reader_starter_rt_idl_gen) : componentidldefaults, dds4ccm { + custom_only = 1 + after += + idlflags += -Wb,stub_export_macro=READER_STARTER_STUB_Export \ + -Wb,stub_export_include=reader_starter_rt_stub_export.h \ + -Wb,skel_export_macro=READER_STARTER_SVNT_Export \ + -Wb,skel_export_include=reader_starter_rt_svnt_export.h \ + -Wb,svnt_export_macro=READER_STARTER_SVNT_Export \ + -Wb,svnt_export_include=reader_starter_rt_svnt_export.h \ + -Wb,exec_export_macro=READER_STARTER_EXEC_Export \ + -Wb,exec_export_include=Reader_Starter_exec_export.h -I.. + + IDL_Files { + Reader_Starter.idl + } +} + +project(reader_starter_rt_lem_gen) : ciaoidldefaults, dds4ccm { + after += reader_starter_rt_idl_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=READER_STARTER_LEM_STUB_Export \ + -Wb,stub_export_include=reader_starter_rt_lem_stub_export.h \ + -SS -Gxhst -I.. + + IDL_Files { + Reader_StarterE.idl + } +} + +project(reader_starter_rt_lem_stub) : ccm_svnt, dds4ccm_base { + after += reader_starter_rt_lem_gen reader_starter_rt_stub + libs += reader_starter_rt_stub + libpaths += ../lib + libout = ../lib + includes += .. + sharedname = reader_starter_rt_lem_stub + dynamicflags += READER_STARTER_LEM_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + Reader_StarterEC.cpp + } + + Header_Files { + Reader_StarterEC.h + reader_starter_rt_lem_stub_export.h + } + + Inline_Files { + Reader_StarterEC.inl + } +} + +project(reader_starter_rt_stub) : ccm_stub, dds4ccm_base { + after += reader_starter_rt_idl_gen + libs += + libpaths += ../lib + libout = ../lib + includes += .. + sharedname = reader_starter_rt_stub + dynamicflags += READER_STARTER_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + Reader_StarterC.cpp + } + + Header_Files { + Reader_StarterC.h + reader_starter_rt_stub_export.h + } + + Inline_Files { + Reader_StarterC.inl + } +} + + +project(reader_starter_rt_svnt) : ciao_servant, dds4ccm_lem_stub, dds4ccm_skel { + after += reader_starter_rt_lem_stub reader_starter_rt_stub + sharedname = reader_starter_rt_svnt + libs += reader_starter_rt_stub reader_starter_rt_lem_stub + libpaths += ../lib + libout = ../lib + includes += .. + dynamicflags += READER_STARTER_SVNT_BUILD_DLL + + IDL_Files { + } + + Source_Files { + Reader_StarterS.cpp + Reader_Starter_svnt.cpp + } + + Header_Files { + Reader_StarterS.h + Reader_Starter_svnt.h + reader_starter_rt_svnt_export.h + } + + Inline_Files { + Reader_StarterS.inl + } +} + + diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Connector/RG_ResetTopic_Connector.idl b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Connector/RG_ResetTopic_Connector.idl new file mode 100644 index 00000000000..1da3f3494d0 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Connector/RG_ResetTopic_Connector.idl @@ -0,0 +1,23 @@ +// $Id$ + +/** + * @file RG_ResetTopic_Connector.idl + * @author Marcel Smit <msmit@remedy.nl> + */ + +#ifndef RG_RESETTOPIC_CONNECTOR_IDL_ +#define RG_RESETTOPIC_CONNECTOR_IDL_ + +#include <Components.idl> +#include <ccm_dds.idl> + +#include "Base/RG_ResetTopic_Base.idl" + +#pragma ciao lem "Connector/RG_ResetTopic_ConnectorE.idl" + +module RG_ResetTopic +{ + module ::CCM_DDS::Typed < ::RG_ResetTopicSample, ::RG_ResetTopicSampleSeq> RG_ResetTopicSampleConnector; +}; + +#endif /* RG_ResetTopic_CONNECTOR_IDL_ */ diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Connector/RG_ResetTopic_Connector.mpc b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Connector/RG_ResetTopic_Connector.mpc new file mode 100644 index 00000000000..f5e8207275a --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Connector/RG_ResetTopic_Connector.mpc @@ -0,0 +1,148 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -p RG_ResetTopicBase -l .. -o ../lib -u DDS RG_ResetTopic_Connector" + +project (RG_ResetTopicConnector_idl_gen) : connectoridldefaults, dds4ccm { + after += DDS4CCM_idl_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=RG_RESETTOPIC_CONNECTOR_STUB_Export \ + -Wb,stub_export_include=LateBinding_Connector_stub_export.h \ + -Wb,skel_export_macro=RG_RESETTOPIC_CONNECTOR_SVNT_Export \ + -Wb,skel_export_include=LateBinding_Connector_svnt_export.h \ + -Wb,svnt_export_macro=RG_RESETTOPIC_CONNECTOR_SVNT_Export \ + -Wb,svnt_export_include=LateBinding_Connector_svnt_export.h \ + -Wb,conn_export_macro=RG_RESETTOPIC_CONNECTOR_CONN_Export \ + -Wb,conn_export_include=LateBinding_Connector_conn_export.h \ + -I .. + + IDL_Files { + RG_ResetTopic_Connector.idl + } +} + +project (RG_ResetTopicConnector_lem_gen) : ciaoidldefaults, dds4ccm { + custom_only = 1 + after += RG_ResetTopicConnector_idl_gen + idlflags += -Wb,stub_export_macro=RG_RESETTOPIC_CONNECTOR_LEM_STUB_Export \ + -Wb,stub_export_include=RG_ResetTopic_Connector_lem_stub_export.h \ + -SS -Gxhst \ + -I .. + + IDL_Files { + RG_ResetTopic_ConnectorE.idl + } +} + +project (RG_ResetTopicConnector_lem_stub) : ccm_svnt, dds4ccm_lem_stub { + after += RG_ResetTopicConnector_lem_gen RG_ResetTopicConnector_stub \ + RG_ResetTopicBase_stub + libs += RG_ResetTopicBase_stub RG_ResetTopicConnector_stub + libpaths += ../lib + libout = ../lib + includes += .. + sharedname = RG_ResetTopicConnector_lem_stub + dynamicflags += RG_RESETTOPIC_CONNECTOR_LEM_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + RG_ResetTopic_ConnectorEC.cpp + } + + Header_Files { + RG_ResetTopic_ConnectorEC.h + RG_ResetTopic_Connector_lem_stub_export.h + } + + Inline_Files { + RG_ResetTopic_ConnectorEC.inl + } +} + +project (RG_ResetTopicConnector_stub) : ccm_stub, dds4ccm_base { + after += RG_ResetTopicConnector_idl_gen RG_ResetTopicBase_stub + libs += RG_ResetTopicBase_stub + libpaths += ../lib + libout = ../lib + includes += .. + sharedname = RG_ResetTopicConnector_stub + dynamicflags += RG_RESETTOPIC_CONNECTOR_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + RG_ResetTopic_ConnectorC.cpp + } + + Header_Files { + RG_ResetTopic_ConnectorC.h + RG_ResetTopic_Connector_stub_export.h + } + + Inline_Files { + RG_ResetTopic_ConnectorC.inl + } +} + +project (RG_ResetTopicConnector_exec) : ciao_executor, dds4ccm_impl { + after += RG_ResetTopicConnector_lem_stub RG_ResetTopicConnector_stub \ + RG_ResetTopicBase_stub + sharedname = RG_ResetTopicConnector_exec + libs += RG_ResetTopicConnector_stub RG_ResetTopicConnector_lem_stub \ + RG_ResetTopicBase_stub RG_ResetTopicBase_stub + libpaths += ../lib + libout = ../lib + includes += .. + dynamicflags += RG_RESETTOPIC_CONNECTOR_CONN_BUILD_DLL + + IDL_Files { + } + + Source_Files { + RG_ResetTopic_Connector_conn.cpp + } + + Header_Files { + RG_ResetTopic_Connector_conn.h + RG_ResetTopic_Connector_conn_export.h + } + + Inline_Files { + } +} + + +project (RG_ResetTopicConnector_svnt) : ciao_servant, dds4ccm_impl { + after += RG_ResetTopicConnector_lem_stub RG_ResetTopicConnector_exec \ + RG_ResetTopicConnector_stub + sharedname = RG_ResetTopicConnector_svnt + libs += RG_ResetTopicConnector_stub \ + RG_ResetTopicConnector_lem_stub \ + RG_ResetTopicBase_stub \ + RG_ResetTopicConnector_exec + libpaths += ../lib + libout = ../lib + includes += .. + dynamicflags += RG_RESETTOPIC_CONNECTOR_SVNT_BUILD_DLL + + IDL_Files { + } + + Source_Files { + RG_ResetTopic_ConnectorS.cpp + RG_ResetTopic_Connector_svnt.cpp + } + + Header_Files { + RG_ResetTopic_ConnectorS.h + RG_ResetTopic_Connector_svnt.h + RG_ResetTopic_Connector_svnt_export.h + } + + Inline_Files { + RG_ResetTopic_ConnectorS.inl + } +} + + diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Receiver/RG_ResetTopic_Receiver.idl b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Receiver/RG_ResetTopic_Receiver.idl new file mode 100644 index 00000000000..1a3d83d66c6 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Receiver/RG_ResetTopic_Receiver.idl @@ -0,0 +1,25 @@ +// $Id$ + +/** + * @file + * @author Marcel Smit <msmit@remedy.nl> + */ + +#ifndef RECEIVER_IDL +#define RECEIVER_IDL + +#include "Connector/RG_ResetTopic_Connector.idl" +#include "Base/Reader_Starter.idl" + +module RG_ResetTopic +{ + component Receiver + { + port RG_ResetTopicSampleConnector::DDS_Get info_get; + port RG_ResetTopicSampleConnector::DDS_Read info_read; + + provides ReaderStarter start_reading; + }; +}; + +#endif diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Receiver/RG_ResetTopic_Receiver.mpc b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Receiver/RG_ResetTopic_Receiver.mpc new file mode 100644 index 00000000000..fe2ed2dae50 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Receiver/RG_ResetTopic_Receiver.mpc @@ -0,0 +1,158 @@ +// $Id$ + +project (RG_ResetTopicReceiver_idl_gen) : componentidldefaults, dds4ccm { + custom_only = 1 + after += RG_ResetTopicConnector_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 { + RG_ResetTopic_Receiver.idl + } +} + +project (RG_ResetTopicReceiver_lem_gen) : ciaoidldefaults, dds4ccm { + after += RG_ResetTopicReceiver_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 { + RG_ResetTopic_ReceiverE.idl + } +} + +project (RG_ResetTopicReceiver_lem_stub) : ccm_svnt, dds4ccm_base { + after += RG_ResetTopicReceiver_lem_gen RG_ResetTopicReceiver_stub RG_ResetTopicConnector_stub \ + RG_ResetTopicBase_stub reader_starter_rt_stub + libs += Receiver_stub RG_ResetTopicConnector_stub RG_ResetTopicBase_stub \ + reader_starter_rt_stub + libpaths += ../lib + libout = ../lib + includes += .. + sharedname = Receiver_lem_stub + dynamicflags += RECEIVER_LEM_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + RG_ResetTopic_ReceiverEC.cpp + } + + Header_Files { + RG_ResetTopic_ReceiverEC.h + Receiver_lem_stub_export.h + } + + Inline_Files { + RG_ResetTopic_ReceiverEC.inl + } +} + +project (RG_ResetTopicReceiver_stub) : ccm_stub, dds4ccm_base { + after += RG_ResetTopicReceiver_idl_gen RG_ResetTopicConnector_stub \ + RG_ResetTopicBase_stub RG_ResetTopicConnector_lem_gen \ + reader_starter_rt_stub reader_starter_rt_lem_stub + libs += RG_ResetTopicConnector_stub RG_ResetTopicBase_stub \ + reader_starter_rt_stub + libpaths += ../lib + libout = ../lib + includes += .. + sharedname = Receiver_stub + dynamicflags += RECEIVER_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + RG_ResetTopic_ReceiverC.cpp + } + + Header_Files { + RG_ResetTopic_ReceiverC.h + Receiver_stub_export.h + } + + Inline_Files { + RG_ResetTopic_ReceiverC.inl + } +} + +project (RG_ResetTopicReceiver_exec) : ciao_executor, dds4ccm_lem_stub { + after += RG_ResetTopicReceiver_lem_stub RG_ResetTopicReceiver_stub \ + RG_ResetTopicBase_stub RG_ResetTopicConnector_stub \ + RG_ResetTopicConnector_lem_stub \ + reader_starter_rt_lem_stub reader_starter_rt_stub + sharedname = Receiver_exec + libs += Receiver_stub Receiver_lem_stub RG_ResetTopicBase_stub \ + RG_ResetTopicConnector_stub RG_ResetTopicConnector_lem_stub \ + reader_starter_rt_lem_stub reader_starter_rt_stub + libpaths += ../lib + libout = ../lib + includes += .. + dynamicflags += RECEIVER_EXEC_BUILD_DLL + + IDL_Files { + } + + Source_Files { + RG_ResetTopic_Receiver_exec.cpp + RG_ResetTopic_Receiver_impl.cpp + } + + Header_Files { + RG_ResetTopic_Receiver_exec.h + RG_ResetTopic_Receiver_impl.h + Receiver_exec_export.h + } + + Inline_Files { + } +} + + +project (RG_ResetTopicReceiver_svnt) : ciao_servant, dds4ccm_lem_stub, dds4ccm_skel { + after += RG_ResetTopicReceiver_lem_stub RG_ResetTopicBase_stub \ + RG_ResetTopicConnector_stub RG_ResetTopicConnector_svnt \ + RG_ResetTopicReceiver_exec RG_ResetTopicConnector_lem_stub \ + reader_starter_rt_stub \ + reader_starter_rt_svnt reader_starter_rt_lem_stub + sharedname = Receiver_svnt + libs += Receiver_stub Receiver_lem_stub RG_ResetTopicBase_stub \ + RG_ResetTopicConnector_stub RG_ResetTopicConnector_svnt \ + Receiver_exec RG_ResetTopicConnector_lem_stub \ + reader_starter_rt_stub reader_starter_rt_svnt \ + reader_starter_rt_lem_stub + libpaths += ../lib + libout = ../lib + includes += .. + dynamicflags += RECEIVER_SVNT_BUILD_DLL + + IDL_Files { + } + + Source_Files { + RG_ResetTopic_ReceiverS.cpp + RG_ResetTopic_Receiver_svnt.cpp + } + + Header_Files { + RG_ResetTopic_ReceiverS.h + RG_ResetTopic_Receiver_svnt.h + Receiver_svnt_export.h + } + + Inline_Files { + RG_ResetTopic_ReceiverS.inl + } +} + + diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Receiver/RG_ResetTopic_Receiver_exec.cpp b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Receiver/RG_ResetTopic_Receiver_exec.cpp new file mode 100644 index 00000000000..02b5ea6f723 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Receiver/RG_ResetTopic_Receiver_exec.cpp @@ -0,0 +1,283 @@ +// -*- C++ -*- +// $Id$ + +#include "RG_ResetTopic_Receiver_exec.h" +#include "RG_ResetTopic_Receiver_impl.h" + +namespace CIAO_RG_ResetTopic_Receiver_Impl +{ + + /** + * Facet Executor Implementation Class: info_get_status_exec_i + */ + + info_get_status_exec_i::info_get_status_exec_i ( + ::RG_ResetTopic::CCM_Receiver_Context_ptr ctx) + : ciao_context_ ( + ::RG_ResetTopic::CCM_Receiver_Context::_duplicate (ctx)) + { + } + + info_get_status_exec_i::~info_get_status_exec_i (void) + { + } + + // Operations from ::CCM_DDS::PortStatusListener + + void + info_get_status_exec_i::on_requested_deadline_missed (::DDS::DataReader_ptr /* the_reader */, + const ::DDS::RequestedDeadlineMissedStatus & /* status */) + { + /* Your code here. */ + } + + void + info_get_status_exec_i::on_sample_lost (::DDS::DataReader_ptr /* the_reader */, + const ::DDS::SampleLostStatus & /* status */) + { + /* Your code here. */ + } + + /** + * Facet Executor Implementation Class: info_read_status_exec_i + */ + + info_read_status_exec_i::info_read_status_exec_i ( + ::RG_ResetTopic::CCM_Receiver_Context_ptr ctx) + : ciao_context_ ( + ::RG_ResetTopic::CCM_Receiver_Context::_duplicate (ctx)) + { + } + + info_read_status_exec_i::~info_read_status_exec_i (void) + { + } + + // Operations from ::CCM_DDS::PortStatusListener + + void + info_read_status_exec_i::on_requested_deadline_missed (::DDS::DataReader_ptr /* the_reader */, + const ::DDS::RequestedDeadlineMissedStatus & /* status */) + { + /* Your code here. */ + } + + void + info_read_status_exec_i::on_sample_lost (::DDS::DataReader_ptr /* the_reader */, + const ::DDS::SampleLostStatus & /* status */) + { + /* Your code here. */ + } + + /** + * Facet Executor Implementation Class: start_reading_exec_i + */ + + start_reading_exec_i::start_reading_exec_i ( + ::RG_ResetTopic::CCM_Receiver_Context_ptr ctx, + Receiver_exec_i &callback) + : ciao_context_ ( + ::RG_ResetTopic::CCM_Receiver_Context::_duplicate (ctx)) + , callback_ (callback) + { + } + + start_reading_exec_i::~start_reading_exec_i (void) + { + } + + // Operations from ::ReaderStarter + + void + start_reading_exec_i::start_read (const char * topic_name) + { + this->callback_.start_read (topic_name); + } + + void + start_reading_exec_i::set_reader_properties (::CORBA::UShort nr_keys, + ::CORBA::UShort nr_iterations) + { + this->callback_.keys (nr_keys); + this->callback_.iterations (nr_iterations); + } + + /** + * Component Executor Implementation Class: Receiver_exec_i + */ + + Receiver_exec_i::Receiver_exec_i (void) + : iterations_ (10) + , keys_ (5) + , impl_(0) + { + } + + Receiver_exec_i::~Receiver_exec_i (void) + { + delete this->impl_; + } + + // Supported operations and attributes. + ::CORBA::UShort + Receiver_exec_i::iterations (void) + { + return this->iterations_; + } + + void + Receiver_exec_i::iterations ( + const ::CORBA::UShort iterations) + { + this->iterations_ = iterations; + if (this->impl_) + { + this->impl_->iterations (iterations); + } + } + + ::CORBA::UShort + Receiver_exec_i::keys (void) + { + return this->keys_; + } + + void + Receiver_exec_i::keys ( + const ::CORBA::UShort keys) + { + this->keys_ = keys; + if (this->impl_) + { + this->impl_->keys (keys); + } + } + + void + Receiver_exec_i::start_read (const char * topic_name) + { + if (!this->impl_) + ACE_NEW_THROW_EX (this->impl_, + RG_ResetTopic_Receiver_impl ( + this->ciao_context_.in (), + this->iterations_, + this->keys_), + ::CORBA::INTERNAL ()); + this->impl_->start (topic_name); + } + + // Component attributes and port operations. + + ::CCM_DDS::CCM_PortStatusListener_ptr + Receiver_exec_i::get_info_get_status (void) + { + if ( ::CORBA::is_nil (this->ciao_info_get_status_.in ())) + { + info_get_status_exec_i *tmp = 0; + ACE_NEW_RETURN ( + tmp, + info_get_status_exec_i ( + this->ciao_context_.in ()), + ::CCM_DDS::CCM_PortStatusListener::_nil ()); + + this->ciao_info_get_status_ = tmp; + } + + return + ::CCM_DDS::CCM_PortStatusListener::_duplicate ( + this->ciao_info_get_status_.in ()); + } + + ::CCM_DDS::CCM_PortStatusListener_ptr + Receiver_exec_i::get_info_read_status (void) + { + if ( ::CORBA::is_nil (this->ciao_info_read_status_.in ())) + { + info_read_status_exec_i *tmp = 0; + ACE_NEW_RETURN ( + tmp, + info_read_status_exec_i ( + this->ciao_context_.in ()), + ::CCM_DDS::CCM_PortStatusListener::_nil ()); + + this->ciao_info_read_status_ = tmp; + } + + return + ::CCM_DDS::CCM_PortStatusListener::_duplicate ( + this->ciao_info_read_status_.in ()); + } + + ::CCM_ReaderStarter_ptr + Receiver_exec_i::get_start_reading (void) + { + if ( ::CORBA::is_nil (this->ciao_start_reading_.in ())) + { + start_reading_exec_i *tmp = 0; + ACE_NEW_RETURN ( + tmp, + start_reading_exec_i ( + this->ciao_context_.in (), + *this), + ::CCM_ReaderStarter::_nil ()); + + this->ciao_start_reading_ = tmp; + } + + return + ::CCM_ReaderStarter::_duplicate ( + this->ciao_start_reading_.in ()); + } + + // Operations from Components::SessionComponent. + + void + Receiver_exec_i::set_session_context ( + ::Components::SessionContext_ptr ctx) + { + this->ciao_context_ = + ::RG_ResetTopic::CCM_Receiver_Context::_narrow (ctx); + + if ( ::CORBA::is_nil (this->ciao_context_.in ())) + { + throw ::CORBA::INTERNAL (); + } + } + + void + Receiver_exec_i::configuration_complete (void) + { + /* Your code here. */ + } + + void + Receiver_exec_i::ccm_activate (void) + { + /* Your code here. */ + } + + void + Receiver_exec_i::ccm_passivate (void) + { + /* Your code here. */ + } + + void + Receiver_exec_i::ccm_remove (void) + { + /* Your code here. */ + } + + extern "C" RECEIVER_EXEC_Export ::Components::EnterpriseComponent_ptr + create_RG_ResetTopic_Receiver_Impl (void) + { + ::Components::EnterpriseComponent_ptr retval = + ::Components::EnterpriseComponent::_nil (); + + ACE_NEW_NORETURN ( + retval, + Receiver_exec_i); + + return retval; + } +} diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Receiver/RG_ResetTopic_Receiver_exec.h b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Receiver/RG_ResetTopic_Receiver_exec.h new file mode 100644 index 00000000000..6b772b6a35e --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Receiver/RG_ResetTopic_Receiver_exec.h @@ -0,0 +1,194 @@ +// -*- C++ -*- +// $Id$ + +#ifndef CIAO_RG_RESETTOPIC_RECEIVER_EXEC_MMKH3G_H_ +#define CIAO_RG_RESETTOPIC_RECEIVER_EXEC_MMKH3G_H_ + +#include /**/ "ace/pre.h" + +#include "RG_ResetTopic_ReceiverEC.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include /**/ "Receiver_exec_export.h" +#include "tao/LocalObject.h" + +namespace CIAO_RG_ResetTopic_Receiver_Impl +{ + class Receiver_exec_i; + class RG_ResetTopic_Receiver_impl; + /** + * Provider Executor Implementation Class: info_get1_status_exec_i + */ + + class info_get_status_exec_i + : public virtual ::CCM_DDS::CCM_PortStatusListener, + public virtual ::CORBA::LocalObject + { + public: + info_get_status_exec_i ( + ::RG_ResetTopic::CCM_Receiver_Context_ptr ctx); + virtual ~info_get_status_exec_i (void); + + /** @name Operations and attributes from CCM_DDS::PortStatusListener */ + //@{ + + virtual + void on_requested_deadline_missed (::DDS::DataReader_ptr the_reader, + const ::DDS::RequestedDeadlineMissedStatus & status); + + virtual + void on_sample_lost (::DDS::DataReader_ptr the_reader, + const ::DDS::SampleLostStatus & status); + //@} + + private: + ::RG_ResetTopic::CCM_Receiver_Context_var ciao_context_; + }; + + /** + * Provider Executor Implementation Class: info_read1_status_exec_i + */ + + class info_read_status_exec_i + : public virtual ::CCM_DDS::CCM_PortStatusListener, + public virtual ::CORBA::LocalObject + { + public: + info_read_status_exec_i ( + ::RG_ResetTopic::CCM_Receiver_Context_ptr ctx); + virtual ~info_read_status_exec_i (void); + + /** @name Operations and attributes from CCM_DDS::PortStatusListener */ + //@{ + + virtual + void on_requested_deadline_missed (::DDS::DataReader_ptr the_reader, + const ::DDS::RequestedDeadlineMissedStatus & status); + + virtual + void on_sample_lost (::DDS::DataReader_ptr the_reader, + const ::DDS::SampleLostStatus & status); + //@} + + private: + ::RG_ResetTopic::CCM_Receiver_Context_var ciao_context_; + }; + + /** + * Provider Executor Implementation Class: start_reading_exec_i + */ + + class start_reading_exec_i + : public virtual ::CCM_ReaderStarter, + public virtual ::CORBA::LocalObject + { + public: + start_reading_exec_i ( + ::RG_ResetTopic::CCM_Receiver_Context_ptr ctx, + Receiver_exec_i &callback_); + virtual ~start_reading_exec_i (void); + + /** @name Operations and attributes from ReaderStarter */ + //@{ + + virtual + void start_read (const char * topic_name); + + virtual + void set_reader_properties (::CORBA::UShort nr_keys, + ::CORBA::UShort nr_iterations); + //@} + + private: + ::RG_ResetTopic::CCM_Receiver_Context_var ciao_context_; + Receiver_exec_i &callback_; + }; + + /** + * Component Executor Implementation Class: Receiver_exec_i + */ + + class Receiver_exec_i + : public virtual Receiver_Exec, + public virtual ::CORBA::LocalObject + { + public: + Receiver_exec_i (void); + virtual ~Receiver_exec_i (void); + + /** @name Supported operations and attributes. */ + //@{ + + //@} + + /** @name Component attributes and port operations. */ + //@{ + + virtual ::CCM_DDS::CCM_PortStatusListener_ptr + get_info_get_status (void); + + virtual ::CCM_DDS::CCM_PortStatusListener_ptr + get_info_read_status (void); + + virtual ::CCM_ReaderStarter_ptr + get_start_reading (void); + + virtual ::CORBA::UShort iterations (void); + + virtual void iterations (::CORBA::UShort iterations); + + virtual ::CORBA::UShort keys (void); + + virtual void keys (::CORBA::UShort keys); + //@} + + /** @name Operations from Components::SessionComponent. */ + //@{ + virtual void set_session_context (::Components::SessionContext_ptr ctx); + virtual void configuration_complete (void); + virtual void ccm_activate (void); + virtual void ccm_passivate (void); + virtual void ccm_remove (void); + //@} + + /** @name User defined public operations. */ + //@{ + void + start_read (const char * topic_name); + //@} + + private: + ::RG_ResetTopic::CCM_Receiver_Context_var ciao_context_; + + /** @name Component attributes. */ + //@{ + ::CCM_DDS::CCM_PortStatusListener_var ciao_info_get_status_; + ::CCM_DDS::CCM_PortStatusListener_var ciao_info_read_status_; + ::CCM_ReaderStarter_var ciao_start_reading_; + + ::CORBA::UShort iterations_; + + ::CORBA::UShort keys_; + //@} + + /** @name User defined members. */ + //@{ + RG_ResetTopic_Receiver_impl *impl_; + //@} + + /** @name User defined private operations. */ + //@{ + + //@} + }; + + extern "C" RECEIVER_EXEC_Export ::Components::EnterpriseComponent_ptr + create_RG_ResetTopic_Receiver_Impl (void); +} + +#include /**/ "ace/post.h" + +#endif /* ifndef */ diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Receiver/RG_ResetTopic_Receiver_impl.cpp b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Receiver/RG_ResetTopic_Receiver_impl.cpp new file mode 100644 index 00000000000..f25757e9552 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Receiver/RG_ResetTopic_Receiver_impl.cpp @@ -0,0 +1,395 @@ +// $Id$ +#include "RG_ResetTopic_Receiver_impl.h" +#include "tao/ORB_Core.h" +#include "ace/Reactor.h" + +namespace CIAO_RG_ResetTopic_Receiver_Impl +{ + + /** + * Check last + */ + LastSampleChecker::LastSampleChecker (RG_ResetTopic_Receiver_impl &callback, + const ::CORBA::UShort &iterations) + : callback_ (callback) + , iterations_ (iterations) + { + } + + LastSampleChecker::~LastSampleChecker () + { + } + + int + LastSampleChecker::handle_timeout (const ACE_Time_Value &, const void *) + { + ACE_DEBUG ((LM_DEBUG, "Checking if last sample " + "is available in DDS...\n")); + if (this->callback_.check_last ()) + this->callback_.start_read (); + return 0; + } + + /** + * RG_ResetTopic_Receiver_impl + */ + RG_ResetTopic_Receiver_impl::RG_ResetTopic_Receiver_impl ( + ::RG_ResetTopic::CCM_Receiver_Context_ptr ctx, + const ::CORBA::UShort & iterations, + const ::CORBA::UShort & keys) + : ciao_context_ ( + ::RG_ResetTopic::CCM_Receiver_Context::_duplicate (ctx)) + , iterations_ (iterations) + , keys_ (keys) + , expected_per_run_ (keys * iterations) + , checker_ (0) + , topic_name_("") + { + } + + RG_ResetTopic_Receiver_impl::~RG_ResetTopic_Receiver_impl () + { + delete this->checker_; + } + + ACE_Reactor* + RG_ResetTopic_Receiver_impl::reactor (void) + { + ACE_Reactor* reactor = 0; + ::CORBA::Object_var ccm_object = + this->ciao_context_->get_CCM_object(); + if (! ::CORBA::is_nil (ccm_object.in ())) + { + ::CORBA::ORB_var orb = ccm_object->_get_orb (); + if (! ::CORBA::is_nil (orb.in ())) + { + reactor = orb->orb_core ()->reactor (); + } + } + if (reactor == 0) + { + throw ::CORBA::INTERNAL (); + } + return reactor; + } + + void + RG_ResetTopic_Receiver_impl::iterations (::CORBA::UShort iterations) + { + this->iterations_ = iterations; + } + + void + RG_ResetTopic_Receiver_impl::keys (::CORBA::UShort keys) + { + this->keys_= keys; + } + + bool + RG_ResetTopic_Receiver_impl::check_last (void) + { + ::RG_ResetTopic::RG_ResetTopicSampleConnector::Reader_var reader = + this->ciao_context_->get_connection_info_read_data (); + try + { + ACE_DEBUG ((LM_DEBUG, "Receiver_exec_i::check_last - " + "last iteration should be <%02d>\n", + this->iterations_)); + RG_ResetTopicSample datum; + ::CCM_DDS::ReadInfo readinfo; + char key[10]; + ACE_OS::sprintf (key, "KEY_%d", this->keys_); + datum.key = CORBA::string_dup (key); + reader->read_one_last ( + datum, + readinfo, + ::DDS::HANDLE_NIL); + ACE_DEBUG ((LM_DEBUG, "Receiver_exec_i::check_last - " + "last iteration <%02d> - <%02d>\n", + datum.iteration, + this->iterations_)); + return datum.iteration >= this->iterations_; + } + catch (const ::CCM_DDS::InternalError &) + { + ACE_DEBUG ((LM_DEBUG, "INTERNAL ERROR\n")); + } + catch (const ::CCM_DDS::NonExistent &) + { + ACE_DEBUG ((LM_DEBUG, "NONEXISTENT\n")); + } + catch (...) + { + ACE_ERROR ((LM_ERROR, "Receiver_exec_i::check_last: " + "ERROR: Unexpected exception caught\n")); + } + return false; + } + + void + RG_ResetTopic_Receiver_impl::start (const char * topic_name) + { + this->topic_name_ = topic_name; + //only the first time... + if (!this->checker_) + this->test_exception (); + this->set_topic_name_reader (topic_name); + + if (!this->checker_) + ACE_NEW_THROW_EX (this->checker_, + LastSampleChecker (*this, + this->iterations_), + ::CORBA::NO_MEMORY ()); + if (this->reactor ()->schedule_timer (this->checker_, + 0, + ACE_Time_Value (1, 0), + ACE_Time_Value (1, 0)) == -1) + { + ACE_ERROR ((LM_ERROR, "Receiver_exec_i::schedule_timer - " + "ERROR: Error while starting LastSampleChecker\n")); + } + } + + void + RG_ResetTopic_Receiver_impl::start_read (void) + { + if (this->checker_) + { + this->reactor ()->cancel_timer (this->checker_); + } + this->start_reading (); + this->set_topic_name_getter (this->topic_name_.c_str()); + this->start_getting (); + } + + void + RG_ResetTopic_Receiver_impl::check_samples ( + const char * test, + const RG_ResetTopicSampleSeq& samples, + const ::CORBA::UShort& expected) + { + bool error = samples.length () != expected; + if (ACE_OS::strcmp (test, "get") == 0) + { + error = !(samples.length () > 0); + } + if (error) + { + ACE_ERROR ((LM_ERROR, "RG_ResetTopic_Receiver_impl::check_samples - " + "ERROR: Unexpected number of %C samples received: " + "expected <%d> - received <%u>\n", + test, + expected, + samples.length ())); + } + else + { + ACE_DEBUG ((LM_DEBUG, "RG_ResetTopic_Receiver_impl::check_samples - " + "%C Samples found: <%u>\n", + test, + samples.length ())); + } + for (::CORBA::ULong i = 0; + i < samples.length (); + ++i) + { + ACE_DEBUG ((LM_DEBUG, "RG_ResetTopic_Receiver_impl::check_samples - " + "Sample %C: sample <%d> - key <%C> - iteration <%d>\n", + test, + i, + samples[i].key.in (), + samples[i].iteration)); + } + } + + void + RG_ResetTopic_Receiver_impl::test_exception (void) + { + try + { + if (! ::CORBA::is_nil (this->ciao_context_.in ())) + { + ::RG_ResetTopic::RG_ResetTopicSampleConnector::Reader_var reader = + this->ciao_context_->get_connection_info_read_data (); + if (::CORBA::is_nil (reader.in ())) + { + ACE_ERROR ((LM_ERROR, "RG_ResetTopic_Receiver_impl::test_exception - " + "ERROR: Unable to get reader interface from the " + "CIAO context\n")); + return; + } + + RG_ResetTopicSample sample; + ::CCM_DDS::ReadInfo readinfo; + sample.key = CORBA::string_dup ("KEY_1"); + reader->read_one_last (sample, + readinfo, + ::DDS::HANDLE_NIL); + ACE_ERROR ((LM_ERROR, "RG_ResetTopic_Receiver_impl::test_exception - " + "ERROR: No exception caught before topic name has been set\n")); + } + else + { + ACE_ERROR ((LM_ERROR, "RG_ResetTopic_Receiver_impl::test_exception - " + "ERROR: CIAO context seems to be NIL\n")); + } + } + catch (const ::CORBA::BAD_INV_ORDER &) + { + ACE_DEBUG ((LM_DEBUG, "RG_ResetTopic_Receiver_impl::test_exception - " + "Expected BAD_INV_ORDER thrown.\n")); + } + catch (const CORBA::Exception &e) + { + e._tao_print_exception("RG_ResetTopic_Receiver_impl::test_exception - " + "ERROR: Unexpected exception"); + } + catch (...) + { + ACE_ERROR ((LM_ERROR, "RG_ResetTopic_Receiver_impl::test_exception - " + "ERROR: expected and unknown exception caught\n")); + } + } + + void + RG_ResetTopic_Receiver_impl::start_reading (void) + { + ACE_DEBUG ((LM_DEBUG, "RG_ResetTopic_Receiver_impl::start_reading - " + "Start reading\n")); + ::RG_ResetTopic::RG_ResetTopicSampleConnector::Reader_var reader = + this->ciao_context_->get_connection_info_read_data (); + try + { + RG_ResetTopicSampleSeq samples; + ::CCM_DDS::ReadInfoSeq readinfo_seq; + reader->read_all (samples, readinfo_seq); + + this->check_samples ("read", samples, this->expected_per_run_); + } + catch (const CORBA::Exception &e) + { + e._tao_print_exception("RG_ResetTopic_Receiver_impl::start_reading - " + "ERROR: Unexpected exception"); + } + catch (...) + { + ACE_ERROR ((LM_ERROR, "RG_ResetTopic_Receiver_impl::start_reading - " + "ERROR: Caught unknow exception\n")); + } + } + + void + RG_ResetTopic_Receiver_impl::start_getting (void) + { + try + { + ::RG_ResetTopic::RG_ResetTopicSampleConnector::Getter_var getter = + this->ciao_context_->get_connection_info_get_fresh_data (); + if (::CORBA::is_nil (getter.in ())) + { + ACE_DEBUG ((LM_DEBUG, "RG_ResetTopic_Receiver_impl::start_getting - " + "ERROR: Unable to get writer interface from the " + "CIAO context\n")); + return; + } + DDS::Duration_t to; + to.sec = 1; + to.nanosec = 0; + getter->time_out (to); + + RG_ResetTopicSampleSeq samples; + ::CCM_DDS::ReadInfoSeq readinfos; + getter->get_many (samples, readinfos); + this->check_samples ("get", samples); + } + catch (const CORBA::Exception &e) + { + e._tao_print_exception("RG_ResetTopic_Receiver_impl::start_getting - " + "ERROR: Unexpected exception"); + } + catch (...) + { + ACE_ERROR ((LM_ERROR, "RG_ResetTopic_Receiver_impl::start_getting - " + "ERROR: expected and unknown exception caught\n")); + } + } + + void + RG_ResetTopic_Receiver_impl::set_topic_name_reader (const char * topic_name) + { + try + { + ACE_DEBUG ((LM_DEBUG, "RG_ResetTopic_Receiver_impl::set_topic_name_reader - " + "Setting topic name to <%C>\n", topic_name)); + ::RG_ResetTopic::RG_ResetTopicSampleConnector::Reader_var reader = + this->ciao_context_->get_connection_info_read_data (); + if (::CORBA::is_nil (reader.in ())) + { + ACE_ERROR ((LM_ERROR, "ERROR: RG_ResetTopic_Receiver_impl::set_topic_name_reader - " + "Unable to get reader interface\n")); + throw ::CORBA::INTERNAL (); + } + ::CORBA::Object_var cmp = reader->_get_component (); + if (::CORBA::is_nil (cmp.in ())) + { + ACE_ERROR ((LM_ERROR, "ERROR: RG_ResetTopic_Receiver_impl::set_topic_name_reader - " + "Unable to get component interface\n")); + throw ::CORBA::INTERNAL (); + } + ::RG_ResetTopic::RG_ResetTopicSampleConnector::CCM_DDS_State_var conn = + ::RG_ResetTopic::RG_ResetTopicSampleConnector::CCM_DDS_State::_narrow (cmp.in ()); + if (::CORBA::is_nil (conn.in ())) + { + ACE_ERROR ((LM_ERROR, "ERROR: RG_ResetTopic_Receiver_impl::set_topic_name_reader - " + "Unable to narrow connector interface\n")); + throw ::CORBA::INTERNAL (); + } + + conn->topic_name (topic_name); + } + catch (const ::CCM_DDS::NonChangeable &) + { + ACE_ERROR ((LM_ERROR, "ERROR: RG_ResetTopic_Receiver_impl::set_topic_name_reader - " + "Caught NonChangeable exception.\n")); + } + } + + void + RG_ResetTopic_Receiver_impl::set_topic_name_getter (const char * topic_name) + { + try + { + ACE_DEBUG ((LM_DEBUG, "RG_ResetTopic_Receiver_impl::set_topic_name_getter - " + "Setting topic name to <%C>\n", topic_name)); + ::RG_ResetTopic::RG_ResetTopicSampleConnector::Getter_var getter = + this->ciao_context_->get_connection_info_get_fresh_data (); + if (::CORBA::is_nil (getter.in ())) + { + ACE_ERROR ((LM_ERROR, "ERROR: RG_ResetTopic_Receiver_impl::set_topic_name_getter - " + "Unable to get getter interface\n")); + throw ::CORBA::INTERNAL (); + } + ::CORBA::Object_var cmp = getter->_get_component (); + if (::CORBA::is_nil (cmp.in ())) + { + ACE_ERROR ((LM_ERROR, "ERROR: RG_ResetTopic_Receiver_impl::set_topic_name_getter - " + "Unable to get component interface\n")); + throw ::CORBA::INTERNAL (); + } + ::RG_ResetTopic::RG_ResetTopicSampleConnector::CCM_DDS_Event_var conn = + ::RG_ResetTopic::RG_ResetTopicSampleConnector::CCM_DDS_Event::_narrow (cmp.in ()); + if (::CORBA::is_nil (conn.in ())) + { + ACE_ERROR ((LM_ERROR, "ERROR: RG_ResetTopic_Receiver_impl::set_topic_name_getter - " + "Unable to narrow connector interface\n")); + throw ::CORBA::INTERNAL (); + } + conn->topic_name (topic_name); + } + catch (const ::CCM_DDS::NonChangeable &) + { + ACE_ERROR ((LM_ERROR, "RG_ResetTopic_Receiver_impl::set_topic_name_getter - " + "ERROR: Caught NonChangeable exception.\n")); + } + } +} diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Receiver/RG_ResetTopic_Receiver_impl.h b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Receiver/RG_ResetTopic_Receiver_impl.h new file mode 100644 index 00000000000..241ab592731 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Receiver/RG_ResetTopic_Receiver_impl.h @@ -0,0 +1,77 @@ +// $Id$ + +#ifndef RG_RESETTOPIC_RECEIVER_IMPL_H_ +#define RG_RESETTOPIC_RECEIVER_IMPL_H_ + +#include "RG_ResetTopic_ReceiverEC.h" + +namespace CIAO_RG_ResetTopic_Receiver_Impl +{ + class RG_ResetTopic_Receiver_impl; + + /** + * LastSampleChecker + */ + class LastSampleChecker + : public ACE_Event_Handler + { + public: + LastSampleChecker (RG_ResetTopic_Receiver_impl &callback, + const ::CORBA::UShort &iterations); + + virtual ~LastSampleChecker (void); + + virtual int handle_timeout (const ACE_Time_Value &tv, + const void *arg); + private: + RG_ResetTopic_Receiver_impl &callback_; + const ::CORBA::UShort iterations_; + }; + + /** + * RG_ResetTopic_Receiver_impl + */ + class RG_ResetTopic_Receiver_impl + { + public: + RG_ResetTopic_Receiver_impl ( + ::RG_ResetTopic::CCM_Receiver_Context_ptr ctx, + const ::CORBA::UShort & iterations, + const ::CORBA::UShort & keys); + ~RG_ResetTopic_Receiver_impl (void); + + void start (const char * topic_name); + bool check_last (void); + void start_read (void); + + + void iterations (::CORBA::UShort iterations); + void keys (::CORBA::UShort keys); + + private: + ::RG_ResetTopic::CCM_Receiver_Context_var ciao_context_; + ::CORBA::UShort iterations_; + ::CORBA::UShort keys_; + ::CORBA::UShort expected_per_run_; + + LastSampleChecker * checker_; + + ACE_CString topic_name_; + + void set_topic_name_reader (const char * topic_name); + void set_topic_name_getter (const char * topic_name); + + void start_reading (void); + void start_getting (void); + void test_exception (void); + + void check_samples ( + const char * test, + const RG_ResetTopicSampleSeq& samples, + const ::CORBA::UShort& expected=0); + + ACE_Reactor* reactor (void); + }; +}; + +#endif /* RG_RESETTOPIC_RECEIVER_IMPL_H_ */ diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Sender/RG_ResetTopic_Sender.idl b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Sender/RG_ResetTopic_Sender.idl new file mode 100644 index 00000000000..218682613f5 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Sender/RG_ResetTopic_Sender.idl @@ -0,0 +1,29 @@ +// $Id$ + +/** + * @file + * @author Marcel Smit <msmit@remedy.nl> + * + * by-hand idl3 translation of sender components. + */ + +#ifndef RG_RESETTOPIC_SENDER_IDL +#define RG_RESETTOPIC_SENDER_IDL + +#include "Connector/RG_ResetTopic_Connector.idl" +#include "Base/Reader_Starter.idl" + +module RG_ResetTopic +{ + component Sender + { + port RG_ResetTopicSampleConnector::DDS_Write info_write; + + attribute unsigned short iterations; + attribute unsigned short keys; + + uses ReaderStarter reader_start; + }; +}; + +#endif diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Sender/RG_ResetTopic_Sender.mpc b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Sender/RG_ResetTopic_Sender.mpc new file mode 100644 index 00000000000..b2ee15acdb8 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Sender/RG_ResetTopic_Sender.mpc @@ -0,0 +1,152 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -p RG_ResetTopicBase -l ../lib -o ../lib -c controller -u DDS Sender" + +project (RG_ResetTopicSender_idl_gen) : componentidldefaults, dds4ccm { + after += RG_ResetTopicConnector_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 { + RG_ResetTopic_Sender.idl + } +} + +project (RG_ResetTopicSender_lem_gen) : ciaoidldefaults, dds4ccm { + after += RG_ResetTopicSender_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 { + RG_ResetTopic_SenderE.idl + } +} + +project (RG_ResetTopicSender_lem_stub) : ccm_svnt, dds4ccm_base { + after += RG_ResetTopicSender_lem_gen RG_ResetTopicSender_stub \ + RG_ResetTopicBase_stub reader_starter_rt_stub + libs += RG_ResetTopicBase_stub Sender_stub reader_starter_rt_stub + libpaths += ../lib + libout = ../lib + includes += .. + sharedname = Sender_lem_stub + dynamicflags += SENDER_LEM_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + RG_ResetTopic_SenderEC.cpp + } + + Header_Files { + RG_ResetTopic_SenderEC.h + Sender_lem_stub_export.h + } + + Inline_Files { + RG_ResetTopic_SenderEC.inl + } +} + +project (RG_ResetTopicSender_stub) : ccm_stub, dds4ccm_base { + after += RG_ResetTopicSender_idl_gen RG_ResetTopicBase_stub \ + RG_ResetTopicConnector_stub reader_starter_rt_stub \ + reader_starter_rt_lem_stub + libs += RG_ResetTopicBase_stub RG_ResetTopicConnector_stub \ + reader_starter_rt_stub + includes += .. + libpaths += ../lib + libout = ../lib + sharedname = Sender_stub + dynamicflags += SENDER_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + RG_ResetTopic_SenderC.cpp + } + + Header_Files { + RG_ResetTopic_SenderC.h + Sender_stub_export.h + } + + Inline_Files { + RG_ResetTopic_SenderC.inl + } +} + +project (RG_ResetTopicSender_exec) : ciao_executor, dds4ccm_lem_stub { + after += RG_ResetTopicSender_lem_stub RG_ResetTopicSender_stub \ + RG_ResetTopicConnector_lem_stub RG_ResetTopicConnector_stub \ + reader_starter_rt_svnt reader_starter_rt_lem_stub + sharedname = Sender_exec + libs += Sender_stub Sender_lem_stub RG_ResetTopicBase_stub \ + RG_ResetTopicConnector_lem_stub RG_ResetTopicConnector_stub \ + reader_starter_rt_stub reader_starter_rt_svnt reader_starter_rt_lem_stub + libpaths += ../lib + includes += .. + libout = ../lib + dynamicflags += SENDER_EXEC_BUILD_DLL + + IDL_Files { + } + + Source_Files { + RG_ResetTopic_Sender_exec.cpp + } + + Header_Files { + RG_ResetTopic_Sender_exec.h + Sender_exec_export.h + } + + Inline_Files { + } +} + + +project (RG_ResetTopicSender_svnt) : ciao_servant, dds4ccm_lem_stub, dds4ccm_skel { + after += RG_ResetTopicBase_stub RG_ResetTopicSender_lem_stub RG_ResetTopicConnector_stub \ + RG_ResetTopicConnector_svnt RG_ResetTopicConnector_lem_stub \ + reader_starter_rt_stub reader_starter_rt_lem_stub reader_starter_rt_svnt + sharedname = Sender_svnt + libs += Sender_stub Sender_lem_stub \ + RG_ResetTopicBase_stub RG_ResetTopicConnector_stub RG_ResetTopicConnector_svnt \ + RG_ResetTopicConnector_lem_stub reader_starter_rt_stub \ + reader_starter_rt_lem_stub reader_starter_rt_svnt + libpaths += ../lib + libout = ../lib + includes += .. + dynamicflags += SENDER_SVNT_BUILD_DLL + + IDL_Files { + } + + Source_Files { + RG_ResetTopic_SenderS.cpp + RG_ResetTopic_Sender_svnt.cpp + } + + Header_Files { + RG_ResetTopic_SenderS.h + RG_ResetTopic_Sender_svnt.h + Sender_svnt_export.h + } + + Inline_Files { + RG_ResetTopic_SenderS.inl + } +} + diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Sender/RG_ResetTopic_Sender_exec.cpp b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Sender/RG_ResetTopic_Sender_exec.cpp new file mode 100644 index 00000000000..1fa28b59098 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Sender/RG_ResetTopic_Sender_exec.cpp @@ -0,0 +1,257 @@ +// -*- C++ -*- +// $Id$ + +#include "RG_ResetTopic_Sender_exec.h" +#include "tao/ORB_Core.h" +#include "ace/Reactor.h" + +#define TOPIC_1 "ResetTopic1" +#define TOPIC_2 "ResetTopic2" + + +namespace CIAO_RG_ResetTopic_Sender_Impl +{ + + /** + * Timeout_Handler + */ + + Timeout_Handler::Timeout_Handler (Sender_exec_i &callback) + : callback_ (callback) + { + } + + int + Timeout_Handler::handle_timeout (const ACE_Time_Value &, const void *) + { + this->callback_.start_write (); + return 0; + } + + /** + * Component Executor Implementation Class: Sender_exec_i + */ + + Sender_exec_i::Sender_exec_i (void) + : iterations_ (0) + , keys_ (0) + , topic_name_ (TOPIC_2) + , run_(0) + , start_key_ (1) + , start_iteration_ (1) + { + } + + Sender_exec_i::~Sender_exec_i (void) + { + } + + // Supported operations and attributes. + ACE_Reactor* + Sender_exec_i::reactor (void) + { + ACE_Reactor* reactor = 0; + ::CORBA::Object_var ccm_object = + this->ciao_context_->get_CCM_object(); + if (! ::CORBA::is_nil (ccm_object.in ())) + { + ::CORBA::ORB_var orb = ccm_object->_get_orb (); + if (! ::CORBA::is_nil (orb.in ())) + { + reactor = orb->orb_core ()->reactor (); + } + } + if (reactor == 0) + { + throw ::CORBA::INTERNAL (); + } + return reactor; + } + + void + Sender_exec_i::start_write (void) + { + try + { + if (++this->run_ > 4) + return; + if (ACE_OS::strcmp (this->topic_name_.c_str(), TOPIC_1) == 0) + this->topic_name_ = TOPIC_2; + else + this->topic_name_ = TOPIC_1; + + ACE_DEBUG ((LM_DEBUG, "Sender_exec_i::start_write - " + "Setting topic name to <%C>\n", this->topic_name_.c_str())); + + ::RG_ResetTopic::RG_ResetTopicSampleConnector::Writer_var writer = + this->ciao_context_->get_connection_info_write_data (); + if (::CORBA::is_nil (writer.in ())) + { + ACE_ERROR ((LM_ERROR, "ERROR: Sender_exec_i::start_write - " + "Unable to get writer interface\n")); + throw ::CORBA::INTERNAL (); + } + ::CORBA::Object_var cmp = writer->_get_component (); + if (::CORBA::is_nil (cmp.in ())) + { + ACE_ERROR ((LM_ERROR, "ERROR: Sender_exec_i::start_write - " + "Unable to get component interface\n")); + throw ::CORBA::INTERNAL (); + } + ::RG_ResetTopic::RG_ResetTopicSampleConnector::CCM_DDS_Event_var conn = + ::RG_ResetTopic::RG_ResetTopicSampleConnector::CCM_DDS_Event::_narrow (cmp.in ()); + if (::CORBA::is_nil (conn.in ())) + { + ACE_ERROR ((LM_ERROR, "ERROR: Sender_exec_i::start_write - " + "Unable to narrow connector interface\n")); + throw ::CORBA::INTERNAL (); + } + + conn->topic_name (::CORBA::string_dup (this->topic_name_.c_str())); + + ::CORBA::UShort key = 0; + ::CORBA::UShort iter = 0; + for (key = this->start_key_; key < this->run_ * this->keys_ + 1; ++key) + { + RG_ResetTopicSample sample; + char tmp[7]; + ACE_OS::sprintf (tmp, "KEY_%d", key); + sample.key = CORBA::string_dup(tmp); + + for (iter = this->start_iteration_; iter < this->run_ * this->iterations_ + 1; ++iter) + { + sample.iteration = iter; + writer->write_one (sample, ::DDS::HANDLE_NIL); + ACE_DEBUG ((LM_DEBUG, "Sender_exec_i::start_event_test - " + "Sample written : key <%C> - iteration <%d>\n", + tmp, iter)); + } + } + this->start_key_ = key; + this->start_iteration_ = iter; + ACE_Time_Value tv (2, 0); + ACE_OS::sleep (tv); + ReaderStarter_var starter = + this->ciao_context_->get_connection_reader_start (); + if (!::CORBA::is_nil (starter.in ())) + { + ACE_DEBUG ((LM_DEBUG, "Sender_exec_i::start_event_test - " + "Inform the receiver that all samples were written\n")); + starter->set_reader_properties (this->start_key_ - 1, this->start_iteration_ - 1); + + starter->start_read (::CORBA::string_dup(this->topic_name_.c_str())); + } + else + { + ACE_ERROR ((LM_ERROR, "Sender_exec_i::start_event_test - " + "ERROR: unable to get connection to the ReaderStarter\n")); + } + } + catch (const ::CCM_DDS::NonChangeable &) + { + ACE_ERROR ((LM_ERROR, "Sender_exec_i::start_event_test - " + "ERROR: Caught NonChangeable exception.\n")); + } + catch (const ::CORBA::Exception & e) + { + e._tao_print_exception("Sender_exec_i::start_event_test - ERROR"); + } + catch (...) + { + ACE_ERROR ((LM_ERROR, "Sender_exec_i::start_event_test - " + "ERROR: Unexpected and unknown exception caught.\n")); + } + } + + + // Component attributes and port operations. + + ::CORBA::UShort + Sender_exec_i::iterations (void) + { + return this->iterations_; + } + + void + Sender_exec_i::iterations ( + const ::CORBA::UShort iterations) + { + this->iterations_ = iterations; + } + + ::CORBA::UShort + Sender_exec_i::keys (void) + { + return this->keys_; + } + + void + Sender_exec_i::keys ( + const ::CORBA::UShort keys) + { + this->keys_ = keys; + } + + // Operations from Components::SessionComponent. + + void + Sender_exec_i::set_session_context ( + ::Components::SessionContext_ptr ctx) + { + this->ciao_context_ = + ::RG_ResetTopic::CCM_Sender_Context::_narrow (ctx); + + if ( ::CORBA::is_nil (this->ciao_context_.in ())) + { + throw ::CORBA::INTERNAL (); + } + } + + void + Sender_exec_i::configuration_complete (void) + { + /* Your code here. */ + } + + void + Sender_exec_i::ccm_activate (void) + { + ACE_NEW_THROW_EX (this->to_handler_, + Timeout_Handler (*this), + ::CORBA::INTERNAL ()); + if (this->reactor ()->schedule_timer ( + this->to_handler_, + 0, + ACE_Time_Value (1, 0), + ACE_Time_Value (10, 0)) == -1) + { + ACE_ERROR ((LM_ERROR, ACE_TEXT ("Sender_exec_i::start : ") + ACE_TEXT ("Error scheduling timer"))); + } + } + + void + Sender_exec_i::ccm_passivate (void) + { + this->reactor()->cancel_timer(this->to_handler_); + } + + void + Sender_exec_i::ccm_remove (void) + { + delete this->to_handler_; + } + + extern "C" SENDER_EXEC_Export ::Components::EnterpriseComponent_ptr + create_RG_ResetTopic_Sender_Impl (void) + { + ::Components::EnterpriseComponent_ptr retval = + ::Components::EnterpriseComponent::_nil (); + + ACE_NEW_NORETURN ( + retval, + Sender_exec_i); + + return retval; + } +} diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Sender/RG_ResetTopic_Sender_exec.h b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Sender/RG_ResetTopic_Sender_exec.h new file mode 100644 index 00000000000..66c55bfa8d9 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Sender/RG_ResetTopic_Sender_exec.h @@ -0,0 +1,139 @@ +// -*- C++ -*- +// $Id$ + +/** + * Code generated by the The ACE ORB (TAO) IDL Compiler v1.8.2 + * TAO and the TAO IDL Compiler have been developed by: + * Center for Distributed Object Computing + * Washington University + * St. Louis, MO + * USA + * http://www.cs.wustl.edu/~schmidt/doc-center.html + * and + * Distributed Object Computing Laboratory + * University of California at Irvine + * Irvine, CA + * USA + * and + * Institute for Software Integrated Systems + * Vanderbilt University + * Nashville, TN + * USA + * http://www.isis.vanderbilt.edu/ + * + * Information about TAO is available at: + * http://www.cs.wustl.edu/~schmidt/TAO.html + **/ +#ifndef CIAO_RG_RESETTOPIC_SENDER_EXEC_YSJ9S8_H_ +#define CIAO_RG_RESETTOPIC_SENDER_EXEC_YSJ9S8_H_ + +#include /**/ "ace/pre.h" + +#include "RG_ResetTopic_SenderEC.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include /**/ "Sender_exec_export.h" +#include "tao/LocalObject.h" + +namespace CIAO_RG_ResetTopic_Sender_Impl +{ + class Sender_exec_i; + + /** + * Timeout_Handler + */ + class Timeout_Handler : + public ACE_Event_Handler + { + public: + Timeout_Handler (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 &callback_; + }; + + /** + * Component Executor Implementation Class: Sender_exec_i + */ + + class Sender_exec_i + : public virtual Sender_Exec, + public virtual ::CORBA::LocalObject + { + public: + Sender_exec_i (void); + virtual ~Sender_exec_i (void); + + //@{ + /** Supported operations and attributes. */ + + //@} + + //@{ + /** Component attributes and port operations. */ + + virtual ::CORBA::UShort iterations (void); + + virtual void iterations (::CORBA::UShort iterations); + + virtual ::CORBA::UShort keys (void); + + virtual void keys (::CORBA::UShort keys); + //@} + + //@{ + /** 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); + //@} + + //@{ + /** User defined public operations. */ + void start_write (void); + //@} + + private: + ::RG_ResetTopic::CCM_Sender_Context_var ciao_context_; + + //@{ + /** Component attributes. */ + + ::CORBA::UShort iterations_; + + ::CORBA::UShort keys_; + //@} + + //@{ + /** User defined members. */ + Timeout_Handler *to_handler_; + ACE_CString topic_name_; + ::CORBA::UShort run_; + ::CORBA::UShort start_key_; + ::CORBA::UShort start_iteration_; + //@} + + //@{ + /** User defined private operations. */ + + //@} + + /// Get the ACE_Reactor + ACE_Reactor* reactor (void); + }; + + extern "C" SENDER_EXEC_Export ::Components::EnterpriseComponent_ptr + create_RG_ResetTopic_Sender_Impl (void); +} + +#include /**/ "ace/post.h" + +#endif /* ifndef */ diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/descriptors/Plan.cdp b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/descriptors/Plan.cdp new file mode 100644 index 00000000000..b47fe050e3c --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/descriptors/Plan.cdp @@ -0,0 +1,461 @@ +<!-- $Id$ --> +<Deployment:DeploymentPlan + xmlns:Deployment="http://www.omg.org/Deployment" + xmlns:xmi="http://www.omg.org/XMI" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.omg.org/Deployment Deployment.xsd"> + <label>ResetTopic_Depl_1</label> + <UUID>ResetTopic_Depl_1</UUID> + + <implementation xmi:id="ReceiverComponentImplementation"> + <name>ReceiverComponentImplementation</name> + <source/> + <artifact xmi:idref="Receiver_ExecArtifact" /> + <artifact xmi:idref="Receiver_SvntArtifact" /> + <execParameter> + <name>component factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_RG_ResetTopic_Receiver_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_RG_ResetTopic_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="ResetTopic_EventConnectorImplementation"> + <name>ResetTopic_EventConnectorImplementation</name> + <source/> + <artifact xmi:idref="ResetTopic_Connector_ExecArtifact" /> + <artifact xmi:idref="ResetTopic_Connector_SvntArtifact" /> + <execParameter> + <name>component factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_RG_ResetTopic_RG_ResetTopicSampleConnector_DDS_Event_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_RG_ResetTopic_RG_ResetTopicSampleConnector_DDS_Event_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>RG_ResetTopic_Connector_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>RG_ResetTopic_Connector_exec</string> + </value> + </value> + </execParameter> + </implementation> + + <implementation xmi:id="ResetTopic_StateConnectorImplementation"> + <name>ResetTopic_StateConnectorImplementation</name> + <source/> + <artifact xmi:idref="ResetTopic_Connector_ExecArtifact" /> + <artifact xmi:idref="ResetTopic_Connector_SvntArtifact" /> + <execParameter> + <name>component factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_RG_ResetTopic_RG_ResetTopicSampleConnector_DDS_State_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_RG_ResetTopic_RG_ResetTopicSampleConnector_DDS_State_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>RG_ResetTopic_Connector_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>RG_ResetTopic_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> + <name>component factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_RG_ResetTopic_Sender_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_RG_ResetTopic_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> + <source/> + <implementation xmi:idref="ReceiverComponentImplementation" /> + </instance> + + <instance xmi:id="ResetTopic_SenderEventConnectorInstance"> + <name>ResetTopic_SenderEventConnectorInstance</name> + <node>SenderNode</node> + <source/> + <implementation xmi:idref="ResetTopic_EventConnectorImplementation" /> + <configProperty> + <name>topic_name</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>ResetTopic1</string> + </value> + </value> + </configProperty> + <configProperty> + <name>qos_profile</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>ResetTopic_Library#ResetTopic_Profile</string> + </value> + </value> + </configProperty> + </instance> + + <instance xmi:id="ResetTopic_ReceiverEventConnectorInstance"> + <name>ResetTopic_ReceiverEventConnectorInstance</name> + <node>ReceiverNode</node> + <source/> + <implementation xmi:idref="ResetTopic_EventConnectorImplementation" /> + <configProperty> + <name>topic_name</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string></string> + </value> + </value> + </configProperty> + <configProperty> + <name>qos_profile</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>ResetTopic_Library#ResetTopic_Profile</string> + </value> + </value> + </configProperty> + </instance> + + <instance xmi:id="ResetTopic_ReceiverStateConnectorInstance"> + <name>ResetTopic_ReceiverStateConnectorInstance</name> + <node>ReceiverNode</node> + <source/> + <implementation xmi:idref="ResetTopic_StateConnectorImplementation" /> + <configProperty> + <name>topic_name</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string></string> + </value> + </value> + </configProperty> + <configProperty> + <name>qos_profile</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>ResetTopic_Library#ResetTopic_Profile</string> + </value> + </value> + </configProperty> + </instance> + + <instance xmi:id="SenderComponentInstance"> + <name>SenderComponent</name> + <node>SenderNode</node> + <source/> + <implementation xmi:idref="SenderComponentImplementation" /> + <configProperty> + <name>keys</name> + <value> + <type> + <kind>tk_ushort</kind> + </type> + <value> + <ushort>5</ushort> + </value> + </value> + </configProperty> + <configProperty> + <name>iterations</name> + <value> + <type> + <kind>tk_ushort</kind> + </type> + <value> + <ushort>10</ushort> + </value> + </value> + </configProperty> + </instance> + + <connection> + <name>reader_starter</name> + <internalEndpoint> + <portName>reader_start</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="SenderComponentInstance" /> + </internalEndpoint> + <internalEndpoint> + <portName>start_reading</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="ReceiverComponentInstance" /> + </internalEndpoint> + </connection> + + <connection> + <name>reader_connection</name> + <deployRequirement> + <name>edu.dre.vanderbilt.DAnCE.ConnectionType</name> + <resourceType>Local_Interface</resourceType> + </deployRequirement> + <internalEndpoint> + <portName>info_read_data</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="ReceiverComponentInstance" /> + </internalEndpoint> + <internalEndpoint> + <portName>passive_observer_data</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="ResetTopic_ReceiverStateConnectorInstance" /> + </internalEndpoint> + </connection> + + <connection> + <name>getter_connection</name> + <deployRequirement> + <name>edu.dre.vanderbilt.DAnCE.ConnectionType</name> + <resourceType>Local_Interface</resourceType> + </deployRequirement> + <internalEndpoint> + <portName>info_get_fresh_data</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="ReceiverComponentInstance" /> + </internalEndpoint> + <internalEndpoint> + <portName>pull_consumer_fresh_data</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="ResetTopic_ReceiverEventConnectorInstance" /> + </internalEndpoint> + </connection> + + <connection> + <name>writer_connection</name> + <deployRequirement> + <name>edu.dre.vanderbilt.DAnCE.ConnectionType</name> + <resourceType>Local_Interface</resourceType> + </deployRequirement> + <internalEndpoint> + <portName>info_write_data</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="SenderComponentInstance" /> + </internalEndpoint> + <internalEndpoint> + <portName>supplier_data</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="ResetTopic_SenderEventConnectorInstance" /> + </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="ResetTopic_Connector_ExecArtifact"> + <name>RG_ResetTopic_Connector_exec</name> + <source/> + <node/> + <location>RG_ResetTopicConnector_exec</location> + </artifact> + <artifact xmi:id="ResetTopic_Connector_SvntArtifact"> + <name>RG_ResetTopic_Connector_svnt</name> + <source/> + <node/> + <location>RG_ResetTopicConnector_svnt</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/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/descriptors/USER_QOS_PROFILES.xml b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/descriptors/USER_QOS_PROFILES.xml new file mode 100644 index 00000000000..55c5d7657cd --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/descriptors/USER_QOS_PROFILES.xml @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="utf-8"?> +<dds xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="c:/ndds/ndds.4.5d/scripts/../resource/rtiddsgen/../qos_profiles_4.5d/schema/rti_dds_qos_profiles.xsd" version="4.5d"> + <qos_library name="ResetTopic_Library"> + <qos_profile name="ResetTopic_Profile" is_default_qos="true"> + <datawriter_qos> + <reliability> + <kind>RELIABLE_RELIABILITY_QOS</kind> + <max_blocking_time> + <sec>10</sec> + <nanosec>0</nanosec> + </max_blocking_time> + </reliability> + <durability> + <kind>TRANSIENT_DURABILITY_QOS</kind> + </durability> + <history> + <kind>KEEP_ALL_HISTORY_QOS</kind> + </history> + <protocol> + <rtps_reliable_writer> + <max_heartbeat_retries>10</max_heartbeat_retries> + </rtps_reliable_writer> + </protocol> + </datawriter_qos> + <datareader_qos> + <reliability> + <kind>RELIABLE_RELIABILITY_QOS</kind> + </reliability> + <history> + <kind>KEEP_ALL_HISTORY_QOS</kind> + </history> + <durability> + <kind>TRANSIENT_LOCAL_DURABILITY_QOS</kind> + </durability> + </datareader_qos> + </qos_profile> + </qos_library> +</dds> diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/descriptors/run_test.pl b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/descriptors/run_test.pl new file mode 100755 index 00000000000..5eb32d70c34 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/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 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 60 seconds to allow task to complete\n"; +sleep (60); + +# Invoke executor - stop the application -. +print "Invoking executor - stop the application -\n"; +print "by running dance_plan_launcher.exe with -k file://$ior_emfile -x $cdp_file\n"; + +$E = $tg_executor->CreateProcess ("$DANCE_ROOT/bin/dance_plan_launcher", + "-k file://$ior_emfile -x $cdp_file -s"); +$pl_status = $E->SpawnWaitKill ($tg_executor->ProcessStartWaitInterval ()); + +if ($pl_status != 0) { + print STDERR "ERROR: dance_plan_launcher returned $pl_status\n"; + kill_open_processes (); + exit 1; +} + +print "Executor returned.\n"; +print "Shutting down rest of the processes.\n"; + +delete_ior_files (); +kill_open_processes (); + +exit $status; |