diff options
Diffstat (limited to 'CIAO/connectors/ami4ccm/tests/Exceptions')
9 files changed, 641 insertions, 332 deletions
diff --git a/CIAO/connectors/ami4ccm/tests/Exceptions/Receiver/ExceptionT_Receiver_exec.cpp b/CIAO/connectors/ami4ccm/tests/Exceptions/Receiver/ExceptionT_Receiver_exec.cpp index 34bc57f9aa6..8a440b64e5a 100644 --- a/CIAO/connectors/ami4ccm/tests/Exceptions/Receiver/ExceptionT_Receiver_exec.cpp +++ b/CIAO/connectors/ami4ccm/tests/Exceptions/Receiver/ExceptionT_Receiver_exec.cpp @@ -1,21 +1,58 @@ // -*- C++ -*- // $Id$ +/** + * 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 "ExceptionT_Receiver_exec.h" #include "ace/OS_NS_unistd.h" namespace CIAO_ExceptionT_Receiver_Impl { - MyFoo_exec_i::MyFoo_exec_i (void) : get_rw_ (true), get_ro_ (true) + + /** + * Facet Executor Implementation Class: do_my_foo_exec_i + */ + + do_my_foo_exec_i::do_my_foo_exec_i ( + ::ExceptionT::CCM_Receiver_Context_ptr ctx) + : ciao_context_ ( + ::ExceptionT::CCM_Receiver_Context::_duplicate (ctx)), + get_rw_ (true), + get_ro_ (true) { } - MyFoo_exec_i::~MyFoo_exec_i (void) + do_my_foo_exec_i::~do_my_foo_exec_i (void) { } + // Operations from ::ExceptionT::MyFoo + ::CORBA::Long - MyFoo_exec_i::foo (const char * in_str, ::CORBA::String_out answer) + do_my_foo_exec_i::foo (const char * in_str, + ::CORBA::String_out answer) { if (ACE_OS::strlen (in_str) == 0) { @@ -32,7 +69,7 @@ namespace CIAO_ExceptionT_Receiver_Impl } void - MyFoo_exec_i::hello (::CORBA::Long_out answer) + do_my_foo_exec_i::hello (::CORBA::Long_out answer) { ACE_OS::sleep (ACE_OS::rand () % 2); answer = ACE_OS::rand () % 100; @@ -43,23 +80,23 @@ namespace CIAO_ExceptionT_Receiver_Impl } ::CORBA::Short - MyFoo_exec_i::rw_attrib () + do_my_foo_exec_i::rw_attrib (void) { - // this->get_rw_ is always true, so always an exception is thrown. - if (this->get_rw_) - { - ExceptionT::InternalError ex (42, "Rec.Exc.get_rw_attrib", - "thrown by receiver"); - throw ex; - } - else - { - return ACE_OS::rand () % 100; - } + // this->get_rw_ is always true, so always an exception is thrown. + if (this->get_rw_) + { + ExceptionT::InternalError ex (42, "Rec.Exc.get_rw_attrib", + "thrown by receiver"); + throw ex; + } + else + { + return ACE_OS::rand () % 100; + } } void - MyFoo_exec_i::rw_attrib (::CORBA::Short new_value) + do_my_foo_exec_i::rw_attrib(::CORBA::Short new_value) { if (new_value == 0) { @@ -74,10 +111,10 @@ namespace CIAO_ExceptionT_Receiver_Impl } } - CORBA::Short - MyFoo_exec_i::ro_attrib () + ::CORBA::Short + do_my_foo_exec_i::ro_attrib (void) { - // this->get_ro_ is always true, so always an exception is thrown. + // this->get_ro_ is always true, so always an exception is thrown. if (this->get_ro_) { ExceptionT::InternalError ex (42, "Rec.Exc.ro_attrib", @@ -91,27 +128,51 @@ namespace CIAO_ExceptionT_Receiver_Impl return ACE_OS::rand () % 100; } - Receiver_exec_i::Receiver_exec_i (void) - { + /** + * Component Executor Implementation Class: Receiver_exec_i + */ + + Receiver_exec_i::Receiver_exec_i (void){ } Receiver_exec_i::~Receiver_exec_i (void) { } + // Supported operations and attributes. + + // Component attributes and port operations. + ::ExceptionT::CCM_MyFoo_ptr Receiver_exec_i::get_do_my_foo (void) { - return new MyFoo_exec_i (); + if ( ::CORBA::is_nil (this->ciao_do_my_foo_.in ())) + { + do_my_foo_exec_i *tmp = 0; + ACE_NEW_RETURN ( + tmp, + do_my_foo_exec_i ( + this->ciao_context_.in ()), + ::ExceptionT::CCM_MyFoo::_nil ()); + + this->ciao_do_my_foo_ = tmp; + } + + return + ::ExceptionT::CCM_MyFoo::_duplicate ( + this->ciao_do_my_foo_.in ()); } + // Operations from Components::SessionComponent. + void Receiver_exec_i::set_session_context ( ::Components::SessionContext_ptr ctx) { - this->context_ = ::ExceptionT::CCM_Receiver_Context::_narrow (ctx); + this->ciao_context_ = + ::ExceptionT::CCM_Receiver_Context::_narrow (ctx); - if ( ::CORBA::is_nil (this->context_.in ())) + if ( ::CORBA::is_nil (this->ciao_context_.in ())) { throw ::CORBA::INTERNAL (); } @@ -120,33 +181,36 @@ namespace CIAO_ExceptionT_Receiver_Impl 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" ::Components::EnterpriseComponent_ptr - create_ExceptionT_AMI_Receiver_Impl (void) + create_ExceptionT_Receiver_Impl (void) { ::Components::EnterpriseComponent_ptr retval = ::Components::EnterpriseComponent::_nil (); - ACE_NEW_RETURN ( + ACE_NEW_NORETURN ( retval, - Receiver_exec_i, - ::Components::EnterpriseComponent::_nil ()); + Receiver_exec_i); return retval; } diff --git a/CIAO/connectors/ami4ccm/tests/Exceptions/Receiver/ExceptionT_Receiver_exec.h b/CIAO/connectors/ami4ccm/tests/Exceptions/Receiver/ExceptionT_Receiver_exec.h index 2f236ef73ee..30c1612f943 100644 --- a/CIAO/connectors/ami4ccm/tests/Exceptions/Receiver/ExceptionT_Receiver_exec.h +++ b/CIAO/connectors/ami4ccm/tests/Exceptions/Receiver/ExceptionT_Receiver_exec.h @@ -1,43 +1,87 @@ // -*- C++ -*- // $Id$ -#ifndef CIAO_EXCEPTION_T_RECEIVER_EXEC_H_ -#define CIAO_EXCEPTION_T_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 + **/ +#ifndef CIAO_EXCEPTIONT_RECEIVER_EXEC_LMPZLZ_H_ +#define CIAO_EXCEPTIONT_RECEIVER_EXEC_LMPZLZ_H_ #include "ExceptionT_ReceiverEC.h" +#include "ExceptionT_Receiver_exec_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "tao/LocalObject.h" -#include "ExceptionT_Receiver_exec_export.h" namespace CIAO_ExceptionT_Receiver_Impl { - class MyFoo_exec_i + + /** + * Provider Executor Implementation Class: do_my_foo_exec_i + */ + class do_my_foo_exec_i : public virtual ::ExceptionT::CCM_MyFoo, public virtual ::CORBA::LocalObject { public: - MyFoo_exec_i (void); - virtual ~MyFoo_exec_i (void); + do_my_foo_exec_i ( + ::ExceptionT::CCM_Receiver_Context_ptr ctx); + virtual ~do_my_foo_exec_i (void); + + //@{ + /** Operations and attributes from ::ExceptionT::MyFoo. */ + + virtual + ::CORBA::Long foo (const char * in_str, + ::CORBA::String_out answer); - virtual ::CORBA::Long foo (const char * in_str, ::CORBA::String_out answer); + virtual + void hello (::CORBA::Long_out answer); - virtual void hello (::CORBA::Long_out answer); + virtual + ::CORBA::Short rw_attrib (void); - virtual ::CORBA::Short rw_attrib (); + virtual + void rw_attrib (::CORBA::Short rw_attrib); - virtual void rw_attrib (::CORBA::Short new_value); + virtual + ::CORBA::Short ro_attrib (void); + //@} - virtual CORBA::Short ro_attrib (); private: + ::ExceptionT::CCM_Receiver_Context_var ciao_context_; bool get_rw_; bool get_ro_; }; - class Receiver_exec_i + /** + * Component Executor Implementation Class: Receiver_exec_i + */ + + class Receiver_exec_i : public virtual Receiver_Exec, public virtual ::CORBA::LocalObject { @@ -45,23 +89,51 @@ namespace CIAO_ExceptionT_Receiver_Impl Receiver_exec_i (void); virtual ~Receiver_exec_i (void); - virtual ::ExceptionT::CCM_MyFoo_ptr get_do_my_foo (void); + //@{ + /** Supported operations and attributes. */ - virtual void set_session_context (::Components::SessionContext_ptr ctx); + //@} - virtual void configuration_complete (void); + //@{ + /** Component attributes and port operations. */ + + virtual ::ExceptionT::CCM_MyFoo_ptr + get_do_my_foo (void); + //@} + //@{ + /** 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. */ + + //@} private: - ::ExceptionT::CCM_Receiver_Context_var context_; + ::ExceptionT::CCM_Receiver_Context_var ciao_context_; + + //@{ + /** Component attributes. */ + ::ExceptionT::CCM_MyFoo_var ciao_do_my_foo_; + //@} + + //@{ + /** User defined members. */ + //@} + + //@{ + /** User defined private operations. */ + //@} }; extern "C" EXCEPTION_T_RECEIVER_EXEC_Export ::Components::EnterpriseComponent_ptr - create_ExceptionT_AMI_Receiver_Impl (void); + create_ExceptionT_Receiver_Impl (void); } #endif /* ifndef */ - diff --git a/CIAO/connectors/ami4ccm/tests/Exceptions/Sender/ExceptionTA_conn_i.cpp b/CIAO/connectors/ami4ccm/tests/Exceptions/Sender/ExceptionTA_conn_i.cpp new file mode 100644 index 00000000000..a1ca4c307b8 --- /dev/null +++ b/CIAO/connectors/ami4ccm/tests/Exceptions/Sender/ExceptionTA_conn_i.cpp @@ -0,0 +1,138 @@ +// -*- C++ -*- +// $Id$ + +/** + * 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 + **/ + +// TAO_IDL - Generated from +// be/be_codegen.cpp:1661 + +#include "ExceptionTA_conn_i.h" + +namespace CIAO_ExceptionT_AMI4CCM_MyFoo_Connector_AMI4CCM_Connector_Impl +{ + void HandleException ( + ::CCM_AMI::ExceptionHolder_ptr excep_holder, + const char* func) + { + try + { + excep_holder->raise_exception (); + } + catch (const ExceptionT::InternalError& ex) + { + CIAO_ExceptionT_Sender_Impl::HandleException (ex.id, + ex.error_string.in (), + ex.test.in(), func); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("ERROR: Caught unexpected exception:"); + } + } + + AMI4CCM_MyFooReplyHandler_i::AMI4CCM_MyFooReplyHandler_i (void) + { + } + + AMI4CCM_MyFooReplyHandler_i::~AMI4CCM_MyFooReplyHandler_i (void) + { + } + + void + AMI4CCM_MyFooReplyHandler_i::foo (::CORBA::Long /* ami_return_val */, + const char * /* answer */) + { + // never should come here in this test. + ACE_ERROR ((LM_ERROR, "ERROR: MyFoo_callback_exec_i::foo: " + "Unexpected return.\n")); + } + + void + AMI4CCM_MyFooReplyHandler_i::foo_excep ( + ::CCM_AMI::ExceptionHolder_ptr excep_holder) + { + HandleException (excep_holder, "FOO (asyn)"); + } + + void + AMI4CCM_MyFooReplyHandler_i::hello (::CORBA::Long /* answer */) + { + // never should come here in this test. + ACE_ERROR ((LM_ERROR, "ERROR: MyFoo_callback_exec_i::hello: " + "Unexpected return.\n")); + } + + void + AMI4CCM_MyFooReplyHandler_i::hello_excep ( + ::CCM_AMI::ExceptionHolder_ptr excep_holder) + { + HandleException (excep_holder, "HELLO (asyn)"); + } + + void + AMI4CCM_MyFooReplyHandler_i::get_rw_attrib (::CORBA::Short /* rw_attrib */) + { + // never should come here in this test. + ACE_ERROR ((LM_ERROR, "ERROR: MyFoo_callback_exec_i::get_rw_attrib : " + "Unexpected return.\n")); + } + + void + AMI4CCM_MyFooReplyHandler_i::get_rw_attrib_excep ( + ::CCM_AMI::ExceptionHolder_ptr excep_holder) + { + HandleException (excep_holder, "GET RW_ATTRIB (asyn)"); + } + + void + AMI4CCM_MyFooReplyHandler_i::set_rw_attrib (void) + { + // never should come here in this test. + ACE_ERROR ((LM_ERROR, "ERROR: MyFoo_callback_exec_i::set_rw_attrib: " + "Unexpected return.\n")); + } + + void + AMI4CCM_MyFooReplyHandler_i::set_rw_attrib_excep ( + ::CCM_AMI::ExceptionHolder_ptr excep_holder) + { + HandleException (excep_holder, "SET_RW_ATTRIB (asyn)"); + } + + void + AMI4CCM_MyFooReplyHandler_i::get_ro_attrib (::CORBA::Short /* ro_attrib */) + { + // never should come here in this test. + ACE_ERROR ((LM_ERROR, "ERROR: MyFoo_callback_exec_i::get_ro_attrib: " + "Unexpected return.\n")); + } + + void + AMI4CCM_MyFooReplyHandler_i::get_ro_attrib_excep ( + ::CCM_AMI::ExceptionHolder_ptr excep_holder) + { + HandleException (excep_holder, "RO_ATTRIB (asyn)"); + } +} diff --git a/CIAO/connectors/ami4ccm/tests/Exceptions/Sender/ExceptionTA_conn_i.h b/CIAO/connectors/ami4ccm/tests/Exceptions/Sender/ExceptionTA_conn_i.h new file mode 100644 index 00000000000..760ba060f90 --- /dev/null +++ b/CIAO/connectors/ami4ccm/tests/Exceptions/Sender/ExceptionTA_conn_i.h @@ -0,0 +1,97 @@ +// -*- C++ -*- +// $Id$ + +/** + * 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 + **/ + +// TAO_IDL - Generated from +// be/be_codegen.cpp:1584 + +#ifndef CIAO_EXCEPTIONTA_CONN_I_YUF8IS_H_ +#define CIAO_EXCEPTIONTA_CONN_I_YUF8IS_H_ + +#include /**/ "ace/pre.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "../Base/ExceptionTAC.h" + +#include "ExceptionT_Sender_exec.h" + +namespace CIAO_ExceptionT_AMI4CCM_MyFoo_Connector_AMI4CCM_Connector_Impl +{ /// Common exception handlers + + void HandleException ( + ::Messaging::ExceptionHolder * excep_holder, + const char* func); + + class AMI4CCM_MyFooReplyHandler_i + : public ::ExceptionT::AMI4CCM_MyFooReplyHandler + { + public: + AMI4CCM_MyFooReplyHandler_i (void); + virtual ~AMI4CCM_MyFooReplyHandler_i (void); + + virtual + void foo (::CORBA::Long ami_return_val, + const char * answer); + + virtual + void foo_excep (::CCM_AMI::ExceptionHolder_ptr excep_holder); + + virtual + void hello (::CORBA::Long answer); + + virtual + void hello_excep (::CCM_AMI::ExceptionHolder_ptr excep_holder); + + virtual + void get_rw_attrib (::CORBA::Short rw_attrib); + + virtual + void get_rw_attrib_excep (::CCM_AMI::ExceptionHolder_ptr excep_holder); + + virtual + void set_rw_attrib (void); + + virtual + void set_rw_attrib_excep (::CCM_AMI::ExceptionHolder_ptr excep_holder); + + virtual + void get_ro_attrib (::CORBA::Short ro_attrib); + + virtual + void get_ro_attrib_excep (::CCM_AMI::ExceptionHolder_ptr excep_holder); + }; +} + +// TAO_IDL - Generated from +// be/be_codegen.cpp:2151 + + +#include /**/ "ace/post.h" + +#endif /* ifndef */ diff --git a/CIAO/connectors/ami4ccm/tests/Exceptions/Sender/ExceptionT_Sender.mpc b/CIAO/connectors/ami4ccm/tests/Exceptions/Sender/ExceptionT_Sender.mpc index d251c688aef..0a1c91b2461 100644 --- a/CIAO/connectors/ami4ccm/tests/Exceptions/Sender/ExceptionT_Sender.mpc +++ b/CIAO/connectors/ami4ccm/tests/Exceptions/Sender/ExceptionT_Sender.mpc @@ -92,11 +92,13 @@ project(AMI_ExceptionT_Base_Sender_exec) : ciao_executor, ami, ami4ccm_stub { Source_Files { ExceptionT_Sender_exec.cpp + ExceptionTA_conn_i.cpp } Header_Files { ExceptionT_Sender_exec.h ExceptionT_Sender_exec_export.h + ExceptionTA_conn_i.h } Inline_Files { diff --git a/CIAO/connectors/ami4ccm/tests/Exceptions/Sender/ExceptionT_Sender_exec.cpp b/CIAO/connectors/ami4ccm/tests/Exceptions/Sender/ExceptionT_Sender_exec.cpp index 14498f9324d..b9c0d947fe1 100644 --- a/CIAO/connectors/ami4ccm/tests/Exceptions/Sender/ExceptionT_Sender_exec.cpp +++ b/CIAO/connectors/ami4ccm/tests/Exceptions/Sender/ExceptionT_Sender_exec.cpp @@ -1,7 +1,33 @@ // -*- C++ -*- // $Id$ +/** + * 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 "ExceptionT_Sender_exec.h" +#include "ExceptionTA_conn_i.h" + #include "ace/OS_NS_unistd.h" namespace CIAO_ExceptionT_Sender_Impl @@ -10,161 +36,45 @@ namespace CIAO_ExceptionT_Sender_Impl CORBA::Short nr_of_syn_received = 0; void HandleException ( - long id, - const char* error_string, - const char* test, - const char* func) - { - if (id != 42) + long id, + const char* error_string, + const char* test, + const char* func) + { + if (id != 42) { ACE_ERROR ((LM_ERROR, "ERROR Sender: unexpected ID received in except " "handler <%u> <%C> (%C)\n", id, error_string,func)); return; } - if (ACE_OS::strcmp (test, "thrown by receiver") != 0) + if (ACE_OS::strcmp (test, "thrown by receiver") != 0) { ACE_ERROR ((LM_ERROR, "ERROR Sender (%s): unexpected string received in" " except handler <%s>\n", func, test)); return; } - ACE_DEBUG ((LM_DEBUG, "Sender: Caught correct exception <%u," + ACE_DEBUG ((LM_DEBUG, "Sender: Caught correct exception <%u," "%C> for %C\n", id, error_string, func)); - ++nr_of_received; - } - - void HandleException ( - ::CCM_AMI::ExceptionHolder_ptr excep_holder, - const char* func) - { - try - { - excep_holder->raise_exception (); - } - catch (const ExceptionT::InternalError& ex) - { - HandleException (ex.id, ex.error_string.in (), ex.test.in(), func); - } - catch (const CORBA::Exception& ex) - { - ex._tao_print_exception ("ERROR: Caught unexpected exception:"); - } - } - - //============================================================ - // Facet Executor Implementation Class: MyFoo_callback_exec_i - //============================================================ - MyFoo_callback_exec_i::MyFoo_callback_exec_i (void) - { + ++nr_of_received; } - - MyFoo_callback_exec_i::~MyFoo_callback_exec_i (void) - { - } - - //============================================================ - // Operations from ::CCM_AMI::MyFoo_callback - //============================================================ - - // FOO methods - void - MyFoo_callback_exec_i::foo ( - ::CORBA::Long /*ami_return_val*/, - const char * /*answer*/) - { - // never should come here in this test. - ACE_ERROR ((LM_ERROR, "ERROR: MyFoo_callback_exec_i::foo: " - "Unexpected return.\n")); - } - - void - MyFoo_callback_exec_i::foo_excep ( - ::CCM_AMI::ExceptionHolder * excep_holder) - { - HandleException (excep_holder, "FOO (asyn)"); - } - - // Hello methods - void - MyFoo_callback_exec_i::hello ( - ::CORBA::Long /*answer*/) - { - // never should come here in this test. - ACE_ERROR ((LM_ERROR, "ERROR: MyFoo_callback_exec_i::hello: " - "Unexpected return.\n")); - } - - void - MyFoo_callback_exec_i::hello_excep ( - ::CCM_AMI::ExceptionHolder * excep_holder) - { - HandleException (excep_holder, "HELLO (asyn)"); - } - - //GET rw_attrib Reply Handler - void - MyFoo_callback_exec_i::get_rw_attrib ( - ::CORBA::Short /*ami_return_val*/) - { - // never should come here in this test. - ACE_ERROR ((LM_ERROR, "ERROR: MyFoo_callback_exec_i::get_rw_attrib : " - "Unexpected return.\n")); - } - - void - MyFoo_callback_exec_i::get_rw_attrib_excep ( - ::CCM_AMI::ExceptionHolder * excep_holder) - { - HandleException (excep_holder, "GET RW_ATTRIB (asyn)"); - } - - //SET rw_attrib Reply Handler - void - MyFoo_callback_exec_i::set_rw_attrib () - { - // never should come here in this test. - ACE_ERROR ((LM_ERROR, "ERROR: MyFoo_callback_exec_i::set_rw_attrib: " - "Unexpected return.\n")); - } - - void - MyFoo_callback_exec_i::set_rw_attrib_excep ( - ::CCM_AMI::ExceptionHolder * excep_holder) - { - HandleException (excep_holder, "SET_RW_ATTRIB (asyn)"); - } - - //ro_attrib Reply Handler - void - MyFoo_callback_exec_i::get_ro_attrib ( - ::CORBA::Short /*ami_return_val*/) - { - // never should come here in this test. - ACE_ERROR ((LM_ERROR, "ERROR: MyFoo_callback_exec_i::get_ro_attrib: " - "Unexpected return.\n")); - } - - void - MyFoo_callback_exec_i::get_ro_attrib_excep ( - ::CCM_AMI::ExceptionHolder * excep_holder) - { - HandleException (excep_holder, "RO_ATTRIB (asyn)"); - } - //============================================================ // Worker thread for asynchronous invocations for MyFoo //============================================================ asynch_foo_generator::asynch_foo_generator ( - ::ExceptionT::AMI4CCM_MyFoo_ptr my_foo_ami) - : my_foo_ami_ (::ExceptionT::AMI4CCM_MyFoo::_duplicate (my_foo_ami)) + ::ExceptionT::CCM_Sender_Context_ptr context) + : context_(::ExceptionT::CCM_Sender_Context::_duplicate (context)) { } int asynch_foo_generator::svc () { ACE_OS::sleep (3); + ::ExceptionT::AMI4CCM_MyFoo_var my_foo_ami_ = + context_->get_connection_sendc_run_my_foo(); + if (CORBA::is_nil (my_foo_ami_)) { ACE_ERROR ((LM_ERROR, "ERROR Sender (ASYNCH) :\tfoo_ami is NIL !\n")); @@ -172,14 +82,17 @@ namespace CIAO_ExceptionT_Sender_Impl } else { + ::ExceptionT::AMI4CCM_MyFooReplyHandler_var cb = + new CIAO_ExceptionT_AMI4CCM_MyFoo_Connector_AMI4CCM_Connector_Impl::AMI4CCM_MyFooReplyHandler_i (); + //Invoke Asynchronous calls to test exception handling //for this test, hello , get_ro_attrib and get_rw_attrib functions of //receiver always sent back a exception - my_foo_ami_->sendc_hello (new MyFoo_callback_exec_i ()); - my_foo_ami_->sendc_get_rw_attrib(new MyFoo_callback_exec_i ()); - my_foo_ami_->sendc_get_ro_attrib(new MyFoo_callback_exec_i ()); - my_foo_ami_->sendc_foo (new MyFoo_callback_exec_i (), ""); - my_foo_ami_->sendc_set_rw_attrib(new MyFoo_callback_exec_i (), 0); + my_foo_ami_->sendc_hello (cb.in()); + my_foo_ami_->sendc_get_rw_attrib(cb.in()); + my_foo_ami_->sendc_get_ro_attrib(cb.in()); + my_foo_ami_->sendc_foo (cb.in(), ""); + my_foo_ami_->sendc_set_rw_attrib(cb.in(), 0); } return 0; } @@ -187,91 +100,95 @@ namespace CIAO_ExceptionT_Sender_Impl //============================================================ // Worker thread for synchronous invocations for MyFoo //============================================================ - synch_foo_generator::synch_foo_generator (::ExceptionT::MyFoo_ptr my_foo_ami) - : my_foo_ami_ (::ExceptionT::MyFoo::_duplicate (my_foo_ami)) + synch_foo_generator::synch_foo_generator ( + ::ExceptionT::CCM_Sender_Context_ptr context) + : context_(::ExceptionT::CCM_Sender_Context::_duplicate (context)) { } int synch_foo_generator::svc () { ACE_OS::sleep (3); + ::ExceptionT::MyFoo_var my_foo_ami_ = + context_->get_connection_run_my_foo (); + //run synch calls CORBA::String_var out_str; - try - { - my_foo_ami_->foo ("Do something synchronous", - out_str.out ()); - } - catch (const ExceptionT::InternalError&) - { - ACE_ERROR ((LM_ERROR, "ERROR: synch_foo_generator::foo: " - "Unexpected exception.\n")); - } - try - { - my_foo_ami_->foo ("", out_str); - } - catch (const ExceptionT::InternalError& ex) - { - //expected exception - HandleException (ex.id, ex.error_string.in (), ex.test.in(), - "foo (syn)"); - ++nr_of_syn_received; + try + { + my_foo_ami_->foo ("Do something synchronous", + out_str.out ()); + } + catch (const ExceptionT::InternalError&) + { + ACE_ERROR ((LM_ERROR, "ERROR: synch_foo_generator::foo: " + "Unexpected exception.\n")); + } + try + { + my_foo_ami_->foo ("", out_str); + } + catch (const ExceptionT::InternalError& ex) + { + //expected exception + HandleException (ex.id, ex.error_string.in (), ex.test.in(), + "foo (syn)"); + ++nr_of_syn_received; - } - try - { - CORBA::Long answer; - my_foo_ami_->hello (answer); - } - catch (const ExceptionT::InternalError& ex) - { - //expected exception - HandleException (ex.id, ex.error_string.in (), ex.test.in(), - "hello (syn)"); - ++nr_of_syn_received; - } - try - { - my_foo_ami_->rw_attrib (); - } - catch (const ExceptionT::InternalError& ex) - { - //expected exception - HandleException (ex.id, ex.error_string.in (), ex.test.in(), - "get_rw_attrib (syn)"); - ++nr_of_syn_received; - } - try - { - my_foo_ami_->rw_attrib (0); - } - catch (const ExceptionT::InternalError& ex) - { - //expected exception - HandleException (ex.id, ex.error_string.in (), ex.test.in(), - "set_rw_attrib (syn)"); - ++nr_of_syn_received; - } - try - { - my_foo_ami_->ro_attrib (); - } - catch (const ExceptionT::InternalError& ex) - { - HandleException (ex.id, ex.error_string.in (), ex.test.in(), - "ro_attrib (syn)"); - ++nr_of_syn_received; - } + } + try + { + CORBA::Long answer; + my_foo_ami_->hello (answer); + } + catch (const ExceptionT::InternalError& ex) + { + //expected exception + HandleException (ex.id, ex.error_string.in (), ex.test.in(), + "hello (syn)"); + ++nr_of_syn_received; + } + try + { + my_foo_ami_->rw_attrib (); + } + catch (const ExceptionT::InternalError& ex) + { + //expected exception + HandleException (ex.id, ex.error_string.in (), ex.test.in(), + "get_rw_attrib (syn)"); + ++nr_of_syn_received; + } + try + { + my_foo_ami_->rw_attrib (0); + } + catch (const ExceptionT::InternalError& ex) + { + //expected exception + HandleException (ex.id, ex.error_string.in (), ex.test.in(), + "set_rw_attrib (syn)"); + ++nr_of_syn_received; + } + try + { + my_foo_ami_->ro_attrib (); + } + catch (const ExceptionT::InternalError& ex) + { + HandleException (ex.id, ex.error_string.in (), ex.test.in(), + "ro_attrib (syn)"); + ++nr_of_syn_received; + } return 0; - } + } - //============================================================ - // Component Executor Implementation Class: Sender_exec_i - //============================================================ - Sender_exec_i::Sender_exec_i (void) - { + /** + * Component Executor Implementation Class: Sender_exec_i + */ + + Sender_exec_i::Sender_exec_i (void){ } Sender_exec_i::~Sender_exec_i (void) @@ -280,18 +197,18 @@ namespace CIAO_ExceptionT_Sender_Impl // Supported operations and attributes. - // Component attributes. + // Component attributes and port operations. - // Port operations. // Operations from Components::SessionComponent. void Sender_exec_i::set_session_context ( ::Components::SessionContext_ptr ctx) { - this->context_ = + this->ciao_context_ = ::ExceptionT::CCM_Sender_Context::_narrow (ctx); - if ( ::CORBA::is_nil (this->context_.in ())) + + if ( ::CORBA::is_nil (this->ciao_context_.in ())) { throw ::CORBA::INTERNAL (); } @@ -300,27 +217,25 @@ namespace CIAO_ExceptionT_Sender_Impl void Sender_exec_i::configuration_complete (void) { + /* Your code here. */ } void Sender_exec_i::ccm_activate (void) { - ::ExceptionT::AMI4CCM_MyFoo_var asynch_foo = - this->context_->get_connection_sendc_run_my_foo(); - asynch_foo_generator* asynch_foo_gen = - new asynch_foo_generator (asynch_foo); - asynch_foo_gen->activate (THR_NEW_LWP | THR_JOINABLE, 1); + this->asynch_foo_gen = + new asynch_foo_generator (this->ciao_context_.in ()); + asynch_foo_gen->activate (THR_NEW_LWP | THR_JOINABLE, 1); - ::ExceptionT::MyFoo_var synch_foo = - this->context_->get_connection_run_my_foo (); - synch_foo_generator* synch_foo_gen = - new synch_foo_generator (synch_foo); - synch_foo_gen->activate (THR_NEW_LWP | THR_JOINABLE, 1); + this->synch_foo_gen = + new synch_foo_generator (this->ciao_context_.in ()); + synch_foo_gen->activate (THR_NEW_LWP | THR_JOINABLE, 1); } void Sender_exec_i::ccm_passivate (void) { + /* Your code here. */ } void @@ -343,24 +258,32 @@ namespace CIAO_ExceptionT_Sender_Impl } if ((nr_of_asyn == 5) && (nr_of_syn_received == 5)) { - ACE_DEBUG ((LM_DEBUG, "OK: Receieved the expected number of" + ACE_DEBUG ((LM_DEBUG, "OK: Received the expected number of" " exceptions for asynchronous and " "synchronous calls\n")); } + if (this->asynch_foo_gen) + { + delete this->asynch_foo_gen; + this->asynch_foo_gen = 0; + } + if (this->synch_foo_gen) + { + delete this->synch_foo_gen; + this->synch_foo_gen = 0; + } } extern "C" ::Components::EnterpriseComponent_ptr - create_ExceptionT_AMI_Sender_Impl (void) + create_ExceptionT_Sender_Impl (void) { ::Components::EnterpriseComponent_ptr retval = ::Components::EnterpriseComponent::_nil (); - ACE_NEW_RETURN ( + ACE_NEW_NORETURN ( retval, - Sender_exec_i, - ::Components::EnterpriseComponent::_nil ()); + Sender_exec_i); return retval; } } - diff --git a/CIAO/connectors/ami4ccm/tests/Exceptions/Sender/ExceptionT_Sender_exec.h b/CIAO/connectors/ami4ccm/tests/Exceptions/Sender/ExceptionT_Sender_exec.h index e0eee27ac1e..3546e52ad31 100644 --- a/CIAO/connectors/ami4ccm/tests/Exceptions/Sender/ExceptionT_Sender_exec.h +++ b/CIAO/connectors/ami4ccm/tests/Exceptions/Sender/ExceptionT_Sender_exec.h @@ -1,9 +1,31 @@ // -*- C++ -*- -// // $Id$ -#ifndef CIAO_EXCEPTION_T_SENDER_EXEC_H_ -#define CIAO_EXCEPTION_T_SENDER_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 + **/ +#ifndef CIAO_EXCEPTIONT_SENDER_EXEC_7KCIGI_H_ +#define CIAO_EXCEPTIONT_SENDER_EXEC_7KCIGI_H_ #include "ExceptionT_SenderEC.h" #include "ExceptionT_Sender_exec_export.h" @@ -17,75 +39,39 @@ namespace CIAO_ExceptionT_Sender_Impl { - /// Common exception handlers + void HandleException ( long id, const char* error_string, const char* test, const char* func); - void HandleException ( - ::Messaging::ExceptionHolder * excep_holder, - const char* func); - /// Worker thread for asynchronous invocations class asynch_foo_generator : public virtual ACE_Task_Base { public: - asynch_foo_generator (::ExceptionT::AMI4CCM_MyFoo_ptr my_foo_ami); + asynch_foo_generator (::ExceptionT::CCM_Sender_Context_ptr context); virtual int svc (void); private: - ::ExceptionT::AMI4CCM_MyFoo_var my_foo_ami_; + ::ExceptionT::CCM_Sender_Context_var context_; }; /// Worker thread for synchronous invocations class synch_foo_generator : public virtual ACE_Task_Base { public: - synch_foo_generator (::ExceptionT::MyFoo_ptr my_foo_ami); + synch_foo_generator (::ExceptionT::CCM_Sender_Context_ptr context); virtual int svc (void); private: - ::ExceptionT::MyFoo_var my_foo_ami_; - }; - - class MyFoo_callback_exec_i - : public virtual ::ExceptionT::CCM_AMI4CCM_MyFooReplyHandler, - public virtual ::CORBA::LocalObject - { - public: - MyFoo_callback_exec_i (void); - virtual ~MyFoo_callback_exec_i (void); - - virtual void foo (::CORBA::Long ami_return_val, const char * answer); - - virtual void foo_excep (::CCM_AMI::ExceptionHolder_ptr excep_holder); - - // ExceptionT Reply Handler - virtual void hello (::CORBA::Long answer); - - virtual void hello_excep (::CCM_AMI::ExceptionHolder_ptr excep_holder); - - // GET rw_attrib Reply Handler - virtual void get_rw_attrib ( - ::CORBA::Short ami_return_val); - virtual void get_rw_attrib_excep ( - ::CCM_AMI::ExceptionHolder_ptr excep_holder); - - // SET rw_attrib Reply Handler - virtual void set_rw_attrib (void); - virtual void set_rw_attrib_excep ( - ::CCM_AMI::ExceptionHolder_ptr excep_holder); - - // ro_attrib Reply Handler - virtual void get_ro_attrib ( - ::CORBA::Short ami_return_val); - virtual void get_ro_attrib_excep ( - ::CCM_AMI::ExceptionHolder_ptr excep_holder); + ::ExceptionT::CCM_Sender_Context_var context_; }; + /** + * Component Executor Implementation Class: Sender_exec_i + */ class Sender_exec_i : public virtual Sender_Exec, @@ -95,23 +81,50 @@ namespace CIAO_ExceptionT_Sender_Impl Sender_exec_i (void); virtual ~Sender_exec_i (void); - virtual void - set_session_context ( - ::Components::SessionContext_ptr ctx); + //@{ + /** Supported operations and attributes. */ - virtual void configuration_complete (void); + //@} + //@{ + /** Component attributes and port operations. */ + //@} + + //@{ + /** 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. */ + //@} private: - ::ExceptionT::CCM_Sender_Context_var context_; + ::ExceptionT::CCM_Sender_Context_var ciao_context_; + asynch_foo_generator* asynch_foo_gen; + synch_foo_generator* synch_foo_gen; + + //@{ + /** Component attributes. */ + //@} + + //@{ + /** User defined members. */ + + //@} + + //@{ + /** User defined private operations. */ + + //@} }; extern "C" EXCEPTION_T_SENDER_EXEC_Export ::Components::EnterpriseComponent_ptr - create_ExceptionT_AMI_Sender_Impl (void); + create_ExceptionT_Sender_Impl (void); } #endif /* ifndef */ - diff --git a/CIAO/connectors/ami4ccm/tests/Exceptions/descriptors/Plan.cdp b/CIAO/connectors/ami4ccm/tests/Exceptions/descriptors/Plan.cdp index 1d7569f49a2..37388d58090 100644 --- a/CIAO/connectors/ami4ccm/tests/Exceptions/descriptors/Plan.cdp +++ b/CIAO/connectors/ami4ccm/tests/Exceptions/descriptors/Plan.cdp @@ -16,7 +16,7 @@ <kind>tk_string</kind> </type> <value> - <string>create_ExceptionT_AMI_Receiver_Impl</string> + <string>create_ExceptionT_Receiver_Impl</string> </value> </value> </execParameter> @@ -67,7 +67,7 @@ <kind>tk_string</kind> </type> <value> - <string>create_ExceptionT_AMI_Sender_Impl</string> + <string>create_ExceptionT_Sender_Impl</string> </value> </value> </execParameter> diff --git a/CIAO/connectors/ami4ccm/tests/Exceptions/descriptors/run_test.pl b/CIAO/connectors/ami4ccm/tests/Exceptions/descriptors/run_test.pl index 7ef48194ce4..18e318c49e5 100755 --- a/CIAO/connectors/ami4ccm/tests/Exceptions/descriptors/run_test.pl +++ b/CIAO/connectors/ami4ccm/tests/Exceptions/descriptors/run_test.pl @@ -185,7 +185,7 @@ if ($em_status != 0) { } if ($tg_exe_man->WaitForFileTimed ($ior_embase, - $tg_exe_man->ProcessStartWaitInterval ()) == -1) { + $tg_exe_man->ProcessStartWaitInterval ()) == -1) { print STDERR "ERROR: The ior file of execution manager could not be found\n"; kill_open_processes (); |