diff options
author | mhengstmengel <mhengstmengel@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2010-05-06 12:23:07 +0000 |
---|---|---|
committer | mhengstmengel <mhengstmengel@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2010-05-06 12:23:07 +0000 |
commit | 7cc10b0e46dbf2fa40802342fefb7e151b02600a (patch) | |
tree | efb57ab8e700afddce86ff55be13cfc0ceddd76e /CIAO/connectors/ami4ccm/tests/InterReturn | |
parent | bf1acc9439e756967791344c0e68ae1f51e8403d (diff) | |
download | ATCD-7cc10b0e46dbf2fa40802342fefb7e151b02600a.tar.gz |
Thu May 6 12:21:20 UTC 2010 Marijke Hengstmengel <mhengstmengel@remedy.nl>
* bin/ciao_tests.lst
* connectors/ami4ccm/tests/InterReturn
* connectors/ami4ccm/tests/InterReturn/Base
* connectors/ami4ccm/tests/InterReturn/Base/InterReturnT.idl
* connectors/ami4ccm/tests/InterReturn/Base/InterReturnT.mpc
* connectors/ami4ccm/tests/InterReturn/descriptors
* connectors/ami4ccm/tests/InterReturn/descriptors/Plan.cdp
* connectors/ami4ccm/tests/InterReturn/descriptors/run_test.pl
* connectors/ami4ccm/tests/InterReturn/Receiver
* connectors/ami4ccm/tests/InterReturn/Receiver/InterReturnT_Receiver.idl
* connectors/ami4ccm/tests/InterReturn/Receiver/InterReturnT_Receiver.mpc
* connectors/ami4ccm/tests/InterReturn/Receiver/InterReturnT_Receiver_exec.cpp
* connectors/ami4ccm/tests/InterReturn/Receiver/InterReturnT_Receiver_exec.h
* connectors/ami4ccm/tests/InterReturn/Sender
* connectors/ami4ccm/tests/InterReturn/Sender/InterReturnT_Sender.idl
* connectors/ami4ccm/tests/InterReturn/Sender/InterReturnT_Sender.mpc
* connectors/ami4ccm/tests/InterReturn/Sender/InterReturnT_Sender_exec.cpp
* connectors/ami4ccm/tests/InterReturn/Sender/InterReturnT_Sender_exec.h
AMI4CCM test for return values.
Diffstat (limited to 'CIAO/connectors/ami4ccm/tests/InterReturn')
12 files changed, 1924 insertions, 0 deletions
diff --git a/CIAO/connectors/ami4ccm/tests/InterReturn/Base/InterReturnT.idl b/CIAO/connectors/ami4ccm/tests/InterReturn/Base/InterReturnT.idl new file mode 100644 index 00000000000..704907330a5 --- /dev/null +++ b/CIAO/connectors/ami4ccm/tests/InterReturn/Base/InterReturnT.idl @@ -0,0 +1,70 @@ +// $Id$ + +#ifndef INTERRETURN_T_IDL +#define INTERRETURN_T_IDL + +#pragma ciao lem "Base/InterReturnTE.idl" +#pragma ciao ami4ccm interface "InterReturnT::MyFoo" +#pragma ciao lem "Base/InterReturnTAE.idl" + +module InterReturnT +{ + // Mixed struct + struct TestStruct { + string key; + long x; + }; + + // Array + struct TestArr { + string key; + short x_array[5]; + }; + + typedef TestArr TestArray[5]; + + // Union + union X_Union switch (short) { + case 0: + string x_test; + case 1: + long x_long; + }; + + // Sequence + struct test { + short x_test; + string x_teststr; + }; + typedef sequence<test> TestSeq; + + exception InternalError + { + long id; + string error_string; + }; + + // Sender/Receiver interface + interface MyFoo + { + void ret_void (in string in_str, out string answer, out long l_cmd) + raises (InternalError); + long ret_long (in string in_str, out string answer, out long l_cmd) + raises (InternalError); + double ret_double (in string in_str, out string answer, out long l_cmd) + raises (InternalError); + TestStruct ret_struct ( in string in_str, out string answer, + out long l_cmd) + raises (InternalError); + TestArray ret_array (in string in_str, out string answer, + out long l_cmd) + raises (InternalError); + TestSeq ret_seq (in string in_str, out string answer, out long l_cmd) + raises (InternalError); + X_Union ret_union (in string in_str, out string answer, out long l_cmd) + raises (InternalError); + }; +}; + +#endif + diff --git a/CIAO/connectors/ami4ccm/tests/InterReturn/Base/InterReturnT.mpc b/CIAO/connectors/ami4ccm/tests/InterReturn/Base/InterReturnT.mpc new file mode 100644 index 00000000000..40d553b78ad --- /dev/null +++ b/CIAO/connectors/ami4ccm/tests/InterReturn/Base/InterReturnT.mpc @@ -0,0 +1,196 @@ +// $Id$ + +project(AMI_InterReturnT_idl_gen) : componentidldefaults, ami, ami4ccm_stub { + custom_only = 1 + idlflags += -Wb,stub_export_macro=INTERRETURN_T_STUB_Export \ + -Wb,stub_export_include=InterReturnT_stub_export.h \ + -Wb,skel_export_macro=INTERRETURN_T_SKEL_Export \ + -Wb,skel_export_include=InterReturnT_skel_export.h \ + -Wb,conn_export_macro=INTERRETURN_T_CONN_Export \ + -Wb,conn_export_include=InterReturnT_conn_export.h \ + -Wb,exec_export_macro=INTERRETURN_T_EXEC_Export \ + -Wb,exec_export_include=InterReturnT_exec_export.h \ + -I.. -GM -Gxhcn + idlflags -= -Gsv + + IDL_Files { + InterReturnT.idl + } +} + +project(AMI_InterReturnT_lem_gen) : ciaoidldefaults { + after += AMI_InterReturnT_idl_gen AMI_InterReturnT_lema_gen + custom_only = 1 + idlflags += -Wb,export_macro=INTERRETURN_T_LEM_STUB_Export \ + -Wb,export_include=InterReturnT_lem_stub_export.h \ + -I.. -SS -Gxhst + + IDL_Files { + InterReturnTE.idl + } +} + +project(AMI_InterReturnT_lema_gen) : ciaoidldefaults { + after += AMI_InterReturnT_idl_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=INTERRETURN_T_STUB_Export \ + -Wb,stub_export_include=InterReturnT_stub_export.h \ + -Wb,conn_export_macro=INTERRETURN_T_CONN_Export \ + -Wb,conn_export_include=InterReturnT_conn_export.h \ + -Wb,svnt_export_macro=INTERRETURN_T_SVNT_Export \ + -Wb,svnt_export_include=InterReturnT_svnt_export.h \ + -Wb,skel_export_macro=INTERRETURN_T_SKEL_Export \ + -Wb,skel_export_include=InterReturnT_skel_export.h \ + -I.. -Gsv -Gcn -Glem -GM -Gxhst -Gxhsv + + IDL_Files { + InterReturnTA.idl + } +} + +project(AMI_InterReturnT_lemae_gen) : ciaoidldefaults { + after += AMI_InterReturnT_lema_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=INTERRETURN_T_LEM_STUB_Export \ + -Wb,stub_export_include=InterReturnT_lem_stub_export.h \ + -I.. -SS + + IDL_Files { + InterReturnTAE.idl + } +} + +project(AMI_InterReturnT_stub) : ccm_stub, ami, ami4ccm_stub { + after += AMI_InterReturnT_lem_gen + libs += + libout = ../lib + libpaths += ../lib + includes += .. + + sharedname = InterReturnT_stub + dynamicflags = INTERRETURN_T_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + InterReturnTC.cpp + InterReturnTAC.cpp + } + + Header_Files { + InterReturnTC.h + InterReturnT_stub_export.h +} + + Inline_Files { + InterReturnTC.inl + } +} + +project(AMI_InterReturnT_lem_stub) : ccm_executor, ami, ami4ccm_lem_stub { + after += AMI_InterReturnT_lem_gen AMI_InterReturnT_stub AMI_InterReturnT_lemae_gen AMI_InterReturnT_skel + libs += InterReturnT_stub InterReturnT_skel + libout = ../lib + libpaths += ../lib + includes += .. + + sharedname = InterReturnT_lem_stub + dynamicflags = INTERRETURN_T_LEM_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + InterReturnTEC.cpp + InterReturnTAEC.cpp + } + + Header_Files { + InterReturnTEC.h + InterReturnT_lem_stub_export.h +} + + Inline_Files { + InterReturnTEC.inl + } +} + +project(AMI_InterReturnT_skel) : ciao_executor, ami, ami4ccm_servant { + after += AMI_InterReturnT_stub + sharedname = InterReturnT_skel + libs += InterReturnT_stub + libout = ../lib + libpaths += ../lib + includes += .. + + dynamicflags = INTERRETURN_T_SKEL_BUILD_DLL + + IDL_Files { + } + + Source_Files { + InterReturnTS.cpp + InterReturnTAS.cpp + } + + Header_Files { + InterReturnTS.h + + InterReturnT_skel_export.h + } + + Inline_Files { + InterReturnTS.inl + + } +} + +project(AMI_InterReturnT_conn) : ciao_executor, ami, ami4ccm_lem_stub { + after += AMI_InterReturnT_lem_stub InterReturnT_Base_AMI_stub AMI_InterReturnT_skel AMI_InterReturnT_lema_gen AMI_InterReturnT_lemae_gen + sharedname = InterReturnT_conn + libs += InterReturnT_stub InterReturnT_skel InterReturnT_lem_stub + libpaths += ../lib + libout = ../lib + dynamicflags = INTERRETURN_T_CONN_BUILD_DLL + includes += .. + IDL_Files { + } + + Source_Files { + InterReturnTA_conn.cpp + } + + Header_Files { + InterReturnTA_conn.h + InterReturnT_conn_export.h + } + + Inline_Files { + } +} + +project(AMI_InterReturnT_svnt) : ciao_servant, ami, ami4ccm_servant { + after += AMI_InterReturnT_lem_stub InterReturnT_Base_AMI_stub AMI_InterReturnT_skel AMI_InterReturnT_lema_gen AMI_InterReturnT_lemae_gen AMI_InterReturnT_conn + sharedname = InterReturnT_svnt + libs += InterReturnT_stub InterReturnT_skel InterReturnT_lem_stub InterReturnT_conn + libpaths += ../lib + libout = ../lib + dynamicflags = INTERRETURN_T_SVNT_BUILD_DLL + includes += .. + IDL_Files { + } + + Source_Files { + InterReturnTA_svnt.cpp + } + + Header_Files { + InterReturnTA_svnt.h + InterReturnTA_svnt_export.h + } + + Inline_Files { + } +} + diff --git a/CIAO/connectors/ami4ccm/tests/InterReturn/Receiver/InterReturnT_Receiver.idl b/CIAO/connectors/ami4ccm/tests/InterReturn/Receiver/InterReturnT_Receiver.idl new file mode 100644 index 00000000000..9f0740cb97f --- /dev/null +++ b/CIAO/connectors/ami4ccm/tests/InterReturn/Receiver/InterReturnT_Receiver.idl @@ -0,0 +1,18 @@ +// $Id$ + +#ifndef INTERRETURN_T_RECEIVER_IDL +#define INTERRETURN_T_RECEIVER_IDL + +#include <Components.idl> + +#include "Base/InterReturnT.idl" + +module InterReturnT +{ + component Receiver + { + /// Provides + provides MyFoo do_my_foo; + }; +}; +#endif diff --git a/CIAO/connectors/ami4ccm/tests/InterReturn/Receiver/InterReturnT_Receiver.mpc b/CIAO/connectors/ami4ccm/tests/InterReturn/Receiver/InterReturnT_Receiver.mpc new file mode 100644 index 00000000000..8c762392b25 --- /dev/null +++ b/CIAO/connectors/ami4ccm/tests/InterReturn/Receiver/InterReturnT_Receiver.mpc @@ -0,0 +1,134 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -p InterReturnT_Base InterReturnT_Receiver" + +project(AMI_ReturnT_Base_Receiver_idl_gen) : componentidldefaults { + custom_only = 1 + after += AMI_InterReturnT_idl_gen + idlflags += -Wb,stub_export_macro=INTERRETURN_T_RECEIVER_STUB_Export \ + -Wb,stub_export_include=InterReturnT_Receiver_stub_export.h \ + -Wb,skel_export_macro=INTERRETURN_T_RECEIVER_SVNT_Export \ + -Wb,skel_export_include=InterReturnT_Receiver_svnt_export.h \ + -Wb,exec_export_macro=INTERRETURN_T_RECEIVER_EXEC_Export \ + -Wb,exec_export_include=InterReturnT_Receiver_exec_export.h \ + -Glem -I.. + + IDL_Files { + InterReturnT_Receiver.idl + } +} + +project(AMI_ReturnT_Base_Receiver_lem_gen) : ciaoidldefaults { + after += AMI_ReturnT_Base_Receiver_idl_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=INTERRETURN_T_RECEIVER_LEM_STUB_Export \ + -Wb,stub_export_include=InterReturnT_Receiver_lem_stub_export.h \ + -SS -Gxhst -I.. + + IDL_Files { + InterReturnT_ReceiverE.idl + } +} + +project(AMI_ReturnT_Base_Receiver_l_stub) : ccm_svnt, messaging { + after += AMI_ReturnT_Base_Receiver_lem_gen AMI_InterReturnT_Base_Receiver_stub AMI_InterReturnT_stub + libs += InterReturnT_stub InterReturnT_Receiver_stub + libpaths += ../lib + libout = ../lib + sharedname = InterReturnT_Receiver_lem_stub + dynamicflags = INTERRETURN_T_RECEIVER_LEM_STUB_BUILD_DLL + includes += .. + IDL_Files { + } + + Source_Files { + InterReturnT_ReceiverEC.cpp + } + + Header_Files { + InterReturnT_ReceiverEC.h + InterReturnT_Receiver_lem_stub_export.h + } + + Inline_Files { + InterReturnT_ReceiverEC.inl + } +} + +project(AMI_InterReturnT_Base_Receiver_stub) : ccm_stub, messaging { + after += AMI_ReturnT_Base_Receiver_idl_gen AMI_InterReturnT_stub + libs += InterReturnT_stub + libpaths += ../lib + libout = ../lib + sharedname = InterReturnT_Receiver_stub + dynamicflags = INTERRETURN_T_RECEIVER_STUB_BUILD_DLL + includes += .. + IDL_Files { + } + + Source_Files { + InterReturnT_ReceiverC.cpp + } + + Header_Files { + InterReturnT_ReceiverC.h + InterReturnT_Receiver_stub_export.h + } + + Inline_Files { + InterReturnT_ReceiverC.inl + } +} + +project(AMI_InterReturnT_Base_Receiver_exec) : ciao_executor, messaging { + after += AMI_ReturnT_Base_Receiver_l_stub AMI_InterReturnT_Base_Receiver_stub AMI_InterReturnT_stub AMI_InterReturnT_lem_stub + sharedname = InterReturnT_Receiver_exec + libs += InterReturnT_Receiver_stub InterReturnT_Receiver_lem_stub InterReturnT_stub InterReturnT_lem_stub + libpaths += ../lib + libout = ../lib + dynamicflags = INTERRETURN_T_RECEIVER_EXEC_BUILD_DLL + includes += .. + IDL_Files { + } + + Source_Files { + InterReturnT_Receiver_exec.cpp + } + + Header_Files { + InterReturnT_Receiver_exec.h + InterReturnT_Receiver_exec_export.h + } + + Inline_Files { + } +} + +project(AMI_InterReturnT_Base_Receiver_svnt) : ciao_servant, messaging { + after += AMI_InterReturnT_Base_skel AMI_ReturnT_Base_Receiver_l_stub AMI_InterReturnT_stub AMI_InterReturnT_skel AMI_InterReturnT_lem_stub + sharedname = InterReturnT_Receiver_svnt + libs += InterReturnT_Receiver_stub InterReturnT_Receiver_lem_stub \ + InterReturnT_skel \ + InterReturnT_stub InterReturnT_lem_stub + libpaths += ../lib + libout = ../lib + dynamicflags = INTERRETURN_T_RECEIVER_SVNT_BUILD_DLL + includes += .. + IDL_Files { + } + + Source_Files { + InterReturnT_ReceiverS.cpp + InterReturnT_Receiver_svnt.cpp + } + + Header_Files { + InterReturnT_ReceiverS.h + InterReturnT_Receiver_svnt.h + InterReturnT_Receiver_svnt_export.h + } + + Inline_Files { + InterReturnT_ReceiverS.inl + } +} + diff --git a/CIAO/connectors/ami4ccm/tests/InterReturn/Receiver/InterReturnT_Receiver_exec.cpp b/CIAO/connectors/ami4ccm/tests/InterReturn/Receiver/InterReturnT_Receiver_exec.cpp new file mode 100644 index 00000000000..1bee4680ab5 --- /dev/null +++ b/CIAO/connectors/ami4ccm/tests/InterReturn/Receiver/InterReturnT_Receiver_exec.cpp @@ -0,0 +1,160 @@ +// -*- C++ -*- +// $Id$ + +#include "InterReturnT_Receiver_exec.h" +#include "ace/OS_NS_unistd.h" + +namespace CIAO_InterReturnT_Receiver_Impl +{ + MyFoo_exec_i::MyFoo_exec_i (void) + { + } + + MyFoo_exec_i::~MyFoo_exec_i (void) + { + } + + void MyFoo_exec_i::ret_void (const char * /*in_str*/, + ::CORBA::String_out answer, + ::CORBA::Long_out l_cmd ) + { + answer = CORBA::string_dup ("This is my answer from ret_void"); + l_cmd = 1; + }; + + CORBA::Long MyFoo_exec_i::ret_long (const char * /*in_str*/, + ::CORBA::String_out answer, + ::CORBA::Long_out l_cmd) + { + answer = CORBA::string_dup ("This is my answer from ret_long"); + l_cmd = 2; + return 200; + }; + + CORBA::Double MyFoo_exec_i::ret_double (const char * /*in_str*/, + ::CORBA::String_out answer, + ::CORBA::Long_out l_cmd) + { + answer = CORBA::string_dup ("This is my answer from ret_double"); + l_cmd = 3; + return 3.14; + }; + + InterReturnT::TestStruct * MyFoo_exec_i::ret_struct (const char * /*in_str*/, + ::CORBA::String_out answer, + ::CORBA::Long_out l_cmd) + { + answer = CORBA::string_dup ("This is my answer from ret_struct"); + l_cmd = 4; + InterReturnT::TestStruct *test_struct = new InterReturnT::TestStruct(); + test_struct->key = CORBA::string_dup("aaa"); + test_struct->x = 10; + return test_struct; + }; + + InterReturnT::TestArray_slice * MyFoo_exec_i::ret_array ( + const char * /*in_str*/, + ::CORBA::String_out answer, + ::CORBA::Long_out l_cmd) + { + answer = CORBA::string_dup ("This is my answer from ret_array"); + l_cmd = 5; + InterReturnT::TestArray test_array; + for ( CORBA::UShort i = 0; i < 5; i ++) + { + test_array[i].key = CORBA::string_dup("bbb"); + for (CORBA::UShort y = 0; y < 5; y ++) + { + test_array[i].x_array[y] = i * 100 + y ; + } + } + return InterReturnT::TestArray_dup(test_array); + }; + + InterReturnT::TestSeq * MyFoo_exec_i::ret_seq (const char * /*in_str*/, + ::CORBA::String_out, + ::CORBA::Long_out l_cmd) + { + l_cmd = 6; + InterReturnT::test ttt; + ttt.x_test = 12; + ttt.x_teststr = CORBA::string_dup("ccc"); + InterReturnT::TestSeq *seq = new InterReturnT::TestSeq(); + seq->length(2); + (*seq)[0]= ttt; + ttt.x_teststr = CORBA::string_dup("ddd"); + (*seq)[1]= ttt; + return seq; + }; + + InterReturnT::X_Union *MyFoo_exec_i::ret_union (const char * /*in_str*/, + ::CORBA::String_out answer, + ::CORBA::Long_out l_cmd) + { + answer = CORBA::string_dup ("This is my answer from ret_union"); + l_cmd = 7; + InterReturnT::X_Union *x_uni = new InterReturnT::X_Union(); + x_uni->x_long(11); + return x_uni; + }; + + Receiver_exec_i::Receiver_exec_i (void) + { + } + + Receiver_exec_i::~Receiver_exec_i (void) + { + } + + ::InterReturnT::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_ = ::InterReturnT::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_InterReturnT_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/InterReturn/Receiver/InterReturnT_Receiver_exec.h b/CIAO/connectors/ami4ccm/tests/InterReturn/Receiver/InterReturnT_Receiver_exec.h new file mode 100644 index 00000000000..34b9546bb06 --- /dev/null +++ b/CIAO/connectors/ami4ccm/tests/InterReturn/Receiver/InterReturnT_Receiver_exec.h @@ -0,0 +1,74 @@ +// -*- C++ -*- +// $Id$ + +#ifndef CIAO_INTERRETURN_T_RECEIVER_EXEC_H_ +#define CIAO_INTERRETURN_T_RECEIVER_EXEC_H_ + +#include "InterReturnT_ReceiverEC.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/LocalObject.h" +#include "InterReturnT_Receiver_exec_export.h" + +namespace CIAO_InterReturnT_Receiver_Impl +{ + class MyFoo_exec_i + : public virtual ::InterReturnT::CCM_MyFoo, + public virtual ::CORBA::LocalObject + { + public: + MyFoo_exec_i (void); + virtual ~MyFoo_exec_i (void); + virtual void ret_void (const char * in_str, + ::CORBA::String_out answer, + ::CORBA::Long_out l_cmd ); + virtual CORBA::Long ret_long (const char * in_str, + ::CORBA::String_out answer, + ::CORBA::Long_out l_cmd); + virtual CORBA::Double ret_double (const char * in_str, + ::CORBA::String_out answer, + ::CORBA::Long_out l_cmd); + virtual InterReturnT::TestStruct *ret_struct ( const char * in_str, + ::CORBA::String_out answer, + ::CORBA::Long_out l_cmd); + virtual InterReturnT::TestArray_slice *ret_array (const char * in_str, + ::CORBA::String_out answer, + ::CORBA::Long_out l_cmd); + virtual InterReturnT::TestSeq *ret_seq (const char * in_str, + ::CORBA::String_out, + ::CORBA::Long_out l_cmd); + virtual InterReturnT::X_Union *ret_union (const char * in_str, + ::CORBA::String_out, + ::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 ::InterReturnT::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: + ::InterReturnT::CCM_Receiver_Context_var context_; + }; + + extern "C" INTERRETURN_T_RECEIVER_EXEC_Export ::Components::EnterpriseComponent_ptr + create_InterReturnT_AMI_Receiver_Impl (void); +} + +#endif /* ifndef */ diff --git a/CIAO/connectors/ami4ccm/tests/InterReturn/Sender/InterReturnT_Sender.idl b/CIAO/connectors/ami4ccm/tests/InterReturn/Sender/InterReturnT_Sender.idl new file mode 100644 index 00000000000..a47f82627b8 --- /dev/null +++ b/CIAO/connectors/ami4ccm/tests/InterReturn/Sender/InterReturnT_Sender.idl @@ -0,0 +1,21 @@ +// $Id$ + +#ifndef INTERRETURN_T_SENDER_IDL +#define INTERRETURN_T_SENDER_IDL + +#include <Components.idl> + +#include "Base/InterReturnT.idl" + +#pragma ciao ami4ccm receptacle "InterReturnT::Sender::run_my_foo" + +module InterReturnT +{ + component Sender + { + /// For synchronous invocation + uses MyFoo run_my_foo; + }; +}; + +#endif diff --git a/CIAO/connectors/ami4ccm/tests/InterReturn/Sender/InterReturnT_Sender.mpc b/CIAO/connectors/ami4ccm/tests/InterReturn/Sender/InterReturnT_Sender.mpc new file mode 100644 index 00000000000..4e9d59cf158 --- /dev/null +++ b/CIAO/connectors/ami4ccm/tests/InterReturn/Sender/InterReturnT_Sender.mpc @@ -0,0 +1,135 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -p InterReturnT_Base InterReturnT_Sender" + +project(AMI_InterReturnT_Base_Sender_idl_gen) : componentidldefaults { + after += Conn_InterReturnT_Base_idl_gen AMI_InterReturnT_idl_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=INTERRETURN_T_SENDER_STUB_Export \ + -Wb,stub_export_include=InterReturnT_Sender_stub_export.h \ + -Wb,skel_export_macro=INTERRETURN_T_SENDER_SVNT_Export \ + -Wb,skel_export_include=InterReturnT_Sender_svnt_export.h \ + -Wb,exec_export_macro=INTERRETURN_T_SENDER_EXEC_Export \ + -Wb,exec_export_include=InterReturnT_Sender_exec_export.h \ + -I.. -GM + + IDL_Files { + InterReturnT_Sender.idl + } +} + +project(AMI_InterReturnT_Base_Sender_lem_gen) : ciaoidldefaults { + after += AMI_InterReturnT_Base_Sender_idl_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=INTERRETURN_T_SENDER_LEM_STUB_Export \ + -Wb,stub_export_include=InterReturnT_Sender_lem_stub_export.h \ + -SS -Gxhst -I.. + + IDL_Files { + InterReturnT_SenderE.idl + } +} + +project(AMI_ReturnT_Base_Sender_lem_stub) : ccm_svnt, ami { + after += AMI_InterReturnT_Base_Sender_lem_gen AMI_InterReturnT_stub Conn_InterReturnT_Base_stub + libs += InterReturnT_stub + libpaths += ../lib + libout = ../lib + sharedname = InterReturnT_Sender_lem_stub + dynamicflags = INTERRETURN_T_SENDER_LEM_STUB_BUILD_DLL + includes += .. + IDL_Files { + } + + Source_Files { + InterReturnT_SenderEC.cpp + } + + Header_Files { + InterReturnT_SenderEC.h + InterReturnT_Sender_lem_stub_export.h + } + + Inline_Files { + InterReturnT_SenderEC.inl + } +} + +project(AMI_InterReturnT_Base_Sender_stub) : ccm_stub, ami { + after += AMI_InterReturnT_Base_Sender_idl_gen AMI_InterReturnT_Base_stub AMI_InterReturnT_stub Conn_InterReturnT_Base_stub + libs += InterReturnT_stub + libpaths += ../lib + libout = ../lib + sharedname = InterReturnT_Sender_stub + dynamicflags = INTERRETURN_T_SENDER_STUB_BUILD_DLL + includes += .. + IDL_Files { + } + + Source_Files { + InterReturnT_SenderC.cpp + } + + Header_Files { + InterReturnT_SenderC.h + InterReturnT_Sender_stub_export.h + } + + Inline_Files { + InterReturnT_SenderC.inl + } +} + +project(AMI_InterReturnT_Base_Sender_exec) : ciao_executor, ami, ami4ccm_stub { + after += AMI_ReturnT_Base_Sender_lem_stub AMI_InterReturnT_Base_Sender_stub AMI_InterReturnT_Base_exec Conn_InterReturnT_Base_stub AMI_InterReturnT_lem_stub + sharedname = InterReturnT_Sender_exec + libs += InterReturnT_Sender_stub InterReturnT_Sender_lem_stub InterReturnT_stub InterReturnT_stub InterReturnT_lem_stub + libpaths += ../lib + libout = ../lib + dynamicflags = INTERRETURN_T_SENDER_EXEC_BUILD_DLL + includes += .. + IDL_Files { + } + + Source_Files { + InterReturnT_Sender_exec.cpp + } + + Header_Files { + InterReturnT_Sender_exec.h + InterReturnT_Sender_exec_export.h + } + + Inline_Files { + } +} + +project(AMI_InterReturnT_Base_Sender_svnt) : ciao_servant, ami { + after += AMI_InterReturnT_Base_skel AMI_ReturnT_Base_Sender_lem_stub AMI_InterReturnT_Base_exec AMI_InterReturnT_skel + sharedname = InterReturnT_Sender_svnt + libs += InterReturnT_Sender_stub InterReturnT_Sender_lem_stub \ + InterReturnT_skel \ + InterReturnT_stub + libpaths += ../lib + libout = ../lib + dynamicflags = INTERRETURN_T_SENDER_SVNT_BUILD_DLL + includes += .. + IDL_Files { + } + + Source_Files { + InterReturnT_SenderS.cpp + InterReturnT_Sender_svnt.cpp + } + + Header_Files { + InterReturnT_SenderS.h + InterReturnT_Sender_svnt.h + InterReturnT_Sender_svnt_export.h + } + + Inline_Files { + InterReturnT_SenderS.inl + } +} + + diff --git a/CIAO/connectors/ami4ccm/tests/InterReturn/Sender/InterReturnT_Sender_exec.cpp b/CIAO/connectors/ami4ccm/tests/InterReturn/Sender/InterReturnT_Sender_exec.cpp new file mode 100644 index 00000000000..9582a4e7ab0 --- /dev/null +++ b/CIAO/connectors/ami4ccm/tests/InterReturn/Sender/InterReturnT_Sender_exec.cpp @@ -0,0 +1,385 @@ +// -*- C++ -*- +// $Id$ + +// test of different return values +#include "InterReturnT_Sender_exec.h" +#include "ace/OS_NS_unistd.h" + +namespace CIAO_InterReturnT_Sender_Impl +{ + CORBA::Short nr_of_received = 0; + + //============================================================ + // 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::ret_void (const char * answer, CORBA::Long l_cmd) + { + if (l_cmd != 1) + { + ACE_ERROR ((LM_ERROR, "ERROR MyFoo_callback_exec_i::ret_void: " + "received the wrong long, expected 1," + " received %lu\n", + l_cmd)); + } + else + { + ++nr_of_received; + } + }; + + void + MyFoo_callback_exec_i::ret_void_excep ( + ::CCM_AMI::ExceptionHolder_ptr excep_holder) + { + excep_holder->raise_exception (); + } + + void + MyFoo_callback_exec_i::ret_long (::CORBA::Long ami_return_val, + const char * answer, CORBA::Long l_cmd) + { + if ((l_cmd != 2) || (ami_return_val != 200)) + { + ACE_ERROR ((LM_ERROR, "ERROR MyFoo_callback_exec_i::ret_long: " + "received the wrong longs, expected 2 and 200," + " received %lu and %lu\n", + l_cmd, ami_return_val)); + } + else + { + ++nr_of_received; + } + }; + + void + MyFoo_callback_exec_i::ret_long_excep ( + ::CCM_AMI::ExceptionHolder_ptr excep_holder) + { + excep_holder->raise_exception (); + }; + + void + MyFoo_callback_exec_i::ret_double (::CORBA::Double ami_return_val, + const char * answer, CORBA::Long l_cmd) + { + if ((l_cmd != 3) || (ami_return_val != 3.14)) + { + ACE_ERROR ((LM_ERROR, "ERROR MyFoo_callback_exec_i::ret_double: " + "received the wrong returns, expected 3 " + "and 3.14,received %u and %2.2f\n", + l_cmd, ami_return_val)); + } + else + { + ++nr_of_received; + } + }; + + void + MyFoo_callback_exec_i::ret_double_excep ( + ::CCM_AMI::ExceptionHolder_ptr excep_holder) + { + excep_holder->raise_exception (); + }; + + void + MyFoo_callback_exec_i::ret_struct ( + const InterReturnT::TestStruct &ami_return_val, + const char * answer, CORBA::Long l_cmd) + { + if (l_cmd != 4) + { + ACE_ERROR ((LM_ERROR, "ERROR MyFoo_callback_exec_i::ret_struct: " + "received the wrong long, expected 4," + " received %u\n", + l_cmd)); + } + else if ((ACE_OS::strcmp (ami_return_val.key.in(), "aaa") != 0) || + (ami_return_val.x != 10)) + { + ACE_ERROR ((LM_ERROR, "ERROR MyFoo_callback_exec_i::ret_struct: " + "received the struct return, expected 'aaa' " + "and 10, received %C and %u\n", + ami_return_val.key.in(), ami_return_val.x)); + } + else + { + ++nr_of_received; + } + }; + + void + MyFoo_callback_exec_i::ret_struct_excep ( + ::CCM_AMI::ExceptionHolder_ptr excep_holder) + { + excep_holder->raise_exception (); + }; + + void + MyFoo_callback_exec_i::ret_array ( + const InterReturnT::TestArr ami_return_val[], + const char * answer, CORBA::Long l_cmd) + { + if ((l_cmd != 5) || (ami_return_val[1].x_array[2] != 102)) + { + ACE_ERROR ((LM_ERROR, "ERROR MyFoo_callback_exec_i::ret_array: " + "received the wrong long or array, expected 5 " + "and 102,received %u and %u\n", + l_cmd, ami_return_val[1].x_array[2])); + } + else + { + ++nr_of_received; + } + }; + + void + MyFoo_callback_exec_i::ret_array_excep ( + ::CCM_AMI::ExceptionHolder_ptr excep_holder) + { + excep_holder->raise_exception (); + }; + + void + MyFoo_callback_exec_i::ret_seq (const InterReturnT::TestSeq &ami_return_val, + const char * answer, CORBA::Long l_cmd) + { + if (l_cmd != 6) + { + ACE_ERROR ((LM_ERROR, "ERROR MyFoo_callback_exec_i::ret_seq: " + "received the wrong long, expected 6," + " received %lu\n", + l_cmd)); + } + else if ((ACE_OS::strcmp (ami_return_val[0].x_teststr, "ccc") != 0) || + (ami_return_val[1].x_test != 12)) + { + ACE_ERROR ((LM_ERROR, "ERROR MyFoo_callback_exec_i::ret_seq: " + "didn't receive the expected sequence," + " received %C and %lu\n", + ami_return_val[0].x_teststr.in(), + ami_return_val[1].x_test)); + } + else + { + ++nr_of_received; + } + }; + + void + MyFoo_callback_exec_i::ret_seq_excep ( + ::CCM_AMI::ExceptionHolder_ptr excep_holder) + { + excep_holder->raise_exception (); + }; + + void + MyFoo_callback_exec_i::ret_union ( + const InterReturnT::X_Union &ami_return_val, + const char * answer, CORBA::Long l_cmd) + { + if ((l_cmd != 7) || (ami_return_val.x_long() != 11)) + { + ACE_ERROR ((LM_ERROR, "ERROR MyFoo_callback_exec_i::ret_union: " + "received the wrong long or union, expected 7" + " and 11, received %u and %u\n", + l_cmd, ami_return_val.x_long())); + } + else + { + ++nr_of_received; + } + }; + + void + MyFoo_callback_exec_i::ret_union_excep ( + ::CCM_AMI::ExceptionHolder_ptr excep_holder) + { + excep_holder->raise_exception (); + }; + + //============================================================ + // Worker thread for asynchronous invocations for MyFoo + //============================================================ + asynch_foo_generator::asynch_foo_generator ( + ::InterReturnT::AMI4CCM_MyFoo_ptr my_foo_ami) + : my_foo_ami_ (::InterReturnT::AMI4CCM_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 + my_foo_ami_->sendc_ret_void (new MyFoo_callback_exec_i (), "Send me a void." ); + my_foo_ami_->sendc_ret_long (new MyFoo_callback_exec_i (),"Send me a long."); + my_foo_ami_->sendc_ret_double (new MyFoo_callback_exec_i (),"Send me a double."); + my_foo_ami_->sendc_ret_struct (new MyFoo_callback_exec_i (), "Send me a struct."); + my_foo_ami_->sendc_ret_array (new MyFoo_callback_exec_i (),"Send me an array."); + my_foo_ami_->sendc_ret_seq (new MyFoo_callback_exec_i (),"Send me a sequence."); + my_foo_ami_->sendc_ret_union (new MyFoo_callback_exec_i (),"Send me a union."); + } + return 0; + } + + //============================================================ + // Worker thread for synchronous invocations for MyFoo + //============================================================ + synch_foo_generator::synch_foo_generator ( + ::InterReturnT::MyFoo_ptr my_foo_ami) + : my_foo_ami_ (::InterReturnT::MyFoo::_duplicate (my_foo_ami)) + { + } + + int synch_foo_generator::svc () + { + ACE_OS::sleep (3); + //run some synch calls + InterReturnT::TestStruct_var test_topic = 0; + InterReturnT::TestArray_var topic_arr = 0; + CORBA::Double d_cmd = 0; + CORBA::Long l_cmd = 0; + char * out_str = 0; + try + { + CORBA::Double ret = + my_foo_ami_->ret_double ("Send me synch double",out_str, l_cmd); + if ( (ret == 3.14 ) && (l_cmd == 3)) + { + ++nr_of_received; + } + } + catch (const InterReturnT::InternalError&) + { + ACE_ERROR ((LM_ERROR, "ERROR: synch_foo_generator::ret_double: " + "Unexpected exception.\n")); + } + try + { + InterReturnT::TestArray_slice *arr = + my_foo_ami_->ret_array ("Send me synch array",out_str, l_cmd); + arr++; + if ((l_cmd != 5) || (arr->x_array[2] != 102)) + { + ACE_ERROR ((LM_ERROR, "ERROR MyFoo synchroon ret_array: " + "received the wrong long or array, expected 5 " + "and 102, received %u and %u\n", + l_cmd, arr->x_array[2])); + } + else + { + ++nr_of_received; + } + } + + catch (const InterReturnT::InternalError&) + { + ACE_ERROR ((LM_ERROR, "ERROR: synch_foo_generator::ret_array: " + "Unexpected exception.\n")); + } + 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_ = + ::InterReturnT::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) + { + ::InterReturnT::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); + + ::InterReturnT::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_received == 9) + { + ACE_DEBUG ((LM_DEBUG, "OK: Received all expected data" + " for syn- and asynchronous calls\n")); + } + else + { + ACE_ERROR ((LM_ERROR, "ERROR: Received not all expected data" + " for syn- and asynchronous calls\n")); + } + } + + extern "C" ::Components::EnterpriseComponent_ptr + create_InterReturnT_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/InterReturn/Sender/InterReturnT_Sender_exec.h b/CIAO/connectors/ami4ccm/tests/InterReturn/Sender/InterReturnT_Sender_exec.h new file mode 100644 index 00000000000..b28c35cc209 --- /dev/null +++ b/CIAO/connectors/ami4ccm/tests/InterReturn/Sender/InterReturnT_Sender_exec.h @@ -0,0 +1,114 @@ +// -*- C++ -*- +// +// $Id$ + +#ifndef CIAO_INTERRETURN_T_SENDER_EXEC_H_ +#define CIAO_INTERRETURN_T_SENDER_EXEC_H_ + +#include "InterReturnT_SenderEC.h" +#include "InterReturnT_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_InterReturnT_Sender_Impl +{ + /// Worker thread for asynchronous invocations + class asynch_foo_generator : public virtual ACE_Task_Base + { + public: + asynch_foo_generator (::InterReturnT::AMI4CCM_MyFoo_ptr my_foo_ami); + + virtual int svc (void); + + private: + ::InterReturnT::AMI4CCM_MyFoo_var my_foo_ami_; + }; + + /// Worker thread for synchronous invocations + class synch_foo_generator : public virtual ACE_Task_Base + { + public: + synch_foo_generator (::InterReturnT::MyFoo_ptr my_foo_ami); + + virtual int svc (void); + + private: + ::InterReturnT::MyFoo_var my_foo_ami_; + }; + + class MyFoo_callback_exec_i + : public virtual ::InterReturnT::CCM_AMI4CCM_MyFooReplyHandler, + public virtual ::CORBA::LocalObject + { + public: + MyFoo_callback_exec_i (void); + virtual ~MyFoo_callback_exec_i (void); + + virtual void ret_void (const char * answer, CORBA::Long l_cmd); + virtual void ret_void_excep ( + ::CCM_AMI::ExceptionHolder_ptr excep_holder); + + virtual void ret_long (::CORBA::Long ami_return_val, + const char * answer, CORBA::Long l_cmd); + virtual void ret_long_excep ( + ::CCM_AMI::ExceptionHolder_ptr excep_holder); + + virtual void ret_double (::CORBA::Double ami_return_val, + const char * answer, CORBA::Long l_cmd); + virtual void ret_double_excep ( + ::CCM_AMI::ExceptionHolder_ptr excep_holder); + + virtual void ret_struct (const InterReturnT::TestStruct &ami_return_val, + const char * answer, CORBA::Long l_cmd); + virtual void ret_struct_excep ( + ::CCM_AMI::ExceptionHolder_ptr excep_holder); + + virtual void ret_array (const InterReturnT::TestArr ami_return_val[], + const char * answer, CORBA::Long l_cmd); + virtual void ret_array_excep ( + ::CCM_AMI::ExceptionHolder_ptr excep_holder); + + virtual void ret_seq (const InterReturnT::TestSeq &ami_return_val, + const char * answer, CORBA::Long l_cmd); + virtual void ret_seq_excep ( + ::CCM_AMI::ExceptionHolder_ptr excep_holder); + + virtual void ret_union (const InterReturnT::X_Union &ami_return_val, + const char * answer, CORBA::Long l_cmd); + virtual void ret_union_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: + ::InterReturnT::CCM_Sender_Context_var context_; + MyFoo_callback_exec_i* global_foo_callback_; + }; + + extern "C" INTERRETURN_T_SENDER_EXEC_Export ::Components::EnterpriseComponent_ptr + create_InterReturnT_AMI_Sender_Impl (void); +} + +#endif /* ifndef */ diff --git a/CIAO/connectors/ami4ccm/tests/InterReturn/descriptors/Plan.cdp b/CIAO/connectors/ami4ccm/tests/InterReturn/descriptors/Plan.cdp new file mode 100644 index 00000000000..50bb6f8a1b9 --- /dev/null +++ b/CIAO/connectors/ami4ccm/tests/InterReturn/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="InterReturnT_ReceiverHomeImplementation"> + <name>InterReturnT_ReceiverHomeImplementation</name> + <source/> + <artifact xmi:idref="InterReturnT_Receiver_ExecArtifact"/> + <artifact xmi:idref="InterReturnT_Receiver_SvntArtifact"/> + <execParameter> + <name>component factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_InterReturnT_AMI_Receiver_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>InterReturnT.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_InterReturnT_Receiver_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>InterReturnT.ImplementationArtifacts.ReceiverArtifacts.Receiver_svnt</string> + </value> + </value> + </execParameter> + </implementation> + + <implementation xmi:id="InterReturnT_SenderHomeImplementation"> + <name>InterReturnT_SenderHomeImplementation</name> + <source/> + <artifact xmi:idref="InterReturnT_Sender_ExecArtifact"/> + <artifact xmi:idref="InterReturnT_Sender_SvntArtifact"/> + <execParameter> + <name>component factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_InterReturnT_AMI_Sender_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>InterReturnT.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_InterReturnT_Sender_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>InterReturnT.ImplementationArtifacts.SenderArtifacts.Sender_svnt</string> + </value> + </value> + </execParameter> + </implementation> + + <implementation xmi:id="InterReturnT_AMIHomeImplementation"> + <name>InterReturnT_AMIHomeImplementation</name> + <source/> + <artifact xmi:idref="InterReturnT_AMI_ExecArtifact"/> + <artifact xmi:idref="InterReturnT_AMI_SvntArtifact"/> + <execParameter> + <name>component factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_InterReturnT_AMI4CCM_MyFoo_Connector_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>InterReturnT.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_InterReturnT_AMI4CCM_MyFoo_Connector_AMI4CCM_Connector_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>InterReturnT.ImplementationArtifacts.AMIArtifacts.AMI_svnt</string> + </value> + </value> + </execParameter> + </implementation> + + <instance xmi:id="InterReturnT.ComponentImplementations.InterReturnTImplementation.InterReturnT.Receiver"> + <name>InterReturnT.ComponentImplementations.InterReturnTImplementation.InterReturnT.Receiver</name> + <node>Receiver</node> + <source/> + <implementation xmi:idref="InterReturnT_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="InterReturnT.ComponentImplementations.InterReturnTImplementation.InterReturnT.Sender"> + <name>InterReturnT.ComponentImplementations.InterReturnTImplementation.InterReturnT.Sender</name> + <node>Sender</node> + <source/> + <implementation xmi:idref="InterReturnT_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="InterReturnT.ComponentImplementations.InterReturnTImplementation.InterReturnT.AMI"> + <name>InterReturnT.ComponentImplementations.InterReturnTImplementation.InterReturnT.AMI</name> + <node>Sender</node> + <source/> + <implementation xmi:idref="InterReturnT_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="InterReturnT.ComponentImplementations.InterReturnTImplementation.InterReturnT.Sender" /> + </internalEndpoint> + <internalEndpoint> + <portName>ami4ccm_port_ami4ccm_provides</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="InterReturnT.ComponentImplementations.InterReturnTImplementation.InterReturnT.AMI" /> + </internalEndpoint> + </connection> + + <connection> + <name>do_foo_connection</name> + <internalEndpoint> + <portName>do_my_foo</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="InterReturnT.ComponentImplementations.InterReturnTImplementation.InterReturnT.Receiver" /> + </internalEndpoint> + <internalEndpoint> + <portName>ami4ccm_port_ami4ccm_uses</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="InterReturnT.ComponentImplementations.InterReturnTImplementation.InterReturnT.AMI" /> + </internalEndpoint> + </connection> + + <connection> + <name>synch_foo_connection</name> + <internalEndpoint> + <portName>do_my_foo</portName> + <provider>true</provider> + <kind>Facet</kind> + <instance xmi:idref="InterReturnT.ComponentImplementations.InterReturnTImplementation.InterReturnT.Receiver" /> + </internalEndpoint> + <internalEndpoint> + <portName>run_my_foo</portName> + <provider>false</provider> + <kind>SimplexReceptacle</kind> + <instance xmi:idref="InterReturnT.ComponentImplementations.InterReturnTImplementation.InterReturnT.Sender" /> + </internalEndpoint> + </connection> + + <artifact xmi:id="InterReturnT_AMI_SvntArtifact"> + <name>InterReturnT.ImplementationArtifacts.AMIArtifacts.AMI_svnt</name> + <source/> + <node/> + <location>InterReturnT_svnt</location> + <execParameter> + <name>entryPoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_InterReturnT_AMI4CCM_MyFoo_Connector_AMI4CCM_Connector_Servant</string> + </value> + </value> + </execParameter> + </artifact> + + <artifact xmi:id="InterReturnT_AMI_ExecArtifact"> + <name>InterReturnT.ImplementationArtifacts.AMIArtifacts.AMI_exec</name> + <source/> + <node/> + <location>InterReturnT_conn</location> + <execParameter> + <name>entryPoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_InterReturnT_AMI4CCM_MyFoo_Connector_Impl</string> + </value> + </value> + </execParameter> + </artifact> + + <artifact xmi:id="InterReturnT_Receiver_SvntArtifact"> + <name>InterReturnT.ImplementationArtifacts.ReceiverArtifacts.Receiver_svnt</name> + <source/> + <node/> + <location>InterReturnT_Receiver_svnt</location> + <execParameter> + <name>entryPoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_InterReturnT_AMI_ReceiverHome_Servant</string> + </value> + </value> + </execParameter> + </artifact> + + <artifact xmi:id="InterReturnT_Receiver_ExecArtifact"> + <name>InterReturnT.ImplementationArtifacts.ReceiverArtifacts.Receiver_exec</name> + <source/> + <node/> + <location>InterReturnT_Receiver_exec</location> + <execParameter> + <name>entryPoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_InterReturnT_AMI_ReceiverHome_Impl</string> + </value> + </value> + </execParameter> + </artifact> + + <artifact xmi:id="InterReturnT_Sender_SvntArtifact"> + <name>InterReturnT.ImplementationArtifacts.SenderArtifacts.Sender_svnt</name> + <source/> + <node/> + <location>InterReturnT_Sender_svnt</location> + <execParameter> + <name>entryPoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_InterReturnT_AMI_SenderHome_Servant</string> + </value> + </value> + </execParameter> + </artifact> + + <artifact xmi:id="InterReturnT_Sender_ExecArtifact"> + <name>InterReturnT.ImplementationArtifacts.SenderArtifacts.Sender_exec</name> + <source/> + <node/> + <location>InterReturnT_Sender_exec</location> + <execParameter> + <name>entryPoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_InterReturnT_AMI_SenderHome_Impl</string> + </value> + </value> + </execParameter> + </artifact> + +</Deployment:DeploymentPlan> diff --git a/CIAO/connectors/ami4ccm/tests/InterReturn/descriptors/run_test.pl b/CIAO/connectors/ami4ccm/tests/InterReturn/descriptors/run_test.pl new file mode 100644 index 00000000000..2153984dbdd --- /dev/null +++ b/CIAO/connectors/ami4ccm/tests/InterReturn/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 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; |