summaryrefslogtreecommitdiff
path: root/CIAO/connectors/dds4ccm/tests/On_Inconsistent_Topic
diff options
context:
space:
mode:
authormsmit <msmit@remedy.nl>2010-02-09 12:39:18 +0000
committermsmit <msmit@remedy.nl>2010-02-09 12:39:18 +0000
commitcd78a9ea1d64b45b6eefd95f96f52e43da0d4a58 (patch)
treebcfdaaacb18157adf44a408d116d41c0679b25c9 /CIAO/connectors/dds4ccm/tests/On_Inconsistent_Topic
parent150563b9ce0861c5576ccb4e4eda4cc8680ec732 (diff)
downloadATCD-cd78a9ea1d64b45b6eefd95f96f52e43da0d4a58.tar.gz
Tue Feb 9 12:36:38 UTC 2010 Marcel Smit <msmit@remedy.nl>
* connectors/dds4ccm/tests/On_Inconsistent_Topic/Receiver/ConnectorStatusListener_Test_Receiver_exec.cpp: Optimized logging. * connectors/dds4ccm/tests/On_Inconsistent_Topic/Sender/ConnectorStatusListener_Test_Sender_exec.h: * connectors/dds4ccm/tests/On_Inconsistent_Topic/Sender/ConnectorStatusListener_Test_Sender_exec.cpp: Added test for thread switch.
Diffstat (limited to 'CIAO/connectors/dds4ccm/tests/On_Inconsistent_Topic')
-rw-r--r--CIAO/connectors/dds4ccm/tests/On_Inconsistent_Topic/Receiver/ConnectorStatusListener_Test_Receiver_exec.cpp21
-rw-r--r--CIAO/connectors/dds4ccm/tests/On_Inconsistent_Topic/Sender/ConnectorStatusListener_Test_Sender_exec.cpp137
-rw-r--r--CIAO/connectors/dds4ccm/tests/On_Inconsistent_Topic/Sender/ConnectorStatusListener_Test_Sender_exec.h45
3 files changed, 131 insertions, 72 deletions
diff --git a/CIAO/connectors/dds4ccm/tests/On_Inconsistent_Topic/Receiver/ConnectorStatusListener_Test_Receiver_exec.cpp b/CIAO/connectors/dds4ccm/tests/On_Inconsistent_Topic/Receiver/ConnectorStatusListener_Test_Receiver_exec.cpp
index 837cd5cd307..ef01ce3c309 100644
--- a/CIAO/connectors/dds4ccm/tests/On_Inconsistent_Topic/Receiver/ConnectorStatusListener_Test_Receiver_exec.cpp
+++ b/CIAO/connectors/dds4ccm/tests/On_Inconsistent_Topic/Receiver/ConnectorStatusListener_Test_Receiver_exec.cpp
@@ -61,7 +61,8 @@ namespace CIAO_ConnectorStatusListener_Test_Receiver_Impl
// Component Executor Implementation Class: Receiver_exec_iTestTopic_RawListener_exec_i ();
//============================================================
Receiver_exec_i::Receiver_exec_i (void)
- : inconsistent_ (false)
+ : inconsistent_ (false) ,
+ thread_id_listener_ (0)
{
}
@@ -134,26 +135,26 @@ namespace CIAO_ConnectorStatusListener_Test_Receiver_Impl
{
if (!this->inconsistent_.value ())
{
- ACE_ERROR ((LM_ERROR, ACE_TEXT ("ERROR: did not receive the expected ")
- ACE_TEXT ("error 'on_inconsistent_topic' in Receiver\n")
+ ACE_ERROR ((LM_ERROR, ACE_TEXT ("RECEIVER ERROR: did not receive the expected ")
+ ACE_TEXT ("error 'on_inconsistent_topic'\n")
));
}
else
{
- ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Received the expected ")
- ACE_TEXT ("'on_inconsistent_topic' in Receiver\n")
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("RECEIVER OK: Received the expected ")
+ ACE_TEXT ("'on_inconsistent_topic'\n")
));
}
if (this->thread_id_listener_.value () == 0)
{
- ACE_ERROR ((LM_ERROR, "ERROR: "
+ ACE_ERROR ((LM_ERROR, "RECEIVER 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 : "
+ ACE_DEBUG ((LM_DEBUG, "RECEIVER OK: "
"Thread switch for ConnectorStatusListener seems OK. "
"(DDS uses the CCM thread for its callback) "
"listener <%u> - component <%u>\n",
@@ -162,7 +163,7 @@ namespace CIAO_ConnectorStatusListener_Test_Receiver_Impl
}
else
{
- ACE_ERROR ((LM_ERROR, "ERROR: "
+ ACE_ERROR ((LM_ERROR, "RECEIVER ERROR: "
"Thread switch for ConnectorStatusListener "
"doesn't seem to work! "
"listener <%u> - component <%u>\n",
@@ -173,7 +174,7 @@ namespace CIAO_ConnectorStatusListener_Test_Receiver_Impl
else if (ACE_OS::thr_equal (this->thread_id_listener_.value (),
ACE_Thread::self ()))
{
- ACE_ERROR ((LM_ERROR, "ERROR: ConnectorStatusListener: "
+ ACE_ERROR ((LM_ERROR, "RECEIVER ERROR: ConnectorStatusListener: "
"DDS seems to use a CCM thread for its callback: "
"listener <%u> - component <%u>\n",
this->thread_id_listener_.value (),
@@ -181,7 +182,7 @@ namespace CIAO_ConnectorStatusListener_Test_Receiver_Impl
}
else
{
- ACE_DEBUG ((LM_DEBUG, "OK : ConnectorStatusListener: "
+ ACE_DEBUG ((LM_DEBUG, "RECEIVER OK: ConnectorStatusListener: "
"DDS seems to use its own thread for its callback: "
"listener <%u> - component <%u>\n",
this->thread_id_listener_.value (),
diff --git a/CIAO/connectors/dds4ccm/tests/On_Inconsistent_Topic/Sender/ConnectorStatusListener_Test_Sender_exec.cpp b/CIAO/connectors/dds4ccm/tests/On_Inconsistent_Topic/Sender/ConnectorStatusListener_Test_Sender_exec.cpp
index 5a2613c5fb0..2d5f072e180 100644
--- a/CIAO/connectors/dds4ccm/tests/On_Inconsistent_Topic/Sender/ConnectorStatusListener_Test_Sender_exec.cpp
+++ b/CIAO/connectors/dds4ccm/tests/On_Inconsistent_Topic/Sender/ConnectorStatusListener_Test_Sender_exec.cpp
@@ -11,11 +11,12 @@ namespace CIAO_ConnectorStatusListener_Test_Sender_Impl
{
//============================================================
- // Facet Executor Implementation Class: ConnectorStatusListener_sec_exec_i
+ // ConnectorStatusListener_sec_exec_i
//============================================================
-
- ConnectorStatusListener_sec_exec_i::ConnectorStatusListener_sec_exec_i (Atomic_Boolean &inconsistent)
- : inconsistent_ (inconsistent)
+ ConnectorStatusListener_sec_exec_i::ConnectorStatusListener_sec_exec_i (Atomic_Boolean &inconsistent,
+ Atomic_ThreadId &thread_id)
+ : inconsistent_ (inconsistent),
+ thread_id_ (thread_id)
{
}
@@ -24,45 +25,50 @@ namespace CIAO_ConnectorStatusListener_Test_Sender_Impl
}
// Operations from ::CCM_DDS::ConnectorStatusListener
- void ConnectorStatusListener_sec_exec_i::on_inconsistent_topic(
+ void ConnectorStatusListener_sec_exec_i::on_inconsistent_topic (
::DDS::Topic_ptr /*the_topic*/,
const DDS::InconsistentTopicStatus & /*status*/)
- {
-// ACE_DEBUG ((LM_DEBUG, "Sender : ConnectorStatusListener_sec_exec_i::on_inconsistent_topic\n"));
- this->inconsistent_ = true;
- }
- void ConnectorStatusListener_sec_exec_i::on_requested_incompatible_qos(
+ {
+ this->thread_id_ = ACE_Thread::self ();
+ this->inconsistent_ = true;
+ }
+
+ void ConnectorStatusListener_sec_exec_i::on_requested_incompatible_qos (
::DDS::DataReader_ptr /*the_reader*/,
- const DDS::RequestedIncompatibleQosStatus & /*status*/) {
-// ACE_DEBUG ((LM_DEBUG, "ConnectorStatusListener_exec_i::on_requested_incompatible_qos\n"));
- }
- void ConnectorStatusListener_sec_exec_i::on_sample_rejected(
- ::DDS::DataReader_ptr /*the_reader*/,
- const DDS::SampleRejectedStatus & /*status*/) {
-// ACE_DEBUG ((LM_DEBUG, "ConnectorStatusListener_exec_i::on_sample_rejected\n"));
- }
- void ConnectorStatusListener_sec_exec_i::on_offered_deadline_missed(
- ::DDS::DataWriter_ptr /*the_writer*/,
- const DDS::OfferedDeadlineMissedStatus & /*status*/) {
-// ACE_DEBUG ((LM_DEBUG, "ConnectorStatusListener_exec_i::on_offered_deadline_missed\n"));
- }
- void ConnectorStatusListener_sec_exec_i::on_offered_incompatible_qos(
- ::DDS::DataWriter_ptr /*the_writer*/,
- const DDS::OfferedIncompatibleQosStatus & /*status*/) {
-// ACE_DEBUG ((LM_DEBUG, "ConnectorStatusListener_exec_i::on_offered_incompatible_qos\n"));
- }
- void ConnectorStatusListener_sec_exec_i::on_unexpected_status(
+ const DDS::RequestedIncompatibleQosStatus & /*status*/)
+ {
+ }
+
+ void ConnectorStatusListener_sec_exec_i::on_sample_rejected (
+ ::DDS::DataReader_ptr /*the_reader*/,
+ const DDS::SampleRejectedStatus & /*status*/)
+ {
+ }
+
+ void ConnectorStatusListener_sec_exec_i::on_offered_deadline_missed (
+ ::DDS::DataWriter_ptr /*the_writer*/,
+ const DDS::OfferedDeadlineMissedStatus & /*status*/)
+ {
+ }
+
+ void ConnectorStatusListener_sec_exec_i::on_offered_incompatible_qos (
+ ::DDS::DataWriter_ptr /*the_writer*/,
+ const DDS::OfferedIncompatibleQosStatus & /*status*/)
+ {
+ }
+
+ void ConnectorStatusListener_sec_exec_i::on_unexpected_status (
::DDS::Entity_ptr /*the_entity*/,
- ::DDS::StatusKind /*status_kind*/) {
-// ACE_DEBUG ((LM_DEBUG, "ConnectorStatusListener_exec_i::on_unexpected_status\n"));
- }
+ ::DDS::StatusKind /*status_kind*/)
+ {
+ }
//============================================================
- // Component Executor Implementation Class: Sender_exec_i
+ // Sender_exec_i
//============================================================
-
Sender_exec_i::Sender_exec_i (void)
- : inconsistent_ (false)
+ : inconsistent_ (false),
+ thread_id_listener_ (0)
{
}
@@ -73,7 +79,8 @@ namespace CIAO_ConnectorStatusListener_Test_Sender_Impl
::CCM_DDS::CCM_ConnectorStatusListener_ptr
Sender_exec_i::get_test_sec_topic_connector_status (void)
{
- return new ConnectorStatusListener_sec_exec_i (this->inconsistent_);
+ return new ConnectorStatusListener_sec_exec_i (this->inconsistent_,
+ this->thread_id_listener_);
}
void
@@ -93,8 +100,7 @@ namespace CIAO_ConnectorStatusListener_Test_Sender_Impl
{
}
-
-void
+ void
Sender_exec_i::add_instance_of_sec_topic (const char * key, int x)
{
TestSecondTopic *new_key = new TestSecondTopic;
@@ -120,17 +126,62 @@ void
void
Sender_exec_i::ccm_remove (void)
{
- if(!this->inconsistent_.value ())
+ if (this->inconsistent_.value ())
{
- ACE_ERROR ((LM_ERROR, ACE_TEXT ("ERROR: did not receive the expected ")
- ACE_TEXT ("error 'on_inconsistent_topic' in Sender\n")
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("SENDER OK: Received the expected ")
+ ACE_TEXT ("'on_inconsistent_topic'\n")
));
}
else
{
- ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Received the expected ")
- ACE_TEXT (" 'on_inconsistent_topic' in Sender\n")));
+ ACE_ERROR ((LM_ERROR, ACE_TEXT ("SENDER ERROR: did not receive the expected ")
+ ACE_TEXT ("error 'on_inconsistent_topic'\n")
+ ));
+ }
+ if (this->thread_id_listener_.value () == 0)
+ {
+ ACE_ERROR ((LM_ERROR, "SENDER 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, "SENDER 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, "SENDER 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, "SENDER 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, "SENDER 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" SENDER_EXEC_Export ::Components::EnterpriseComponent_ptr
diff --git a/CIAO/connectors/dds4ccm/tests/On_Inconsistent_Topic/Sender/ConnectorStatusListener_Test_Sender_exec.h b/CIAO/connectors/dds4ccm/tests/On_Inconsistent_Topic/Sender/ConnectorStatusListener_Test_Sender_exec.h
index aeb634f6f79..0740c92a9ff 100644
--- a/CIAO/connectors/dds4ccm/tests/On_Inconsistent_Topic/Sender/ConnectorStatusListener_Test_Sender_exec.h
+++ b/CIAO/connectors/dds4ccm/tests/On_Inconsistent_Topic/Sender/ConnectorStatusListener_Test_Sender_exec.h
@@ -20,40 +20,48 @@
namespace CIAO_ConnectorStatusListener_Test_Sender_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 Sender_exec_i;
-class SENDER_EXEC_Export ConnectorStatusListener_sec_exec_i
+ //============================================================
+ // ConnectorStatusListener_sec_exec_i
+ //============================================================
+ class SENDER_EXEC_Export ConnectorStatusListener_sec_exec_i
: public virtual ::CCM_DDS::CCM_ConnectorStatusListener,
public virtual ::CORBA::LocalObject
{
public:
- ConnectorStatusListener_sec_exec_i (Atomic_Boolean &);
- virtual ~ConnectorStatusListener_sec_exec_i (void);
+ ConnectorStatusListener_sec_exec_i (Atomic_Boolean &,
+ Atomic_ThreadId &);
+ virtual ~ConnectorStatusListener_sec_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,
- const DDS::OfferedDeadlineMissedStatus & status);
+ 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,
- ::DDS::StatusKind status_kind);
- private:
+ void on_unexpected_status (::DDS::Entity_ptr the_entity,
+ ::DDS::StatusKind status_kind);
+ private:
Atomic_Boolean &inconsistent_;
-
+ Atomic_ThreadId &thread_id_;
};
+ //============================================================
+ // Sender_exec_i
+ //============================================================
class Sender_exec_i
: public virtual Sender_Exec,
public virtual ::CORBA::LocalObject
@@ -64,28 +72,27 @@ class SENDER_EXEC_Export ConnectorStatusListener_sec_exec_i
virtual void set_session_context (::Components::SessionContext_ptr ctx);
- virtual void add_instance_of_sec_topic (const char *, int x );
-
-
virtual void configuration_complete (void);
-
virtual void ccm_activate (void);
virtual void ccm_passivate (void);
virtual void ccm_remove (void);
// Port operations.
virtual ::CCM_DDS::CCM_ConnectorStatusListener_ptr
- get_test_sec_topic_connector_status(void);
+ get_test_sec_topic_connector_status(void);
private:
::ConnectorStatusListener_Test::CCM_Sender_Context_var context_;
Atomic_Boolean inconsistent_;
+ Atomic_ThreadId thread_id_listener_;
TAO_SYNCH_MUTEX mutex_;
typedef std::map<ACE_CString, TestSecondTopic_var> ConnectorStatusListener_TestSec_Table;
ConnectorStatusListener_TestSec_Table sec_ktests_;
- };
+
+ void add_instance_of_sec_topic (const char *, int x );
+ };
extern "C" SENDER_EXEC_Export ::Components::EnterpriseComponent_ptr
create_ConnectorStatusListener_Test_Sender_Impl (void);