diff options
author | William R. Otte <wotte@dre.vanderbilt.edu> | 2006-07-24 15:50:11 +0000 |
---|---|---|
committer | William R. Otte <wotte@dre.vanderbilt.edu> | 2006-07-24 15:50:11 +0000 |
commit | 6b846cf03c0bcbd8c276cb0af61a181e5f98eaae (patch) | |
tree | da50d054f9c761c3f6a5923f6979e93306c56d68 /TAO/tests/Bug_1270_Regression | |
parent | 0e555b9150d38e3b3473ba325b56db2642e6352b (diff) | |
download | ATCD-6b846cf03c0bcbd8c276cb0af61a181e5f98eaae.tar.gz |
Repo restructuring
Diffstat (limited to 'TAO/tests/Bug_1270_Regression')
-rw-r--r-- | TAO/tests/Bug_1270_Regression/.cvsignore | 3 | ||||
-rw-r--r-- | TAO/tests/Bug_1270_Regression/Bug_1270_Regression.mpc | 25 | ||||
-rw-r--r-- | TAO/tests/Bug_1270_Regression/Echo.cpp | 43 | ||||
-rw-r--r-- | TAO/tests/Bug_1270_Regression/Echo.h | 31 | ||||
-rw-r--r-- | TAO/tests/Bug_1270_Regression/Echo_Caller.cpp | 40 | ||||
-rw-r--r-- | TAO/tests/Bug_1270_Regression/Echo_Caller.h | 30 | ||||
-rw-r--r-- | TAO/tests/Bug_1270_Regression/ORB_Task.cpp | 33 | ||||
-rw-r--r-- | TAO/tests/Bug_1270_Regression/ORB_Task.h | 25 | ||||
-rw-r--r-- | TAO/tests/Bug_1270_Regression/Server_Timer.cpp | 74 | ||||
-rw-r--r-- | TAO/tests/Bug_1270_Regression/Server_Timer.h | 41 | ||||
-rw-r--r-- | TAO/tests/Bug_1270_Regression/Test.idl | 28 | ||||
-rw-r--r-- | TAO/tests/Bug_1270_Regression/client.cpp | 171 | ||||
-rwxr-xr-x | TAO/tests/Bug_1270_Regression/run_test.pl | 65 | ||||
-rw-r--r-- | TAO/tests/Bug_1270_Regression/server.cpp | 134 | ||||
-rw-r--r-- | TAO/tests/Bug_1270_Regression/shutdown.cpp | 85 |
15 files changed, 0 insertions, 828 deletions
diff --git a/TAO/tests/Bug_1270_Regression/.cvsignore b/TAO/tests/Bug_1270_Regression/.cvsignore deleted file mode 100644 index d955c473987..00000000000 --- a/TAO/tests/Bug_1270_Regression/.cvsignore +++ /dev/null @@ -1,3 +0,0 @@ -client -server -shutdown diff --git a/TAO/tests/Bug_1270_Regression/Bug_1270_Regression.mpc b/TAO/tests/Bug_1270_Regression/Bug_1270_Regression.mpc deleted file mode 100644 index 146c41a5026..00000000000 --- a/TAO/tests/Bug_1270_Regression/Bug_1270_Regression.mpc +++ /dev/null @@ -1,25 +0,0 @@ -// -*- MPC -*- -// $Id$ - -project(*Server): taoserver, messaging { - Source_Files { - Echo_Caller.cpp - Server_Timer.cpp - server.cpp - } -} - -project(*Client): taoclient, messaging { - after += *Server - Source_Files { - Echo.cpp - client.cpp - } -} - -project(*Shutdown): taoexe, messaging { - after += *Client - Source_Files { - shutdown.cpp - } -} diff --git a/TAO/tests/Bug_1270_Regression/Echo.cpp b/TAO/tests/Bug_1270_Regression/Echo.cpp deleted file mode 100644 index df37f3c644b..00000000000 --- a/TAO/tests/Bug_1270_Regression/Echo.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/** - * @file Echo.cpp - * - * $Id$ - * - * @author Carlos O'Ryan <coryan@atdesk.com> - * - */ -#include "Echo.h" -#include "ace/OS_NS_unistd.h" - -ACE_RCSID(Bug_1270_Regression, Echo, "$Id$") - -Echo::Echo(CORBA::ORB_ptr orb, - int abort_counter) - : orb_(CORBA::ORB::_duplicate(orb)) - , abort_counter_(abort_counter) -{ -} - -void -Echo::echo_payload(Test::Payload const & - ACE_ENV_ARG_DECL_NOT_USED) - ACE_THROW_SPEC((CORBA::SystemException)) -{ - this->abort_counter_--; - - if (this->abort_counter_ == 0) - { - ACE_DEBUG ((LM_DEBUG, "(%P|%t) Echo::echo_payload, sleeping\n")); - // Sleep for 15 seconds, forcing a flow control of some kind. - ACE_OS::sleep(15); - - // Run the ORB for a while, to generate a short-lived release of - // the flow control. - ACE_Time_Value tv(0, 10000); - this->orb_->perform_work(tv); - - ACE_DEBUG ((LM_DEBUG, "(%P|%t) Echo::echo_payload, aborting\n")); - // Kill the app - ACE_OS::abort(); - } -} diff --git a/TAO/tests/Bug_1270_Regression/Echo.h b/TAO/tests/Bug_1270_Regression/Echo.h deleted file mode 100644 index ba9fc0be452..00000000000 --- a/TAO/tests/Bug_1270_Regression/Echo.h +++ /dev/null @@ -1,31 +0,0 @@ - -/** - * @file Echo.h - * - * $Id$ - * - * @author Carlos O'Ryan <coryan@atdesk.com> - * - */ -#ifndef TAO_TESTS_BUG1270_ECHO_H -#define TAO_TESTS_BUG1270_ECHO_H - -#include "TestS.h" - -class Echo : public POA_Test::Echo -{ -public: - Echo(CORBA::ORB_ptr orb, - int abort_counter); - - virtual void echo_payload (Test::Payload const & data - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC((CORBA::SystemException)); - -private: - CORBA::ORB_var orb_; - - int abort_counter_; -}; - -#endif /* TAO_TESTS_BUG1270_ECHO_H*/ diff --git a/TAO/tests/Bug_1270_Regression/Echo_Caller.cpp b/TAO/tests/Bug_1270_Regression/Echo_Caller.cpp deleted file mode 100644 index a208f05a8ed..00000000000 --- a/TAO/tests/Bug_1270_Regression/Echo_Caller.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/** - * @file Echo_Caller.cpp - * - * $Id$ - * - * @author Carlos O'Ryan <coryan@atdesk.com> - * - */ -#include "Echo_Caller.h" -#include "Server_Timer.h" -#include "tao/ORB_Core.h" - -ACE_RCSID(Bug_1270_Regression, Echo_Caller, "$Id$") - -Echo_Caller::Echo_Caller(CORBA::ORB_ptr orb) - : orb_(CORBA::ORB::_duplicate(orb)) -{ -} - -void -Echo_Caller::start_task(Test::Echo_ptr client - ACE_ENV_ARG_DECL_NOT_USED) - ACE_THROW_SPEC((CORBA::SystemException)) -{ - Server_Timer * task = - new Server_Timer(client, orb_->orb_core()->reactor()); - task->activate(); - - task = - new Server_Timer(client, orb_->orb_core()->reactor()); - task->activate(); -} - -void -Echo_Caller::shutdown(ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC((CORBA::SystemException)) -{ - ACE_DEBUG ((LM_DEBUG, "Server received shutdown message\n")); - orb_->shutdown(0 ACE_ENV_ARG_PARAMETER); -} diff --git a/TAO/tests/Bug_1270_Regression/Echo_Caller.h b/TAO/tests/Bug_1270_Regression/Echo_Caller.h deleted file mode 100644 index cff3dec424e..00000000000 --- a/TAO/tests/Bug_1270_Regression/Echo_Caller.h +++ /dev/null @@ -1,30 +0,0 @@ -/** - * @file Echo_Caller.h - * - * $Id$ - * - * @author Carlos O'Ryan <coryan@atdesk.com> - * - */ -#ifndef Echo_Caller__h_ -#define Echo_Caller__h_ - -#include "TestS.h" - -class Echo_Caller : public POA_Test::Echo_Caller -{ -public: - Echo_Caller(CORBA::ORB_ptr orb); - - virtual void start_task(Test::Echo_ptr client - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC((CORBA::SystemException)); - - virtual void shutdown(ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC((CORBA::SystemException)); - -private: - CORBA::ORB_var orb_; -}; - -#endif /* Echo_Caller__h_ */ diff --git a/TAO/tests/Bug_1270_Regression/ORB_Task.cpp b/TAO/tests/Bug_1270_Regression/ORB_Task.cpp deleted file mode 100644 index a011e89137d..00000000000 --- a/TAO/tests/Bug_1270_Regression/ORB_Task.cpp +++ /dev/null @@ -1,33 +0,0 @@ -/** - * @file ORB_Task.cpp - * - * $Id$ - * - * @author Carlos O'Ryan <coryan@atdesk.com> - * - */ -#include "ORB_Task.h" -#include "tao/Environment.h" - -ACE_RCSID(Bug_1270_Regression, ORB_Task, "$Id$") - -ORB_Task::ORB_Task (CORBA::ORB_ptr orb) - : orb_ (CORBA::ORB::_duplicate (orb)) -{ -} - -int -ORB_Task::svc (void) -{ - ACE_DECLARE_NEW_CORBA_ENV; - ACE_TRY - { - this->orb_->run (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCH (CORBA::Exception, ex) - { - } - ACE_ENDTRY; - return 0; -} diff --git a/TAO/tests/Bug_1270_Regression/ORB_Task.h b/TAO/tests/Bug_1270_Regression/ORB_Task.h deleted file mode 100644 index 55ce8c75d3d..00000000000 --- a/TAO/tests/Bug_1270_Regression/ORB_Task.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef ORB_Task__h_ -#define ORB_Task__h_ -/** - * @file ORB_Task.h - * - * $Id$ - * - * @author Carlos O'Ryan <coryan@atdesk.com> - * - */ -#include "tao/ORB.h" -#include "ace/Task.h" - -class ORB_Task : public ACE_Task_Base -{ -public: - ORB_Task(CORBA::ORB_ptr orb); - - virtual int svc (void); - -private: - CORBA::ORB_var orb_; -}; - -#endif /* ORB_Task__h_ */ diff --git a/TAO/tests/Bug_1270_Regression/Server_Timer.cpp b/TAO/tests/Bug_1270_Regression/Server_Timer.cpp deleted file mode 100644 index 7deb4156030..00000000000 --- a/TAO/tests/Bug_1270_Regression/Server_Timer.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/** - * @file Server_Timer.cpp - * - * $Id$ - * - * @author Carlos O'Ryan <coryan@atdesk.com> - * - */ -#include "Server_Timer.h" -#include "ace/Reactor.h" -#include "ace/OS_NS_string.h" - -ACE_RCSID(Bug_1270_Regression, Server_Timer, "$Id$") - -Server_Timer::Server_Timer(Test::Echo_ptr echo, - ACE_Reactor * reactor) - : ACE_Event_Handler (reactor) - , echo_(Test::Echo::_duplicate(echo)) - , refcnt_ (1) -{ -} - -void -Server_Timer::activate (void) -{ - ACE_Time_Value tv (0, 20000); - this->reactor()->schedule_timer (this, 0, tv, tv); -} - -int -Server_Timer::handle_timeout (ACE_Time_Value const &, void const *) -{ - refcnt_++; - - Test::Payload pload (1024); - pload.length (1024); - - ACE_OS::memset (pload.get_buffer(), pload.length(), 0); - - ACE_DECLARE_NEW_CORBA_ENV; - ACE_TRY - { - Test::Echo_var echo = - Test::Echo::_duplicate (this->echo_.in ()); - - if(CORBA::is_nil (echo.in ())) - return 0; - - echo->echo_payload (pload - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - this->echo_ = Test::Echo::_nil (); - - if (this->reactor ()->cancel_timer (this) != 0) - refcnt_--; - } - ACE_ENDTRY; - - refcnt_--; - if(refcnt_ == 0) - return -1; - - return 0; -} - -int -Server_Timer::handle_close (ACE_HANDLE, ACE_Reactor_Mask) -{ - delete this; - return 0; -} diff --git a/TAO/tests/Bug_1270_Regression/Server_Timer.h b/TAO/tests/Bug_1270_Regression/Server_Timer.h deleted file mode 100644 index 55d51862464..00000000000 --- a/TAO/tests/Bug_1270_Regression/Server_Timer.h +++ /dev/null @@ -1,41 +0,0 @@ -/** - * @file Server_Timer.h - * - * $Id$ - * - * @author Carlos O'Ryan <coryan@atdesk.com> - * - */ - -#ifndef Server_Timer__h_ -#define Server_Timer__h_ -#include /**/ "ace/pre.h" - -#include "TestC.h" -#include "ace/Event_Handler.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -class Server_Timer : public ACE_Event_Handler -{ -public: - /// Constructor - Server_Timer (Test::Echo_ptr echo, ACE_Reactor * reactor); - - void activate (void); - - /// Thread entry point - int handle_timeout(ACE_Time_Value const & tv, void const *); - int handle_close (ACE_HANDLE, ACE_Reactor_Mask); - -private: - /// Reference to the test interface - Test::Echo_var echo_; - - int refcnt_; -}; - -#include /**/ "ace/post.h" -#endif /* Server_Timer__h_ */ diff --git a/TAO/tests/Bug_1270_Regression/Test.idl b/TAO/tests/Bug_1270_Regression/Test.idl deleted file mode 100644 index 7e21df19733..00000000000 --- a/TAO/tests/Bug_1270_Regression/Test.idl +++ /dev/null @@ -1,28 +0,0 @@ -/** - * @file Test.idl - * - * $Id$ - * - * @author Carlos O'Ryan <coryan@atdesk.com> - * - */ -#ifndef Test__idl_ -#define Test__idl_ - -module Test -{ - typedef sequence<octet> Payload; - interface Echo - { - oneway void echo_payload(in Payload data); - }; - - interface Echo_Caller - { - void start_task(in Echo client); - - oneway void shutdown(); - }; -}; - -#endif /* Test__idl_ */ diff --git a/TAO/tests/Bug_1270_Regression/client.cpp b/TAO/tests/Bug_1270_Regression/client.cpp deleted file mode 100644 index 8405b2d1c0c..00000000000 --- a/TAO/tests/Bug_1270_Regression/client.cpp +++ /dev/null @@ -1,171 +0,0 @@ -// $Id$ - -#include "Echo.h" -#include "ORB_Task.h" -#include "tao/Messaging/Messaging.h" -#include "tao/AnyTypeCode/Any.h" -#include "tao/Utils/Servant_Var.h" -#include "tao/ORB_Core.h" -#include "ace/Get_Opt.h" -#include "ace/Reactor.h" - -ACE_RCSID(Bug_1270_Regression, client, "$Id$") - -const char *ior = "file://test.ior"; - -int -parse_args (int argc, char *argv[]); - -int -main (int argc, char *argv[]) -{ - ACE_TRY_NEW_ENV - { - CORBA::ORB_var orb = - CORBA::ORB_init (argc, argv, "" - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - CORBA::Object_var poa_object = - orb->resolve_initial_references("RootPOA" - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - PortableServer::POA_var root_poa = - PortableServer::POA::_narrow (poa_object.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (CORBA::is_nil (root_poa.in ())) - ACE_ERROR_RETURN ((LM_ERROR, - " (%P|%t) Panic: nil RootPOA\n"), - 1); - - PortableServer::POAManager_var poa_manager = - root_poa->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - CORBA::Object_var object = - orb->resolve_initial_references ("PolicyCurrent" ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - CORBA::PolicyCurrent_var policy_current = - CORBA::PolicyCurrent::_narrow (object.in () ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (CORBA::is_nil (policy_current.in ())) - { - ACE_ERROR ((LM_ERROR, "ERROR: Nil policy current\n")); - return 1; - } - CORBA::Any scope_as_any; - scope_as_any <<= Messaging::SYNC_WITH_TRANSPORT; - - CORBA::PolicyList policies(1); policies.length (1); - policies[0] = - orb->create_policy (Messaging::SYNC_SCOPE_POLICY_TYPE, - scope_as_any - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - policy_current->set_policy_overrides (policies, CORBA::ADD_OVERRIDE - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - policies[0]->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (parse_args (argc, argv) != 0) - return 1; - - TAO::Utils::Servant_Var<Echo> impl; - { - Echo * tmp; - // ACE_NEW_RETURN is the worst possible way to handle - // exceptions (think: what if the constructor allocates memory - // and fails?), but I'm not in the mood to fight for a more - // reasonable way to handle allocation errors in ACE. - ACE_NEW_RETURN (tmp, - Echo(orb.in(), 100), - 1); - impl = tmp; - } - - Test::Echo_var echo = - impl->_this (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - CORBA::Object_var tmp = - orb->string_to_object(ior - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - Test::Echo_Caller_var server = - Test::Echo_Caller::_narrow(tmp.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (CORBA::is_nil (echo.in ())) - { - ACE_ERROR_RETURN ((LM_DEBUG, - "Nil Test::Echo_Caller reference <%s>\n", - ior), - 1); - } - - poa_manager->activate (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - server->start_task(echo.in() - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - orb->run (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - ACE_DEBUG ((LM_DEBUG, "(%P|%t) client - event loop finished\n")); - - // Actually the code here should never be reached. - root_poa->destroy (1, 1 - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - orb->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, - "Exception caught:"); - return 1; - } - ACE_ENDTRY; - - return 0; -} - -int -parse_args (int argc, char *argv[]) -{ - ACE_Get_Opt get_opts (argc, argv, "k:"); - int c; - - while ((c = get_opts ()) != -1) - switch (c) - { - case 'k': - ior = get_opts.opt_arg (); - break; - - case '?': - default: - ACE_ERROR_RETURN ((LM_ERROR, - "usage: %s " - "-k <ior> " - "\n", - argv [0]), - -1); - } - // Indicates sucessful parsing of the command line - return 0; -} diff --git a/TAO/tests/Bug_1270_Regression/run_test.pl b/TAO/tests/Bug_1270_Regression/run_test.pl deleted file mode 100755 index 9c650eae188..00000000000 --- a/TAO/tests/Bug_1270_Regression/run_test.pl +++ /dev/null @@ -1,65 +0,0 @@ -eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' - & eval 'exec perl -S $0 $argv:q' - if 0; - -# $Id$ -# -*- perl -*- - -use lib '../../../bin'; -use PerlACE::Run_Test; - -$iorfile = PerlACE::LocalFile ("server.ior"); -unlink $iorfile; - -if (PerlACE::is_vxworks_test()) { - $SV = new PerlACE::ProcessVX ("server", "-o server.ior"); -} -else { - $SV = new PerlACE::Process ("server", "-o $iorfile"); -} -$CL1 = new PerlACE::Process ("client", "-k file://$iorfile"); -$CL2 = new PerlACE::Process ("client", "-k file://$iorfile"); -$CL3 = new PerlACE::Process ("client", "-k file://$iorfile"); - -$SV->Spawn (); - -if (PerlACE::waitforfile_timed ($iorfile, - $PerlACE::wait_interval_for_process_creation) == -1) { - print STDERR "ERROR: cannot find file <$iorfile>\n"; - $SV->Kill (); $SV->TimedWait (1); - exit 1; -} - -local $start_time = time(); -local $max_running_time = 240; # 4 minutes -local $elapsed = time() - $start_time; - -while($elapsed < $max_running_time) { - # Start all clients in parallel - $client1 = $CL1->Spawn (); - $client2 = $CL2->Spawn (); - $client3 = $CL3->Spawn (); - - # ... wait for the clients to die unless they did not startup, - # ignore errors because they intentionally crash themselves! - $CL3->WaitKill(60) unless $client3 < 0; - $CL2->WaitKill(60) unless $client2 < 0; - $CL1->WaitKill(60) unless $client1 < 0; - - $elapsed = time() - $start_time; -} - -$SH = new PerlACE::Process ("shutdown", "-k file://$iorfile"); -my $shutdown = $SH->Spawn(); -$SH->WaitKill(10) unless $shutdown < 0; - -$server = $SV->WaitKill (10); - -if ($server != 0) { - print STDERR "ERROR: server returned $server\n"; - $status = 1; -} - -unlink $iorfile; - -exit $status; diff --git a/TAO/tests/Bug_1270_Regression/server.cpp b/TAO/tests/Bug_1270_Regression/server.cpp deleted file mode 100644 index 361b06dd275..00000000000 --- a/TAO/tests/Bug_1270_Regression/server.cpp +++ /dev/null @@ -1,134 +0,0 @@ -// $Id$ - -#include "Echo_Caller.h" -#include "tao/Messaging/Messaging.h" -#include "tao/Utils/Servant_Var.h" -#include "tao/ORB_Core.h" -#include "ace/Get_Opt.h" - -ACE_RCSID(Bug_1270_Regression, server, "$Id$") - -const char *ior_output_file = "test.ior"; - -int -parse_args (int argc, char *argv[]); - -int -main (int argc, char *argv[]) -{ - ACE_TRY_NEW_ENV - { - CORBA::ORB_var orb = - CORBA::ORB_init (argc, argv, "" - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - CORBA::Object_var poa_object = - orb->resolve_initial_references("RootPOA" - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - PortableServer::POA_var root_poa = - PortableServer::POA::_narrow (poa_object.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (CORBA::is_nil (root_poa.in ())) - ACE_ERROR_RETURN ((LM_ERROR, - " (%P|%t) Panic: nil RootPOA\n"), - 1); - - PortableServer::POAManager_var poa_manager = - root_poa->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - CORBA::Object_var object = - orb->resolve_initial_references ("PolicyCurrent" ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (parse_args (argc, argv) != 0) - return 1; - - TAO::Utils::Servant_Var<Echo_Caller> impl; - { - Echo_Caller * tmp; - // ACE_NEW_RETURN is the worst possible way to handle - // exceptions (think: what if the constructor allocates memory - // and fails?), but I'm not in the mood to fight for a more - // reasonable way to handle allocation errors in ACE. - ACE_NEW_RETURN (tmp, - Echo_Caller(orb.in()), - 1); - impl = tmp; - } - - Test::Echo_Caller_var server = - impl->_this (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - CORBA::String_var ior = - orb->object_to_string (server.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - // If the ior_output_file exists, output the ior to it - FILE *output_file= ACE_OS::fopen (ior_output_file, "w"); - if (output_file == 0) - ACE_ERROR_RETURN ((LM_ERROR, - "Cannot open output file for writing IOR: %s", - ior_output_file), - 1); - ACE_OS::fprintf (output_file, "%s", ior.in ()); - ACE_OS::fclose (output_file); - - poa_manager->activate (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - orb->run(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - ACE_DEBUG ((LM_DEBUG, "(%P|%t) server - event loop finished\n")); - - root_poa->destroy (1, 1 - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - orb->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, - "Exception caught:"); - return 1; - } - ACE_ENDTRY; - - return 0; -} - -int -parse_args (int argc, char *argv[]) -{ - ACE_Get_Opt get_opts (argc, argv, "o:"); - int c; - - while ((c = get_opts ()) != -1) - switch (c) - { - case 'o': - ior_output_file = get_opts.opt_arg (); - break; - - case '?': - default: - ACE_ERROR_RETURN ((LM_ERROR, - "usage: %s " - "-o <iorfile> " - "\n", - argv [0]), - -1); - } - // Indicates sucessful parsing of the command line - return 0; -} diff --git a/TAO/tests/Bug_1270_Regression/shutdown.cpp b/TAO/tests/Bug_1270_Regression/shutdown.cpp deleted file mode 100644 index 68026a71eec..00000000000 --- a/TAO/tests/Bug_1270_Regression/shutdown.cpp +++ /dev/null @@ -1,85 +0,0 @@ -// $Id$ - -#include "TestC.h" -#include "ace/Get_Opt.h" - -ACE_RCSID(Bug_1270_Regression, shutdown, "$Id$") - -const char *ior = "file://test.ior"; - -int -parse_args (int argc, char *argv[]); - -int -main (int argc, char *argv[]) -{ - ACE_TRY_NEW_ENV - { - CORBA::ORB_var orb = - CORBA::ORB_init (argc, argv, "" - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (parse_args (argc, argv) != 0) - return 1; - - CORBA::Object_var tmp = - orb->string_to_object (ior - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - Test::Echo_Caller_var server = - Test::Echo_Caller::_narrow(tmp.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (CORBA::is_nil (server.in ())) - { - ACE_ERROR_RETURN ((LM_DEBUG, - "Nil Test::Echo_Caller reference <%s>\n", - ior), - 1); - } - - server->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - orb->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, - "Exception caught:"); - return 1; - } - ACE_ENDTRY; - - return 0; -} - -int -parse_args (int argc, char *argv[]) -{ - ACE_Get_Opt get_opts (argc, argv, "k:"); - int c; - - while ((c = get_opts ()) != -1) - switch (c) - { - case 'k': - ior = get_opts.opt_arg (); - break; - - case '?': - default: - ACE_ERROR_RETURN ((LM_ERROR, - "usage: %s " - "-k <ior> " - "\n", - argv [0]), - -1); - } - // Indicates sucessful parsing of the command line - return 0; -} |