summaryrefslogtreecommitdiff
path: root/CIAO/connectors/dds4ccm/tests/ContentFilteredTopic/ReadGet/Receiver/ReadGet_Test_Receiver_exec.cpp
diff options
context:
space:
mode:
authormsmit <msmit@remedy.nl>2010-11-18 12:46:14 +0000
committermsmit <msmit@remedy.nl>2010-11-18 12:46:14 +0000
commitb31320f6d77f9e64263967aaf687e663b7035d5e (patch)
treeeb828a544d08893d84e581e4be771fcb2f6a44d6 /CIAO/connectors/dds4ccm/tests/ContentFilteredTopic/ReadGet/Receiver/ReadGet_Test_Receiver_exec.cpp
parent2343cfc9a31417c46cb82df2b9f947421673634f (diff)
downloadATCD-b31320f6d77f9e64263967aaf687e663b7035d5e.tar.gz
Thu Nov 18 12:46:17 UTC 2010 Marcel Smit <msmit@remedy.nl>
* connectors/dds4ccm/tests/ContentFilteredTopic/ReadGet/Receiver/ReadGet_Test_Receiver.mpc: * connectors/dds4ccm/tests/ContentFilteredTopic/ReadGet/Receiver/ReadGet_Test_Receiver_exec.h: * connectors/dds4ccm/tests/ContentFilteredTopic/ReadGet/Receiver/ReadGet_Test_Receiver_exec.cpp: * connectors/dds4ccm/tests/ContentFilteredTopic/ReadGet/Sender/ReadGet_Test_Sender_exec.h: * connectors/dds4ccm/tests/ContentFilteredTopic/ReadGet/Sender/ReadGet_Test_Sender_exec.cpp: Re-implemented test using the -Gexr option on the TAO IDL compiler.
Diffstat (limited to 'CIAO/connectors/dds4ccm/tests/ContentFilteredTopic/ReadGet/Receiver/ReadGet_Test_Receiver_exec.cpp')
-rw-r--r--CIAO/connectors/dds4ccm/tests/ContentFilteredTopic/ReadGet/Receiver/ReadGet_Test_Receiver_exec.cpp288
1 files changed, 226 insertions, 62 deletions
diff --git a/CIAO/connectors/dds4ccm/tests/ContentFilteredTopic/ReadGet/Receiver/ReadGet_Test_Receiver_exec.cpp b/CIAO/connectors/dds4ccm/tests/ContentFilteredTopic/ReadGet/Receiver/ReadGet_Test_Receiver_exec.cpp
index 30b70ba5657..b445784aaed 100644
--- a/CIAO/connectors/dds4ccm/tests/ContentFilteredTopic/ReadGet/Receiver/ReadGet_Test_Receiver_exec.cpp
+++ b/CIAO/connectors/dds4ccm/tests/ContentFilteredTopic/ReadGet/Receiver/ReadGet_Test_Receiver_exec.cpp
@@ -1,12 +1,33 @@
// -*- C++ -*-
// $Id$
-#include "ReadGet_Test_Receiver_exec.h"
+/**
+ * Code generated by the The ACE ORB (TAO) IDL Compiler v1.8.3
+ * 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
+ **/
-#include "ace/OS_NS_unistd.h"
+#include "ReadGet_Test_Receiver_exec.h"
#include "tao/ORB_Core.h"
#include "ace/Reactor.h"
-#include "ace/Log_Msg.h"
#include "dds4ccm/impl/dds4ccm_conf.h"
@@ -30,7 +51,6 @@
// (see constructor Receiver_exec_i).
#define SAMPLES_PER_KEY_GETTER (2 + 11)
-
// Samples received on the Reader port depend on the
// number of iterations send. The sender informs the
// Receiver about this number by invoking set_reader_properties.
@@ -40,13 +60,14 @@
// result in the same amount of samples of the read on the getter
// port.
-
namespace CIAO_ReadGet_Test_Receiver_Impl
{
- //============================================================
- // read_action_Generator
- //============================================================
- read_action_Generator::read_action_Generator (Receiver_exec_i &callback, int run)
+ /**
+ * read_action_Generator
+ */
+
+ read_action_Generator::read_action_Generator (Receiver_exec_i &callback,
+ int run)
: callback_ (callback),
run_ (run)
{
@@ -68,35 +89,105 @@ namespace CIAO_ReadGet_Test_Receiver_Impl
return 0;
}
- //============================================================
- // Starter_exec_i
- //============================================================
- Starter_exec_i::Starter_exec_i (Receiver_exec_i & callback)
- : callback_ (callback)
+ /**
+ * Facet Executor Implementation Class: get_port_status_exec_i
+ */
+
+ get_port_status_exec_i::get_port_status_exec_i (
+ ::ReadGet_Test::CCM_Receiver_Context_ptr ctx)
+ : ciao_context_ (
+ ::ReadGet_Test::CCM_Receiver_Context::_duplicate (ctx))
+ {
+ }
+
+ get_port_status_exec_i::~get_port_status_exec_i (void)
+ {
+ }
+
+ // Operations from ::CCM_DDS::PortStatusListener
+
+ void
+ get_port_status_exec_i::on_requested_deadline_missed (::DDS::DataReader_ptr /* the_reader */,
+ const ::DDS::RequestedDeadlineMissedStatus & /* status */)
+ {
+ /* Your code here. */
+ }
+
+ void
+ get_port_status_exec_i::on_sample_lost (::DDS::DataReader_ptr /* the_reader */,
+ const ::DDS::SampleLostStatus & /* status */)
+ {
+ /* Your code here. */
+ }
+
+ /**
+ * Facet Executor Implementation Class: read_port_status_exec_i
+ */
+
+ read_port_status_exec_i::read_port_status_exec_i (
+ ::ReadGet_Test::CCM_Receiver_Context_ptr ctx)
+ : ciao_context_ (
+ ::ReadGet_Test::CCM_Receiver_Context::_duplicate (ctx))
{
}
- Starter_exec_i::~Starter_exec_i (void)
+ read_port_status_exec_i::~read_port_status_exec_i (void)
+ {
+ }
+
+ // Operations from ::CCM_DDS::PortStatusListener
+
+ void
+ read_port_status_exec_i::on_requested_deadline_missed (::DDS::DataReader_ptr /* the_reader */,
+ const ::DDS::RequestedDeadlineMissedStatus & /* status */)
{
+ /* Your code here. */
}
void
- Starter_exec_i::set_reader_properties (CORBA::UShort nr_keys,
- CORBA::UShort nr_iterations)
+ read_port_status_exec_i::on_sample_lost (::DDS::DataReader_ptr /* the_reader */,
+ const ::DDS::SampleLostStatus & /* status */)
+ {
+ /* Your code here. */
+ }
+
+ /**
+ * Facet Executor Implementation Class: reader_start_exec_i
+ */
+
+ reader_start_exec_i::reader_start_exec_i (
+ ::ReadGet_Test::CCM_Receiver_Context_ptr ctx,
+ Receiver_exec_i & callback)
+ : ciao_context_ (
+ ::ReadGet_Test::CCM_Receiver_Context::_duplicate (ctx))
+ , callback_ (callback)
+ {
+ }
+
+ reader_start_exec_i::~reader_start_exec_i (void)
+ {
+ }
+
+ // Operations from ::ReadGetStarter
+
+ void
+ reader_start_exec_i::set_reader_properties (::CORBA::UShort nr_keys,
+ ::CORBA::UShort nr_iterations)
{
this->callback_.keys (nr_keys);
this->callback_.iterations (nr_iterations);
}
void
- Starter_exec_i::start_read (CORBA::UShort run)
+ reader_start_exec_i::start_read (::CORBA::UShort run)
{
this->callback_.start_read (run);
}
- //============================================================
- // Receiver_exec_i
- //============================================================
+ /**
+ * Component Executor Implementation Class: Receiver_exec_i
+ */
+
Receiver_exec_i::Receiver_exec_i (void)
: iterations_ (20),
keys_ (5),
@@ -113,8 +204,30 @@ namespace CIAO_ReadGet_Test_Receiver_Impl
Receiver_exec_i::~Receiver_exec_i (void)
{
+ delete this->ticker_;
}
+ // Supported operations and attributes.
+ ACE_Reactor*
+ Receiver_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;
+ }
bool
Receiver_exec_i::check_last ()
@@ -122,7 +235,7 @@ namespace CIAO_ReadGet_Test_Receiver_Impl
try
{
::ReadGet_Test::QueryConditionTestConnector::Reader_var get_reader =
- this->context_->get_connection_get_port_data ();
+ this->ciao_context_->get_connection_get_port_data ();
if (::CORBA::is_nil (get_reader.in ()))
{
ACE_ERROR ((LM_ERROR, ACE_TEXT ("ERROR: Receiver_exec_i::check_last - ")
@@ -209,7 +322,7 @@ namespace CIAO_ReadGet_Test_Receiver_Impl
Receiver_exec_i::read_all_on_reader_port (void)
{
::ReadGet_Test::QueryConditionTestConnector::Reader_var read_reader =
- this->context_->get_connection_read_port_data ();
+ this->ciao_context_->get_connection_read_port_data ();
if (::CORBA::is_nil (read_reader))
{
@@ -236,7 +349,7 @@ namespace CIAO_ReadGet_Test_Receiver_Impl
Receiver_exec_i::read_all_on_getter_port (void)
{
::ReadGet_Test::QueryConditionTestConnector::Reader_var get_reader =
- this->context_->get_connection_get_port_data ();
+ this->ciao_context_->get_connection_get_port_data ();
if (::CORBA::is_nil (get_reader))
{
@@ -263,7 +376,7 @@ namespace CIAO_ReadGet_Test_Receiver_Impl
Receiver_exec_i::get_all_on_getter_port (void)
{
::ReadGet_Test::QueryConditionTestConnector::Getter_var get_getter =
- this->context_->get_connection_get_port_fresh_data ();
+ this->ciao_context_->get_connection_get_port_fresh_data ();
if (::CORBA::is_nil (get_getter))
{
@@ -356,8 +469,6 @@ namespace CIAO_ReadGet_Test_Receiver_Impl
void
Receiver_exec_i::check_filter ()
{
-
-
this->check_filter_getter ();
this->check_filter_reader ();
}
@@ -372,7 +483,7 @@ namespace CIAO_ReadGet_Test_Receiver_Impl
try
{
::ReadGet_Test::QueryConditionTestConnector::Getter_var get_getter =
- this->context_->get_connection_get_port_fresh_data ();
+ this->ciao_context_->get_connection_get_port_fresh_data ();
if (::CORBA::is_nil (get_getter.in ()))
{
ACE_ERROR ((LM_ERROR, ACE_TEXT ("ERROR: Receiver_exec_i::check_filter <GETTER> - ")
@@ -426,12 +537,13 @@ namespace CIAO_ReadGet_Test_Receiver_Impl
//check query
bool error = false;
- if (ACE_OS::strcmp (filter->expression, QUERY_GETTER_PORT) != 0)
+ ::CORBA::String_var expression = filter->expression.in ();
+ if (ACE_OS::strcmp (expression.in (), QUERY_GETTER_PORT) != 0)
{
ACE_ERROR ((LM_ERROR, ACE_TEXT ("ERROR: Receiver_exec_i::check_filter <GETTER> - ")
ACE_TEXT ("Unexpected query when retrieving filter: ")
ACE_TEXT ("expected <%C> - received <%C>\n"),
- QUERY_GETTER_PORT, filter->expression.in ()));
+ QUERY_GETTER_PORT, expression.in ()));
error = true;
}
//check current parameters.
@@ -446,25 +558,27 @@ namespace CIAO_ReadGet_Test_Receiver_Impl
if (filter->parameters.length () >= 1)
{
- if (ACE_OS::atoi (filter->parameters[0]) != this->current_iter_value1_)
+ CORBA::String_var param = ::CORBA::string_dup (filter->parameters[0].in ());
+ if (ACE_OS::atoi (param.in ()) != this->current_iter_value1_)
{
ACE_ERROR ((LM_ERROR, ACE_TEXT ("ERROR: Receiver_exec_i::check_filter <GETTER> - ")
ACE_TEXT ("Unexpected param value: ")
ACE_TEXT ("expected <%d> - received <%C>\n"),
this->current_iter_value1_,
- filter->parameters[0].in ()));
+ param.in ()));
error = true;
}
}
if (filter->parameters.length () >= 2)
{
- if (ACE_OS::atoi (filter->parameters[1]) != this->current_iter_value2_)
+ CORBA::String_var param = ::CORBA::string_dup (filter->parameters[1].in ());
+ if (ACE_OS::atoi (param.in ()) != this->current_iter_value2_)
{
ACE_ERROR ((LM_ERROR, ACE_TEXT ("ERROR: Receiver_exec_i::check_filter <GETTER> - ")
ACE_TEXT ("Unexpected param value: ")
ACE_TEXT ("expected <%d> - received <%C>\n"),
this->current_iter_value2_,
- filter->parameters[1].in ()));
+ param.in ()));
error = true;
}
}
@@ -485,7 +599,7 @@ namespace CIAO_ReadGet_Test_Receiver_Impl
try
{
::ReadGet_Test::QueryConditionTestConnector::Reader_var reader =
- this->context_->get_connection_read_port_data ();
+ this->ciao_context_->get_connection_read_port_data ();
if (::CORBA::is_nil (reader.in ()))
{
ACE_ERROR ((LM_ERROR, ACE_TEXT ("ERROR: Receiver_exec_i::check_filter <READER> - ")
@@ -539,12 +653,13 @@ namespace CIAO_ReadGet_Test_Receiver_Impl
//check query
bool error = false;
- if (ACE_OS::strcmp (filter->expression, QUERY_READER_PORT) != 0)
+ ::CORBA::String_var expression = ::CORBA::string_dup (filter->expression.in ());
+ if (ACE_OS::strcmp (expression.in (), QUERY_READER_PORT) != 0)
{
ACE_ERROR ((LM_ERROR, ACE_TEXT ("ERROR: Receiver_exec_i::check_filter <READER> - ")
ACE_TEXT ("Unexpected query when retrieving filter: ")
ACE_TEXT ("expected <%C> - received <%C>\n"),
- QUERY_READER_PORT, filter->expression.in ()));
+ QUERY_READER_PORT, expression.in ()));
error = true;
}
//check current parameters.
@@ -559,25 +674,27 @@ namespace CIAO_ReadGet_Test_Receiver_Impl
if (filter->parameters.length () >= 1)
{
- if (ACE_OS::atoi (filter->parameters[0]) != this->current_iter_value1_)
+ CORBA::String_var param = ::CORBA::string_dup (filter->parameters[0].in ());
+ if (ACE_OS::atoi (param.in ()) != this->current_iter_value1_)
{
ACE_ERROR ((LM_ERROR, ACE_TEXT ("ERROR: Receiver_exec_i::check_filter <READER> - ")
ACE_TEXT ("Unexpected param value: ")
ACE_TEXT ("expected <%d> - received <%C>\n"),
this->current_iter_value1_,
- filter->parameters[0].in ()));
+ param.in ()));
error = true;
}
}
if (filter->parameters.length () >= 2)
{
- if (ACE_OS::atoi (filter->parameters[1]) != this->current_iter_value2_)
+ CORBA::String_var param = ::CORBA::string_dup (filter->parameters[1].in ());
+ if (ACE_OS::atoi (param.in ()) != this->current_iter_value2_)
{
ACE_ERROR ((LM_ERROR, ACE_TEXT ("ERROR: Receiver_exec_i::check_filter <READER> - ")
ACE_TEXT ("Unexpected param value: ")
ACE_TEXT ("expected <%d> - received <%C>\n"),
this->current_iter_value2_,
- filter->parameters[1].in ()));
+ param.in ()));
error = true;
}
}
@@ -594,7 +711,7 @@ namespace CIAO_ReadGet_Test_Receiver_Impl
try
{
::CCM_DDS::ContentFilterSetting_var get_filter_setting =
- this->context_->get_connection_get_port_filter_config ();
+ this->ciao_context_->get_connection_get_port_filter_config ();
if (::CORBA::is_nil (get_filter_setting.in ()))
{
ACE_ERROR ((LM_ERROR, ACE_TEXT ("ERROR: Receiver_exec_i::test_set_query_parameters - ")
@@ -602,7 +719,7 @@ namespace CIAO_ReadGet_Test_Receiver_Impl
throw ::CCM_DDS::InternalError ();
}
::CCM_DDS::ContentFilterSetting_var read_filter_setting =
- this->context_->get_connection_read_port_filter_config ();
+ this->ciao_context_->get_connection_read_port_filter_config ();
if (::CORBA::is_nil (read_filter_setting.in ()))
{
ACE_ERROR ((LM_ERROR, ACE_TEXT ("ERROR: Receiver_exec_i::test_set_query_parameters - ")
@@ -613,8 +730,8 @@ namespace CIAO_ReadGet_Test_Receiver_Impl
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Receiver_exec_i::test_set_query_parameters: Set parameters\n")));
::DDS::StringSeq parameters;
parameters.length (2);
- parameters[0] = CORBA::string_dup (ITER2_VALUE1);
- parameters[1] = CORBA::string_dup (ITER2_VALUE2);
+ parameters[0] = ::CORBA::string_dup (ITER2_VALUE1);
+ parameters[1] = ::CORBA::string_dup (ITER2_VALUE2);
get_filter_setting->set_filter_parameters (parameters);
read_filter_setting->set_filter_parameters (parameters);
@@ -650,8 +767,8 @@ namespace CIAO_ReadGet_Test_Receiver_Impl
ACE_NEW_THROW_EX (this->ticker_,
read_action_Generator (*this, run),
::CORBA::INTERNAL ());
- if (this->context_->get_CCM_object()->_get_orb ()->orb_core ()->reactor ()->schedule_timer (
- this->ticker_,
+
+ if (this->reactor ()->schedule_timer (this->ticker_,
0,
ACE_Time_Value(1, 0),
ACE_Time_Value(1, 0)) == -1)
@@ -665,12 +782,12 @@ namespace CIAO_ReadGet_Test_Receiver_Impl
{
if (this->ticker_)
{
- this->context_->get_CCM_object()->_get_orb ()->orb_core ()->reactor ()->cancel_timer (this->ticker_);
+ this->reactor ()->cancel_timer (this->ticker_);
delete this->ticker_;
this->ticker_ = 0;
}
- ReadGetRestarter_var restarter = this->context_->get_connection_writer_restart ();
+ ReadGetRestarter_var restarter = this->ciao_context_->get_connection_writer_restart ();
if (::CORBA::is_nil (restarter.in ()))
{
ACE_ERROR ((LM_ERROR, ACE_TEXT ("ERROR: Receiver_exec_i::run - ")
@@ -734,31 +851,79 @@ namespace CIAO_ReadGet_Test_Receiver_Impl
this->samples_expected_getter_ = (keys_ - 1) * SAMPLES_PER_KEY_GETTER;
}
- // Port operations.
+ // Component attributes and port operations.
+
::CCM_DDS::CCM_PortStatusListener_ptr
Receiver_exec_i::get_get_port_status (void)
{
- return ::CCM_DDS::CCM_PortStatusListener::_nil ();
+ if ( ::CORBA::is_nil (this->ciao_get_port_status_.in ()))
+ {
+ get_port_status_exec_i *tmp = 0;
+ ACE_NEW_RETURN (
+ tmp,
+ get_port_status_exec_i (
+ this->ciao_context_.in ()),
+ ::CCM_DDS::CCM_PortStatusListener::_nil ());
+
+ this->ciao_get_port_status_ = tmp;
+ }
+
+ return
+ ::CCM_DDS::CCM_PortStatusListener::_duplicate (
+ this->ciao_get_port_status_.in ());
}
::CCM_DDS::CCM_PortStatusListener_ptr
- Receiver_exec_i::get_read_port_status(void)
+ Receiver_exec_i::get_read_port_status (void)
{
- return ::CCM_DDS::CCM_PortStatusListener::_nil ();
+ if ( ::CORBA::is_nil (this->ciao_read_port_status_.in ()))
+ {
+ read_port_status_exec_i *tmp = 0;
+ ACE_NEW_RETURN (
+ tmp,
+ read_port_status_exec_i (
+ this->ciao_context_.in ()),
+ ::CCM_DDS::CCM_PortStatusListener::_nil ());
+
+ this->ciao_read_port_status_ = tmp;
+ }
+
+ return
+ ::CCM_DDS::CCM_PortStatusListener::_duplicate (
+ this->ciao_read_port_status_.in ());
}
::CCM_ReadGetStarter_ptr
- Receiver_exec_i::get_reader_start ()
+ Receiver_exec_i::get_reader_start (void)
{
- return new Starter_exec_i (*this);
+ if ( ::CORBA::is_nil (this->ciao_reader_start_.in ()))
+ {
+ reader_start_exec_i *tmp = 0;
+ ACE_NEW_RETURN (
+ tmp,
+ reader_start_exec_i (
+ this->ciao_context_.in (),
+ *this),
+ ::CCM_ReadGetStarter::_nil ());
+
+ this->ciao_reader_start_ = tmp;
+ }
+
+ return
+ ::CCM_ReadGetStarter::_duplicate (
+ this->ciao_reader_start_.in ());
}
// Operations from Components::SessionComponent.
+
void
- Receiver_exec_i::set_session_context (::Components::SessionContext_ptr ctx)
+ Receiver_exec_i::set_session_context (
+ ::Components::SessionContext_ptr ctx)
{
- this->context_ = ::ReadGet_Test::CCM_Receiver_Context::_narrow (ctx);
- if ( ::CORBA::is_nil (this->context_.in ()))
+ this->ciao_context_ =
+ ::ReadGet_Test::CCM_Receiver_Context::_narrow (ctx);
+
+ if ( ::CORBA::is_nil (this->ciao_context_.in ()))
{
throw ::CORBA::INTERNAL ();
}
@@ -767,11 +932,13 @@ namespace CIAO_ReadGet_Test_Receiver_Impl
void
Receiver_exec_i::configuration_complete (void)
{
+ /* Your code here. */
}
void
Receiver_exec_i::ccm_activate (void)
{
+ /* Your code here. */
}
void
@@ -779,9 +946,7 @@ namespace CIAO_ReadGet_Test_Receiver_Impl
{
if (this->ticker_)
{
- this->context_->get_CCM_object()->_get_orb ()->orb_core ()->reactor ()->cancel_timer (this->ticker_);
- delete this->ticker_;
- this->ticker_ = 0;
+ this->reactor ()->cancel_timer (this->ticker_);
}
}
@@ -835,4 +1000,3 @@ namespace CIAO_ReadGet_Test_Receiver_Impl
return retval;
}
}
-