diff options
Diffstat (limited to 'TAO/tests/Client_Leaks/child.cpp')
-rw-r--r-- | TAO/tests/Client_Leaks/child.cpp | 70 |
1 files changed, 27 insertions, 43 deletions
diff --git a/TAO/tests/Client_Leaks/child.cpp b/TAO/tests/Client_Leaks/child.cpp index a0238cb7074..2d5b51a97f2 100644 --- a/TAO/tests/Client_Leaks/child.cpp +++ b/TAO/tests/Client_Leaks/child.cpp @@ -5,33 +5,6 @@ ACE_RCSID(Client_Leaks, server, "$Id$") -const char *ior_output_file = "test.ior"; - -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.optarg; - 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; -} - int main (int argc, char *argv[]) { @@ -41,6 +14,31 @@ main (int argc, char *argv[]) CORBA::ORB_init (argc, argv, "", ACE_TRY_ENV); ACE_TRY_CHECK; + if (argc < 2) + { + // Paranoia, we should have an auto_ptr-like gadget for + // this. + orb->destroy (ACE_TRY_ENV); + ACE_TRY_CHECK; + + ACE_ERROR_RETURN ((LM_ERROR, + "Usage: %s <ior>\n", + argv[0]), 1); + } + + CORBA::Object_var object = + orb->string_to_object (argv[1], ACE_TRY_ENV); + ACE_TRY_CHECK; + Test::Startup_Callback_var startup_callback = + Test::Startup_Callback::_narrow (object.in (), ACE_TRY_ENV); + ACE_TRY_CHECK; + if (CORBA::is_nil (startup_callback.in ())) + { + ACE_ERROR_RETURN ((LM_ERROR, + "ERROR: nil startup callback\n"), + 1); + } + CORBA::Object_var poa_object = orb->resolve_initial_references("RootPOA", ACE_TRY_ENV); ACE_TRY_CHECK; @@ -58,9 +56,6 @@ main (int argc, char *argv[]) root_poa->the_POAManager (ACE_TRY_ENV); ACE_TRY_CHECK; - if (parse_args (argc, argv) != 0) - return 1; - Process *process_impl; ACE_NEW_RETURN (process_impl, Process (orb.in ()), @@ -71,21 +66,10 @@ main (int argc, char *argv[]) process_impl->_this (ACE_TRY_ENV); ACE_TRY_CHECK; - CORBA::String_var ior = - orb->object_to_string (process.in (), ACE_TRY_ENV); + poa_manager->activate (ACE_TRY_ENV); 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_TRY_ENV); + startup_callback->started (process.in (), ACE_TRY_ENV); ACE_TRY_CHECK; ACE_Time_Value tv (50, 0); |