From ea70633f9c0d98dc0c46923702c93ec071ca1500 Mon Sep 17 00:00:00 2001 From: mhengstmengel Date: Tue, 8 Jun 2010 13:56:56 +0000 Subject: Tue Jun 8 13:56:10 UTC 2010 Marijke Hengstmengel * bin/ciao_tests.lst * connectors/ami4ccm/tests/OneReplyH * connectors/ami4ccm/tests/OneReplyH/Base * connectors/ami4ccm/tests/OneReplyH/Base/OneReplyH.idl * connectors/ami4ccm/tests/OneReplyH/Base/OneReplyH.mpc * connectors/ami4ccm/tests/OneReplyH/descriptors * connectors/ami4ccm/tests/OneReplyH/descriptors/Plan.cdp * connectors/ami4ccm/tests/OneReplyH/descriptors/run_test.pl * connectors/ami4ccm/tests/OneReplyH/Receiver * connectors/ami4ccm/tests/OneReplyH/Receiver/OneReplyH_Receiver.idl * connectors/ami4ccm/tests/OneReplyH/Receiver/OneReplyH_Receiver.mpc * connectors/ami4ccm/tests/OneReplyH/Receiver/OneReplyH_Receiver_exec.cpp * connectors/ami4ccm/tests/OneReplyH/Receiver/OneReplyH_Receiver_exec.h * connectors/ami4ccm/tests/OneReplyH/Sender * connectors/ami4ccm/tests/OneReplyH/Sender/OneReplyH_Sender.idl * connectors/ami4ccm/tests/OneReplyH/Sender/OneReplyH_Sender.mpc * connectors/ami4ccm/tests/OneReplyH/Sender/OneReplyH_Sender_exec.cpp * connectors/ami4ccm/tests/OneReplyH/Sender/OneReplyH_Sender_exec.h AMI4CCM test with one replyhandler for more than one request. --- .../ami4ccm/tests/OneReplyH/Base/OneReplyH.idl | 28 ++ .../ami4ccm/tests/OneReplyH/Base/OneReplyH.mpc | 196 +++++++++++ .../OneReplyH/Receiver/OneReplyH_Receiver.idl | 18 + .../OneReplyH/Receiver/OneReplyH_Receiver.mpc | 134 ++++++++ .../OneReplyH/Receiver/OneReplyH_Receiver_exec.cpp | 111 ++++++ .../OneReplyH/Receiver/OneReplyH_Receiver_exec.h | 59 ++++ .../tests/OneReplyH/Sender/OneReplyH_Sender.idl | 21 ++ .../tests/OneReplyH/Sender/OneReplyH_Sender.mpc | 135 ++++++++ .../OneReplyH/Sender/OneReplyH_Sender_exec.cpp | 308 +++++++++++++++++ .../tests/OneReplyH/Sender/OneReplyH_Sender_exec.h | 95 ++++++ .../ami4ccm/tests/OneReplyH/descriptors/Plan.cdp | 373 +++++++++++++++++++++ .../tests/OneReplyH/descriptors/run_test.pl | 244 ++++++++++++++ 12 files changed, 1722 insertions(+) create mode 100644 CIAO/connectors/ami4ccm/tests/OneReplyH/Base/OneReplyH.idl create mode 100644 CIAO/connectors/ami4ccm/tests/OneReplyH/Base/OneReplyH.mpc create mode 100644 CIAO/connectors/ami4ccm/tests/OneReplyH/Receiver/OneReplyH_Receiver.idl create mode 100644 CIAO/connectors/ami4ccm/tests/OneReplyH/Receiver/OneReplyH_Receiver.mpc create mode 100644 CIAO/connectors/ami4ccm/tests/OneReplyH/Receiver/OneReplyH_Receiver_exec.cpp create mode 100644 CIAO/connectors/ami4ccm/tests/OneReplyH/Receiver/OneReplyH_Receiver_exec.h create mode 100644 CIAO/connectors/ami4ccm/tests/OneReplyH/Sender/OneReplyH_Sender.idl create mode 100644 CIAO/connectors/ami4ccm/tests/OneReplyH/Sender/OneReplyH_Sender.mpc create mode 100644 CIAO/connectors/ami4ccm/tests/OneReplyH/Sender/OneReplyH_Sender_exec.cpp create mode 100644 CIAO/connectors/ami4ccm/tests/OneReplyH/Sender/OneReplyH_Sender_exec.h create mode 100644 CIAO/connectors/ami4ccm/tests/OneReplyH/descriptors/Plan.cdp create mode 100644 CIAO/connectors/ami4ccm/tests/OneReplyH/descriptors/run_test.pl (limited to 'CIAO/connectors/ami4ccm/tests/OneReplyH') diff --git a/CIAO/connectors/ami4ccm/tests/OneReplyH/Base/OneReplyH.idl b/CIAO/connectors/ami4ccm/tests/OneReplyH/Base/OneReplyH.idl new file mode 100644 index 00000000000..970037e8ad6 --- /dev/null +++ b/CIAO/connectors/ami4ccm/tests/OneReplyH/Base/OneReplyH.idl @@ -0,0 +1,28 @@ +// $Id$ + +#ifndef ONEREPLYH_T_IDL +#define ONEREPLYH_T_IDL + +#pragma ciao lem "Base/OneReplyHE.idl" +#pragma ciao ami4ccm interface "OneReplyH::MyFoo" +#pragma ciao lem "Base/OneReplyHAE.idl" + +module OneReplyH +{ + exception InternalError + { + long id; + string error_string; + }; + + // Sender/Receiver interface + interface MyFoo + { + long foo (in string in_str, in long cmd, out string answer) + raises (InternalError); + void bar (in string in_str, in long cmd, out string answer, out long l_cmd) + raises (InternalError); + }; +}; + +#endif diff --git a/CIAO/connectors/ami4ccm/tests/OneReplyH/Base/OneReplyH.mpc b/CIAO/connectors/ami4ccm/tests/OneReplyH/Base/OneReplyH.mpc new file mode 100644 index 00000000000..1f386880df5 --- /dev/null +++ b/CIAO/connectors/ami4ccm/tests/OneReplyH/Base/OneReplyH.mpc @@ -0,0 +1,196 @@ +// $Id$ + +project(AMI_OneReplyH_idl_gen) : componentidldefaults, ami, ami4ccm_stub { + custom_only = 1 + idlflags += -Wb,stub_export_macro=ONEREPLYH_T_STUB_Export \ + -Wb,stub_export_include=OneReplyH_stub_export.h \ + -Wb,skel_export_macro=ONEREPLYH_T_SKEL_Export \ + -Wb,skel_export_include=OneReplyH_skel_export.h \ + -Wb,conn_export_macro=ONEREPLYH_T_CONN_Export \ + -Wb,conn_export_include=OneReplyH_conn_export.h \ + -Wb,exec_export_macro=ONEREPLYH_T_EXEC_Export \ + -Wb,exec_export_include=OneReplyH_exec_export.h \ + -I.. -GM -Gxhcn + idlflags -= -Gsv + + IDL_Files { + OneReplyH.idl + } +} + +project(AMI_OneReplyH_lem_gen) : ciaoidldefaults { + after += AMI_OneReplyH_idl_gen AMI_OneReplyH_lema_gen + custom_only = 1 + idlflags += -Wb,export_macro=ONEREPLYH_T_LEM_STUB_Export \ + -Wb,export_include=OneReplyH_lem_stub_export.h \ + -I.. -SS -Gxhst + + IDL_Files { + OneReplyHE.idl + } +} + +project(AMI_OneReplyH_lema_gen) : ciaoidldefaults { + after += AMI_OneReplyH_idl_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=ONEREPLYH_T_STUB_Export \ + -Wb,stub_export_include=OneReplyH_stub_export.h \ + -Wb,conn_export_macro=ONEREPLYH_T_CONN_Export \ + -Wb,conn_export_include=OneReplyH_conn_export.h \ + -Wb,svnt_export_macro=ONEREPLYH_T_SVNT_Export \ + -Wb,svnt_export_include=OneReplyH_svnt_export.h \ + -Wb,skel_export_macro=ONEREPLYH_T_SKEL_Export \ + -Wb,skel_export_include=OneReplyH_skel_export.h \ + -I.. -Gsv -Gcn -Glem -GC -Gxhst -Gxhsv + + IDL_Files { + OneReplyHA.idl + } +} + +project(AMI_OneReplyH_lemae_gen) : ciaoidldefaults { + after += AMI_OneReplyH_lema_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=ONEREPLYH_T_LEM_STUB_Export \ + -Wb,stub_export_include=OneReplyH_lem_stub_export.h \ + -I.. -SS + + IDL_Files { + OneReplyHAE.idl + } +} + +project(AMI_OneReplyH_stub) : ccm_stub, ami, ami4ccm_stub { + after += AMI_OneReplyH_lem_gen + libs += + libout = ../lib + libpaths += ../lib + includes += .. + + sharedname = OneReplyH_stub + dynamicflags = ONEREPLYH_T_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + OneReplyHC.cpp + OneReplyHAC.cpp + } + + Header_Files { + OneReplyHC.h + OneReplyH_stub_export.h +} + + Inline_Files { + OneReplyHC.inl + } +} + +project(AMI_OneReplyH_lem_stub) : ccm_executor, ami, ami4ccm_lem_stub { + after += AMI_OneReplyH_lem_gen AMI_OneReplyH_stub AMI_OneReplyH_lemae_gen AMI_OneReplyH_skel + libs += OneReplyH_stub OneReplyH_skel + libout = ../lib + libpaths += ../lib + includes += .. + + sharedname = OneReplyH_lem_stub + dynamicflags = ONEREPLYH_T_LEM_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + OneReplyHEC.cpp + OneReplyHAEC.cpp + } + + Header_Files { + OneReplyHEC.h + OneReplyH_lem_stub_export.h +} + + Inline_Files { + OneReplyHEC.inl + } +} + +project(AMI_OneReplyH_skel) : ciao_executor, ami, ami4ccm_servant { + after += AMI_OneReplyH_stub + sharedname = OneReplyH_skel + libs += OneReplyH_stub + libout = ../lib + libpaths += ../lib + includes += .. + + dynamicflags = ONEREPLYH_T_SKEL_BUILD_DLL + + IDL_Files { + } + + Source_Files { + OneReplyHS.cpp + OneReplyHAS.cpp + } + + Header_Files { + OneReplyHS.h + + OneReplyH_skel_export.h + } + + Inline_Files { + OneReplyHS.inl + + } +} + +project(AMI_OneReplyH_conn) : ciao_executor, ami, ami4ccm_lem_stub { + after += AMI_OneReplyH_lem_stub OneReplyH_Base_AMI_stub AMI_OneReplyH_skel AMI_OneReplyH_lema_gen AMI_OneReplyH_lemae_gen + sharedname = OneReplyH_conn + libs += OneReplyH_stub OneReplyH_skel OneReplyH_lem_stub + libpaths += ../lib + libout = ../lib + dynamicflags = ONEREPLYH_T_CONN_BUILD_DLL + includes += .. + IDL_Files { + } + + Source_Files { + OneReplyHA_conn.cpp + } + + Header_Files { + OneReplyHA_conn.h + OneReplyH_conn_export.h + } + + Inline_Files { + } +} + +project(AMI_OneReplyH_svnt) : ciao_servant, ami, ami4ccm_servant { + after += AMI_OneReplyH_lem_stub OneReplyH_Base_AMI_stub AMI_OneReplyH_skel AMI_OneReplyH_lema_gen AMI_OneReplyH_lemae_gen AMI_OneReplyH_conn + sharedname = OneReplyH_svnt + libs += OneReplyH_stub OneReplyH_skel OneReplyH_lem_stub OneReplyH_conn + libpaths += ../lib + libout = ../lib + dynamicflags = ONEREPLYH_T_SVNT_BUILD_DLL + includes += .. + IDL_Files { + } + + Source_Files { + OneReplyHA_svnt.cpp + } + + Header_Files { + OneReplyHA_svnt.h + OneReplyHA_svnt_export.h + } + + Inline_Files { + } +} + diff --git a/CIAO/connectors/ami4ccm/tests/OneReplyH/Receiver/OneReplyH_Receiver.idl b/CIAO/connectors/ami4ccm/tests/OneReplyH/Receiver/OneReplyH_Receiver.idl new file mode 100644 index 00000000000..7a969b40dc1 --- /dev/null +++ b/CIAO/connectors/ami4ccm/tests/OneReplyH/Receiver/OneReplyH_Receiver.idl @@ -0,0 +1,18 @@ +// $Id$ + +#ifndef ONEREPLYH_T_RECEIVER_IDL +#define ONEREPLYH_T_RECEIVER_IDL + +#include + +#include "Base/OneReplyH.idl" + +module OneReplyH +{ + component Receiver + { + /// Provides + provides MyFoo do_my_foo; + }; +}; +#endif diff --git a/CIAO/connectors/ami4ccm/tests/OneReplyH/Receiver/OneReplyH_Receiver.mpc b/CIAO/connectors/ami4ccm/tests/OneReplyH/Receiver/OneReplyH_Receiver.mpc new file mode 100644 index 00000000000..20fe86e6682 --- /dev/null +++ b/CIAO/connectors/ami4ccm/tests/OneReplyH/Receiver/OneReplyH_Receiver.mpc @@ -0,0 +1,134 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -p OneReplyH_Base OneReplyH_Receiver" + +project(AMI_OneRep_Base_Receiver_idl_gen) : componentidldefaults { + custom_only = 1 + after += AMI_OneReplyH_idl_gen + idlflags += -Wb,stub_export_macro=ONEREPLYH_T_RECEIVER_STUB_Export \ + -Wb,stub_export_include=OneReplyH_Receiver_stub_export.h \ + -Wb,skel_export_macro=ONEREPLYH_T_RECEIVER_SVNT_Export \ + -Wb,skel_export_include=OneReplyH_Receiver_svnt_export.h \ + -Wb,exec_export_macro=ONEREPLYH_T_RECEIVER_EXEC_Export \ + -Wb,exec_export_include=OneReplyH_Receiver_exec_export.h \ + -Glem -I.. + + IDL_Files { + OneReplyH_Receiver.idl + } +} + +project(AMI_OneRep_Base_Receiver_lem_gen) : ciaoidldefaults { + after += AMI_OneRep_Base_Receiver_idl_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=ONEREPLYH_T_RECEIVER_LEM_STUB_Export \ + -Wb,stub_export_include=OneReplyH_Receiver_lem_stub_export.h \ + -SS -Gxhst -I.. + + IDL_Files { + OneReplyH_ReceiverE.idl + } +} + +project(AMI_OneReplyH_Base_Receiver_l_stub) : ccm_svnt, messaging { + after += AMI_OneRep_Base_Receiver_lem_gen AMI_OneReplyH_Base_Receiver_stub AMI_OneReplyH_stub + libs += OneReplyH_stub OneReplyH_Receiver_stub + libpaths += ../lib + libout = ../lib + sharedname = OneReplyH_Receiver_lem_stub + dynamicflags = ONEREPLYH_T_RECEIVER_LEM_STUB_BUILD_DLL + includes += .. + IDL_Files { + } + + Source_Files { + OneReplyH_ReceiverEC.cpp + } + + Header_Files { + OneReplyH_ReceiverEC.h + OneReplyH_Receiver_lem_stub_export.h + } + + Inline_Files { + OneReplyH_ReceiverEC.inl + } +} + +project(AMI_OneReplyH_Base_Receiver_stub) : ccm_stub, messaging { + after += AMI_OneRep_Base_Receiver_idl_gen AMI_OneReplyH_stub + libs += OneReplyH_stub + libpaths += ../lib + libout = ../lib + sharedname = OneReplyH_Receiver_stub + dynamicflags = ONEREPLYH_T_RECEIVER_STUB_BUILD_DLL + includes += .. + IDL_Files { + } + + Source_Files { + OneReplyH_ReceiverC.cpp + } + + Header_Files { + OneReplyH_ReceiverC.h + OneReplyH_Receiver_stub_export.h + } + + Inline_Files { + OneReplyH_ReceiverC.inl + } +} + +project(AMI_OneReplyH_Base_Receiver_exec) : ciao_executor, messaging { + after += AMI_OneReplyH_Base_Receiver_l_stub AMI_OneReplyH_Base_Receiver_stub AMI_OneReplyH_stub AMI_OneReplyH_lem_stub + sharedname = OneReplyH_Receiver_exec + libs += OneReplyH_Receiver_stub OneReplyH_Receiver_lem_stub OneReplyH_stub OneReplyH_lem_stub + libpaths += ../lib + libout = ../lib + dynamicflags = ONEREPLYH_T_RECEIVER_EXEC_BUILD_DLL + includes += .. + IDL_Files { + } + + Source_Files { + OneReplyH_Receiver_exec.cpp + } + + Header_Files { + OneReplyH_Receiver_exec.h + OneReplyH_Receiver_exec_export.h + } + + Inline_Files { + } +} + +project(AMI_OneReplyH_Base_Receiver_svnt) : ciao_servant, messaging { + after += AMI_OneReplyH_Base_skel AMI_OneReplyH_Base_Receiver_l_stub AMI_OneReplyH_stub AMI_OneReplyH_skel AMI_OneReplyH_lem_stub + sharedname = OneReplyH_Receiver_svnt + libs += OneReplyH_Receiver_stub OneReplyH_Receiver_lem_stub \ + OneReplyH_skel \ + OneReplyH_stub OneReplyH_lem_stub + libpaths += ../lib + libout = ../lib + dynamicflags = ONEREPLYH_T_RECEIVER_SVNT_BUILD_DLL + includes += .. + IDL_Files { + } + + Source_Files { + OneReplyH_ReceiverS.cpp + OneReplyH_Receiver_svnt.cpp + } + + Header_Files { + OneReplyH_ReceiverS.h + OneReplyH_Receiver_svnt.h + OneReplyH_Receiver_svnt_export.h + } + + Inline_Files { + OneReplyH_ReceiverS.inl + } +} + diff --git a/CIAO/connectors/ami4ccm/tests/OneReplyH/Receiver/OneReplyH_Receiver_exec.cpp b/CIAO/connectors/ami4ccm/tests/OneReplyH/Receiver/OneReplyH_Receiver_exec.cpp new file mode 100644 index 00000000000..9fec6afda12 --- /dev/null +++ b/CIAO/connectors/ami4ccm/tests/OneReplyH/Receiver/OneReplyH_Receiver_exec.cpp @@ -0,0 +1,111 @@ +// -*- C++ -*- +// $Id$ + +#include "OneReplyH_Receiver_exec.h" +#include "ace/OS_NS_unistd.h" + +namespace CIAO_OneReplyH_Receiver_Impl +{ + MyFoo_exec_i::MyFoo_exec_i (void) + { + } + + MyFoo_exec_i::~MyFoo_exec_i (void) + { + } + + ::CORBA::Long + MyFoo_exec_i::foo (const char * in_str,::CORBA::Long cmd, + ::CORBA::String_out answer) + { + if (ACE_OS::strlen (in_str) == 0) + { + OneReplyH::InternalError ex (cmd,"foo thrown by receiver"); + throw ex; + } + else + { + answer = CORBA::string_dup ("This is my answer : Hi"); + return cmd; + } + } + + void + MyFoo_exec_i::bar (const char * in_str, + ::CORBA::Long cmd, + ::CORBA::String_out answer, + ::CORBA::Long_out l_cmd) + { + if (ACE_OS::strlen (in_str) == 0) + { + OneReplyH::InternalError ex (cmd,"bar thrown by receiver"); + throw ex; + } + else + { + answer = CORBA::string_alloc(20); + sprintf(answer,"in_str was <%C>", in_str); + l_cmd = cmd; + } + } + + Receiver_exec_i::Receiver_exec_i (void) + { + } + + Receiver_exec_i::~Receiver_exec_i (void) + { + } + + ::OneReplyH::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_ = ::OneReplyH::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_OneReplyH_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/OneReplyH/Receiver/OneReplyH_Receiver_exec.h b/CIAO/connectors/ami4ccm/tests/OneReplyH/Receiver/OneReplyH_Receiver_exec.h new file mode 100644 index 00000000000..d5feece94fd --- /dev/null +++ b/CIAO/connectors/ami4ccm/tests/OneReplyH/Receiver/OneReplyH_Receiver_exec.h @@ -0,0 +1,59 @@ +// -*- C++ -*- +// $Id$ + +#ifndef CIAO_ONEREPLYH_T_RECEIVER_EXEC_H_ +#define CIAO_ONEREPLYH_T_RECEIVER_EXEC_H_ + +#include "OneReplyH_ReceiverEC.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/LocalObject.h" +#include "OneReplyH_Receiver_exec_export.h" + +namespace CIAO_OneReplyH_Receiver_Impl +{ + class MyFoo_exec_i + : public virtual ::OneReplyH::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::Long cmd, + ::CORBA::String_out answer); + virtual void bar (const char * in_str, ::CORBA::Long cmd, + ::CORBA::String_out answer, ::CORBA::Long_out l_cmd); + }; + + class Receiver_exec_i + : public virtual Receiver_Exec, + public virtual ::CORBA::LocalObject + { + public: + Receiver_exec_i (void); + virtual ~Receiver_exec_i (void); + + virtual ::OneReplyH::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: + ::OneReplyH::CCM_Receiver_Context_var context_; + }; + + extern "C" ONEREPLYH_T_RECEIVER_EXEC_Export ::Components::EnterpriseComponent_ptr + create_OneReplyH_AMI_Receiver_Impl (void); +} + +#endif /* ifndef */ + diff --git a/CIAO/connectors/ami4ccm/tests/OneReplyH/Sender/OneReplyH_Sender.idl b/CIAO/connectors/ami4ccm/tests/OneReplyH/Sender/OneReplyH_Sender.idl new file mode 100644 index 00000000000..4f676accbd3 --- /dev/null +++ b/CIAO/connectors/ami4ccm/tests/OneReplyH/Sender/OneReplyH_Sender.idl @@ -0,0 +1,21 @@ +// $Id$ + +#ifndef ONEREPLYH_T_SENDER_IDL +#define ONEREPLYH_T_SENDER_IDL + +#include + +#include "Base/OneReplyH.idl" + +#pragma ciao ami4ccm receptacle "OneReplyH::Sender::run_my_foo" + +module OneReplyH +{ + component Sender + { + /// For synchronous invocation + uses MyFoo run_my_foo; + }; +}; + +#endif diff --git a/CIAO/connectors/ami4ccm/tests/OneReplyH/Sender/OneReplyH_Sender.mpc b/CIAO/connectors/ami4ccm/tests/OneReplyH/Sender/OneReplyH_Sender.mpc new file mode 100644 index 00000000000..16077417ab1 --- /dev/null +++ b/CIAO/connectors/ami4ccm/tests/OneReplyH/Sender/OneReplyH_Sender.mpc @@ -0,0 +1,135 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -p OneReplyH_Base OneReplyH_Sender" + +project(AMI_OneReplyH_Base_Sender_idl_gen) : componentidldefaults { + after += Conn_OneReplyH_Base_idl_gen AMI_OneReplyH_idl_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=ONEREPLYH_T_SENDER_STUB_Export \ + -Wb,stub_export_include=OneReplyH_Sender_stub_export.h \ + -Wb,skel_export_macro=ONEREPLYH_T_SENDER_SVNT_Export \ + -Wb,skel_export_include=OneReplyH_Sender_svnt_export.h \ + -Wb,exec_export_macro=ONEREPLYH_T_SENDER_EXEC_Export \ + -Wb,exec_export_include=OneReplyH_Sender_exec_export.h \ + -I.. -GC + + IDL_Files { + OneReplyH_Sender.idl + } +} + +project(AMI_OneReplyH_Base_Sender_lem_gen) : ciaoidldefaults { + after += AMI_OneReplyH_Base_Sender_idl_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=ONEREPLYH_T_SENDER_LEM_STUB_Export \ + -Wb,stub_export_include=OneReplyH_Sender_lem_stub_export.h \ + -SS -Gxhst -I.. + + IDL_Files { + OneReplyH_SenderE.idl + } +} + +project(AMI_OneReplyH_Base_Sender_lem_stub) : ccm_svnt, ami { + after += AMI_OneReplyH_Base_Sender_lem_gen AMI_OneReplyH_stub Conn_OneReplyH_Base_stub + libs += OneReplyH_stub + libpaths += ../lib + libout = ../lib + sharedname = OneReplyH_Sender_lem_stub + dynamicflags = ONEREPLYH_T_SENDER_LEM_STUB_BUILD_DLL + includes += .. + IDL_Files { + } + + Source_Files { + OneReplyH_SenderEC.cpp + } + + Header_Files { + OneReplyH_SenderEC.h + OneReplyH_Sender_lem_stub_export.h + } + + Inline_Files { + OneReplyH_SenderEC.inl + } +} + +project(AMI_OneReplyH_Base_Sender_stub) : ccm_stub, ami { + after += AMI_OneReplyH_Base_Sender_idl_gen AMI_OneReplyH_Base_stub AMI_OneReplyH_stub Conn_OneReplyH_Base_stub + libs += OneReplyH_stub + libpaths += ../lib + libout = ../lib + sharedname = OneReplyH_Sender_stub + dynamicflags = ONEREPLYH_T_SENDER_STUB_BUILD_DLL + includes += .. + IDL_Files { + } + + Source_Files { + OneReplyH_SenderC.cpp + } + + Header_Files { + OneReplyH_SenderC.h + OneReplyH_Sender_stub_export.h + } + + Inline_Files { + OneReplyH_SenderC.inl + } +} + +project(AMI_OneReplyH_Base_Sender_exec) : ciao_executor, ami, ami4ccm_stub { + after += AMI_OneReplyH_Base_Sender_lem_stub AMI_OneReplyH_Base_Sender_stub AMI_OneReplyH_Base_exec Conn_OneReplyH_Base_stub AMI_OneReplyH_lem_stub + sharedname = OneReplyH_Sender_exec + libs += OneReplyH_Sender_stub OneReplyH_Sender_lem_stub OneReplyH_stub OneReplyH_stub OneReplyH_lem_stub + libpaths += ../lib + libout = ../lib + dynamicflags = ONEREPLYH_T_SENDER_EXEC_BUILD_DLL + includes += .. + IDL_Files { + } + + Source_Files { + OneReplyH_Sender_exec.cpp + } + + Header_Files { + OneReplyH_Sender_exec.h + OneReplyH_Sender_exec_export.h + } + + Inline_Files { + } +} + +project(AMI_OneReplyH_Base_Sender_svnt) : ciao_servant, ami { + after += AMI_OneReplyH_Base_skel AMI_OneReplyH_Base_Sender_lem_stub AMI_OneReplyH_Base_Sender_stub AMI_OneReplyH_Base_exec AMI_OneReplyH_skel + sharedname = OneReplyH_Sender_svnt + libs += OneReplyH_Sender_stub OneReplyH_Sender_lem_stub \ + OneReplyH_skel \ + OneReplyH_stub + libpaths += ../lib + libout = ../lib + dynamicflags = ONEREPLYH_T_SENDER_SVNT_BUILD_DLL + includes += .. + IDL_Files { + } + + Source_Files { + OneReplyH_SenderS.cpp + OneReplyH_Sender_svnt.cpp + } + + Header_Files { + OneReplyH_SenderS.h + OneReplyH_Sender_svnt.h + OneReplyH_Sender_svnt_export.h + } + + Inline_Files { + OneReplyH_SenderS.inl + } +} + + diff --git a/CIAO/connectors/ami4ccm/tests/OneReplyH/Sender/OneReplyH_Sender_exec.cpp b/CIAO/connectors/ami4ccm/tests/OneReplyH/Sender/OneReplyH_Sender_exec.cpp new file mode 100644 index 00000000000..8a76dbe0e9f --- /dev/null +++ b/CIAO/connectors/ami4ccm/tests/OneReplyH/Sender/OneReplyH_Sender_exec.cpp @@ -0,0 +1,308 @@ +// -*- C++ -*- +// $Id$ + +// test the use of one replyhandler with more then one request +#include "OneReplyH_Sender_exec.h" +#include "ace/OS_NS_unistd.h" + +namespace CIAO_OneReplyH_Sender_Impl +{ + CORBA::Short nr_of_excep_received = 0; + CORBA::Short nr_of_received = 0; + const CORBA::Short cmd_synch_foo_ok = 1; + const CORBA::Short cmd_synch_foo_nok = 2; + const CORBA::Short cmd_asynch_foo_ok = 3; + const CORBA::Short cmd_asynch_foo_nok = 4; + const CORBA::Short cmd_synch_bar_ok = 5; + const CORBA::Short cmd_synch_bar_nok = 6; + const CORBA::Short cmd_asynch_bar_ok = 7; + const CORBA::Short cmd_asynch_bar_nok = 8; + + void HandleException ( + long id, + long expect_id, + const char* error_string, + const char* func) + { + //expected exception + if ( id == expect_id) + { + ++nr_of_excep_received; + } + else + { + ACE_ERROR ((LM_ERROR, "ERROR Sender: wrong exception received" + " for %C\n", func)); + } + } + //============================================================ + // 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*/) + { + if ( ami_return_val == cmd_asynch_foo_ok) + { + ++nr_of_received; + } + } + + void + MyFoo_callback_exec_i::foo_excep ( + ::CCM_AMI::ExceptionHolder * excep_holder) + { + try + { + excep_holder->raise_exception (); + } + catch (const OneReplyH::InternalError& ex) + { + HandleException (ex.id, cmd_asynch_foo_nok, + ex.error_string.in(), "asynch foo"); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("ERROR: Caught unexpected exception:"); + } + } + + void + MyFoo_callback_exec_i::bar ( + const char *answer, CORBA::Long l_cmd) + { + if ( l_cmd == cmd_asynch_bar_ok ) + { + ++nr_of_received; + } + } + + void + MyFoo_callback_exec_i::bar_excep ( + ::CCM_AMI::ExceptionHolder * excep_holder) + { + try + { + excep_holder->raise_exception (); + } + catch (const OneReplyH::InternalError& ex) + { + HandleException (ex.id, cmd_asynch_bar_nok, + ex.error_string.in(), "asynch bar"); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("ERROR: Caught unexpected exception:"); + } + } + //============================================================ + // Worker thread for asynchronous invocations for MyFoo + //============================================================ + asynch_foo_generator::asynch_foo_generator ( + ::OneReplyH::AMI4CCM_MyFoo_ptr my_foo_ami) + : my_foo_ami_ (::OneReplyH::AMI4CCM_MyFoo::_duplicate (my_foo_ami)) + { + cb_ = new MyFoo_callback_exec_i (); + } + + 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 ,test with one replyhandler. + my_foo_ami_->sendc_foo ( this->cb_.in(), "Hi from foo 1", + cmd_asynch_foo_ok); + //this should invoke a exception + my_foo_ami_->sendc_foo ( this->cb_.in(), "", cmd_asynch_foo_nok); + + my_foo_ami_->sendc_foo ( this->cb_.in(), "Hi from foo 2", + cmd_asynch_foo_ok); + my_foo_ami_->sendc_bar ( this->cb_.in(), "Hi from bar", + cmd_asynch_bar_ok); + my_foo_ami_->sendc_foo ( this->cb_.in(), "Hi from foo 3", + cmd_asynch_foo_ok); + + //this should invoke a exception + my_foo_ami_->sendc_bar ( this->cb_.in(), "", cmd_asynch_bar_nok); + } + return 0; + } + + //============================================================ + // Worker thread for synchronous invocations for MyFoo + //============================================================ + synch_foo_generator::synch_foo_generator ( + ::OneReplyH::MyFoo_ptr my_foo_ami) + : my_foo_ami_ (::OneReplyH::MyFoo::_duplicate (my_foo_ami)) + { + } + + int synch_foo_generator::svc () + { + ACE_OS::sleep (3); + //run some synch calls + char * out_str = 0; + CORBA::Long l_cmd = 0; + try + { + CORBA::Long result = my_foo_ami_->foo ("Do something synchronous", + cmd_synch_foo_ok , + out_str); + if ( result == cmd_synch_foo_ok) + { + ++nr_of_received; + } + } + catch (const OneReplyH::InternalError&) + { + ACE_ERROR ((LM_ERROR, "ERROR: synch_foo_generator::foo: " + "Unexpected exception.\n")); + } + try + { + my_foo_ami_->foo ("",cmd_synch_foo_nok, out_str); + } + catch (const OneReplyH::InternalError& ex) + { + HandleException (ex.id, cmd_synch_foo_nok, ex.error_string.in(), + "synch foo"); + } + try + { + my_foo_ami_->bar ("Do something synchronous", + cmd_synch_bar_ok, + out_str, l_cmd); + if ( l_cmd == cmd_synch_bar_ok) + { + ++nr_of_received; + } + } + catch (const OneReplyH::InternalError&) + { + ACE_ERROR ((LM_ERROR, "ERROR: synch_foo_generator::bar: " + "Unexpected exception.\n")); + } + try + { + my_foo_ami_->bar ( "", cmd_synch_bar_nok, out_str, l_cmd); + } + catch (const OneReplyH::InternalError& ex) + { + HandleException (ex.id, cmd_synch_bar_nok, ex.error_string.in(), + "synch bar"); + } + 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. + // Operations from Components::SessionComponent. + void + Sender_exec_i::set_session_context ( + ::Components::SessionContext_ptr ctx) + { + this->context_ = + ::OneReplyH::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) + { + ::OneReplyH::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); + + ::OneReplyH::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) + { + if (nr_of_excep_received != 4) + { + ACE_ERROR ((LM_ERROR, "ERROR: not received the expected number of" + " exceptions" + "Expected: 4, Received: %u.\n", + nr_of_excep_received)); + } + if (nr_of_received != 6) + { + ACE_ERROR ((LM_ERROR, "ERROR: Sender not received the expected number" + " of callbacks and returns for syn- and " + "asynchronous calls. Expected: 6," + " Received: %u.\n", + nr_of_excep_received)); + } + if ((nr_of_received == 6) && (nr_of_excep_received == 4)) + { + ACE_DEBUG ((LM_DEBUG, "OK: Sender received the expected number of" + " callbacks and exceptions for syn- and " + "asynchronous calls\n")); + } + } + + extern "C" ::Components::EnterpriseComponent_ptr + create_OneReplyH_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/OneReplyH/Sender/OneReplyH_Sender_exec.h b/CIAO/connectors/ami4ccm/tests/OneReplyH/Sender/OneReplyH_Sender_exec.h new file mode 100644 index 00000000000..a9eb73eb24c --- /dev/null +++ b/CIAO/connectors/ami4ccm/tests/OneReplyH/Sender/OneReplyH_Sender_exec.h @@ -0,0 +1,95 @@ +// -*- C++ -*- +// +// $Id$ + +#ifndef CIAO_ONEREPLYH_T_SENDER_EXEC_H_ +#define CIAO_ONEREPLYH_T_SENDER_EXEC_H_ + +#include "OneReplyH_SenderEC.h" +#include "OneReplyH_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_OneReplyH_Sender_Impl +{ + /// Common exception handlers + void HandleException ( + long id, + long expect_id, + const char* error_string, + const char* func); + + /// Worker thread for asynchronous invocations + class asynch_foo_generator : public virtual ACE_Task_Base + { + public: + asynch_foo_generator (::OneReplyH::AMI4CCM_MyFoo_ptr my_foo_ami); + + virtual int svc (void); + + private: + ::OneReplyH::AMI4CCM_MyFoo_var my_foo_ami_; + ::OneReplyH::CCM_AMI4CCM_MyFooReplyHandler_var cb_; + }; + + /// Worker thread for synchronous invocations + class synch_foo_generator : public virtual ACE_Task_Base + { + public: + synch_foo_generator (::OneReplyH::MyFoo_ptr my_foo_ami); + + virtual int svc (void); + + private: + ::OneReplyH::MyFoo_var my_foo_ami_; + }; + + class MyFoo_callback_exec_i + : public virtual ::OneReplyH::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); + virtual void bar (const char * answer, CORBA::Long l_cmd); + virtual void bar_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: + ::OneReplyH::CCM_Sender_Context_var context_; + MyFoo_callback_exec_i* global_foo_callback_; + }; + + extern "C" ONEREPLYH_T_SENDER_EXEC_Export ::Components::EnterpriseComponent_ptr + create_OneReplyH_AMI_Sender_Impl (void); +} + +#endif /* ifndef */ + diff --git a/CIAO/connectors/ami4ccm/tests/OneReplyH/descriptors/Plan.cdp b/CIAO/connectors/ami4ccm/tests/OneReplyH/descriptors/Plan.cdp new file mode 100644 index 00000000000..865d33fb90c --- /dev/null +++ b/CIAO/connectors/ami4ccm/tests/OneReplyH/descriptors/Plan.cdp @@ -0,0 +1,373 @@ + + + + 6D382DAE-9024-4C4D-B91B-A0F9176AFACF + + + OneReplyH_ReceiverHomeImplementation + + + + + component factory + + + tk_string + + + create_OneReplyH_AMI_Receiver_Impl + + + + + edu.vanderbilt.dre.CIAO.ExecutorArtifact + + + tk_string + + + OneReplyH.ImplementationArtifacts.ReceiverArtifacts.Receiver_exec + + + + + edu.vanderbilt.dre.CIAO.ServantEntrypoint + + + tk_string + + + create_OneReplyH_Receiver_Servant + + + + + edu.vanderbilt.dre.CIAO.ServantArtifact + + + tk_string + + + OneReplyH.ImplementationArtifacts.ReceiverArtifacts.Receiver_svnt + + + + + + + OneReplyH_SenderHomeImplementation + + + + + component factory + + + tk_string + + + create_OneReplyH_AMI_Sender_Impl + + + + + edu.vanderbilt.dre.CIAO.ExecutorArtifact + + + tk_string + + + OneReplyH.ImplementationArtifacts.SenderArtifacts.Sender_exec + + + + + edu.vanderbilt.dre.CIAO.ServantEntrypoint + + + tk_string + + + create_OneReplyH_Sender_Servant + + + + + edu.vanderbilt.dre.CIAO.ServantArtifact + + + tk_string + + + OneReplyH.ImplementationArtifacts.SenderArtifacts.Sender_svnt + + + + + + + OneReplyH_AMIHomeImplementation + + + + + component factory + + + tk_string + + + create_OneReplyH_AMI4CCM_MyFoo_Connector_Impl + + + + + edu.vanderbilt.dre.CIAO.ExecutorArtifact + + + tk_string + + + OneReplyH.ImplementationArtifacts.AMIArtifacts.AMI_exec + + + + + edu.vanderbilt.dre.CIAO.ServantEntrypoint + + + tk_string + + + create_OneReplyH_AMI4CCM_MyFoo_Connector_AMI4CCM_Connector_Servant + + + + + edu.vanderbilt.dre.CIAO.ServantArtifact + + + tk_string + + + OneReplyH.ImplementationArtifacts.AMIArtifacts.AMI_svnt + + + + + + + OneReplyH.ComponentImplementations.OneReplyHImplementation.OneReplyH.Receiver + Receiver + + + + edu.vanderbilt.dre.DAnCE.InstanceIOR + + + tk_string + + + Receiver.ior + + + + + + + OneReplyH.ComponentImplementations.OneReplyHImplementation.OneReplyH.Sender + Sender + + + + edu.vanderbilt.dre.DAnCE.InstanceIOR + + + tk_string + + + Sender.ior + + + + + + + OneReplyH.ComponentImplementations.OneReplyHImplementation.OneReplyH.AMI + Sender + + + + edu.vanderbilt.dre.DAnCE.InstanceIOR + + + tk_string + + + AMI.ior + + + + + + + run_asynch_foo_connection + + edu.dre.vanderbilt.DAnCE.ConnectionType + Local_Interface + + + sendc_run_my_foo + false + SimplexReceptacle + + + + ami4ccm_port_ami4ccm_provides + true + Facet + + + + + + do_foo_connection + + do_my_foo + true + Facet + + + + ami4ccm_port_ami4ccm_uses + false + SimplexReceptacle + + + + + + synch_foo_connection + + do_my_foo + true + Facet + + + + run_my_foo + false + SimplexReceptacle + + + + + + OneReplyH.ImplementationArtifacts.AMIArtifacts.AMI_svnt + + + OneReplyH_svnt + + entryPoint + + + tk_string + + + create_OneReplyH_AMI4CCM_MyFoo_Connector_AMI4CCM_Connector_Servant + + + + + + + OneReplyH.ImplementationArtifacts.AMIArtifacts.AMI_exec + + + OneReplyH_conn + + entryPoint + + + tk_string + + + create_OneReplyH_AMI4CCM_MyFoo_Connector_Impl + + + + + + + OneReplyH.ImplementationArtifacts.ReceiverArtifacts.Receiver_svnt + + + OneReplyH_Receiver_svnt + + entryPoint + + + tk_string + + + create_OneReplyH_AMI_ReceiverHome_Servant + + + + + + + OneReplyH.ImplementationArtifacts.ReceiverArtifacts.Receiver_exec + + + OneReplyH_Receiver_exec + + entryPoint + + + tk_string + + + create_OneReplyH_AMI_ReceiverHome_Impl + + + + + + + OneReplyH.ImplementationArtifacts.SenderArtifacts.Sender_svnt + + + OneReplyH_Sender_svnt + + entryPoint + + + tk_string + + + create_OneReplyH_AMI_SenderHome_Servant + + + + + + + OneReplyH.ImplementationArtifacts.SenderArtifacts.Sender_exec + + + OneReplyH_Sender_exec + + entryPoint + + + tk_string + + + create_OneReplyH_AMI_SenderHome_Impl + + + + + + diff --git a/CIAO/connectors/ami4ccm/tests/OneReplyH/descriptors/run_test.pl b/CIAO/connectors/ami4ccm/tests/OneReplyH/descriptors/run_test.pl new file mode 100644 index 00000000000..c555924db17 --- /dev/null +++ b/CIAO/connectors/ami4ccm/tests/OneReplyH/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 ('dance_locality_manager'); +} + +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 = "$DANCE_ROOT/bin/dance_locality_manager"; + + $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 30 seconds to allow task to complete\n"; +sleep (30); + +# 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; -- cgit v1.2.1