diff options
author | msmit <msmit@remedy.nl> | 2009-11-12 15:25:04 +0000 |
---|---|---|
committer | msmit <msmit@remedy.nl> | 2009-11-12 15:25:04 +0000 |
commit | d0702f5a5231168104917d1691dc2ad1821ddd2c (patch) | |
tree | bcbb2faf80ce8301ba6100fd6fc2a60cb94123b8 /CIAO/tests | |
parent | fa7d706f03de0bc849974716909ad52c7fa0b64d (diff) | |
download | ATCD-d0702f5a5231168104917d1691dc2ad1821ddd2c.tar.gz |
Thu Nov 12 15:23:43 UTC 2009 Marcel Smit <msmit@remedy.nl>
* bin/ciao_tests.lst:
Added Double_Inherited_Component test.
* connectors/dds4ccm/examples/Hello/Receiver/Hello_Receiver.idl:
* connectors/dds4ccm/examples/Hello/Receiver/Hello_Receiver_exec.h:
* connectors/dds4ccm/examples/Hello/Receiver/Hello_Receiver_exec.cpp:
Added ConnectorStatusListener.
* tests/IDL_Test/Double_Inherited_Component:
* tests/IDL_Test/Double_Inherited_Component/ComponentC.cdp:
* tests/IDL_Test/Double_Inherited_Component/ComponentC_exec.h:
* tests/IDL_Test/Double_Inherited_Component/ComponentC_exec.cpp:
* tests/IDL_Test/Double_Inherited_Component/Inherited_components.idl:
* tests/IDL_Test/Double_Inherited_Component/Inherited_components.mpc:
* tests/IDL_Test/Double_Inherited_Component/run_test.pl:
Test to test setting an attribute on a parent component.
Diffstat (limited to 'CIAO/tests')
6 files changed, 626 insertions, 0 deletions
diff --git a/CIAO/tests/IDL_Test/Double_Inherited_Component/ComponentC.cdp b/CIAO/tests/IDL_Test/Double_Inherited_Component/ComponentC.cdp new file mode 100644 index 00000000000..075e5417150 --- /dev/null +++ b/CIAO/tests/IDL_Test/Double_Inherited_Component/ComponentC.cdp @@ -0,0 +1,103 @@ +<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"> + <label>Hello_DDS_Deployment_1</label> + <UUID>Hello_DDS_Deployment_1</UUID> + + <!-- Implementations declarations --> + + <!-- Home implementation --> + <implementation xmi:id="ComponentCComponentImplementation"> + <name>ComponentCComponentImplementation</name> + <source/> + <artifact xmi:idref="ComponentC_ExecArtifact" /> + <artifact xmi:idref="ComponentC_SvntArtifact" /> + <execParameter> + <!-- entrypoint as exec parameter (see 10.6.1) --> + <name>component factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_Hello_Sender_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_connector_test_C_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>ComponentC_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>ComponentC_exec</string> + </value> + </value> + </execParameter> + </implementation> + + <instance xmi:id="ComponentCComponentInstance"> + <name>ComponentCComponent</name> + <node>ComponentCNode</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="ComponentCComponentImplementation" /> + <configProperty> + <name>topic_name</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Square</string> + </value> + </value> + </configProperty> + </instance> + + <!-- Artifacts declarations --> + <artifact xmi:id="ComponentC_ExecArtifact"> + <name>ComponentC_exec</name> + <source/> + <node/> + <location>ComponentC_exec</location> + </artifact> + <artifact xmi:id="ComponentC_SvntArtifact"> + <name>ComponentC_svnt</name> + <source/> + <node/> + <location>ComponentC_svnt</location> + </artifact> + <artifact xmi:id="ComponentC_StubArtifact"> + <name>ComponentC_stub</name> + <source/> + <node/> + <location>ComponentC_stub</location> + </artifact> + +</Deployment:DeploymentPlan> diff --git a/CIAO/tests/IDL_Test/Double_Inherited_Component/ComponentC_exec.cpp b/CIAO/tests/IDL_Test/Double_Inherited_Component/ComponentC_exec.cpp new file mode 100644 index 00000000000..3e4d1ac7f41 --- /dev/null +++ b/CIAO/tests/IDL_Test/Double_Inherited_Component/ComponentC_exec.cpp @@ -0,0 +1,84 @@ +// -*- C++ -*- +// $Id$ + +#include "ComponentC_exec.h" +#include "ciao/Logger/Log_Macros.h" + +namespace CIAO_connector_test_C_Impl +{ + //============================================================ + // Pulse generator + //============================================================ + + ComponentC_exec_i ::ComponentC_exec_i (void) + : topic_name_has_been_set_ (false) + { + } + + ComponentC_exec_i ::~ComponentC_exec_i (void) + { + } + + // Port operations. + void + ComponentC_exec_i ::topic_name (const char * topic_name) + { + this->topic_name_ = topic_name; + this->topic_name_has_been_set_ = true; + } + char * + ComponentC_exec_i ::topic_name (void) + { + return CORBA::string_dup (this->topic_name_.in ()); + } + + // Operations from Components::SessionComponent. + void + ComponentC_exec_i ::set_session_context ( + ::Components::SessionContext_ptr ctx) + { + this->context_ = + ::connector_test::CCM_C_Context::_narrow (ctx); + + if ( ::CORBA::is_nil (this->context_.in ())) + { + throw ::CORBA::INTERNAL (); + } + } + + void + ComponentC_exec_i ::configuration_complete (void) + { + } + + void + ComponentC_exec_i ::ccm_activate (void) + { + } + + void + ComponentC_exec_i ::ccm_passivate (void) + { + } + + void + ComponentC_exec_i ::ccm_remove (void) + { + if (!this->topic_name_has_been_set_) + CIAO_ERROR ((LM_ERROR, ACE_TEXT ("ERROR : Topic name has not been set\n"))); + } + + extern "C" INHERITED_COMPONENTS_EXEC_Export ::Components::EnterpriseComponent_ptr + create_Hello_Sender_Impl (void) + { + ::Components::EnterpriseComponent_ptr retval = + ::Components::EnterpriseComponent::_nil (); + + ACE_NEW_NORETURN ( + retval, + ComponentC_exec_i ); + + return retval; + } +} + diff --git a/CIAO/tests/IDL_Test/Double_Inherited_Component/ComponentC_exec.h b/CIAO/tests/IDL_Test/Double_Inherited_Component/ComponentC_exec.h new file mode 100644 index 00000000000..94bdfb4f75f --- /dev/null +++ b/CIAO/tests/IDL_Test/Double_Inherited_Component/ComponentC_exec.h @@ -0,0 +1,56 @@ +// -*- C++ -*- +// $Id$ + +#ifndef HELLO_SENDER_EXEC_H_ +#define HELLO_SENDER_EXEC_H_ + + +#include "Inherited_componentsEC.h" + +#include /**/ "ComponentC_exec_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/LocalObject.h" +#include "ace/Task.h" +#include "ace/Reactor.h" + +#include <map> + +namespace CIAO_connector_test_C_Impl +{ + class ComponentC_exec_i + : public virtual C_Exec, + public virtual ::CORBA::LocalObject + { + public: + ComponentC_exec_i (void); + virtual ~ComponentC_exec_i (void); + + virtual void + topic_name (const char * topic_name); + virtual char * + topic_name (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: + ::connector_test::CCM_C_Context_var context_; + CORBA::String_var topic_name_; + bool topic_name_has_been_set_; + }; + + extern "C" INHERITED_COMPONENTS_EXEC_Export ::Components::EnterpriseComponent_ptr + create_Hello_Sender_Impl (void); +} + +#endif /* ifndef */ + diff --git a/CIAO/tests/IDL_Test/Double_Inherited_Component/Inherited_components.idl b/CIAO/tests/IDL_Test/Double_Inherited_Component/Inherited_components.idl new file mode 100644 index 00000000000..c05da5c7db6 --- /dev/null +++ b/CIAO/tests/IDL_Test/Double_Inherited_Component/Inherited_components.idl @@ -0,0 +1,27 @@ +// $Id$ + +/** + * @file + * @author Marcel Smit <msmit@remedy.nl> + * + * by-hand idl3 translation of sender components. + */ + +#ifndef DDS_SENDER_IDL +#define DDS_SENDER_IDL +#include <Components.idl> +module connector_test +{ + component A + { + attribute string topic_name; + }; + component B : A + { + }; + + component C : B + { + }; +}; +#endif diff --git a/CIAO/tests/IDL_Test/Double_Inherited_Component/Inherited_components.mpc b/CIAO/tests/IDL_Test/Double_Inherited_Component/Inherited_components.mpc new file mode 100644 index 00000000000..bbeefa6165d --- /dev/null +++ b/CIAO/tests/IDL_Test/Double_Inherited_Component/Inherited_components.mpc @@ -0,0 +1,131 @@ +// $Id$ + +project(Inherited_Components_idl_gen) : componentidldefaults { + after += + custom_only = 1 + idlflags += -Wb,stub_export_macro=INHERITED_COMPONENTS_STUB_Export \ + -Wb,stub_export_include=ComponentC_stub_export.h \ + -Wb,skel_export_macro=INHERITED_COMPONENTS_SVNT_Export \ + -Wb,skel_export_include=ComponentC_svnt_export.h \ + -Wb,svnt_export_macro=INHERITED_COMPONENTS_SVNT_Export \ + -Wb,svnt_export_include=ComponentC_svnt_export.h \ + -Wb,exec_export_macro=INHERITED_COMPONENTS_EXEC_Export \ + -Wb,exec_export_include=ComponentC_exec_export.h \ + -I .. + + IDL_Files { + Inherited_components.idl + } +} + +project(Inherited_Components_lem_gen) : ciaoidldefaults { + after += Inherited_Components_idl_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=Inherited_Components_LEM_STUB_Export \ + -Wb,stub_export_include=ComponentC_lem_stub_export.h \ + -SS -Gxhst -I .. + + IDL_Files { + Inherited_componentsE.idl + } +} + +project(Inherited_Components_lem_stub) : ccm_svnt, dds4ccm_base { + after += Inherited_Components_lem_gen Inherited_Components_stub + libs += ComponentC_stub + includes += .. + sharedname = ComponentC_lem_stub + dynamicflags = INHERITED_COMPONENTS_LEM_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + Inherited_componentsEC.cpp + } + + Header_Files { + Inherited_componentsEC.h + ComponentC_lem_stub_export.h + } + + Inline_Files { + Inherited_componentsEC.inl + } +} + +project(Inherited_Components_stub) : ccm_stub, dds4ccm_base { + after += Inherited_Components_idl_gen + libs += + includes += .. + sharedname = ComponentC_stub + dynamicflags = INHERITED_COMPONENTS_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + Inherited_componentsC.cpp + } + + Header_Files { + Inherited_componentsC.h + ComponentC_stub_export.h + } + + Inline_Files { + Inherited_componentsC.inl + } +} + +project(Inherited_Components_exec) : ciao_executor, dds4ccm_base { + after += Inherited_Components_lem_stub Inherited_Components_stub + sharedname = ComponentC_exec + libs += ComponentC_stub ComponentC_lem_stub + includes += .. + dynamicflags = INHERITED_COMPONENTS_EXEC_BUILD_DLL + + IDL_Files { + } + + Source_Files { + ComponentC_exec.cpp + } + + Header_Files { + ComponentC_exec.h + ComponentC_exec_export.h + } + + Inline_Files { + } +} + + +project(Inherited_Components_svnt) : ciao_servant, dds4ccm_base, nddslib { + after += Inherited_Components_lem_stub DDS4CCM_lem_stub DDS4CCM_skel + sharedname = ComponentC_svnt + libs += ComponentC_stub ComponentC_lem_stub \ + DDS4CCM_lem_stub DDS4CCM_skel + includes += .. + dynamicflags = INHERITED_COMPONENTS_SVNT_BUILD_DLL + + IDL_Files { + } + + Source_Files { + Inherited_componentsS.cpp + Inherited_components_svnt.cpp + } + + Header_Files { + Inherited_componentsS.h + Inherited_components_svnt.h + ComponentC_svnt_export.h + } + + Inline_Files { + Inherited_componentsS.inl + } +} + diff --git a/CIAO/tests/IDL_Test/Double_Inherited_Component/run_test.pl b/CIAO/tests/IDL_Test/Double_Inherited_Component/run_test.pl new file mode 100755 index 00000000000..f7202e3dcaf --- /dev/null +++ b/CIAO/tests/IDL_Test/Double_Inherited_Component/run_test.pl @@ -0,0 +1,225 @@ +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 = 1; +@ports = ( 60001 ); +@iorbases = ( "ComponentC.ior" ); +@iorfiles = 0; +@nodenames = ( "ComponentCNode" ); + +# ior files other than daemon +# 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 = "ComponentC.cdp"; + +PerlACE::add_lib_path ('.'); +$ENV{"DANCE_TRACE_ENABLE"} = 0; +$ENV{"CIAO_TRACE_ENABLE"} = 0; + + +sub create_targets { + # naming service + $tg_naming = PerlACE::TestTarget::create_target (1) || die "Create target for ns failed\n"; + + # 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"; + } + # execution manager + $tg_exe_man = PerlACE::TestTarget::create_target (1) || die "Create target for EM failed\n"; + # executor (plan_launcher) + $tg_executor = PerlACE::TestTarget::create_target (1) || die "Create target for executor failed\n"; +} + +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); + } + +} + +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); + $result = $DEAMONS[$i]->Spawn (); + push(@processes, $DEAMONS[$i]); + + 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"); + +$NS->Spawn (); + +print STDERR "Starting Naming Service with -m 1 -ORBEndpoint iiop://localhost:60003 -o ns.ior\n"; + +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->Spawn (); + +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"); +$E->SpawnWaitKill (2*$tg_executor->ProcessStartWaitInterval ()); + +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 10 seconds to allow task to complete\n"; +sleep (10); + +# 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 = + new PerlACE::Process ("$DANCE_ROOT/bin/dance_plan_launcher", + "-k file://$ior_emfile -x $cdp_file -q"); +$E->SpawnWaitKill ($tg_executor->ProcessStopWaitInterval ()); + +print "Executor returned.\n"; +print "Shutting down rest of the processes.\n"; + +delete_ior_files (); +kill_open_processes (); + +exit $status; |