diff options
author | mcorino <mcorino@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2011-04-09 17:53:42 +0000 |
---|---|---|
committer | mcorino <mcorino@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2011-04-09 17:53:42 +0000 |
commit | 62904f74955373ff396b6e2a58e09a601c65f52e (patch) | |
tree | e9a2a0150a2f19216a2279939099287759345faa /CIAO/connectors/dds4ccm/tests/CoherentWriter | |
parent | 2a51a0c99f2809e03fe5f7dd7fde446d50096862 (diff) | |
download | ATCD-62904f74955373ff396b6e2a58e09a601c65f52e.tar.gz |
Sat Apr 9 17:47:00 UTC 2011 Martin Corino <mcorino@remedy.nl>
Merged changes from Remedy work branch.
Diffstat (limited to 'CIAO/connectors/dds4ccm/tests/CoherentWriter')
4 files changed, 192 insertions, 43 deletions
diff --git a/CIAO/connectors/dds4ccm/tests/CoherentWriter/Receiver/CoherentWrite_Test_Receiver.idl b/CIAO/connectors/dds4ccm/tests/CoherentWriter/Receiver/CoherentWrite_Test_Receiver.idl index 08a5cf09eb0..52d4c12a8cb 100644 --- a/CIAO/connectors/dds4ccm/tests/CoherentWriter/Receiver/CoherentWrite_Test_Receiver.idl +++ b/CIAO/connectors/dds4ccm/tests/CoherentWriter/Receiver/CoherentWrite_Test_Receiver.idl @@ -15,7 +15,7 @@ module CoherentWrite_Test { component Receiver { - port CoherentWriteTestConnector::DDS_Read info_out; + port CoherentWriteTestConnector::DDS_Get info_out; provides CoherentWriteStarter reader_start; uses CoherentWriteRestarter writer_restart; diff --git a/CIAO/connectors/dds4ccm/tests/CoherentWriter/Receiver/CoherentWrite_Test_Receiver_exec.cpp b/CIAO/connectors/dds4ccm/tests/CoherentWriter/Receiver/CoherentWrite_Test_Receiver_exec.cpp index b834c542218..48fd54e6059 100644 --- a/CIAO/connectors/dds4ccm/tests/CoherentWriter/Receiver/CoherentWrite_Test_Receiver_exec.cpp +++ b/CIAO/connectors/dds4ccm/tests/CoherentWriter/Receiver/CoherentWrite_Test_Receiver_exec.cpp @@ -51,7 +51,16 @@ namespace CIAO_CoherentWrite_Test_Receiver_Impl { ACE_DEBUG ((LM_DEBUG, "Checking if last sample " "is available in DDS...\n")); - if (this->callback_.check_last ()) + // Use get_many for every even number. In that case, don't check whether + // the last sample has arrived since the samples are read by then (the + // getter only reads unread samples). + if (this->run_ % 2 == 1) + { + // Odd number so check if the last sample is available in DDS. + if (this->callback_.check_last ()) + this->callback_.run (this->run_); + } + else this->callback_.run (this->run_); return 0; } @@ -192,17 +201,98 @@ namespace CIAO_CoherentWrite_Test_Receiver_Impl } void + Receiver_exec_i::check_iters (const char * test, + const CoherentWriteTestSeq& coherentwrite_info_seq) + { + for (CORBA::ULong it = 0; it < coherentwrite_info_seq.length (); ++it) + { + if (coherentwrite_info_seq[it].iteration > this->last_iter_) + { + if (coherentwrite_info_seq[it].iteration == ++this->last_iter_) + { + ACE_DEBUG ((LM_DEBUG, "%C ALL OK: ", test)); + } + else + { + ACE_ERROR ((LM_ERROR, "%C ALL ERROR: ", test)); + } + ACE_DEBUG ((LM_DEBUG, "expected: <%u> - " + "received <%d>\n", + this->last_iter_, + coherentwrite_info_seq[it].iteration)); + } + } + if (this->run_ < this->nr_runs () + 1) + { + ::CoherentWriteRestarter_var restarter = + this->ciao_context_->get_connection_writer_restart (); + if (!::CORBA::is_nil (restarter.in ())) + restarter->restart_write (); + else + ACE_ERROR ((LM_ERROR, "Receiver_exec_i::get_all - " + "Unable to restart the writer " + "since the restarter is nil.\n")); + } + else + { + ACE_DEBUG ((LM_DEBUG, "Finished: wait for shutdown\n")); + } + } + + void + Receiver_exec_i::get_all (void) + { + try + { + ::CoherentWriteTestConnector::Getter_var getter = + this->ciao_context_->get_connection_info_out_fresh_data (); + + if (::CORBA::is_nil (getter.in ())) + { + ACE_ERROR ((LM_ERROR, "Receiver_exec_i::get_all - " + "Unable to get samples since " + "getter is nil.\n")); + return; + } + DDS::Duration_t to; + to.sec = 5; + to.nanosec = 0; + getter->time_out (to); + + CoherentWriteTestSeq coherentwrite_info_seq; + ::CCM_DDS::ReadInfoSeq readinfo_seq; + getter->get_many (coherentwrite_info_seq, readinfo_seq); + + this->check_iters ("GET", coherentwrite_info_seq); + } + catch (const CCM_DDS::NonExistent& ex) + { + ACE_ERROR ((LM_ERROR, ACE_TEXT ("ERROR: GET ALL: ") + ACE_TEXT ("caught NonExistent exception\n"))); + } + catch (const CCM_DDS::InternalError& ex) + { + ACE_ERROR ((LM_ERROR, ACE_TEXT ("ERROR: GET ALL: ") + ACE_TEXT ("caught InternalError exception: retval <%u>\n"), + ex.error_code)); + } + catch (const ::CORBA::Exception& ex) + { + ex._tao_print_exception ("ERROR: GET ALL: "); + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("ERROR: Receiver_exec_i::get_all : Exception caught\n"))); + } + } + + void Receiver_exec_i::read_all (void) { try { ::CoherentWriteTestConnector::Reader_var reader = this->ciao_context_->get_connection_info_out_data (); - CoherentWriteRestarter_var restarter = - this->ciao_context_->get_connection_writer_restart (); - if (::CORBA::is_nil (reader.in ()) || - ::CORBA::is_nil (restarter.in ())) + if (::CORBA::is_nil (reader.in ())) { ACE_ERROR ((LM_ERROR, "Receiver_exec_i::read_all - " "Unable to read since reader or " @@ -214,32 +304,7 @@ namespace CIAO_CoherentWrite_Test_Receiver_Impl ::CCM_DDS::ReadInfoSeq readinfo_seq; reader->read_all (coherentwrite_info_seq, readinfo_seq); - for (CORBA::ULong it = 0; it < coherentwrite_info_seq.length (); ++it) - { - if (coherentwrite_info_seq[it].iteration > this->last_iter_) - { - if (coherentwrite_info_seq[it].iteration == ++this->last_iter_) - { - ACE_DEBUG ((LM_DEBUG, "OK: ")); - } - else - { - ACE_ERROR ((LM_ERROR, "ERROR: ")); - } - ACE_DEBUG ((LM_DEBUG, "expected: <%u> - " - "received <%d>\n", - this->last_iter_, - coherentwrite_info_seq[it].iteration)); - } - } - if (this->run_ < this->nr_runs () + 1) - { - restarter->restart_write (); - } - else - { - ACE_DEBUG ((LM_DEBUG, "Finished: wait for shutdown\n")); - } + this->check_iters ("READ", coherentwrite_info_seq); } catch (const CCM_DDS::NonExistent& ex) { @@ -293,7 +358,10 @@ namespace CIAO_CoherentWrite_Test_Receiver_Impl "Starting run number <%d>\n", run)); this->run_ = run; - read_all (); + if (this->run_ % 2 == 1) + this->read_all (); + else + this->get_all (); } ::CORBA::UShort diff --git a/CIAO/connectors/dds4ccm/tests/CoherentWriter/Receiver/CoherentWrite_Test_Receiver_exec.h b/CIAO/connectors/dds4ccm/tests/CoherentWriter/Receiver/CoherentWrite_Test_Receiver_exec.h index 3a5231ed465..be797696480 100644 --- a/CIAO/connectors/dds4ccm/tests/CoherentWriter/Receiver/CoherentWrite_Test_Receiver_exec.h +++ b/CIAO/connectors/dds4ccm/tests/CoherentWriter/Receiver/CoherentWrite_Test_Receiver_exec.h @@ -190,6 +190,10 @@ namespace CIAO_CoherentWrite_Test_Receiver_Impl read_action_Generator *ticker_; + void check_iters (const char * test, + const CoherentWriteTestSeq& coherentwrite_info_seq); + + void get_all (void); void read_all (void); //@} diff --git a/CIAO/connectors/dds4ccm/tests/CoherentWriter/descriptors/Plan.cdp b/CIAO/connectors/dds4ccm/tests/CoherentWriter/descriptors/Plan.cdp index 7b27c761106..bd78b9fb47f 100644 --- a/CIAO/connectors/dds4ccm/tests/CoherentWriter/descriptors/Plan.cdp +++ b/CIAO/connectors/dds4ccm/tests/CoherentWriter/descriptors/Plan.cdp @@ -59,8 +59,60 @@ </execParameter> </implementation> - <implementation xmi:id="CoherentWrite_Test_ConnectorComponentImplementation"> - <name>CoherentWrite_Test_ConnectorComponentImplementation</name> + <implementation xmi:id="CoherentWrite_Test_StateConnectorImplementation"> + <name>CoherentWrite_Test_StateConnectorImplementation</name> + <source/> + <artifact xmi:idref="CoherentWrite_Test_Connector_ExecArtifact" /> + <artifact xmi:idref="CoherentWrite_Test_Connector_SvntArtifact" /> + <execParameter> + <!-- entrypoint as exec parameter (see 10.6.1) --> + <name>component factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_CoherentWriteTestConnector_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_CoherentWriteTestConnector_DDS_State_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>CoherentWrite_Test_Connector_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>CoherentWrite_Test_Connector_exec</string> + </value> + </value> + </execParameter> + </implementation> + + <implementation xmi:id="CoherentWrite_Test_EventConnectorImplementation"> + <name>CoherentWrite_Test_EventConnectorImplementation</name> <source/> <artifact xmi:idref="CoherentWrite_Test_Connector_ExecArtifact" /> <artifact xmi:idref="CoherentWrite_Test_Connector_SvntArtifact" /> @@ -110,6 +162,7 @@ </value> </execParameter> </implementation> + <implementation xmi:id="SenderComponentImplementation"> <name>SenderComponentImplementation</name> <source/> @@ -161,6 +214,7 @@ </value> </execParameter> </implementation> + <instance xmi:id="ReceiverComponentInstance"> <name>ReceiverComponent</name> <node>ReceiverNode</node> @@ -179,12 +233,13 @@ </value> </configProperty> </instance> - <instance xmi:id="CoherentWrite_Test_ConnectorComponentInstance"> + + <instance xmi:id="CoherentWrite_Test_SenderConnectorInstance"> <name>CoherentWrite_Test_ConnectorComponent</name> <node>SenderNode</node> <!-- hostname --> <source/> - <implementation xmi:idref="CoherentWrite_Test_ConnectorComponentImplementation" /> + <implementation xmi:idref="CoherentWrite_Test_EventConnectorImplementation" /> <configProperty> <name>qos_profile</name> <value> @@ -208,12 +263,13 @@ </value> </configProperty> </instance> - <instance xmi:id="CoherentWrite_Test_ConnectorComponentInstance2"> - <name>CoherentWrite_Test_ConnectorComponent2</name> + + <instance xmi:id="CoherentWrite_Test_ReceiverConnectorInstance"> + <name>CoherentWrite_Test_ReceiverConnector</name> <node>ReceiverNode</node> <!-- hostname --> <source/> - <implementation xmi:idref="CoherentWrite_Test_ConnectorComponentImplementation" /> + <implementation xmi:idref="CoherentWrite_Test_StateConnectorImplementation" /> <configProperty> <name>qos_profile</name> <value> @@ -237,6 +293,7 @@ </value> </configProperty> </instance> + <instance xmi:id="SenderComponentInstance"> <name>SenderComponent</name> <node>SenderNode</node> @@ -269,10 +326,30 @@ <instance xmi:idref="ReceiverComponentInstance" /> </internalEndpoint> <internalEndpoint> - <portName>push_consumer_data</portName> + <portName>pull_observer_data</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="CoherentWrite_Test_ReceiverConnectorInstance" /> + </internalEndpoint> + </connection> + + <connection> + <name>info_out_fresh_data</name> + <deployRequirement> + <name>edu.dre.vanderbilt.DAnCE.ConnectionType</name> + <resourceType>Local_Interface</resourceType> + </deployRequirement> + <internalEndpoint> + <portName>info_out_fresh_data</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="ReceiverComponentInstance" /> + </internalEndpoint> + <internalEndpoint> + <portName>pull_observer_fresh_data</portName> <provider>true</provider> <kind>Facet</kind> - <instance xmi:idref="CoherentWrite_Test_ConnectorComponentInstance2" /> + <instance xmi:idref="CoherentWrite_Test_ReceiverConnectorInstance" /> </internalEndpoint> </connection> @@ -292,7 +369,7 @@ <portName>supplier_data</portName> <provider>true</provider> <kind>Facet</kind> - <instance xmi:idref="CoherentWrite_Test_ConnectorComponentInstance" /> + <instance xmi:idref="CoherentWrite_Test_SenderConnectorInstance" /> </internalEndpoint> </connection> |