diff options
Diffstat (limited to 'modules/CIAO/connectors/dds4ccm/tests/SetConnectorAttributes')
7 files changed, 627 insertions, 0 deletions
diff --git a/modules/CIAO/connectors/dds4ccm/tests/SetConnectorAttributes/Base/SetConnectorAttribute_Base.idl b/modules/CIAO/connectors/dds4ccm/tests/SetConnectorAttributes/Base/SetConnectorAttribute_Base.idl new file mode 100644 index 00000000000..94d30cd743c --- /dev/null +++ b/modules/CIAO/connectors/dds4ccm/tests/SetConnectorAttributes/Base/SetConnectorAttribute_Base.idl @@ -0,0 +1,20 @@ +// $Id$ + +/** + * @file SetConnectorAttribute_Base.idl + * @author Marcel Smit <msmit@remedy.nl> + */ + +#ifndef SETCONNECTORATTRIBUTE_BASE_IDL +#define SETCONNECTORATTRIBUTE_BASE_IDL + +#pragma ndds typesupport "Base/SetConnectorAttribute_BaseSupport.h" + +struct SetConnectorAttributeTest { + string key; + long iteration; +}; + +typedef sequence<SetConnectorAttributeTest> SetConnectorAttributeTestSeq; + +#endif diff --git a/modules/CIAO/connectors/dds4ccm/tests/SetConnectorAttributes/Base/SetConnectorAttribute_Base.mpc b/modules/CIAO/connectors/dds4ccm/tests/SetConnectorAttributes/Base/SetConnectorAttribute_Base.mpc new file mode 100644 index 00000000000..5d5a42ccba8 --- /dev/null +++ b/modules/CIAO/connectors/dds4ccm/tests/SetConnectorAttributes/Base/SetConnectorAttribute_Base.mpc @@ -0,0 +1,26 @@ +// $Id$ + +project (DDS_SCABase_stub) : taoidldefaults, anytypecode, dds4ccm_ts_default { + sharedname = DDS_SCABase_stub + dynamicflags += SETCONNECTORATTRIBUTE_BASE_STUB_BUILD_DLL + libout = ../lib + + idlflags += -SS -Sci \ + -Wb,stub_export_macro=SETCONNECTORATTRIBUTE_BASE_STUB_Export \ + -Wb,stub_export_include=SetConnectorAttribute_Base_stub_export.h + + IDL_Files { + idlflags += -Gxhst + SetConnectorAttribute_Base.idl + } + + opendds_ts_flags += --export=SETCONNECTORATTRIBUTE_BASE_STUB_Export + + DDSGenerator_Files { + SetConnectorAttribute_Base.idl + } + + Source_Files { + } +} + diff --git a/modules/CIAO/connectors/dds4ccm/tests/SetConnectorAttributes/Connector/SetConnectorAttribute_Connector.idl b/modules/CIAO/connectors/dds4ccm/tests/SetConnectorAttributes/Connector/SetConnectorAttribute_Connector.idl new file mode 100644 index 00000000000..53f741205e2 --- /dev/null +++ b/modules/CIAO/connectors/dds4ccm/tests/SetConnectorAttributes/Connector/SetConnectorAttribute_Connector.idl @@ -0,0 +1,27 @@ +// $Id$ + +/** + * @file SetConnectorAttribute_Connector.idl + * @author Marcel Smit <msmit@remedy.nl> + */ + +#ifndef SETCONNECTORATTRIBUTE_CONNECTOR_IDL_ +#define SETCONNECTORATTRIBUTE_CONNECTOR_IDL_ + +#include <Components.idl> +#include "Base/SetConnectorAttribute_Base.idl" +#include "connectors/dds4ccm/idl/ccm_dds.idl" + +#pragma ciao lem "Connector/SetConnectorAttribute_ConnectorE.idl" + +module SetConnectorAttribute +{ + module ::CCM_DDS::Typed + < ::SetConnectorAttributeTest, ::SetConnectorAttributeTestSeq> + SetConnectorAttributeTestConn; + connector SetConnectorAttribute_Connector : SetConnectorAttributeTestConn::DDS_Event + { + }; +}; + +#endif /* SetConnectorAttribute_CONNECTOR_IDL_ */ diff --git a/modules/CIAO/connectors/dds4ccm/tests/SetConnectorAttributes/Connector/SetConnectorAttribute_Connector.mpc b/modules/CIAO/connectors/dds4ccm/tests/SetConnectorAttributes/Connector/SetConnectorAttribute_Connector.mpc new file mode 100644 index 00000000000..6f913842f95 --- /dev/null +++ b/modules/CIAO/connectors/dds4ccm/tests/SetConnectorAttributes/Connector/SetConnectorAttribute_Connector.mpc @@ -0,0 +1,145 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -p DDS_SCABase -l .. -o ../lib -u DDS SetConnectorAttribute_Connector" + +project(DDS_SCAConnector_idl_gen) : connectoridldefaults, dds4ccm { + after += DDS4CCM_idl_gen + custom_only = 1 + idlflags += -Wb,stub_export_macro=SETCONNECTORATTRIBUTE_CONNECTOR_STUB_Export \ + -Wb,stub_export_include=SetConnectorAttribute_Connector_stub_export.h \ + -Wb,skel_export_macro=SETCONNECTORATTRIBUTE_CONNECTOR_SVNT_Export \ + -Wb,skel_export_include=SetConnectorAttribute_Connector_svnt_export.h \ + -Wb,svnt_export_macro=SETCONNECTORATTRIBUTE_CONNECTOR_SVNT_Export \ + -Wb,svnt_export_include=SetConnectorAttribute_Connector_svnt_export.h \ + -Wb,conn_export_macro=SETCONNECTORATTRIBUTE_CONNECTOR_CONN_Export \ + -Wb,conn_export_include=SetConnectorAttribute_Connector_conn_export.h \ + -I .. + + IDL_Files { + SetConnectorAttribute_Connector.idl + } +} + +project(DDS_SCAConnector_lem_gen) : ciaoidldefaults, dds4ccm { + custom_only = 1 + after += DDS_SCAConnector_idl_gen + idlflags += -Wb,stub_export_macro=SETCONNECTORATTRIBUTE_CONNECTOR_LEM_STUB_Export \ + -Wb,stub_export_include=SetConnectorAttribute_Connector_lem_stub_export.h \ + -SS -Gxhst \ + -I .. + + IDL_Files { + SetConnectorAttribute_ConnectorE.idl + } +} + +project(DDS_SCAConnector_lem_stub) : ccm_svnt, dds4ccm_base { + after += DDS_SCAConnector_lem_gen DDS_SCAConnector_stub DDS_SCABase_stub DDS4CCM_lem_stub + libs += DDS_SCABase_stub DDS_SCAConnector_stub DDS4CCM_lem_stub + libpaths += ../lib + libout = ../lib + includes += .. + sharedname = DDS_SCAConnector_lem_stub + dynamicflags = SETCONNECTORATTRIBUTE_CONNECTOR_LEM_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + SetConnectorAttribute_ConnectorEC.cpp + } + + Header_Files { + SetConnectorAttribute_ConnectorEC.h + SetConnectorAttribute_Connector_lem_stub_export.h + } + + Inline_Files { + SetConnectorAttribute_ConnectorEC.inl + } +} + +project(DDS_SCAConnector_stub) : ccm_stub, dds4ccm_base { + after += DDS_SCAConnector_idl_gen DDS_SCABase_stub + libs += DDS_SCABase_stub + libpaths += ../lib + libout = ../lib + includes += .. + sharedname = DDS_SCAConnector_stub + dynamicflags = SETCONNECTORATTRIBUTE_CONNECTOR_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + SetConnectorAttribute_ConnectorC.cpp + } + + Header_Files { + SetConnectorAttribute_ConnectorC.h + SetConnectorAttribute_Connector_stub_export.h + } + + Inline_Files { + SetConnectorAttribute_ConnectorC.inl + } +} + +project(DDS_SCAConnector_exec) : ciao_executor, dds4ccm_impl { + after += DDS_SCAConnector_lem_stub DDS_SCAConnector_stub DDS4CCM_lem_stub DDS_SCABase_stub + sharedname = DDS_SCAConnector_exec + libs += DDS_SCAConnector_stub DDS_SCAConnector_lem_stub DDS_SCABase_stub DDS4CCM_lem_stub DDS_SCABase_stub + libpaths += ../lib + libout = ../lib + includes += .. + dynamicflags = SETCONNECTORATTRIBUTE_CONNECTOR_CONN_BUILD_DLL + + IDL_Files { + } + + Source_Files { + SetConnectorAttribute_Connector_conn.cpp + } + + Header_Files { + SetConnectorAttribute_Connector_conn.h + SetConnectorAttribute_Connector_conn_export.h + } + + Inline_Files { + } +} + + +project(DDS_SCAConnector_svnt) : ciao_servant, dds4ccm_impl { + after += DDS_SCAConnector_lem_stub DDS_SCAConnector_exec DDS_SCAConnector_stub DDS4CCM_lem_stub + sharedname = DDS_SCAConnector_svnt + libs += DDS_SCAConnector_stub \ + DDS_SCAConnector_lem_stub \ + DDS_SCABase_stub \ + DDS_SCAConnector_exec \ + DDS4CCM_lem_stub + libpaths += ../lib + libout = ../lib + includes += .. + dynamicflags = SETCONNECTORATTRIBUTE_CONNECTOR_SVNT_BUILD_DLL + + IDL_Files { + } + + Source_Files { + SetConnectorAttribute_ConnectorS.cpp + SetConnectorAttribute_Connector_svnt.cpp + } + + Header_Files { + SetConnectorAttribute_ConnectorS.h + SetConnectorAttribute_Connector_svnt.h + SetConnectorAttribute_Connector_svnt_export.h + } + + Inline_Files { + SetConnectorAttribute_ConnectorS.inl + } +} + + diff --git a/modules/CIAO/connectors/dds4ccm/tests/SetConnectorAttributes/README b/modules/CIAO/connectors/dds4ccm/tests/SetConnectorAttributes/README new file mode 100644 index 00000000000..8986a3b67ca --- /dev/null +++ b/modules/CIAO/connectors/dds4ccm/tests/SetConnectorAttributes/README @@ -0,0 +1,15 @@ +# $Id$ + +Tests whether the connector attribute are +properly set by the D&C framework. +The following connector attributes are defined in +the deployment plan: + * key_fields + * domain_id + * qos_profile + * topic_name + +On ccm_activate in the connector, these values +are checked. + +An error is reported for every mismatch. diff --git a/modules/CIAO/connectors/dds4ccm/tests/SetConnectorAttributes/descriptors/Plan.cdp b/modules/CIAO/connectors/dds4ccm/tests/SetConnectorAttributes/descriptors/Plan.cdp new file mode 100644 index 00000000000..f7fe2fc0074 --- /dev/null +++ b/modules/CIAO/connectors/dds4ccm/tests/SetConnectorAttributes/descriptors/Plan.cdp @@ -0,0 +1,150 @@ +<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>SetConnectorAttributeAttribute_Depl_1</label> + <UUID>SetConnectorAttributeAttribute_Depl_1</UUID> + + + <implementation xmi:id="SetConnectorAttributeConnectorComponentImplementation"> + <name>SetConnectorAttributeConnectorComponentImplementation</name> + <source/> + <artifact xmi:idref="SetConnectorAttributeConnector_ExecArtifact" /> + <artifact xmi:idref="SetConnectorAttributeConnector_SvntArtifact" /> + <execParameter> + <!-- entrypoint as exec parameter (see 10.6.1) --> + <name>component factory</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_SetConnectorAttribute_SetConnectorAttribute_Connector_Impl</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_SetConnectorAttribute_SetConnectorAttribute_Connector_Servant</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SetConnectorAttributeConnector_svnt</string> + </value> + </value> + </execParameter> + <execParameter> + <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SetConnectorAttributeConnector_exec</string> + </value> + </value> + </execParameter> + </implementation> + <instance xmi:id="SetConnectorAttributeConnectorComponentInstance"> + <name>SetConnectorAttributeConnectorComponent</name> + <node>ComponentNode</node> + <!-- hostname --> + <source/> + <implementation xmi:idref="SetConnectorAttributeConnectorComponentImplementation" /> + <configProperty> + <name>topic_name</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>SetConnectorAttribute</string> + </value> + </value> + </configProperty> + <configProperty> + <name>domain_id</name> + <value> + <type> + <kind>tk_long</kind> + </type> + <value> + <long>100</long> + </value> + </value> + </configProperty> + <configProperty> + <name>qos_profile</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>'qos profile'</string> + </value> + </value> + </configProperty> + <configProperty> + <name>key_fields</name> + <value> + <type> + <kind>tk_sequence</kind> + <sequence> + <elementType> + <kind>tk_string</kind> + </elementType> + </sequence> + </type> + <value> + <element> + <string>string_1</string> + </element> + <element> + <string>string_2</string> + </element> + <element> + <string>string_3</string> + </element> + <element> + <string>string_4</string> + </element> + <element> + <string>string_5</string> + </element> + </value> + </value> + </configProperty> + </instance> + + <artifact xmi:id="SetConnectorAttributeConnector_ExecArtifact"> + <name>SetConnectorAttributeConnector_exec</name> + <source/> + <node/> + <location>DDS_SCAConnector_exec</location> + </artifact> + <artifact xmi:id="SetConnectorAttributeConnector_SvntArtifact"> + <name>SetConnectorAttributeConnector_svnt</name> + <source/> + <node/> + <location>DDS_SCAConnector_svnt</location> + </artifact> + <artifact xmi:id="SetConnectorAttributeConnector_StubArtifact"> + <name>SetConnectorAttributeConnector_stub</name> + <source/> + <node/> + <location>DDS_SCAConnector_stub</location> + </artifact> +</Deployment:DeploymentPlan> diff --git a/modules/CIAO/connectors/dds4ccm/tests/SetConnectorAttributes/descriptors/run_test.pl b/modules/CIAO/connectors/dds4ccm/tests/SetConnectorAttributes/descriptors/run_test.pl new file mode 100755 index 00000000000..b51ae16243d --- /dev/null +++ b/modules/CIAO/connectors/dds4ccm/tests/SetConnectorAttributes/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 = 1; +@ports = ( 60001); +@iorbases = ( "NodeApp1.ior" ); +@iorfiles = 0; +@nodenames = ( "ComponentNode"); + +# 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 = "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"); + +$ns_status = $NS->Spawn (); + +if ($ns_status != 0) { + print STDERR "ERROR: Unable to execute the naming service\n"; + kill_open_processes (); + exit 1; +} + +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_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 (2 * $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 5 seconds to allow task to complete\n"; +sleep (5); + +# 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; |