diff options
13 files changed, 1884 insertions, 0 deletions
diff --git a/CIAO/ChangeLog b/CIAO/ChangeLog index e547997e5d0..4ce4172835c 100644 --- a/CIAO/ChangeLog +++ b/CIAO/ChangeLog @@ -1,3 +1,24 @@ +Tue Apr 13 15:06:31 UTC 2010 Marijke Hengstmengel <mhengstmengel@remedy.nl> + + * connectors/ami4ccm/tests/Exceptions + * connectors/ami4ccm/tests/Exceptions/Base + * connectors/ami4ccm/tests/Exceptions/Base/ExceptionT.idl + * connectors/ami4ccm/tests/Exceptions/Base/ExceptionT.mpc + * connectors/ami4ccm/tests/Exceptions/descriptors + * connectors/ami4ccm/tests/Exceptions/descriptors/Plan.cdp + * connectors/ami4ccm/tests/Exceptions/descriptors/run_test.pl + * connectors/ami4ccm/tests/Exceptions/Receiver + * connectors/ami4ccm/tests/Exceptions/Receiver/ExceptionT_Receiver.idl + * connectors/ami4ccm/tests/Exceptions/Receiver/ExceptionT_Receiver.mpc + * connectors/ami4ccm/tests/Exceptions/Receiver/ExceptionT_Receiver_exec.cpp + * connectors/ami4ccm/tests/Exceptions/Receiver/ExceptionT_Receiver_exec.h + * connectors/ami4ccm/tests/Exceptions/Sender + * connectors/ami4ccm/tests/Exceptions/Sender/ExceptionT_Sender.idl + * connectors/ami4ccm/tests/Exceptions/Sender/ExceptionT_Sender.mpc + * connectors/ami4ccm/tests/Exceptions/Sender/ExceptionT_Sender_exec.cpp + * connectors/ami4ccm/tests/Exceptions/Sender/ExceptionT_Sender_exec.h + Test in server thrown exceptions are passed back correctly. + Tue Apr 13 11:43:31 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> * DAnCE/NodeApplication/NodeApplication_Impl.cpp: diff --git a/CIAO/connectors/ami4ccm/tests/Exceptions/Base/ExceptionT.idl b/CIAO/connectors/ami4ccm/tests/Exceptions/Base/ExceptionT.idl new file mode 100644 index 00000000000..a1237dcd29e --- /dev/null +++ b/CIAO/connectors/ami4ccm/tests/Exceptions/Base/ExceptionT.idl @@ -0,0 +1,37 @@ +// $Id$ + +#ifndef EXCEPTION_T_IDL +#define EXCEPTION_T_IDL + +#pragma ciao lem "Base/ExceptionTE.idl" +#pragma ciao ami4ccm interface "ExceptionT::MyFoo" +#pragma ciao lem "Base/ExceptionTAE.idl" + +module ExceptionT +{ + exception InternalError + { + long id; + string error_string; + string test; + }; + + // Sender/Receiver interface + interface MyFoo + { + long foo (in string in_str, out string answer) + raises (InternalError); + void hello (out long answer) + raises (InternalError); + + attribute short rw_attrib + getraises (InternalError) + setraises (InternalError); + + readonly attribute short ro_attrib + raises (InternalError); + }; +}; + +#endif + diff --git a/CIAO/connectors/ami4ccm/tests/Exceptions/Base/ExceptionT.mpc b/CIAO/connectors/ami4ccm/tests/Exceptions/Base/ExceptionT.mpc new file mode 100644 index 00000000000..4b68714f5c2 --- /dev/null +++ b/CIAO/connectors/ami4ccm/tests/Exceptions/Base/ExceptionT.mpc @@ -0,0 +1,196 @@ +// $Id$ + +project(AMI_ExceptionT_idl_gen) : componentidldefaults, ami, ami4ccm_stub { + custom_only = 1 + idlflags += -Wb,stub_export_macro=EXCEPTION_T_STUB_Export \ + -Wb,stub_export_include=ExceptionT_stub_export.h \ + -Wb,skel_export_macro=EXCEPTION_T_SKEL_Export \ + -Wb,skel_export_include=ExceptionT_skel_export.h \ + -Wb,conn_export_macro=EXCEPTION_T_CONN_Export \ + -Wb,conn_export_include=ExceptionT_conn_export.h \ + -Wb,exec_export_macro=EXCEPTION_T_EXEC_Export \ + -Wb,exec_export_include=ExceptionT_exec_export.h \ + -I.. -GM -Gxhcn + idlflags -= -Gsv + + IDL_Files { + ExceptionT.idl + } +} + +project(AMI_ExceptionT_lem_gen) : ciaoidldefaults { + after += AMI_ExceptionT_idl_gen + custom_only = 1 + idlflags += -Wb,export_macro=EXCEPTION_T_LEM_STUB_Export \ + -Wb,export_include=ExceptionT_lem_stub_export.h \ + -I.. -SS -Gxhst + + IDL_Files { + ExceptionTE.idl + } +} + +project(AMI_ExceptionT_lema_gen) : ciaoidldefaults { + after += AMI_ExceptionT_idl_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=EXCEPTION_T_STUB_Export \ + -Wb,stub_export_include=ExceptionT_stub_export.h \ + -Wb,conn_export_macro=EXCEPTION_T_CONN_Export \ + -Wb,conn_export_include=ExceptionT_conn_export.h \ + -Wb,svnt_export_macro=EXCEPTION_T_SVNT_Export \ + -Wb,svnt_export_include=ExceptionT_svnt_export.h \ + -Wb,skel_export_macro=EXCEPTION_T_SKEL_Export \ + -Wb,skel_export_include=ExceptionT_skel_export.h \ + -I.. -Gsv -Gcn -Glem -GC -Gxhst -Gxhsv + + IDL_Files { + ExceptionTA.idl + } +} + +project(AMI_ExceptionT_lemae_gen) : ciaoidldefaults { + after += AMI_ExceptionT_lema_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=EXCEPTION_T_LEM_STUB_Export \ + -Wb,stub_export_include=ExceptionT_lem_stub_export.h \ + -I.. -SS + + IDL_Files { + ExceptionTAE.idl + } +} + +project(AMI_ExceptionT_stub) : ccm_stub, ami, ami4ccm_stub { + after += AMI_ExceptionT_lem_gen AMI_ExceptionT_lema_gen + libs += + libout = ../lib + libpaths += ../lib + includes += .. + + sharedname = ExceptionT_stub + dynamicflags = EXCEPTION_T_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + ExceptionTC.cpp + ExceptionTAC.cpp + } + + Header_Files { + ExceptionTC.h + ExceptionT_stub_export.h +} + + Inline_Files { + ExceptionTC.inl + } +} + +project(AMI_ExceptionT_lem_stub) : ccm_executor, ami, ami4ccm_lem_stub { + after += AMI_ExceptionT_lem_gen AMI_ExceptionT_stub AMI_ExceptionT_lemae_gen AMI_ExceptionT_skel + libs += ExceptionT_stub ExceptionT_skel + libout = ../lib + libpaths += ../lib + includes += .. + + sharedname = ExceptionT_lem_stub + dynamicflags = EXCEPTION_T_LEM_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + ExceptionTEC.cpp + ExceptionTAEC.cpp + } + + Header_Files { + ExceptionTEC.h + ExceptionT_lem_stub_export.h +} + + Inline_Files { + ExceptionTEC.inl + } +} + +project(AMI_ExceptionT_skel) : ciao_executor, ami, ami4ccm_servant { + after += AMI_ExceptionT_stub + sharedname = ExceptionT_skel + libs += ExceptionT_stub + libout = ../lib + libpaths += ../lib + includes += .. + + dynamicflags = EXCEPTION_T_SKEL_BUILD_DLL + + IDL_Files { + } + + Source_Files { + ExceptionTS.cpp + ExceptionTAS.cpp + } + + Header_Files { + ExceptionTS.h + ExceptionTAS.h + ExceptionT_skel_export.h + } + + Inline_Files { + ExceptionTS.inl + ExceptionTAS.inl + } +} + +project(AMI_ExceptionT_conn) : ciao_executor, ami, ami4ccm_lem_stub { + after += AMI_ExceptionT_lem_stub ExceptionT_Base_AMI_stub AMI_ExceptionT_skel AMI_ExceptionT_lema_gen AMI_ExceptionT_lemae_gen + sharedname = ExceptionT_conn + libs += ExceptionT_stub ExceptionT_skel ExceptionT_lem_stub + libpaths += ../lib + libout = ../lib + dynamicflags = EXCEPTION_T_CONN_BUILD_DLL + includes += .. + IDL_Files { + } + + Source_Files { + ExceptionTA_conn.cpp + } + + Header_Files { + ExceptionTA_conn.h + ExceptionTA_conn_export.h + } + + Inline_Files { + } +} + +project(AMI_ExceptionT_svnt) : ciao_servant, ami, ami4ccm_servant { + after += AMI_ExceptionT_lem_stub ExceptionT_Base_AMI_stub AMI_ExceptionT_skel AMI_ExceptionT_lema_gen AMI_ExceptionT_lemae_gen AMI_ExceptionT_conn + sharedname = ExceptionT_svnt + libs += ExceptionT_stub ExceptionT_skel ExceptionT_lem_stub ExceptionT_conn + libpaths += ../lib + libout = ../lib + dynamicflags = EXCEPTION_T_SVNT_BUILD_DLL + includes += .. + IDL_Files { + } + + Source_Files { + ExceptionTA_svnt.cpp + } + + Header_Files { + ExceptionTA_svnt.h + ExceptionTA_svnt_export.h + } + + Inline_Files { + } +} + diff --git a/CIAO/connectors/ami4ccm/tests/Exceptions/Receiver/ExceptionT_Receiver.idl b/CIAO/connectors/ami4ccm/tests/Exceptions/Receiver/ExceptionT_Receiver.idl new file mode 100644 index 00000000000..6795cdc58a5 --- /dev/null +++ b/CIAO/connectors/ami4ccm/tests/Exceptions/Receiver/ExceptionT_Receiver.idl @@ -0,0 +1,18 @@ +// $Id$ + +#ifndef EXCEPTION_T_RECEIVER_IDL +#define EXCEPTION_T_RECEIVER_IDL + +#include <Components.idl> + +#include "Base/ExceptionT.idl" + +module ExceptionT +{ + component Receiver + { + /// Provides + provides MyFoo do_my_foo; + }; +}; +#endif diff --git a/CIAO/connectors/ami4ccm/tests/Exceptions/Receiver/ExceptionT_Receiver.mpc b/CIAO/connectors/ami4ccm/tests/Exceptions/Receiver/ExceptionT_Receiver.mpc new file mode 100644 index 00000000000..66be5866116 --- /dev/null +++ b/CIAO/connectors/ami4ccm/tests/Exceptions/Receiver/ExceptionT_Receiver.mpc @@ -0,0 +1,134 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -p ExceptionT_Base ExceptionT_Receiver" + +project(AMI_ExceptionT_Base_ExceptionT_Receiver_idl_gen) : componentidldefaults { + custom_only = 1 + after += AMI_ExceptionT_idl_gen + idlflags += -Wb,stub_export_macro=EXCEPTION_T_RECEIVER_STUB_Export \ + -Wb,stub_export_include=ExceptionT_Receiver_stub_export.h \ + -Wb,skel_export_macro=EXCEPTION_T_RECEIVER_SVNT_Export \ + -Wb,skel_export_include=ExceptionT_Receiver_svnt_export.h \ + -Wb,exec_export_macro=EXCEPTION_T_RECEIVER_EXEC_Export \ + -Wb,exec_export_include=ExceptionT_Receiver_exec_export.h \ + -Glem -I.. + + IDL_Files { + ExceptionT_Receiver.idl + } +} + +project(AMI_ExceptionT_Base_ExceptionT_Receiver_lem_gen) : ciaoidldefaults { + after += AMI_ExceptionT_Base_ExceptionT_Receiver_idl_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=EXCEPTION_T_RECEIVER_LEM_STUB_Export \ + -Wb,stub_export_include=ExceptionT_Receiver_lem_stub_export.h \ + -SS -Gxhst -I.. + + IDL_Files { + ExceptionT_ReceiverE.idl + } +} + +project(AMI_ExceptionT_Base_ExceptionT_Receiver_l_stub) : ccm_svnt, messaging { + after += AMI_ExceptionT_Base_ExceptionT_Receiver_lem_gen AMI_ExceptionT_Base_ExceptionT_Receiver_stub AMI_ExceptionT_stub + libs += ExceptionT_stub ExceptionT_Receiver_stub + libpaths += ../lib + libout = ../lib + sharedname = ExceptionT_Receiver_lem_stub + dynamicflags = EXCEPTION_T_RECEIVER_LEM_STUB_BUILD_DLL + includes += .. + IDL_Files { + } + + Source_Files { + ExceptionT_ReceiverEC.cpp + } + + Header_Files { + ExceptionT_ReceiverEC.h + ExceptionT_Receiver_lem_stub_export.h + } + + Inline_Files { + ExceptionT_ReceiverEC.inl + } +} + +project(AMI_ExceptionT_Base_ExceptionT_Receiver_stub) : ccm_stub, messaging { + after += AMI_ExceptionT_Base_ExceptionT_Receiver_idl_gen AMI_ExceptionT_stub + libs += ExceptionT_stub + libpaths += ../lib + libout = ../lib + sharedname = ExceptionT_Receiver_stub + dynamicflags = EXCEPTION_T_RECEIVER_STUB_BUILD_DLL + includes += .. + IDL_Files { + } + + Source_Files { + ExceptionT_ReceiverC.cpp + } + + Header_Files { + ExceptionT_ReceiverC.h + ExceptionT_Receiver_stub_export.h + } + + Inline_Files { + ExceptionT_ReceiverC.inl + } +} + +project(AMI_ExceptionT_Base_ExceptionT_Receiver_exec) : ciao_executor, messaging { + after += AMI_ExceptionT_Base_ExceptionT_Receiver_l_stub AMI_ExceptionT_Base_ExceptionT_Receiver_stub AMI_ExceptionT_stub AMI_ExceptionT_lem_stub + sharedname = ExceptionT_Receiver_exec + libs += ExceptionT_Receiver_stub ExceptionT_Receiver_lem_stub ExceptionT_stub ExceptionT_lem_stub + libpaths += ../lib + libout = ../lib + dynamicflags = EXCEPTION_T_RECEIVER_EXEC_BUILD_DLL + includes += .. + IDL_Files { + } + + Source_Files { + ExceptionT_Receiver_exec.cpp + } + + Header_Files { + ExceptionT_Receiver_exec.h + ExceptionT_Receiver_exec_export.h + } + + Inline_Files { + } +} + +project(AMI_ExceptionT_Base_ExceptionT_Receiver_svnt) : ciao_servant, messaging { + after += AMI_ExceptionT_Base_skel AMI_ExceptionT_Base_ExceptionT_Receiver_l_stub AMI_ExceptionT_stub AMI_ExceptionT_skel AMI_ExceptionT_lem_stub + sharedname = ExceptionT_Receiver_svnt + libs += ExceptionT_Receiver_stub ExceptionT_Receiver_lem_stub \ + ExceptionT_skel \ + ExceptionT_stub ExceptionT_lem_stub + libpaths += ../lib + libout = ../lib + dynamicflags = EXCEPTION_T_RECEIVER_SVNT_BUILD_DLL + includes += .. + IDL_Files { + } + + Source_Files { + ExceptionT_ReceiverS.cpp + ExceptionT_Receiver_svnt.cpp + } + + Header_Files { + ExceptionT_ReceiverS.h + ExceptionT_Receiver_svnt.h + ExceptionT_Receiver_svnt_export.h + } + + Inline_Files { + ExceptionT_ReceiverS.inl + } +} + diff --git a/CIAO/connectors/ami4ccm/tests/Exceptions/Receiver/ExceptionT_Receiver_exec.cpp b/CIAO/connectors/ami4ccm/tests/Exceptions/Receiver/ExceptionT_Receiver_exec.cpp new file mode 100644 index 00000000000..c7067fe0fb3 --- /dev/null +++ b/CIAO/connectors/ami4ccm/tests/Exceptions/Receiver/ExceptionT_Receiver_exec.cpp @@ -0,0 +1,153 @@ +// -*- C++ -*- +// $Id$ + +#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) + { + } + + MyFoo_exec_i::~MyFoo_exec_i (void) + { + } + + ::CORBA::Long + MyFoo_exec_i::foo (const char * in_str, ::CORBA::String_out answer) + { + if (ACE_OS::strlen (in_str) == 0) + { + ExceptionT::InternalError ex (42, "Rec.Exc.foo", + "thrown by receiver"); + throw ex; + } + else + { + ACE_OS::sleep (ACE_OS::rand () % 2); + answer = CORBA::string_dup ("This is my answer : Hi"); + return ACE_OS::rand () % 100; + } + } + + void + MyFoo_exec_i::hello (::CORBA::Long_out answer) + { + ACE_OS::sleep (ACE_OS::rand () % 2); + answer = ACE_OS::rand () % 100; + //always an exception is thrown + ExceptionT::InternalError ex (42, "Rec.Exc.hello", + "thrown by receiver"); + throw ex; + } + + ::CORBA::Short + MyFoo_exec_i::rw_attrib () + { + // 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) + { + if (new_value == 0) + { + //throw internal excep + ExceptionT::InternalError ex (42, "Rec.Exc.set_rw_attrib", + "thrown by receiver"); + throw ex; + } + else + { + ACE_OS::sleep (ACE_OS::rand () % 2); + } + } + + CORBA::Short + MyFoo_exec_i::ro_attrib () + { + // this->get_ro_ is always true, so always an exception is thrown. + if (this->get_ro_) + { + ExceptionT::InternalError ex (42, "Rec.Exc.ro_attrib", + "thrown by receiver"); + throw ex; + } + else + { + ACE_OS::sleep (ACE_OS::rand () % 2); + } + return ACE_OS::rand () % 100; + } + + Receiver_exec_i::Receiver_exec_i (void) + { + } + + Receiver_exec_i::~Receiver_exec_i (void) + { + } + + ::ExceptionT::CCM_MyFoo_ptr + Receiver_exec_i::get_do_my_foo (void) + { + return new MyFoo_exec_i (); + } + + void + Receiver_exec_i::set_session_context ( + ::Components::SessionContext_ptr ctx) + { + this->context_ = ::ExceptionT::CCM_Receiver_Context::_narrow (ctx); + + if ( ::CORBA::is_nil (this->context_.in ())) + { + throw ::CORBA::INTERNAL (); + } + } + + void + Receiver_exec_i::configuration_complete (void) + { + } + + void + Receiver_exec_i::ccm_activate (void) + { + } + + void + Receiver_exec_i::ccm_passivate (void) + { + } + + void + Receiver_exec_i::ccm_remove (void) + { + } + + extern "C" ::Components::EnterpriseComponent_ptr + create_ExceptionT_AMI_Receiver_Impl (void) + { + ::Components::EnterpriseComponent_ptr retval = + ::Components::EnterpriseComponent::_nil (); + + ACE_NEW_RETURN ( + retval, + Receiver_exec_i, + ::Components::EnterpriseComponent::_nil ()); + + 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 new file mode 100644 index 00000000000..2f236ef73ee --- /dev/null +++ b/CIAO/connectors/ami4ccm/tests/Exceptions/Receiver/ExceptionT_Receiver_exec.h @@ -0,0 +1,67 @@ +// -*- C++ -*- +// $Id$ + +#ifndef CIAO_EXCEPTION_T_RECEIVER_EXEC_H_ +#define CIAO_EXCEPTION_T_RECEIVER_EXEC_H_ + +#include "ExceptionT_ReceiverEC.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 + : public virtual ::ExceptionT::CCM_MyFoo, + public virtual ::CORBA::LocalObject + { + public: + MyFoo_exec_i (void); + virtual ~MyFoo_exec_i (void); + + virtual ::CORBA::Long foo (const char * in_str, ::CORBA::String_out answer); + + virtual void hello (::CORBA::Long_out answer); + + virtual ::CORBA::Short rw_attrib (); + + virtual void rw_attrib (::CORBA::Short new_value); + + virtual CORBA::Short ro_attrib (); + private: + bool get_rw_; + bool get_ro_; + }; + + class Receiver_exec_i + : public virtual Receiver_Exec, + public virtual ::CORBA::LocalObject + { + public: + Receiver_exec_i (void); + virtual ~Receiver_exec_i (void); + + virtual ::ExceptionT::CCM_MyFoo_ptr get_do_my_foo (void); + + 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); + + private: + ::ExceptionT::CCM_Receiver_Context_var context_; + }; + + extern "C" EXCEPTION_T_RECEIVER_EXEC_Export ::Components::EnterpriseComponent_ptr + create_ExceptionT_AMI_Receiver_Impl (void); +} + +#endif /* ifndef */ + diff --git a/CIAO/connectors/ami4ccm/tests/Exceptions/Sender/ExceptionT_Sender.idl b/CIAO/connectors/ami4ccm/tests/Exceptions/Sender/ExceptionT_Sender.idl new file mode 100644 index 00000000000..09367bac0a4 --- /dev/null +++ b/CIAO/connectors/ami4ccm/tests/Exceptions/Sender/ExceptionT_Sender.idl @@ -0,0 +1,21 @@ +// $Id$ + +#ifndef EXCEPTION_T_SENDER_IDL +#define EXCEPTION_T_SENDER_IDL + +#include <Components.idl> + +#include "Base/ExceptionT.idl" + +#pragma ciao ami4ccm receptacle "ExceptionT::Sender::run_my_foo" + +module ExceptionT +{ + component Sender + { + /// For synchronous invocation + uses MyFoo run_my_foo; + }; +}; + +#endif diff --git a/CIAO/connectors/ami4ccm/tests/Exceptions/Sender/ExceptionT_Sender.mpc b/CIAO/connectors/ami4ccm/tests/Exceptions/Sender/ExceptionT_Sender.mpc new file mode 100644 index 00000000000..2ec981159a3 --- /dev/null +++ b/CIAO/connectors/ami4ccm/tests/Exceptions/Sender/ExceptionT_Sender.mpc @@ -0,0 +1,135 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -p ExceptionT_Base ExceptionT_Sender" + +project(AMI_ExceptionT_Base_ExceptionT_Sender_idl_gen) : componentidldefaults { + after += Conn_ExceptionT_Base_idl_gen AMI_ExceptionT_idl_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=EXCEPTION_T_SENDER_STUB_Export \ + -Wb,stub_export_include=ExceptionT_Sender_stub_export.h \ + -Wb,skel_export_macro=EXCEPTION_T_SENDER_SVNT_Export \ + -Wb,skel_export_include=ExceptionT_Sender_svnt_export.h \ + -Wb,exec_export_macro=EXCEPTION_T_SENDER_EXEC_Export \ + -Wb,exec_export_include=ExceptionT_Sender_exec_export.h \ + -I.. -GM + + IDL_Files { + ExceptionT_Sender.idl + } +} + +project(AMI_ExceptionT_Base_ExceptionT_Sender_lem_gen) : ciaoidldefaults { + after += AMI_ExceptionT_Base_ExceptionT_Sender_idl_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=EXCEPTION_T_SENDER_LEM_STUB_Export \ + -Wb,stub_export_include=ExceptionT_Sender_lem_stub_export.h \ + -SS -Gxhst -I.. + + IDL_Files { + ExceptionT_SenderE.idl + } +} + +project(AMI_ExceptionT_Base_ExceptionT_Sender_lem_stub) : ccm_svnt, ami { + after += AMI_ExceptionT_Base_ExceptionT_Sender_lem_gen AMI_ExceptionT_stub Conn_ExceptionT_Base_stub + libs += ExceptionT_stub + libpaths += ../lib + libout = ../lib + sharedname = ExceptionT_Sender_lem_stub + dynamicflags = EXCEPTION_T_SENDER_LEM_STUB_BUILD_DLL + includes += .. + IDL_Files { + } + + Source_Files { + ExceptionT_SenderEC.cpp + } + + Header_Files { + ExceptionT_SenderEC.h + ExceptionT_Sender_lem_stub_export.h + } + + Inline_Files { + ExceptionT_SenderEC.inl + } +} + +project(AMI_ExceptionT_Base_ExceptionT_Sender_stub) : ccm_stub, ami { + after += AMI_ExceptionT_Base_ExceptionT_Sender_idl_gen AMI_ExceptionT_Base_stub AMI_ExceptionT_stub Conn_ExceptionT_Base_stub + libs += ExceptionT_stub + libpaths += ../lib + libout = ../lib + sharedname = ExceptionT_Sender_stub + dynamicflags = EXCEPTION_T_SENDER_STUB_BUILD_DLL + includes += .. + IDL_Files { + } + + Source_Files { + ExceptionT_SenderC.cpp + } + + Header_Files { + ExceptionT_SenderC.h + ExceptionT_Sender_stub_export.h + } + + Inline_Files { + ExceptionT_SenderC.inl + } +} + +project(AMI_ExceptionT_Base_ExceptionT_Sender_exec) : ciao_executor, ami, ami4ccm_stub { + after += AMI_ExceptionT_Base_ExceptionT_Sender_lem_stub AMI_ExceptionT_Base_ExceptionT_Sender_stub AMI_ExceptionT_Base_exec Conn_ExceptionT_Base_stub AMI_ExceptionT_lem_stub + sharedname = ExceptionT_Sender_exec + libs += ExceptionT_Sender_stub ExceptionT_Sender_lem_stub ExceptionT_stub ExceptionT_stub ExceptionT_lem_stub + libpaths += ../lib + libout = ../lib + dynamicflags = EXCEPTION_T_SENDER_EXEC_BUILD_DLL + includes += .. + IDL_Files { + } + + Source_Files { + ExceptionT_Sender_exec.cpp + } + + Header_Files { + ExceptionT_Sender_exec.h + ExceptionT_Sender_exec_export.h + } + + Inline_Files { + } +} + +project(AMI_ExceptionT_Base_ExceptionT_Sender_svnt) : ciao_servant, ami { + after += AMI_ExceptionT_Base_skel AMI_ExceptionT_Base_ExceptionT_Sender_lem_stub AMI_ExceptionT_Base_exec AMI_ExceptionT_skel + sharedname = ExceptionT_Sender_svnt + libs += ExceptionT_Sender_stub ExceptionT_Sender_lem_stub \ + ExceptionT_skel \ + ExceptionT_stub + libpaths += ../lib + libout = ../lib + dynamicflags = EXCEPTION_T_SENDER_SVNT_BUILD_DLL + includes += .. + IDL_Files { + } + + Source_Files { + ExceptionT_SenderS.cpp + ExceptionT_Sender_svnt.cpp + } + + Header_Files { + ExceptionT_SenderS.h + ExceptionT_Sender_svnt.h + ExceptionT_Sender_svnt_export.h + } + + Inline_Files { + ExceptionT_SenderS.inl + } +} + + diff --git a/CIAO/connectors/ami4ccm/tests/Exceptions/Sender/ExceptionT_Sender_exec.cpp b/CIAO/connectors/ami4ccm/tests/Exceptions/Sender/ExceptionT_Sender_exec.cpp new file mode 100644 index 00000000000..847c0d0a0e4 --- /dev/null +++ b/CIAO/connectors/ami4ccm/tests/Exceptions/Sender/ExceptionT_Sender_exec.cpp @@ -0,0 +1,367 @@ +// -*- C++ -*- +// $Id$ + +#include "ExceptionT_Sender_exec.h" +#include "ace/OS_NS_unistd.h" + +namespace CIAO_ExceptionT_Sender_Impl +{ + CORBA::Short nr_of_received = 0; + CORBA::Short nr_of_syn_received = 0; + + void HandleException ( + 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) + { + 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," + "%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) + { + } + + 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::AMI_MyFoo_ptr my_foo_ami) + : my_foo_ami_ (::ExceptionT::AMI_MyFoo::_duplicate (my_foo_ami)) + { + } + + int asynch_foo_generator::svc () + { + ACE_OS::sleep (3); + if (CORBA::is_nil (my_foo_ami_)) + { + ACE_ERROR ((LM_ERROR, "ERROR Sender (ASYNCH) :\tfoo_ami is NIL !\n")); + return 1; + } + else + { + //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); + } + return 0; + } + + //============================================================ + // 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)) + { + } + + int synch_foo_generator::svc () + { + ACE_OS::sleep (3); + //run synch calls + char * out_str = 0; + try + { + CORBA::Long result = my_foo_ami_->foo ("Do something synchronous", + out_str); + } + catch (const ExceptionT::InternalError&) + { + ACE_ERROR ((LM_ERROR, "ERROR: synch_foo_generator::foo: " + "Unexpected exception.\n")); + } + try + { + CORBA::Long result = 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 + { + CORBA::Short rw_attrib = 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 + { + CORBA::Short ro_attrib = 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) + : global_foo_callback_ (0) + { + } + + Sender_exec_i::~Sender_exec_i (void) + { + } + + // Supported operations and attributes. + + // Component attributes. + + // Port operations. + // Operations from Components::SessionComponent. + + void + Sender_exec_i::set_session_context ( + ::Components::SessionContext_ptr ctx) + { + this->context_ = + ::ExceptionT::CCM_Sender_Context::_narrow (ctx); + if ( ::CORBA::is_nil (this->context_.in ())) + { + throw ::CORBA::INTERNAL (); + } + } + + void + Sender_exec_i::configuration_complete (void) + { + } + + void + Sender_exec_i::ccm_activate (void) + { + ::ExceptionT::AMI_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); + + ::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); + } + + void + Sender_exec_i::ccm_passivate (void) + { + } + + void + Sender_exec_i::ccm_remove (void) + { + CORBA::Short nr_of_asyn = nr_of_received - nr_of_syn_received; + if (nr_of_asyn != 5) + { + ACE_ERROR ((LM_ERROR, "ERROR: not received the expected number of" + " exceptions for asynchronous calls" + "Expected: 5, Received: %u.\n", + nr_of_asyn)); + } + if (nr_of_syn_received != 5) + { + ACE_ERROR ((LM_ERROR, "ERROR: not received the expected number of" + " exceptions for synchronous calls" + "Expected: 5, Received: %u.\n", + nr_of_syn_received)); + } + if ((nr_of_asyn == 5) && (nr_of_syn_received == 5)) + { + ACE_DEBUG ((LM_DEBUG, "OK: Receieved the expected number of" + " exceptions for asynchronous and " + "synchronous calls\n")); + } + } + + extern "C" ::Components::EnterpriseComponent_ptr + create_ExceptionT_AMI_Sender_Impl (void) + { + ::Components::EnterpriseComponent_ptr retval = + ::Components::EnterpriseComponent::_nil (); + + ACE_NEW_RETURN ( + retval, + Sender_exec_i, + ::Components::EnterpriseComponent::_nil ()); + + 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 new file mode 100644 index 00000000000..4ec1c63d104 --- /dev/null +++ b/CIAO/connectors/ami4ccm/tests/Exceptions/Sender/ExceptionT_Sender_exec.h @@ -0,0 +1,118 @@ +// -*- C++ -*- +// +// $Id$ + +#ifndef CIAO_EXCEPTION_T_SENDER_EXEC_H_ +#define CIAO_EXCEPTION_T_SENDER_EXEC_H_ + +#include "ExceptionT_SenderEC.h" +#include "ExceptionT_Sender_exec_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/LocalObject.h" +#include "ace/Task.h" + +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::AMI_MyFoo_ptr my_foo_ami); + + virtual int svc (void); + + private: + ::ExceptionT::AMI_MyFoo_var my_foo_ami_; + }; + + /// Worker thread for synchronous invocations + class synch_foo_generator : public virtual ACE_Task_Base + { + public: + synch_foo_generator (::ExceptionT::MyFoo_ptr my_foo_ami); + + virtual int svc (void); + + private: + ::ExceptionT::MyFoo_var my_foo_ami_; + }; + + class MyFoo_callback_exec_i + : public virtual ::ExceptionT::CCM_AMI_MyFooCallback, + 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); + }; + + class Sender_exec_i + : public virtual Sender_Exec, + public virtual ::CORBA::LocalObject + { + public: + Sender_exec_i (void); + virtual ~Sender_exec_i (void); + + 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); + + private: + ::ExceptionT::CCM_Sender_Context_var context_; + MyFoo_callback_exec_i* global_foo_callback_; + }; + + extern "C" EXCEPTION_T_SENDER_EXEC_Export ::Components::EnterpriseComponent_ptr + create_ExceptionT_AMI_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 new file mode 100644 index 00000000000..097753214de --- /dev/null +++ b/CIAO/connectors/ami4ccm/tests/Exceptions/descriptors/Plan.cdp @@ -0,0 +1,373 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no" ?> +<Deployment:DeploymentPlan xmlns:Deployment="http://www.omg.org/Deployment" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.omg.org/Deployment Deployment.xsd"> + + <UUID>6D382DAE-9024-4C4D-B91B-A0F9176AFACF</UUID> + + <implementation xmi:id="ExceptionT_ReceiverHomeImplementation"> + <name>ExceptionT_ReceiverHomeImplementation</name> + <source/> + <artifact xmi:idref="ExceptionT_Receiver_ExecArtifact"/> + <artifact xmi:idref="ExceptionT_Receiver_SvntArtifact"/> + <execParameter> + <name>component factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_ExceptionT_AMI_Receiver_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>ExceptionT.ImplementationArtifacts.ReceiverArtifacts.Receiver_exec</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_ExceptionT_Receiver_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>ExceptionT.ImplementationArtifacts.ReceiverArtifacts.Receiver_svnt</string> + </value> + </value> + </execParameter> + </implementation> + + <implementation xmi:id="ExceptionT_SenderHomeImplementation"> + <name>ExceptionT_SenderHomeImplementation</name> + <source/> + <artifact xmi:idref="ExceptionT_Sender_ExecArtifact"/> + <artifact xmi:idref="ExceptionT_Sender_SvntArtifact"/> + <execParameter> + <name>component factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_ExceptionT_AMI_Sender_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>ExceptionT.ImplementationArtifacts.SenderArtifacts.Sender_exec</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_ExceptionT_Sender_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>ExceptionT.ImplementationArtifacts.SenderArtifacts.Sender_svnt</string> + </value> + </value> + </execParameter> + </implementation> + + <implementation xmi:id="ExceptionT_AMIHomeImplementation"> + <name>ExceptionT_AMIHomeImplementation</name> + <source/> + <artifact xmi:idref="ExceptionT_AMI_ExecArtifact"/> + <artifact xmi:idref="ExceptionT_AMI_SvntArtifact"/> + <execParameter> + <name>component factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_ExceptionT_AMI_MyFoo_Connector_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>ExceptionT.ImplementationArtifacts.AMIArtifacts.AMI_exec</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_ExceptionT_AMI_MyFoo_Connector_The_Connector_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>ExceptionT.ImplementationArtifacts.AMIArtifacts.AMI_svnt</string> + </value> + </value> + </execParameter> + </implementation> + + <instance xmi:id="ExceptionT.ComponentImplementations.ExceptionTImplementation.ExceptionT.Receiver"> + <name>ExceptionT.ComponentImplementations.ExceptionTImplementation.ExceptionT.Receiver</name> + <node>Receiver</node> + <source/> + <implementation xmi:idref="ExceptionT_ReceiverHomeImplementation"/> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.InstanceIOR</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Receiver.ior</string> + </value> + </value> + </configProperty> + </instance> + + <instance xmi:id="ExceptionT.ComponentImplementations.ExceptionTImplementation.ExceptionT.Sender"> + <name>ExceptionT.ComponentImplementations.ExceptionTImplementation.ExceptionT.Sender</name> + <node>Sender</node> + <source/> + <implementation xmi:idref="ExceptionT_SenderHomeImplementation"/> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.InstanceIOR</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Sender.ior</string> + </value> + </value> + </configProperty> + </instance> + + <instance xmi:id="ExceptionT.ComponentImplementations.ExceptionTImplementation.ExceptionT.AMI"> + <name>ExceptionT.ComponentImplementations.ExceptionTImplementation.ExceptionT.AMI</name> + <node>Sender</node> + <source/> + <implementation xmi:idref="ExceptionT_AMIHomeImplementation"/> + <configProperty> + <name>edu.vanderbilt.dre.DAnCE.InstanceIOR</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>AMI.ior</string> + </value> + </value> + </configProperty> + </instance> + + <connection> + <name>run_asynch_foo_connection</name> + <deployRequirement> + <name>edu.dre.vanderbilt.DAnCE.ConnectionType</name> + <resourceType>Local_Interface</resourceType> + </deployRequirement> + <internalEndpoint> + <portName>sendc_run_my_foo</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="ExceptionT.ComponentImplementations.ExceptionTImplementation.ExceptionT.Sender" /> + </internalEndpoint> + <internalEndpoint> + <portName>The_Port_sendc_run</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="ExceptionT.ComponentImplementations.ExceptionTImplementation.ExceptionT.AMI" /> + </internalEndpoint> + </connection> + + <connection> + <name>do_foo_connection</name> + <internalEndpoint> + <portName>do_my_foo</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="ExceptionT.ComponentImplementations.ExceptionTImplementation.ExceptionT.Receiver" /> + </internalEndpoint> + <internalEndpoint> + <portName>The_Port_run</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="ExceptionT.ComponentImplementations.ExceptionTImplementation.ExceptionT.AMI" /> + </internalEndpoint> + </connection> + + <connection> + <name>synch_foo_connection</name> + <internalEndpoint> + <portName>do_my_foo</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="ExceptionT.ComponentImplementations.ExceptionTImplementation.ExceptionT.Receiver" /> + </internalEndpoint> + <internalEndpoint> + <portName>run_my_foo</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="ExceptionT.ComponentImplementations.ExceptionTImplementation.ExceptionT.Sender" /> + </internalEndpoint> + </connection> + + <artifact xmi:id="ExceptionT_AMI_SvntArtifact"> + <name>ExceptionT.ImplementationArtifacts.AMIArtifacts.AMI_svnt</name> + <source/> + <node/> + <location>ExceptionT_svnt</location> + <execParameter> + <name>entryPoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_ExceptionT_AMI_MyFoo_Connector_The_Connector_Servant</string> + </value> + </value> + </execParameter> + </artifact> + + <artifact xmi:id="ExceptionT_AMI_ExecArtifact"> + <name>ExceptionT.ImplementationArtifacts.AMIArtifacts.AMI_exec</name> + <source/> + <node/> + <location>ExceptionT_conn</location> + <execParameter> + <name>entryPoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_ExceptionT_AMI_MyFoo_Connector_Impl</string> + </value> + </value> + </execParameter> + </artifact> + + <artifact xmi:id="ExceptionT_Receiver_SvntArtifact"> + <name>ExceptionT.ImplementationArtifacts.ReceiverArtifacts.Receiver_svnt</name> + <source/> + <node/> + <location>ExceptionT_Receiver_svnt</location> + <execParameter> + <name>entryPoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_ExceptionT_AMI_ReceiverHome_Servant</string> + </value> + </value> + </execParameter> + </artifact> + + <artifact xmi:id="ExceptionT_Receiver_ExecArtifact"> + <name>ExceptionT.ImplementationArtifacts.ReceiverArtifacts.Receiver_exec</name> + <source/> + <node/> + <location>ExceptionT_Receiver_exec</location> + <execParameter> + <name>entryPoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_ExceptionT_AMI_ReceiverHome_Impl</string> + </value> + </value> + </execParameter> + </artifact> + + <artifact xmi:id="ExceptionT_Sender_SvntArtifact"> + <name>ExceptionT.ImplementationArtifacts.SenderArtifacts.Sender_svnt</name> + <source/> + <node/> + <location>ExceptionT_Sender_svnt</location> + <execParameter> + <name>entryPoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_ExceptionT_AMI_SenderHome_Servant</string> + </value> + </value> + </execParameter> + </artifact> + + <artifact xmi:id="ExceptionT_Sender_ExecArtifact"> + <name>ExceptionT.ImplementationArtifacts.SenderArtifacts.Sender_exec</name> + <source/> + <node/> + <location>ExceptionT_Sender_exec</location> + <execParameter> + <name>entryPoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_ExceptionT_AMI_SenderHome_Impl</string> + </value> + </value> + </execParameter> + </artifact> + +</Deployment:DeploymentPlan> diff --git a/CIAO/connectors/ami4ccm/tests/Exceptions/descriptors/run_test.pl b/CIAO/connectors/ami4ccm/tests/Exceptions/descriptors/run_test.pl new file mode 100644 index 00000000000..4ba745a3d22 --- /dev/null +++ b/CIAO/connectors/ami4ccm/tests/Exceptions/descriptors/run_test.pl @@ -0,0 +1,244 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "$ENV{'ACE_ROOT'}/bin"; +use PerlACE::TestTarget; + +$CIAO_ROOT = "$ENV{'CIAO_ROOT'}"; +$TAO_ROOT = "$ENV{'TAO_ROOT'}"; +$DANCE_ROOT = "$ENV{'DANCE_ROOT'}"; + +$daemons_running = 0; +$em_running = 0; +$ns_running = 0; + +$nr_daemon = 3; +@ports = ( 60000, 60001 ); +@iorbases = ( "Sender.ior", "Receiver.ior", "AMI.ior" ); +@iorfiles = 0; +@nodenames = ( "Sender", "Receiver" ); + +# ior files other than daemon +$ior_nsbase = "ns.ior"; +$ior_nsfile = 0; +$ior_embase = "EM.ior"; +$ior_emfile = 0; + +# Processes +$E = 0; +$EM = 0; +$NS = 0; +@DEAMONS = 0; + +# targets +@tg_daemons = 0; +$tg_naming = 0; +$tg_exe_man = 0; +$tg_executor = 0; + +$status = 0; +$cdp_file = "Plan.cdp"; + +sub create_targets { + # naming service + $tg_naming = PerlACE::TestTarget::create_target (1) || die "Create target for ns failed\n"; + $tg_naming->AddLibPath ('../lib'); + # daemon + for ($i = 0; $i < $nr_daemon; ++$i) { + $tg_daemons[$i] = PerlACE::TestTarget::create_target ($i+1) || die "Create target for deamon $i failed\n"; + $tg_daemons[$i]->AddLibPath ('../lib'); + } + # execution manager + $tg_exe_man = PerlACE::TestTarget::create_target (1) || die "Create target for EM failed\n"; + $tg_exe_man->AddLibPath ('../lib'); + # executor (plan_launcher) + $tg_executor = PerlACE::TestTarget::create_target (1) || die "Create target for executor failed\n"; + $tg_executor->AddLibPath ('../lib'); +} + +sub init_ior_files { + $ior_nsfile = $tg_naming->LocalFile ($ior_nsbase); + $ior_emfile = $tg_exe_man->LocalFile ($ior_embase); + for ($i = 0; $i < $nr_daemon; ++$i) { + $iorfiles[$i] = $tg_daemons[$i]->LocalFile ($iorbases[$i]); + } + delete_ior_files (); +} + +# Delete if there are any .ior files. +sub delete_ior_files { + for ($i = 0; $i < $nr_daemon; ++$i) { + $tg_daemons[$i]->DeleteFile ($iorbases[$i]); + } + $tg_naming->DeleteFile ($ior_nsbase); + $tg_exe_man->DeleteFile ($ior_embase); + for ($i = 0; $i < $nr_daemon; ++$i) { + $iorfiles[$i] = $tg_daemons[$i]->LocalFile ($iorbases[$i]); + } +} + +sub kill_node_daemon { + for ($i = 0; $i < $nr_daemon; ++$i) { + $DEAMONS[$i]->Kill (); $DEAMONS[$i]->TimedWait (1); + } +} + +sub kill_open_processes { + if ($daemons_running == 1) { + kill_node_daemon (); + } + + if ($em_running == 1) { + $EM->Kill (); $EM->TimedWait (1); + } + + if ($ns_running == 1) { + $NS->Kill (); $NS->TimedWait (1); + } + # in case shutdown did not perform as expected + $tg_executor->KillAll ('ciao_componentserver'); +} + +sub run_node_daemons { + for ($i = 0; $i < $nr_daemon; ++$i) { + $iorbase = $iorbases[$i]; + $iorfile = $iorfiles[$i]; + $port = $ports[$i]; + $nodename = $nodenames[$i]; + $iiop = "iiop://localhost:$port"; + $node_app = "$CIAO_ROOT/bin/ciao_componentserver"; + + $d_cmd = "$DANCE_ROOT/bin/dance_node_manager"; + $d_param = "-ORBEndpoint $iiop -s $node_app -n $nodename=$iorfile -t 30 --domain-nc corbaloc:rir:/NameService"; + + print "Run dance_node_manager with $d_param\n"; + + $DEAMONS[$i] = $tg_daemons[$i]->CreateProcess ($d_cmd, $d_param); + $DEAMONS[$i]->Spawn (); + + if ($tg_daemons[$i]->WaitForFileTimed($iorbase, + $tg_daemons[$i]->ProcessStartWaitInterval ()) == -1) { + print STDERR + "ERROR: The ior $iorfile file of node daemon $i could not be found\n"; + for (; $i >= 0; --$i) { + $DEAMONS[$i]->Kill (); $DEAMONS[$i]->TimedWait (1); + } + return -1; + } + } + return 0; +} + +create_targets (); +init_ior_files (); + +# Invoke naming service + +$NS = $tg_naming->CreateProcess ("$TAO_ROOT/orbsvcs/Naming_Service/Naming_Service", "-m 1 -ORBEndpoint iiop://localhost:60003 -o $ior_nsfile"); + +print STDERR "Starting Naming Service with -m 1 -ORBEndpoint iiop://localhost:60003 -o ns.ior\n"; + +$ns_status = $NS->Spawn (); + +if ($ns_status != 0) { + print STDERR "ERROR: Unable to execute the naming service\n"; + kill_open_processes (); + exit 1; +} + +if ($tg_naming->WaitForFileTimed ($ior_nsbase, + $tg_naming->ProcessStartWaitInterval ()) == -1) { + print STDERR "ERROR: cannot find naming service IOR file\n"; + $NS->Kill (); $NS->TimedWait (1); + exit 1; +} + +$ns_running = 1; +# Set up NamingService environment +$ENV{"NameServiceIOR"} = "corbaloc:iiop:localhost:60003/NameService"; + +# Invoke node daemon. +print "Invoking node daemon\n"; +$status = run_node_daemons (); + +if ($status != 0) { + print STDERR "ERROR: Unable to execute the node daemon\n"; + kill_open_processes (); + exit 1; +} + +$daemons_running = 1; + +# Invoke execution manager. +print "Invoking execution manager (dance_execution_manager.exe) with -e$ior_emfile\n"; +$EM = $tg_exe_man->CreateProcess ("$DANCE_ROOT/bin/dance_execution_manager", + "-e$ior_emfile --domain-nc corbaloc:rir:/NameService"); +$em_status = $EM->Spawn (); + +if ($em_status != 0) { + print STDERR "ERROR: dance_execution_manager returned $em_status"; + exit 1; +} + +if ($tg_exe_man->WaitForFileTimed ($ior_embase, + $tg_exe_man->ProcessStartWaitInterval ()) == -1) { + print STDERR + "ERROR: The ior file of execution manager could not be found\n"; + kill_open_processes (); + exit 1; +} + +$em_running = 1; + +# Invoke executor - start the application -. +print "Invoking executor - launch the application -\n"; + +print "Start dance_plan_launcher.exe with -x $cdp_file -k file://$ior_emfile\n"; +$E = $tg_executor->CreateProcess ("$DANCE_ROOT/bin/dance_plan_launcher", + "-x $cdp_file -k file://$ior_emfile"); + +$pl_status = $E->SpawnWaitKill ($tg_executor->ProcessStartWaitInterval ()); + +if ($pl_status != 0) { + print STDERR "ERROR: dance_plan_launcher returned $pl_status\n"; + kill_open_processes (); + exit 1; +} + +for ($i = 0; $i < $nr_daemon; ++$i) { + if ($tg_daemons[$i]->WaitForFileTimed ($iorbases[$i], + $tg_daemons[$i]->ProcessStopWaitInterval ()) == -1) { + print STDERR "ERROR: The ior file of daemon $i could not be found\n"; + kill_open_processes (); + exit 1; + } +} + +print "Sleeping 60 seconds to allow task to complete\n"; +sleep (60); + +# Invoke executor - stop the application -. +print "Invoking executor - stop the application -\n"; +print "by running dance_plan_launcher.exe with -k file://$ior_emfile -x $cdp_file -q\n"; + +$E = $tg_executor->CreateProcess ("$DANCE_ROOT/bin/dance_plan_launcher", + "-k file://$ior_emfile -x $cdp_file -s"); +$pl_status = $E->SpawnWaitKill ($tg_executor->ProcessStartWaitInterval ()); + +if ($pl_status != 0) { + print STDERR "ERROR: dance_plan_launcher returned $pl_status\n"; + kill_open_processes (); + exit 1; +} + +print "Executor returned.\n"; +print "Shutting down rest of the processes.\n"; + +delete_ior_files (); +kill_open_processes (); + +exit $status; |