diff options
author | wolff1 <wolff1@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2007-12-07 22:41:10 +0000 |
---|---|---|
committer | wolff1 <wolff1@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2007-12-07 22:41:10 +0000 |
commit | b93eebe93647d2fe5f65053c46bdde46238ec5e2 (patch) | |
tree | 5b1cfad5e089069ce94e56755f0e88e8d89fc34c | |
parent | c3805f5825933ae751b993c3ca4b79c902573f0e (diff) | |
download | ATCD-b93eebe93647d2fe5f65053c46bdde46238ec5e2.tar.gz |
fixed configuration code and added startup scripts to DDS integration example
-rw-r--r-- | CIAO/tests/DDS/DDSTest.mwc | 2 | ||||
-rw-r--r-- | CIAO/tests/DDS/Publisher/publisher.cpp | 32 | ||||
-rw-r--r-- | CIAO/tests/DDS/Receiver/DDSReceiver_exec.cpp | 6 | ||||
-rw-r--r-- | CIAO/tests/DDS/Receiver/DDSReceiver_exec.h | 3 | ||||
-rw-r--r-- | CIAO/tests/DDS/Receiver/Receiver_Task.cpp | 49 | ||||
-rw-r--r-- | CIAO/tests/DDS/Receiver/Receiver_Task.h | 8 | ||||
-rwxr-xr-x | CIAO/tests/DDS/descriptors/Deployment.cdp | 75 | ||||
-rw-r--r-- | CIAO/tests/DDS/descriptors/dds_tcp_conf.ini | 19 | ||||
-rw-r--r-- | CIAO/tests/DDS/descriptors/domain_ids | 1 | ||||
-rw-r--r-- | CIAO/tests/DDS/descriptors/tcp.conf | 1 | ||||
-rwxr-xr-x | CIAO/tests/DDS/tests/run_components.pl | 278 | ||||
-rwxr-xr-x | CIAO/tests/DDS/tests/run_publisher.pl | 79 |
12 files changed, 509 insertions, 44 deletions
diff --git a/CIAO/tests/DDS/DDSTest.mwc b/CIAO/tests/DDS/DDSTest.mwc index de42423654f..97fd230bbd2 100644 --- a/CIAO/tests/DDS/DDSTest.mwc +++ b/CIAO/tests/DDS/DDSTest.mwc @@ -10,5 +10,5 @@ workspace { Base Receiver - + Publisher } diff --git a/CIAO/tests/DDS/Publisher/publisher.cpp b/CIAO/tests/DDS/Publisher/publisher.cpp index a14c8780e4f..6f412c89fd1 100644 --- a/CIAO/tests/DDS/Publisher/publisher.cpp +++ b/CIAO/tests/DDS/Publisher/publisher.cpp @@ -19,8 +19,8 @@ const OpenDDS::DCPS::TransportIdType TRANSPORT_IMPL_ID = 1; // constants for Stock Ddstopicr domain Id, types, and topic DDS::DomainId_t DDSTOPIC_DOMAIN_ID = 467; -const char* DDSTOPIC_TYPE = "DDS Test"; -const char* DDSTEST_TOPIC = "DDSTopic"; +const char* DDSTOPIC_TYPE = "DDSTopic"; +const char* DDSTEST_TOPIC = "DDSTopic Data"; int main (int argc, char *argv[]) { @@ -131,21 +131,23 @@ int main (int argc, char *argv[]) { // Publish... ACE_Time_Value wait_time( 1, 0 ); - for ( int i = 0; i < 8; ++i ) { - DDSTopic ddstopic; - ddstopic.id = CORBA::string_dup("Asynch Message"); - ddstopic.sequence_number = i; - - cout << "Writing Ddstopicr, count " << i << endl; - - DDS::ReturnCode_t ret = ddstopic_dw->write(ddstopic, topic_handle); - if (ret != DDS::RETCODE_OK) { - ACE_ERROR ((LM_ERROR, ACE_TEXT("(%P|%t)ERROR: topic write returned %d.\n"), ret)); + long i = 0; + while(true) + { + DDSTopic ddstopic; + ddstopic.id = CORBA::string_dup("Asynch Message"); + ddstopic.sequence_number = i++; + + cout << "Writing DDSTopic [" << i << "]" << endl; + + DDS::ReturnCode_t ret = ddstopic_dw->write(ddstopic, topic_handle); + if (ret != DDS::RETCODE_OK) { + ACE_ERROR ((LM_ERROR, ACE_TEXT("(%P|%t)ERROR: topic write returned %d.\n"), ret)); + } + + ACE_OS::sleep( wait_time ); } - ACE_OS::sleep( wait_time ); - } - } catch (CORBA::Exception& e) { cerr << "Exception caught in main.cpp:" << endl << e << endl; diff --git a/CIAO/tests/DDS/Receiver/DDSReceiver_exec.cpp b/CIAO/tests/DDS/Receiver/DDSReceiver_exec.cpp index 7896a9c05ed..cd91e70b886 100644 --- a/CIAO/tests/DDS/Receiver/DDSReceiver_exec.cpp +++ b/CIAO/tests/DDS/Receiver/DDSReceiver_exec.cpp @@ -78,19 +78,19 @@ namespace CIDL_DDSReceiverImpl void DDSReceiver_exec_i::ccm_activate () { - // Your code here. + task_.activate (); } void DDSReceiver_exec_i::ccm_passivate () { - // Your code here. + task_.stop (); } void DDSReceiver_exec_i::ccm_remove () { - // Your code here. + task_.wait (); } //================================================================== diff --git a/CIAO/tests/DDS/Receiver/DDSReceiver_exec.h b/CIAO/tests/DDS/Receiver/DDSReceiver_exec.h index 201c8bd5af9..e9e4ba0a4be 100644 --- a/CIAO/tests/DDS/Receiver/DDSReceiver_exec.h +++ b/CIAO/tests/DDS/Receiver/DDSReceiver_exec.h @@ -31,6 +31,7 @@ #include "DDSReceiver_exec_export.h" #include "tao/LocalObject.h" +#include "Receiver_Task.h" namespace CIDL_DDSReceiverImpl { @@ -70,6 +71,8 @@ namespace CIDL_DDSReceiverImpl protected: DDSReceiver_Context *context_; + + Receiver_Task task_; }; class DDSRECEIVER_EXEC_Export DDSReceiverHome_exec_i diff --git a/CIAO/tests/DDS/Receiver/Receiver_Task.cpp b/CIAO/tests/DDS/Receiver/Receiver_Task.cpp index 5eae08bcfc3..5ec26b8990c 100644 --- a/CIAO/tests/DDS/Receiver/Receiver_Task.cpp +++ b/CIAO/tests/DDS/Receiver/Receiver_Task.cpp @@ -14,10 +14,10 @@ #include "Receiver_Task.h" #include "DDSTopicDataReaderListenerImpl.h" #include "DDSTopicTypeSupportImpl.h" -#include <dds/DCPS/Service_Participant.h> #include <dds/DCPS/Marked_Default_Qos.h> #include <dds/DCPS/SubscriberImpl.h> #include <dds/DCPS/transport/framework/TheTransportFactory.h> +#include <ace/ARGV.h> namespace CIDL_DDSReceiverImpl { @@ -27,8 +27,8 @@ namespace CIDL_DDSReceiverImpl const OpenDDS::DCPS::TransportIdType TRANSPORT_IMPL_ID = 1; DDS::DomainId_t DDSTOPIC_DOMAIN_ID = 467; -const char* DDSTOPIC_TYPE = "DDS Test"; -const char* DDSTEST_TOPIC = "DDSTopic"; +const char* DDSTOPIC_TYPE = "DDSTopic"; +const char* DDSTEST_TOPIC = "DDSTopic Data"; //----------------------------------------------------------------------------- @@ -49,22 +49,19 @@ const char* DDSTEST_TOPIC = "DDSTopic"; int Receiver_Task::svc () { - DDS::DomainParticipantFactory_var dpf = - DDS::DomainParticipantFactory::_nil(); - DDS::DomainParticipant_var participant = - DDS::DomainParticipant::_nil(); - try { // Initialize, and create a DomainParticipant + ACE_ARGV args ("-ORBSvcConf ../descriptors/tcp.conf -DCPSConfigFile ../descriptors/dds_tcp_conf.ini"); + + int argc = args.argc (); + dp_factory_ = TheParticipantFactoryWithArgs (argc, args.argv ()); - dpf = TheParticipantFactory; - - participant = dpf->create_participant( - DDSTOPIC_DOMAIN_ID, - PARTICIPANT_QOS_DEFAULT, - DDS::DomainParticipantListener::_nil()); + participant_ = dp_factory_->create_participant( + DDSTOPIC_DOMAIN_ID, + PARTICIPANT_QOS_DEFAULT, + DDS::DomainParticipantListener::_nil()); - if (CORBA::is_nil (participant.in ())) { + if (CORBA::is_nil (participant_.in ())) { cerr << "create_participant failed." << endl; return 1; } @@ -72,8 +69,8 @@ const char* DDSTEST_TOPIC = "DDSTopic"; // Create a subscriber for the two topics // (SUBSCRIBER_QOS_DEFAULT is defined in Marked_Default_Qos.h) DDS::Subscriber_var sub = - participant->create_subscriber(SUBSCRIBER_QOS_DEFAULT, - DDS::SubscriberListener::_nil()); + participant_->create_subscriber(SUBSCRIBER_QOS_DEFAULT, + DDS::SubscriberListener::_nil()); if (CORBA::is_nil (sub.in ())) { cerr << "create_subscriber failed." << endl; return 1; @@ -119,7 +116,7 @@ const char* DDSTEST_TOPIC = "DDSTopic"; // Register the Ddstopic type DDSTopicTypeSupport_var ddstopic_servant = new DDSTopicTypeSupportImpl(); - if (DDS::RETCODE_OK != ddstopic_servant->register_type(participant.in (), + if (DDS::RETCODE_OK != ddstopic_servant->register_type(participant_.in (), DDSTOPIC_TYPE)) { cerr << "register_type for " << DDSTOPIC_TYPE << " failed." << endl; return 1; @@ -127,7 +124,7 @@ const char* DDSTEST_TOPIC = "DDSTopic"; // Create a topic for the Ddstopic type... DDS::Topic_var ddstopic_topic = - participant->create_topic (DDSTEST_TOPIC, + participant_->create_topic (DDSTEST_TOPIC, DDSTOPIC_TYPE, TOPIC_QOS_DEFAULT, DDS::TopicListener::_nil()); @@ -155,9 +152,10 @@ const char* DDSTEST_TOPIC = "DDSTopic"; ddstopic_listener.in ()); // Wait for events from the Publisher; shut down when "close" received + ACE_Time_Value quartersecond (0, 250000); // 250 ms + while ( !this->stopped_ ) { - cout << "DDSTopic Reveicer sleeping for 1 sec..." << endl; - ACE_OS::sleep(1); + ACE_OS::sleep(quartersecond); } } @@ -169,11 +167,11 @@ const char* DDSTEST_TOPIC = "DDSTopic"; // Cleanup try { - if (!CORBA::is_nil (participant.in ())) { - participant->delete_contained_entities(); + if (!CORBA::is_nil (participant_.in ())) { + participant_->delete_contained_entities(); } - if (!CORBA::is_nil (dpf.in ())) { - dpf->delete_participant(participant.in ()); + if (!CORBA::is_nil (dp_factory_.in ())) { + dp_factory_->delete_participant(participant_.in ()); } } catch (CORBA::Exception& e) { cerr << "Exception caught in cleanup." << endl << e << endl; @@ -181,6 +179,7 @@ const char* DDSTEST_TOPIC = "DDSTopic"; } TheTransportFactory->release(); TheServiceParticipant->shutdown (); + return 0; } diff --git a/CIAO/tests/DDS/Receiver/Receiver_Task.h b/CIAO/tests/DDS/Receiver/Receiver_Task.h index e072ace3349..c0ac02554dd 100644 --- a/CIAO/tests/DDS/Receiver/Receiver_Task.h +++ b/CIAO/tests/DDS/Receiver/Receiver_Task.h @@ -15,6 +15,8 @@ #define _DDS_TEST_RECEIVER_TASK_H_ #include "DDSReceiver_svnt.h" +#include <dds/DCPS/Service_Participant.h> + #include <ace/Task.h> #include <string> #include <map> @@ -46,6 +48,12 @@ namespace CIDL_DDSReceiverImpl /// flag for thread cancellation bool stopped_; + /// domain participant factory + DDS::DomainParticipantFactory_var dp_factory_; + + /// domain participant + DDS::DomainParticipant_var participant_; + /// component context DDSReceiver_Context* context_; }; diff --git a/CIAO/tests/DDS/descriptors/Deployment.cdp b/CIAO/tests/DDS/descriptors/Deployment.cdp new file mode 100755 index 00000000000..2c7b50568d1 --- /dev/null +++ b/CIAO/tests/DDS/descriptors/Deployment.cdp @@ -0,0 +1,75 @@ +<?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>C7335AE9-0193-4D17-93E3-0DA18DB23CD0</UUID> + + <implementation id="_C70BC55F-5046-483D-AD6C-3F7E59B65412"> + <name>DDSComponent.ComponentImplementations.DDSReceiver.DDSReceiverImpl</name> + <source/> + <artifact>_0AAAEE60-682B-4C30-B609-ABEAB08A7306</artifact> + <artifact>_6261D847-FC88-4944-901D-1E3E01CEA838</artifact> + <artifact>_CB007241-052C-43F7-B2A0-1609B79A9338</artifact> + </implementation> + + <instance id="DDSComponent.ComponentImplementations.DDSReceiverAssembly.DDSReceiverAssembly.DDSReceiver"> + <name>DDSComponent.ComponentImplementations.DDSReceiverAssembly.DDSReceiverAssembly.DDSReceiver</name> + <node>CCMNode</node> + <source/> + <implementation>_C70BC55F-5046-483D-AD6C-3F7E59B65412</implementation> + <configProperty> + <name>ComponentIOR</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>DDSReceiver.ior</string> + </value> + </value> + </configProperty> + </instance> + + <artifact id="_0AAAEE60-682B-4C30-B609-ABEAB08A7306"> + <name>DDSComponent.ImplementationArtifacts.DDSReceiverArtifacts.DDSReceiver_stub</name> + <source/> + <node/> + <location>DDSReceiver_stub</location> + </artifact> + + <artifact id="_6261D847-FC88-4944-901D-1E3E01CEA838"> + <name>DDSComponent.ImplementationArtifacts.DDSReceiverArtifacts.DDSReceiver_svnt</name> + <source/> + <node/> + <location>DDSReceiver_svnt</location> + <execParameter> + <name>entryPoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_DDSTest_DDSReceiverHome_Servant</string> + </value> + </value> + </execParameter> + </artifact> + + <artifact id="_CB007241-052C-43F7-B2A0-1609B79A9338"> + <name>DDSComponent.ImplementationArtifacts.DDSReceiverArtifacts.DDSReceiver_exec</name> + <source/> + <node/> + <location>DDSReceiver_exec</location> + <execParameter> + <name>entryPoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>create_DDSTest_DDSReceiverHome_Impl</string> + </value> + </value> + </execParameter> + </artifact> + +</Deployment:deploymentPlan> diff --git a/CIAO/tests/DDS/descriptors/dds_tcp_conf.ini b/CIAO/tests/DDS/descriptors/dds_tcp_conf.ini new file mode 100644 index 00000000000..5550cd5c054 --- /dev/null +++ b/CIAO/tests/DDS/descriptors/dds_tcp_conf.ini @@ -0,0 +1,19 @@ +# This "common" section configures the data in Service_Participant. +[common] + +# Debug Level +DCPSDebugLevel=0 + +# IOR of DCPSInfoRepo process. +DCPSInfoRepo=corbaloc::localhost:88776/DCPSInfoRepo + + +# Configuration for a specific TransportImpl object. The section name +# has the "transport_impl_" as prefix and appeneds with the transport id +# which is an integer. The integer must match the transport_id integer +# used in the code. +[transport_impl_1] + +# This transport_type should match the "type" argument in the +# svc.conf or be the SimpleTcp which is part of the DDSdcps lib. +transport_type=SimpleTcp diff --git a/CIAO/tests/DDS/descriptors/domain_ids b/CIAO/tests/DDS/descriptors/domain_ids new file mode 100644 index 00000000000..5873851d327 --- /dev/null +++ b/CIAO/tests/DDS/descriptors/domain_ids @@ -0,0 +1 @@ +467 diff --git a/CIAO/tests/DDS/descriptors/tcp.conf b/CIAO/tests/DDS/descriptors/tcp.conf new file mode 100644 index 00000000000..7084cc8118d --- /dev/null +++ b/CIAO/tests/DDS/descriptors/tcp.conf @@ -0,0 +1 @@ +dynamic DCPS_SimpleTcpLoader Service_Object * SimpleTcp:_make_DCPS_SimpleTcpLoader() "-type SimpleTcp" diff --git a/CIAO/tests/DDS/tests/run_components.pl b/CIAO/tests/DDS/tests/run_components.pl new file mode 100755 index 00000000000..f42fa94b41e --- /dev/null +++ b/CIAO/tests/DDS/tests/run_components.pl @@ -0,0 +1,278 @@ +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::Run_Test; + +$CIAO_ROOT = "$ENV{'CIAO_ROOT'}"; +$TAO_ROOT = "$ENV{'TAO_ROOT'}"; +$DAnCE = "$ENV{'CIAO_ROOT'}/DAnCE"; +#$debug_param = "-ORBDebug -ORBDebugLevel 100"; +$daemons_running = 0; +$em_running = 0; +$ns_running = 0; +$status = 0; +$nodes; +$shutdown = 0; +@ior_files; +$E = 0; +$EM = 0; + +$nsior = PerlACE::LocalFile ("ns.ior"); +unlink $nsior; + +# first argument will be interpreted as .cdp file +die "please specifiy a .cdp file!" unless (@ARGV[0]); +$cdp_file = @ARGV[0]; + +sub gen_dat_name { + my $datname = shift; + $datname =~ s{.cdp}{.dat}; + return $datname; +} + +sub get_node_list { + my $cdp_file = shift; + my $cdp; + my $node_list; # array of hashes, containing node info + my $nodeno = 0; + my $portcount = 60001; + my %nodenames; + + # read file into a string + open (my $FILE, $cdp_file) or die "could not open $cdp_file!"; + while(<$FILE>) { + $cdp .= $_; + } + close ($FILE) or die "could not close $cdp_file!"; + + #do regex evaluation on string + while ($cdp =~ m{\G.*?<instance.*?>.*? + <node>(\w+)<\/node>.*? + <\/instance>}xcgs ) { + unless (exists($nodenames{$1})) { + $nodenames{$1} = true; + $node_list->[$nodeno]->{"node"} = $1; + $node_list->[$nodeno]->{"ip"} = "localhost"; + $node_list->[$nodeno++]->{"port"} = $portcount++; + } + } + + return $node_list; +} + +sub write_dat_file { + my $nodes = shift; + my $datfile = shift; + my $maxlen = 0; + + open (my $FILE, ">$datfile") or die "could not open $datfile!"; + + for (my $i = 0; $i < scalar(@$nodes); ++$i) { + my $thislen = length($nodes->[$i]->{"node"}); + if ($thislen > $maxlen) { + $maxlen = $thislen; + } + } + + for (my $i = 0; $i < scalar(@$nodes); ++$i) { + print $FILE "\n" if $i; + print $FILE $nodes->[$i]->{"node"} . + " " x ($maxlen - length($nodes->[$i]->{"node"}) + 4) . + "corbaloc:iiop:" . + $nodes->[$i]->{"ip"} . + ":" . + $nodes->[$i]->{"port"} . + "/NodeManager" + } + + close ($FILE) or die "could not close $datfile!"; +} + +sub get_ior_files { + my $cdp_file = shift; + my $cdp; + my @iorfiles; + + # read file into a string + open (my $FILE, $cdp_file) or die "could not open $cdp_file!"; + while(<$FILE>) { + $cdp .= $_; + } + close ($FILE) or die "could not close $cdp_file!"; + + #do regex evaluation on string + while ($cdp =~ m{\G.*?<configProperty>.*? + <name>(\w+)<\/name>.*? + <string>(.*?)<\/string>.*? + <\/configProperty>}xcgs ) { + # I'm interested in all ComponentIOR configProperties + if ($1 == "ComponentIOR") { + push (@iorfiles, $2); + } + } + + return @iorfiles; +} + +# Delete if there are any .ior files. +sub delete_output_files { + for ($i = 0; $i < scalar(@$nodes); ++$i) { + unlink $nodes->[$i]->{"node"} . ".ior"; + } + unlink PerlACE::LocalFile ("EM.ior"); + unlink PerlACE::LocalFile ("DAM.ior"); + unlink PerlACE::LocalFile ("ns.ior"); + + foreach my $ior_file (@ior_files) { + unlink PerlACE::LocalFile ($ior_file); + } + + unlink PerlACE::LocalFile (gen_dat_name($cdp_file)); +} + +sub kill_node_daemons { + for ($i = 0; $i < scalar(@$nodes); ++$i) { + $Daemons[$i]->Kill (); $Daemons[$i]->TimedWait (1); + } +} + +sub kill_open_processes { + if ($daemons_running == 1) { + kill_node_daemons (); + } + + if ($em_running == 1) { + $EM->Kill (); + $EM->TimedWait (1); + } + + if ($ns_running == 1) { + $NS->Kill (); + $NS->TimedWait (2); + } + +} + +sub run_node_daemons { + for ($i = 0; $i < scalar(@$nodes); ++$i) + { + $iorfile = $nodes->[$i]->{"node"} . ".ior"; + $iiop = "iiop://" . $nodes->[$i]->{"ip"} . ":" . $nodes->[$i]->{"port"}; + $node_app = "$CIAO_ROOT/bin/NodeApplication"; + + $d_cmd = "$CIAO_ROOT/bin/NodeManager"; + $d_param = "-ORBEndpoint $iiop -s $node_app -o $iorfile -d 30 $debug_param"; + + print $d_cmd . " " . $d_param . "\n"; + $Daemons[$i] = new PerlACE::Process ($d_cmd, $d_param); + $result = $Daemons[$i]->Spawn (); + push(@processes, $Daemons[$i]); + + if (PerlACE::waitforfile_timed ($iorfile, + $PerlACE::wait_interval_for_process_creation) == -1) { + print STDERR + "ERROR: The ior file of node daemon $i could not be found\n"; + for (; $i >= 0; --$i) { + $Daemons[$i]->Kill (); $Daemons[$i]->TimedWait (1); + } + return -1; + } + } + return 0; +} + +$nodes = get_node_list ($cdp_file); +@ior_files = get_ior_files ($cdp_file); + +delete_output_files (); + +# Invoke naming service +$ENV{"CIAO_DEBUG_LEVEL"} = "20"; + +$NS = new PerlACE::Process ("$TAO_ROOT/orbsvcs/Naming_Service/Naming_Service", "-m 0 -ORBEndpoint iiop://localhost:60000 -o ns.ior"); + +$NS->Spawn (); + +print STDERR "Starting Naming Service\n"; + +if (PerlACE::waitforfile_timed ($nsior, $PerlACE::wait_interval_for_process_creation) == -1) +{ + print STDERR "ERROR: cannot find naming service IOR file\n"; + $NS->Kill (); + exit 1; +} + +$Ns_running = 1; + +# Invoke node daemons. +print "Invoking node daemons\n"; +$status = run_node_daemons (); + +if ($status != 0) { + print STDERR "ERROR: Unable to execute the node daemons\n"; + kill_open_processes (); + exit 1; +} + +$daemons_running = 1; + +my $dat_file = gen_dat_name($cdp_file); +write_dat_file ($nodes, $dat_file); + +# Invoke execution manager. +print "Invoking execution manager\n"; +$EM = new PerlACE::Process ("$CIAO_ROOT/bin/Execution_Manager", + "-o EM.ior -i $dat_file $debug_param"); +$EM->Spawn (); + +if (PerlACE::waitforfile_timed ("EM.ior", + $PerlACE::wait_interval_for_process_creation) == -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 - start the application -\n"; +$E = + new PerlACE::Process ("$CIAO_ROOT/bin/plan_launcher", + "-p $cdp_file -k file://EM.ior -o DAM.ior $debug_param"); + +$E->SpawnWaitKill (5000); + +foreach my $ior_file (@ior_files) { + if (PerlACE::waitforfile_timed ( + $ior_file, + $PerlACE::wait_interval_for_process_creation) == -1) { + print STDERR "ERROR: The ior file $ior_file could not be found\n"; + kill_open_processes (); + exit 1; + } +} + +print "\n*************************************************************************\n"; +print "* Press any key to shutdown the test ...\n"; +print "*************************************************************************\n\n"; +$confirmation = <STDIN>; + +# Invoke executor - stop the application -. +print "Invoking executor - stop the application -\n"; +$E = new PerlACE::Process ("$CIAO_ROOT/bin/plan_launcher", + "-k file://EM.ior -i file://DAM.ior"); +$E->SpawnWaitKill (3000); + +print "Executor returned.\n"; +print "Shutting down rest of the processes.\n"; + +delete_output_files (); +kill_open_processes (); + +exit $status; diff --git a/CIAO/tests/DDS/tests/run_publisher.pl b/CIAO/tests/DDS/tests/run_publisher.pl new file mode 100755 index 00000000000..50393564c1d --- /dev/null +++ b/CIAO/tests/DDS/tests/run_publisher.pl @@ -0,0 +1,79 @@ +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::Run_Test; + +$CIAO_ROOT = "$ENV{'CIAO_ROOT'}"; +$TAO_ROOT = "$ENV{'TAO_ROOT'}"; +$DDS_ROOT = "$ENV{'DDS_ROOT'}"; +$DAnCE = "$ENV{'CIAO_ROOT'}/DAnCE"; +#$debug_param = "-ORBDebug -ORBDebugLevel 100"; +$irepo_running = 0; +$IREPO = 0; + +# DCPS info repository parameters +$svcconf = "../descriptors/tcp.conf"; +$dcpsconf = "../descriptors/dds_tcp_conf.ini"; +$repaddr = "localhost:88776"; +$repoior = "repo.ior"; +$domainids = "../descriptors/domain_ids"; + +sub delete_output_files { + unlink PerlACE::LocalFile ($repoior); +} + +sub kill_open_processes { + if ($irepo_running == 1) { + $IREPO->Kill (); + $IREPO->TimedWait (1); + } +} + +delete_output_files (); + +$psresult = `ps axo comm= | grep DCPSInfoRepo`; +if ($psresult) { + die "please shutdown any running DCPSInfoRepo first!\n"; +} + +# Invoke DCPS information repository +$IREPO = new PerlACE::Process ("$DDS_ROOT/bin/DCPSInfoRepo", + "-ORBSvcConf $svcconf -ORBEndpoint iiop://$repaddr -d $domainids"); +$IREPO->Spawn (); + +print STDERR "Starting DCPS Info Repository\n"; + +if (PerlACE::waitforfile_timed ($repoior, $PerlACE::wait_interval_for_process_creation) == -1) +{ + print STDERR "ERROR: cannot find DCPS Info Repo IOR file\n"; + $IREPO->Kill (); + exit 1; +} + +$irepo_running = 1; + +# invoke publisher +print "Invoking DDS publisher\n"; +$pub = new PerlACE::Process ("../Publisher/publisher", + "-ORBSvcConf $svcconf -DCPSConfigFile $dcpsconf"); +$pub->Spawn (); + +print "\n*************************************************************************\n"; +print "* Press any key to shutdown the test ...\n"; +print "*************************************************************************\n\n"; +$confirmation = <STDIN>; + +# Invoke executor - stop the application -. +print "killing the publisher\n"; +$pub->Kill (); +$pub->TimedWait (1); + +kill_open_processes (); +delete_output_files (); + +exit 0; |