diff options
author | msmit <msmit@remedy.nl> | 2010-02-08 11:18:25 +0000 |
---|---|---|
committer | msmit <msmit@remedy.nl> | 2010-02-08 11:18:25 +0000 |
commit | aca71f55eaa2704b657977c609fb848f3dbdeafa (patch) | |
tree | 95de975fd164ef199165f6a3fb76db01aab0b869 /CIAO/connectors/dds4ccm/tests/CSLQoS/Receiver | |
parent | 5c35cd8f650949db1f910e39f719398df2fee63b (diff) | |
download | ATCD-aca71f55eaa2704b657977c609fb848f3dbdeafa.tar.gz |
Mon Feb 8 11:15:00 UTC 2010 Marcel Smit <msmit@remedy.nl>
* connectors/dds4ccm/tests/CSLQoS/Receiver/CSL_QoSTest_Receiver_exec.h:
* connectors/dds4ccm/tests/CSLQoS/Receiver/CSL_QoSTest_Receiver_exec.cpp:
* connectors/dds4ccm/tests/CSLUnexpStat/Receiver/CSL_USTest_Receiver_exec.h:
* connectors/dds4ccm/tests/CSLUnexpStat/Receiver/CSL_USTest_Receiver_exec.cpp:
Added test scenario for thread switch.
* connectors/dds4ccm/tests/CSLDeadline/Receiver/CSL_DeadlineTest_Receiver_exec.cpp:
* connectors/dds4ccm/tests/CSLSampleRejected/Receiver/CSL_SRTest_Receiver_exec.cpp:
* connectors/dds4ccm/tests/ListenOneByOne/Receiver/LOBO_Test_Receiver_exec.cpp:
* connectors/dds4ccm/tests/PSLSampleLost/Receiver/PSL_SampleLost_Receiver_exec.cpp:
* connectors/dds4ccm/tests/SLOneByOne/Receiver/SL_OneByOne_Receiver_exec.cpp:
Optimized logging regarding thread switch test.
Diffstat (limited to 'CIAO/connectors/dds4ccm/tests/CSLQoS/Receiver')
-rw-r--r-- | CIAO/connectors/dds4ccm/tests/CSLQoS/Receiver/CSL_QoSTest_Receiver_exec.cpp | 165 | ||||
-rw-r--r-- | CIAO/connectors/dds4ccm/tests/CSLQoS/Receiver/CSL_QoSTest_Receiver_exec.h | 65 |
2 files changed, 125 insertions, 105 deletions
diff --git a/CIAO/connectors/dds4ccm/tests/CSLQoS/Receiver/CSL_QoSTest_Receiver_exec.cpp b/CIAO/connectors/dds4ccm/tests/CSLQoS/Receiver/CSL_QoSTest_Receiver_exec.cpp index 84415f26e19..b76005f1dda 100644 --- a/CIAO/connectors/dds4ccm/tests/CSLQoS/Receiver/CSL_QoSTest_Receiver_exec.cpp +++ b/CIAO/connectors/dds4ccm/tests/CSLQoS/Receiver/CSL_QoSTest_Receiver_exec.cpp @@ -11,10 +11,12 @@ namespace CIAO_CSL_QoSTest_Receiver_Impl { //============================================================ - // Facet Executor Implementation Class: ConnectorStatusListener_exec_i + // ConnectorStatusListener_exec_i //============================================================ - ConnectorStatusListener_exec_i::ConnectorStatusListener_exec_i (Atomic_Boolean &incompatible) - : incompatible_ (incompatible) + ConnectorStatusListener_exec_i::ConnectorStatusListener_exec_i (Atomic_Boolean &incompatible, + Atomic_ThreadId &thread_id) + : incompatible_ (incompatible), + thread_id_ (thread_id) { } @@ -24,44 +26,51 @@ namespace CIAO_CSL_QoSTest_Receiver_Impl // Operations from ::CCM_DDS::ConnectorStatusListener void ConnectorStatusListener_exec_i::on_inconsistent_topic( - ::DDS::Topic_ptr /*the_topic*/, - const DDS::InconsistentTopicStatus & /*status*/) - { - } + ::DDS::Topic_ptr /*the_topic*/, + const DDS::InconsistentTopicStatus & /*status*/) + { + } - void ConnectorStatusListener_exec_i::on_requested_incompatible_qos( + void ConnectorStatusListener_exec_i::on_requested_incompatible_qos ( ::DDS::DataReader_ptr the_reader, - const DDS::RequestedIncompatibleQosStatus & /*status*/) { - if(!CORBA::is_nil(the_reader)) - { - this->incompatible_ = true; - } - } - void ConnectorStatusListener_exec_i::on_sample_rejected( - ::DDS::DataReader_ptr /*the_reader*/, - const DDS::SampleRejectedStatus & /*status*/) { - } - - void ConnectorStatusListener_exec_i::on_offered_deadline_missed( - ::DDS::DataWriter_ptr /*the_writer*/, - const DDS::OfferedDeadlineMissedStatus & /*status*/) { - } - - void ConnectorStatusListener_exec_i::on_offered_incompatible_qos( - ::DDS::DataWriter_ptr /*the_writer*/, - const DDS::OfferedIncompatibleQosStatus & /*status*/) { - } - - void ConnectorStatusListener_exec_i::on_unexpected_status( + const DDS::RequestedIncompatibleQosStatus & /*status*/) + { + this->thread_id_ = ACE_Thread::self (); + if(!CORBA::is_nil(the_reader)) + { + this->incompatible_ = true; + } + } + + void ConnectorStatusListener_exec_i::on_sample_rejected ( + ::DDS::DataReader_ptr /*the_reader*/, + const DDS::SampleRejectedStatus & /*status*/) + { + } + + void ConnectorStatusListener_exec_i::on_offered_deadline_missed ( + ::DDS::DataWriter_ptr /*the_writer*/, + const DDS::OfferedDeadlineMissedStatus & /*status*/) + { + } + + void ConnectorStatusListener_exec_i::on_offered_incompatible_qos ( + ::DDS::DataWriter_ptr /*the_writer*/, + const DDS::OfferedIncompatibleQosStatus & /*status*/) + { + } + + void ConnectorStatusListener_exec_i::on_unexpected_status ( ::DDS::Entity_ptr /*the_entity*/, - ::DDS::StatusKind /*status_kind */) { - } + ::DDS::StatusKind /*status_kind */) + { + } //============================================================ - // Facet Executor Implementation Class: TestTopic_RawListener_exec_i + // TestTopic_RawListener_exec_i //============================================================ TestTopic_RawListener_exec_i::TestTopic_RawListener_exec_i (Atomic_ULong &received) - : received_ (received) + : received_ (received) { } @@ -88,40 +97,14 @@ namespace CIAO_CSL_QoSTest_Receiver_Impl const ::CCM_DDS::ReadInfoSeq & /* info */) { } - //============================================================ - // Facet Executor Implementation Class: PortStatusListener_exec_i - //============================================================ - - PortStatusListener_exec_i::PortStatusListener_exec_i (void) - { - } - - PortStatusListener_exec_i::~PortStatusListener_exec_i (void) - { - } - - // Operations from ::CCM_DDS::PortStatusListener - - void - PortStatusListener_exec_i::on_requested_deadline_missed ( - ::DDS::DataReader_ptr /* the_reader */, - const ::DDS::RequestedDeadlineMissedStatus & /* status */) - { - } - - void - PortStatusListener_exec_i::on_sample_lost ( - ::DDS::DataReader_ptr /* the_reader */, - const ::DDS::SampleLostStatus & /* status */) - { - } //============================================================ // Component Executor Implementation Class: Receiver_exec_iTestTopic_RawListener_exec_i (); //============================================================ - Receiver_exec_i::Receiver_exec_i (void) - : incompatible_ (false) + : incompatible_ (false), + received_ (0), + thread_id_listener_ (0) { } @@ -129,9 +112,6 @@ namespace CIAO_CSL_QoSTest_Receiver_Impl { } - // Supported operations and attributes. - // Component attributes. - // Port operations. ::CCM_DDS::TestTopic::CCM_Listener_ptr Receiver_exec_i::get_info_out_data_listener (void) { @@ -143,13 +123,14 @@ namespace CIAO_CSL_QoSTest_Receiver_Impl Receiver_exec_i::get_info_out_status (void) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("new PortStatuslistener\n"))); - return new PortStatusListener_exec_i (); + return ::CCM_DDS::CCM_PortStatusListener::_nil (); } ::CCM_DDS::CCM_ConnectorStatusListener_ptr Receiver_exec_i::get_info_out_connector_status (void) { - return new ConnectorStatusListener_exec_i (this->incompatible_); + return new ConnectorStatusListener_exec_i (this->incompatible_, + this->thread_id_listener_); } // Operations from Components::SessionComponent. @@ -192,7 +173,7 @@ namespace CIAO_CSL_QoSTest_Receiver_Impl void Receiver_exec_i::ccm_remove (void) { - if(!this->incompatible_.value ()) + if (!this->incompatible_.value ()) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("ERROR: did not receive the expected ") ACE_TEXT ("error 'on_requested_incompatible_Qos' in Receiver\n") @@ -200,10 +181,54 @@ namespace CIAO_CSL_QoSTest_Receiver_Impl } else { - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Received the expected ") + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("OK : Received the expected ") ACE_TEXT ("'on_requested_incompatible_Qos' in Receiver\n") )); } + if (this->thread_id_listener_.value () == 0) + { + ACE_ERROR ((LM_ERROR, "ERROR: " + "Thread ID for ConnectorStatusListener not set!\n")); + } + #if defined (CIAO_DDS4CCM_CONTEXT_SWITCH) && (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 ConnectorStatusListener 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 ConnectorStatusListener " + "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: ConnectorStatusListener: " + "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 : ConnectorStatusListener: " + "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 diff --git a/CIAO/connectors/dds4ccm/tests/CSLQoS/Receiver/CSL_QoSTest_Receiver_exec.h b/CIAO/connectors/dds4ccm/tests/CSLQoS/Receiver/CSL_QoSTest_Receiver_exec.h index d99f0b3df24..c7757593c67 100644 --- a/CIAO/connectors/dds4ccm/tests/CSLQoS/Receiver/CSL_QoSTest_Receiver_exec.h +++ b/CIAO/connectors/dds4ccm/tests/CSLQoS/Receiver/CSL_QoSTest_Receiver_exec.h @@ -13,16 +13,21 @@ #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "tao/LocalObject.h" -#include "ace/Task.h" +#include "ace/OS_NS_Thread.h" #include "ace/Reactor.h" +#include "ace/Task.h" namespace CIAO_CSL_QoSTest_Receiver_Impl { typedef ACE_Atomic_Op <TAO_SYNCH_MUTEX, CORBA::ULong > Atomic_ULong; 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; - + + //============================================================ + // TestTopic_RawListener_exec_i + //============================================================ class RECEIVER_EXEC_Export TestTopic_RawListener_exec_i : public virtual ::CCM_DDS::TestTopic::CCM_Listener, public virtual ::CORBA::LocalObject @@ -30,7 +35,7 @@ namespace CIAO_CSL_QoSTest_Receiver_Impl public: TestTopic_RawListener_exec_i (Atomic_ULong &); virtual ~TestTopic_RawListener_exec_i (void); - + virtual void on_one_data ( const TestTopic & an_instance, @@ -39,61 +44,50 @@ namespace CIAO_CSL_QoSTest_Receiver_Impl virtual void on_many_data ( const ::TestTopic_Seq & data, - const ::CCM_DDS::ReadInfoSeq & info ); + const ::CCM_DDS::ReadInfoSeq & info); private: Atomic_ULong &received_; }; - -class RECEIVER_EXEC_Export ConnectorStatusListener_exec_i + + //============================================================ + // ConnectorStatusListener_exec_i + //============================================================ + class RECEIVER_EXEC_Export ConnectorStatusListener_exec_i : public virtual ::CCM_DDS::CCM_ConnectorStatusListener, public virtual ::CORBA::LocalObject { public: - ConnectorStatusListener_exec_i (Atomic_Boolean &); + ConnectorStatusListener_exec_i (Atomic_Boolean &, + Atomic_ThreadId &); virtual ~ConnectorStatusListener_exec_i (void); - + virtual - void on_inconsistent_topic( ::DDS::Topic_ptr the_topic, + void on_inconsistent_topic (::DDS::Topic_ptr the_topic, const DDS::InconsistentTopicStatus & status); virtual - void on_requested_incompatible_qos( ::DDS::DataReader_ptr the_reader, + void on_requested_incompatible_qos (::DDS::DataReader_ptr the_reader, const DDS::RequestedIncompatibleQosStatus & status); virtual - void on_sample_rejected( ::DDS::DataReader_ptr the_reader, + void on_sample_rejected (::DDS::DataReader_ptr the_reader, const DDS::SampleRejectedStatus & status); virtual - void on_offered_deadline_missed( ::DDS::DataWriter_ptr the_writer, + void on_offered_deadline_missed (::DDS::DataWriter_ptr the_writer, const DDS::OfferedDeadlineMissedStatus & status); virtual - void on_offered_incompatible_qos( ::DDS::DataWriter_ptr the_writer, + void on_offered_incompatible_qos (::DDS::DataWriter_ptr the_writer, const DDS::OfferedIncompatibleQosStatus & status); virtual - void on_unexpected_status( ::DDS::Entity_ptr the_entity, + void on_unexpected_status (::DDS::Entity_ptr the_entity, ::DDS::StatusKind status_kind); - private: + private: Atomic_Boolean &incompatible_; - }; - -class RECEIVER_EXEC_Export PortStatusListener_exec_i - : public virtual ::CCM_DDS::CCM_PortStatusListener, - public virtual ::CORBA::LocalObject - { - public: - PortStatusListener_exec_i (void); - virtual ~PortStatusListener_exec_i (void); - - 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); + Atomic_ThreadId &thread_id_; }; + //============================================================ + // Receiver_exec_i + //============================================================ class RECEIVER_EXEC_Export Receiver_exec_i : public virtual Receiver_Exec, public virtual ::CORBA::LocalObject @@ -126,6 +120,7 @@ class RECEIVER_EXEC_Export PortStatusListener_exec_i ::CSL_QoSTest::CCM_Receiver_Context_var context_; Atomic_ULong received_; Atomic_Boolean incompatible_; + Atomic_ThreadId thread_id_listener_; }; extern "C" RECEIVER_EXEC_Export ::Components::EnterpriseComponent_ptr |