From a75ae25c02118f49ed9d947ae87022910552a587 Mon Sep 17 00:00:00 2001 From: Phil Mesnier Date: Thu, 19 Mar 2009 13:59:11 +0000 Subject: Thu Mar 19 13:49:23 UTC 2009 Phil Mesnier * configure.ac: * orbsvcs/tests/Notify/Makefile.am: Add new build to the automake files. * orbsvcs/tests/Notify/Validate_Client/Makefile.am: * orbsvcs/tests/Notify/Validate_Client/README: * orbsvcs/tests/Notify/Validate_Client/Validate_Client.mpc: * orbsvcs/tests/Notify/Validate_Client/proxy_dummy.cpp: * orbsvcs/tests/Notify/Validate_Client/run_test.pl: Added a server that generates the persistence file for the notify service that is uses locally created references. This should ensure that the validator feature will actually get a OBJECT_NOT_EXIST exception rather than time out trying to resolve an unknown hostname. The problem with this test was the original source persistence file contained proxy references that were unresolvable, and so on some hosts, it took longer than the timeout period to fail to resolve, and this caused the validator to get a TIMEOUT exception and decide that the peer is still present, just busy. Thus the proxy would not be reaped, and the persistence file would end up with proxy references, causing the test to fail. * orbsvcs/tests/Notify/Validate_Client/persistency_copy: Removed this file, the source data file is generated now. --- TAO/ChangeLog | 34 +++- TAO/configure.ac | 1 + TAO/orbsvcs/tests/Notify/Makefile.am | 3 +- .../tests/Notify/Validate_Client/Makefile.am | 51 ++++++ TAO/orbsvcs/tests/Notify/Validate_Client/README | 11 +- .../Notify/Validate_Client/Validate_Client.mpc | 11 ++ .../tests/Notify/Validate_Client/persistency_copy | 95 ---------- .../tests/Notify/Validate_Client/proxy_dummy.cpp | 202 +++++++++++++++++++++ .../tests/Notify/Validate_Client/run_test.pl | 15 +- 9 files changed, 318 insertions(+), 105 deletions(-) create mode 100644 TAO/orbsvcs/tests/Notify/Validate_Client/Makefile.am create mode 100644 TAO/orbsvcs/tests/Notify/Validate_Client/Validate_Client.mpc delete mode 100644 TAO/orbsvcs/tests/Notify/Validate_Client/persistency_copy create mode 100644 TAO/orbsvcs/tests/Notify/Validate_Client/proxy_dummy.cpp diff --git a/TAO/ChangeLog b/TAO/ChangeLog index d8fd3ef900c..0ea970ea709 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,35 @@ +Thu Mar 19 13:49:23 UTC 2009 Phil Mesnier + + * configure.ac: + * orbsvcs/tests/Notify/Makefile.am: + + Add new build to the automake files. + + * orbsvcs/tests/Notify/Validate_Client/Makefile.am: + * orbsvcs/tests/Notify/Validate_Client/README: + * orbsvcs/tests/Notify/Validate_Client/Validate_Client.mpc: + * orbsvcs/tests/Notify/Validate_Client/proxy_dummy.cpp: + * orbsvcs/tests/Notify/Validate_Client/run_test.pl: + + Added a server that generates the persistence file for the + notify service that is uses locally created references. This + should ensure that the validator feature will actually get a + OBJECT_NOT_EXIST exception rather than time out trying to + resolve an unknown hostname. + + The problem with this test was the original source persistence + file contained proxy references that were unresolvable, and so + on some hosts, it took longer than the timeout period to fail to + resolve, and this caused the validator to get a TIMEOUT + exception and decide that the peer is still present, just + busy. Thus the proxy would not be reaped, and the persistence + file would end up with proxy references, causing the test to + fail. + + * orbsvcs/tests/Notify/Validate_Client/persistency_copy: + + Removed this file, the source data file is generated now. + Thu Mar 19 04:55:02 UTC 2009 Phil Mesnier * orbsvcs/orbsvcs/Notify/CosNotify_Service.cpp: @@ -8,7 +40,7 @@ Thu Mar 19 04:55:02 UTC 2009 Phil Mesnier the notify service. This was a problem on some platforms such as Solaris where the validator thread continued to run during service shutdown, yielding a crash. - + Thu Mar 19 03:02:52 UTC 2009 Phil Mesnier * orbsvcs/orbsvcs/Notify/ETCL_Filter.cpp: diff --git a/TAO/configure.ac b/TAO/configure.ac index 00fc064768b..0f3f8804474 100644 --- a/TAO/configure.ac +++ b/TAO/configure.ac @@ -524,6 +524,7 @@ if test $tao_build_tests = yes; then orbsvcs/tests/Notify/performance-tests/RedGreen/Makefile orbsvcs/tests/Notify/performance-tests/Throughput/Makefile orbsvcs/tests/Notify/Timeout/Makefile + orbsvcs/tests/Notify/Validate_Client/Makefile orbsvcs/tests/Property/Makefile orbsvcs/tests/Redundant_Naming/Makefile orbsvcs/tests/Sched/Makefile diff --git a/TAO/orbsvcs/tests/Notify/Makefile.am b/TAO/orbsvcs/tests/Notify/Makefile.am index 022957c0820..fd57f40dcae 100644 --- a/TAO/orbsvcs/tests/Notify/Makefile.am +++ b/TAO/orbsvcs/tests/Notify/Makefile.am @@ -32,7 +32,8 @@ SUBDIRS = \ Bug_1385_Regression \ Blocking \ Basic \ - Timeout + Timeout \ + Validate_Client if BUILD_TESTS SUBDIRS += performance-tests diff --git a/TAO/orbsvcs/tests/Notify/Validate_Client/Makefile.am b/TAO/orbsvcs/tests/Notify/Validate_Client/Makefile.am new file mode 100644 index 00000000000..1923fd9d2de --- /dev/null +++ b/TAO/orbsvcs/tests/Notify/Validate_Client/Makefile.am @@ -0,0 +1,51 @@ +## Process this file with automake to create Makefile.in +## +## $Id$ +## +## This file was generated by MPC. Any changes made directly to +## this file will be lost the next time it is generated. +## +## MPC Command: +## /tao_builds/phil/wustl/ACE+TAO+CIAO/ACE_wrappers/build/native/bin/mwc.pl -type automake + +ACE_BUILDDIR = $(top_builddir)/.. +ACE_ROOT = $(top_srcdir)/.. +TAO_BUILDDIR = $(top_builddir) +TAO_ROOT = $(top_srcdir) + + +## Makefile.Validate_Client_Proxy_Dummy.am + +if BUILD_EXCEPTIONS + +noinst_PROGRAMS = proxy_dummy + +proxy_dummy_CPPFLAGS = \ + -I$(ACE_ROOT) \ + -I$(ACE_BUILDDIR) \ + -I$(TAO_ROOT) \ + -I$(TAO_BUILDDIR) + +proxy_dummy_SOURCES = \ + proxy_dummy.cpp + +proxy_dummy_LDADD = \ + $(TAO_BUILDDIR)/tao/libTAO_PortableServer.la \ + $(TAO_BUILDDIR)/tao/llibTAO_AnyTypeCode.la \ + $(TAO_BUILDDIR)/tao/llibTAO.la \ + $(ACE_BUILDDIR)/ace/libACE.la + +endif BUILD_EXCEPTIONS + + +ACLOCAL = @ACLOCAL@ +ACLOCAL_AMFLAGS = -I m4 +AUTOMAKE_OPTIONS = foreign + +## Clean up template repositories, etc. +clean-local: + -rm -f *~ *.bak *.rpo *.sym lib*.*_pure_* core core.* + -rm -f gcctemp.c gcctemp so_locations *.ics + -rm -rf cxx_repository ptrepository ti_files + -rm -rf templateregistry ir.out + -rm -rf ptrepository SunWS_cache Templates.DB diff --git a/TAO/orbsvcs/tests/Notify/Validate_Client/README b/TAO/orbsvcs/tests/Notify/Validate_Client/README index 2182774607c..4bf085ce6e9 100644 --- a/TAO/orbsvcs/tests/Notify/Validate_Client/README +++ b/TAO/orbsvcs/tests/Notify/Validate_Client/README @@ -1,10 +1,13 @@ This test is to verify the Notification Service client connection validation feature. -The test simply runs Notify_Service with persistent on. It uses -an XML persistent file with some proxies specified. Grep proxy -in XML before and after Notify_Service start to verify if the -Notify_Service the connection validation feature. +The test synthesizes a persistency file that points to a dummy +service. The Notify service is then run so that it uses the +persistency file to restore a topology and eventually reap the +proxies because the "ping" yields an OBJECT_NOT_EXIST exception. + +The result should be that after a few seconds, a new persistence +file is created that contains no proxy references. Run ./run_test.pl and it should output "test passed". diff --git a/TAO/orbsvcs/tests/Notify/Validate_Client/Validate_Client.mpc b/TAO/orbsvcs/tests/Notify/Validate_Client/Validate_Client.mpc new file mode 100644 index 00000000000..1ebcf636372 --- /dev/null +++ b/TAO/orbsvcs/tests/Notify/Validate_Client/Validate_Client.mpc @@ -0,0 +1,11 @@ +// -*- MPC -*- +// $Id$ + +project(*proxy_dummy): taoserver { + exename=proxy_dummy + Source_Files { + proxy_dummy.cpp + } +} + + diff --git a/TAO/orbsvcs/tests/Notify/Validate_Client/persistency_copy b/TAO/orbsvcs/tests/Notify/Validate_Client/persistency_copy deleted file mode 100644 index 412a50707ea..00000000000 --- a/TAO/orbsvcs/tests/Notify/Validate_Client/persistency_copy +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/TAO/orbsvcs/tests/Notify/Validate_Client/proxy_dummy.cpp b/TAO/orbsvcs/tests/Notify/Validate_Client/proxy_dummy.cpp new file mode 100644 index 00000000000..79f179f8bfb --- /dev/null +++ b/TAO/orbsvcs/tests/Notify/Validate_Client/proxy_dummy.cpp @@ -0,0 +1,202 @@ +// $Id$ + +#include "ace/Get_Opt.h" +#include "ace/OS_NS_stdio.h" +#include "tao/ORB.h" +#include "tao/PortableServer/POAC.h" +#include "tao/PortableServer/POAManagerC.h" + +ACE_RCSID (Validate_Client, + gen_data, + "$Id$") + +const ACE_TCHAR *output_filename = ACE_TEXT ("persistence.notify.xml"); + +// must be char +const char *format = + "\n" + "\n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + "\n" + ; + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("o:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'o': + output_filename = get_opts.opt_arg (); + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("usage: %s ") + ACE_TEXT ("-o ") + ACE_TEXT ("\n"), + argv [0]), + -1); + } + // Indicates sucessful parsing of the command line + return 0; +} + +int +ACE_TMAIN(int argc, ACE_TCHAR *argv[]) +{ + try + { + CORBA::ORB_var orb = + CORBA::ORB_init (argc, argv); + + CORBA::Object_var poa_object = + orb->resolve_initial_references("RootPOA"); + + PortableServer::POA_var root_poa = + PortableServer::POA::_narrow (poa_object.in ()); + + 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 (); + + if (parse_args (argc, argv) != 0) + return 1; + + CORBA::String_var repo_id = + "IDL:omg.org/CosNotifyComm/StructuredPushConsumer:1.0"; + + CORBA::Object_var object = + root_poa->create_reference (repo_id.in()); + + CORBA::String_var ior = orb->object_to_string (object.in ()); + + FILE *output_file= ACE_OS::fopen (output_filename, "w"); + if (output_file == 0) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("Cannot open output file for writing IOR: %C\n"), + output_file), + 1); + const char * dummy_consumer_proxy = ior.in(); + + ACE_OS::fprintf (output_file, format, + dummy_consumer_proxy, dummy_consumer_proxy, + dummy_consumer_proxy, dummy_consumer_proxy); + ACE_OS::fclose (output_file); + + poa_manager->activate (); + + orb->run (); + + ACE_DEBUG ((LM_DEBUG, "(%P|%t) server - event loop finished\n")); + + root_poa->destroy (1, 1); + + orb->destroy (); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Exception caught:"); + return 1; + } + + return 0; +} diff --git a/TAO/orbsvcs/tests/Notify/Validate_Client/run_test.pl b/TAO/orbsvcs/tests/Notify/Validate_Client/run_test.pl index 35d80dc2725..bd989d4e6cb 100755 --- a/TAO/orbsvcs/tests/Notify/Validate_Client/run_test.pl +++ b/TAO/orbsvcs/tests/Notify/Validate_Client/run_test.pl @@ -14,7 +14,6 @@ PerlACE::check_privilege_group(); $notifyior = PerlACE::LocalFile ("notify.ior"); $notify_conf = PerlACE::LocalFile ("notify$PerlACE::svcconf_ext"); -$persistent_file_orig = PerlACE::LocalFile ("persistency_copy"); $persistent_file_prefix = "persistency.notif"; $persistent_file = PerlACE::LocalFile ("persistency.notif.xml"); @@ -28,14 +27,22 @@ $TS = new PerlACE::Process ("../../../Notify_Service/Notify_Service", unlink $notifyior; unlink <$persistent_file_prefix.*>; -copy($persistent_file_orig, $persistent_file) or die "Persistent File cannot be copied."; + +$DUMMY = new PerlACE::Process ("proxy_dummy", "-o $persistent_file"); +$DUMMY->Spawn(); +if (PerlACE::waitforfile_timed ($persistent_file, $PerlACE::wait_interval_for_process_creation) == -1) { + print STDERR "ERROR: waiting for the proxy_dummy to start\n"; + $DUMMY->Kill (); + exit 1; +} + $TS->Spawn (); if (PerlACE::waitforfile_timed ($notifyior, $PerlACE::wait_interval_for_process_creation) == -1) { print STDERR "ERROR: waiting for the notify service to start\n"; $TS->Kill (); - $NS->Kill (); + $DUMMY->Kill (); exit 1; } @@ -63,7 +70,7 @@ else } $TS->Kill (); - +$DUMMY->Kill (); unlink $persistent_file; unlink $notifyior; -- cgit v1.2.1