summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/tests
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/orbsvcs/tests')
-rw-r--r--TAO/orbsvcs/tests/Bug_3598b_Regression/Bug_3598b_Regression.mpc39
-rw-r--r--TAO/orbsvcs/tests/Bug_3598b_Regression/ClientORBInitializer.cpp28
-rw-r--r--TAO/orbsvcs/tests/Bug_3598b_Regression/ClientORBInitializer.h50
-rw-r--r--TAO/orbsvcs/tests/Bug_3598b_Regression/ClientRequest_Interceptor.cpp89
-rw-r--r--TAO/orbsvcs/tests/Bug_3598b_Regression/ClientRequest_Interceptor.h68
-rw-r--r--TAO/orbsvcs/tests/Bug_3598b_Regression/Hello.cpp23
-rw-r--r--TAO/orbsvcs/tests/Bug_3598b_Regression/Hello.h31
-rw-r--r--TAO/orbsvcs/tests/Bug_3598b_Regression/README12
-rw-r--r--TAO/orbsvcs/tests/Bug_3598b_Regression/Test.idl20
-rw-r--r--TAO/orbsvcs/tests/Bug_3598b_Regression/client.cpp102
-rwxr-xr-xTAO/orbsvcs/tests/Bug_3598b_Regression/run_test.pl76
-rw-r--r--TAO/orbsvcs/tests/Bug_3598b_Regression/server.cpp99
-rw-r--r--TAO/orbsvcs/tests/ImplRepo/Bug_2604_Regression/Messenger_i.cpp1
-rwxr-xr-xTAO/orbsvcs/tests/ImplRepo/Bug_2604_Regression/run_test.pl2
-rw-r--r--TAO/orbsvcs/tests/ImplRepo/nestea_client_i.cpp6
-rw-r--r--TAO/orbsvcs/tests/InterfaceRepo/Application_Test/IFR_Application_Test.mpc2
-rw-r--r--TAO/orbsvcs/tests/InterfaceRepo/Application_Test/Makefile.am5
-rw-r--r--TAO/orbsvcs/tests/InterfaceRepo/Application_Test/server.cpp29
-rw-r--r--TAO/orbsvcs/tests/InterfaceRepo/Application_Test/test_i.cpp2
-rw-r--r--TAO/orbsvcs/tests/InterfaceRepo/Bug_2962_Regression/client.cpp6
-rw-r--r--TAO/orbsvcs/tests/InterfaceRepo/Bug_3155_Regression/test_idl.cpp4
-rw-r--r--TAO/orbsvcs/tests/InterfaceRepo/IFR_Inheritance_Test/main.cpp53
-rwxr-xr-xTAO/orbsvcs/tests/InterfaceRepo/IFR_Inheritance_Test/run_test.pl4
-rw-r--r--TAO/orbsvcs/tests/Notify/Bug_1884_Regression/Bug_1884_Regression.mpc26
-rw-r--r--TAO/orbsvcs/tests/Notify/Bug_1884_Regression/common.h83
-rw-r--r--TAO/orbsvcs/tests/Notify/Bug_1884_Regression/consumer.cpp205
-rw-r--r--TAO/orbsvcs/tests/Notify/Bug_1884_Regression/ecf.conf2
-rw-r--r--TAO/orbsvcs/tests/Notify/Bug_1884_Regression/filter.cpp246
-rwxr-xr-xTAO/orbsvcs/tests/Notify/Bug_1884_Regression/run_test.pl118
-rw-r--r--TAO/orbsvcs/tests/Notify/Bug_1884_Regression/supplier.cpp148
-rw-r--r--TAO/orbsvcs/tests/Notify/Makefile.am4
-rw-r--r--TAO/orbsvcs/tests/Notify/Persistent_Filter/Filter.cpp752
-rw-r--r--TAO/orbsvcs/tests/Notify/Persistent_Filter/Filter.h270
-rw-r--r--TAO/orbsvcs/tests/Notify/Persistent_Filter/Makefile.am95
-rw-r--r--TAO/orbsvcs/tests/Notify/Persistent_Filter/NS.conf5
-rw-r--r--TAO/orbsvcs/tests/Notify/Persistent_Filter/Persistent_Filter.mpc19
-rw-r--r--TAO/orbsvcs/tests/Notify/Persistent_Filter/README10
-rw-r--r--TAO/orbsvcs/tests/Notify/Persistent_Filter/consumer.cpp30
-rwxr-xr-xTAO/orbsvcs/tests/Notify/Persistent_Filter/run_test.pl132
-rw-r--r--TAO/orbsvcs/tests/Notify/Persistent_Filter/supplier.cpp29
-rw-r--r--TAO/orbsvcs/tests/Notify/Test_Filter/RT_Test_FilterFactory.cpp45
-rw-r--r--TAO/orbsvcs/tests/Notify/Test_Filter/RT_Test_FilterFactory.h8
-rw-r--r--TAO/orbsvcs/tests/Notify/Test_Filter/Test_Filter.mpc2
-rw-r--r--TAO/orbsvcs/tests/Notify/Validate_Client/Makefile.am51
-rw-r--r--TAO/orbsvcs/tests/Notify/Validate_Client/README13
-rw-r--r--TAO/orbsvcs/tests/Notify/Validate_Client/Validate_Client.mpc11
-rw-r--r--TAO/orbsvcs/tests/Notify/Validate_Client/notify.conf4
-rw-r--r--TAO/orbsvcs/tests/Notify/Validate_Client/proxy_dummy.cpp202
-rwxr-xr-xTAO/orbsvcs/tests/Notify/Validate_Client/run_test.pl80
-rw-r--r--TAO/orbsvcs/tests/Security/mixed_security_test/server.cpp10
50 files changed, 3300 insertions, 51 deletions
diff --git a/TAO/orbsvcs/tests/Bug_3598b_Regression/Bug_3598b_Regression.mpc b/TAO/orbsvcs/tests/Bug_3598b_Regression/Bug_3598b_Regression.mpc
new file mode 100644
index 00000000000..63b37d20812
--- /dev/null
+++ b/TAO/orbsvcs/tests/Bug_3598b_Regression/Bug_3598b_Regression.mpc
@@ -0,0 +1,39 @@
+// -*- MPC -*-
+// $Id$
+
+project(*idl): taoidldefaults {
+ idlflags += -Sp
+ IDL_Files {
+ Test.idl
+ }
+ custom_only = 1
+}
+
+project(*Server): taoserver {
+ after += *idl
+ Source_Files {
+ Hello.cpp
+ server.cpp
+ }
+ Source_Files {
+ TestC.cpp
+ TestS.cpp
+ }
+ IDL_Files {
+ }
+}
+
+project(*Client): taoclient, pi, ftclientorb {
+ after += *idl
+ Source_Files {
+ ClientORBInitializer.cpp
+ ClientRequest_Interceptor.cpp
+ client.cpp
+ }
+ Source_Files {
+ TestC.cpp
+ }
+ IDL_Files {
+ }
+}
+
diff --git a/TAO/orbsvcs/tests/Bug_3598b_Regression/ClientORBInitializer.cpp b/TAO/orbsvcs/tests/Bug_3598b_Regression/ClientORBInitializer.cpp
new file mode 100644
index 00000000000..2f4406185c9
--- /dev/null
+++ b/TAO/orbsvcs/tests/Bug_3598b_Regression/ClientORBInitializer.cpp
@@ -0,0 +1,28 @@
+// -*- C++ -*-
+//
+// $Id$
+
+#include "ClientORBInitializer.h"
+
+void
+ClientORBInitializer::pre_init (PortableInterceptor::ORBInitInfo_ptr)
+{
+ // No-op
+}
+
+void
+ClientORBInitializer::post_init (PortableInterceptor::ORBInitInfo_ptr info)
+{
+ PortableInterceptor::ClientRequestInterceptor_ptr cri =
+ PortableInterceptor::ClientRequestInterceptor::_nil ();
+
+ ACE_NEW_THROW_EX (cri,
+ ClientRequest_Interceptor,
+ CORBA::NO_MEMORY ());
+
+ PortableInterceptor::ClientRequestInterceptor_var
+ client_interceptor = cri;
+
+ info->add_client_request_interceptor (client_interceptor.in ());
+
+}
diff --git a/TAO/orbsvcs/tests/Bug_3598b_Regression/ClientORBInitializer.h b/TAO/orbsvcs/tests/Bug_3598b_Regression/ClientORBInitializer.h
new file mode 100644
index 00000000000..1c0ca44b138
--- /dev/null
+++ b/TAO/orbsvcs/tests/Bug_3598b_Regression/ClientORBInitializer.h
@@ -0,0 +1,50 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file ClientORBInitializer.h
+ *
+ * $Id$
+ */
+//=============================================================================
+#ifndef CLIENTORBINITIALIZER_H
+#define CLIENTORBINITIALIZER_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/PortableInterceptorC.h"
+#include "ClientRequest_Interceptor.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/PI/PI.h"
+#include "tao/LocalObject.h"
+
+// This is to remove "inherits via dominance" warnings from MSVC.
+// MSVC is being a little too paranoid.
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+/// RTCORBA ORB initializer.
+class ClientORBInitializer :
+ public virtual PortableInterceptor::ORBInitializer,
+ public virtual ::CORBA::LocalObject
+{
+public:
+
+ virtual void pre_init (PortableInterceptor::ORBInitInfo_ptr info);
+
+ virtual void post_init (PortableInterceptor::ORBInitInfo_ptr info);
+};
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#include /**/ "ace/post.h"
+
+#endif /* CLIENTORBINITIALIZER_H */
diff --git a/TAO/orbsvcs/tests/Bug_3598b_Regression/ClientRequest_Interceptor.cpp b/TAO/orbsvcs/tests/Bug_3598b_Regression/ClientRequest_Interceptor.cpp
new file mode 100644
index 00000000000..8c25c69b51e
--- /dev/null
+++ b/TAO/orbsvcs/tests/Bug_3598b_Regression/ClientRequest_Interceptor.cpp
@@ -0,0 +1,89 @@
+// $Id$
+
+#include "ClientRequest_Interceptor.h"
+
+#include "tao/CORBA_String.h"
+#include "tao/debug.h"
+#include "ace/Log_Msg.h"
+
+ CORBA::Boolean
+ ClientRequest_Interceptor::success_flag_ = 0;
+
+ ClientRequest_Interceptor::ClientRequest_Interceptor (void)
+ : name_ ("ClientRequest_Interceptor")
+ {
+ }
+
+ ClientRequest_Interceptor::~ClientRequest_Interceptor (void)
+ {
+ }
+
+ char *
+ ClientRequest_Interceptor::name ()
+ {
+ return CORBA::string_dup (this->name_);
+ }
+
+ void
+ ClientRequest_Interceptor::destroy ()
+ {
+ // No-op
+ }
+
+ void
+ ClientRequest_Interceptor::send_poll (
+ PortableInterceptor::ClientRequestInfo_ptr ri
+ )
+ {
+ // Print debug
+ CORBA::String_var op =
+ ri->operation ();
+
+
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO_FT (%P|%t): ClientRequest_Interceptor::send_poll called for operation: %C\n",
+ op.in ()));
+ }
+
+ void
+ ClientRequest_Interceptor::send_request (
+ PortableInterceptor::ClientRequestInfo_ptr ri)
+ {
+ // Print debug
+ CORBA::String_var op =
+ ri->operation ();
+
+
+ ACE_DEBUG ((LM_DEBUG,
+ "ClientRequest_Interceptor::send_request called for operation: %C - things are going well...\n",
+ op.in ()));
+ }
+
+ void
+ ClientRequest_Interceptor::receive_reply (
+ PortableInterceptor::ClientRequestInfo_ptr)
+ {
+ // No-op
+ }
+
+ void
+ ClientRequest_Interceptor::receive_other (
+ PortableInterceptor::ClientRequestInfo_ptr)
+ {
+ // No-op
+ }
+
+ void
+ ClientRequest_Interceptor::receive_exception (
+ PortableInterceptor::ClientRequestInfo_ptr ri)
+ {
+ // Print debug
+ CORBA::String_var op =
+ ri->operation ();
+
+
+ ACE_DEBUG ((LM_DEBUG,
+ "ClientRequest_Interceptor::receive_exception called for operation: %C - test has succeeded...\n",
+ op.in ()));
+ success_flag_ = 1;
+ }
diff --git a/TAO/orbsvcs/tests/Bug_3598b_Regression/ClientRequest_Interceptor.h b/TAO/orbsvcs/tests/Bug_3598b_Regression/ClientRequest_Interceptor.h
new file mode 100644
index 00000000000..36e4fc7032d
--- /dev/null
+++ b/TAO/orbsvcs/tests/Bug_3598b_Regression/ClientRequest_Interceptor.h
@@ -0,0 +1,68 @@
+// -*- C++ -*-
+//=============================================================================
+/**
+ * @file ClientRequest_Interceptor.h
+ *
+ * $Id$
+ */
+//=============================================================================
+#ifndef CLIENTREQUEST_INTERCEPTOR_H
+#define CLIENTREQUEST_INTERCEPTOR_H
+#include /**/ "ace/pre.h"
+
+#include "tao/PI/PI.h"
+#include "tao/PortableInterceptorC.h"
+#include "tao/LocalObject.h"
+
+// This is to remove "inherits via dominance" warnings from MSVC.
+// MSVC is being a little too paranoid.
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+/**
+* @class ClientRequest_Interceptor
+*
+*/
+class ClientRequest_Interceptor
+: public virtual PortableInterceptor::ClientRequestInterceptor,
+ public virtual ::CORBA::LocalObject
+{
+public:
+
+ClientRequest_Interceptor (void);
+
+~ClientRequest_Interceptor (void);
+
+/// Canonical name of the interceptor.
+virtual char * name ();
+
+
+virtual void destroy ();
+
+virtual void send_poll (PortableInterceptor::ClientRequestInfo_ptr);
+
+virtual void send_request (PortableInterceptor::ClientRequestInfo_ptr ri);
+
+virtual void receive_reply (PortableInterceptor::ClientRequestInfo_ptr ri);
+
+virtual void receive_other (PortableInterceptor::ClientRequestInfo_ptr ri);
+
+virtual void receive_exception (PortableInterceptor::ClientRequestInfo_ptr ri);
+
+static CORBA::Boolean success_flag_;
+
+private:
+
+/// Name of the interceptor
+const char *name_;
+
+};
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#include /**/ "ace/post.h"
+#endif /*CLIENTREQUEST_INTERCEPTOR_H*/
+
diff --git a/TAO/orbsvcs/tests/Bug_3598b_Regression/Hello.cpp b/TAO/orbsvcs/tests/Bug_3598b_Regression/Hello.cpp
new file mode 100644
index 00000000000..7b9497529ec
--- /dev/null
+++ b/TAO/orbsvcs/tests/Bug_3598b_Regression/Hello.cpp
@@ -0,0 +1,23 @@
+//
+// $Id$
+//
+#include "Hello.h"
+
+ACE_RCSID(Hello, Hello, "Hello.cpp,v 1.3 2002/01/29 20:21:07 okellogg Exp")
+
+Hello::Hello (CORBA::ORB_ptr orb)
+ : orb_ (CORBA::ORB::_duplicate (orb))
+{
+}
+
+char *
+Hello::get_string ()
+{
+ return CORBA::string_dup ("Hello there!");
+}
+
+void
+Hello::shutdown ()
+{
+ this->orb_->shutdown (0 );
+}
diff --git a/TAO/orbsvcs/tests/Bug_3598b_Regression/Hello.h b/TAO/orbsvcs/tests/Bug_3598b_Regression/Hello.h
new file mode 100644
index 00000000000..782b1b2f573
--- /dev/null
+++ b/TAO/orbsvcs/tests/Bug_3598b_Regression/Hello.h
@@ -0,0 +1,31 @@
+//
+// $Id$
+//
+
+#ifndef HELLO_H
+#define HELLO_H
+#include /**/ "ace/pre.h"
+
+#include "TestS.h"
+
+/// Implement the Test::Hello interface
+class Hello
+ : public virtual POA_Test::Hello
+{
+public:
+ /// Constructor
+ Hello (CORBA::ORB_ptr orb);
+
+ // = The skeleton methods
+ virtual char * get_string ();
+
+ virtual void shutdown ();
+
+private:
+ /// Use an ORB reference to conver strings to objects and shutdown
+ /// the application.
+ CORBA::ORB_var orb_;
+};
+
+#include /**/ "ace/post.h"
+#endif /* HELLO_H */
diff --git a/TAO/orbsvcs/tests/Bug_3598b_Regression/README b/TAO/orbsvcs/tests/Bug_3598b_Regression/README
new file mode 100644
index 00000000000..b2d570b8158
--- /dev/null
+++ b/TAO/orbsvcs/tests/Bug_3598b_Regression/README
@@ -0,0 +1,12 @@
+$Id$
+
+This test attempts to contact a server IOR with no connectable profile in it (on account of how there is no server running).
+
+The method invocation should fail but the installed client request interceptor should have its send_request and receive_exception methods invoked regardless.
+
+The expected result looks like:
+
+Client about to make method call that is doomed to failure...
+ClientRequest_Interceptor::send_request called for operation: get_string - things are going well...
+ClientRequest_Interceptor::receive_exception called for operation: get_string - test has succeeded...
+Success - the server was unreachable and PI receive_exception was invoked.
diff --git a/TAO/orbsvcs/tests/Bug_3598b_Regression/Test.idl b/TAO/orbsvcs/tests/Bug_3598b_Regression/Test.idl
new file mode 100644
index 00000000000..3c0976e106d
--- /dev/null
+++ b/TAO/orbsvcs/tests/Bug_3598b_Regression/Test.idl
@@ -0,0 +1,20 @@
+//
+// $Id$
+//
+
+/// Put the interfaces in a module, to avoid global namespace pollution
+module Test
+{
+ /// A very simple interface
+ interface Hello
+ {
+ /// Return a simple string
+ string get_string ();
+
+ /// A method to shutdown the ORB
+ /**
+ * This method is used to simplify the test shutdown process
+ */
+ oneway void shutdown ();
+ };
+};
diff --git a/TAO/orbsvcs/tests/Bug_3598b_Regression/client.cpp b/TAO/orbsvcs/tests/Bug_3598b_Regression/client.cpp
new file mode 100644
index 00000000000..651abc13e44
--- /dev/null
+++ b/TAO/orbsvcs/tests/Bug_3598b_Regression/client.cpp
@@ -0,0 +1,102 @@
+// $Id$
+
+#include "TestC.h"
+#include "ace/Get_Opt.h"
+#include "tao/PortableInterceptorC.h"
+#include "ClientORBInitializer.h"
+#include "tao/ORBInitializer_Registry.h"
+#include "orbsvcs/FaultTolerance/FT_ClientService_Activate.h"
+
+ACE_RCSID(Hello, client, "client.cpp,v 1.5 2002/01/29 20:21:07 okellogg Exp")
+
+const ACE_TCHAR *ior = ACE_TEXT ("file://test.ior");
+
+int
+parse_args (int argc, ACE_TCHAR *argv[])
+{
+ ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("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;
+}
+
+int
+ACE_TMAIN (int argc, ACE_TCHAR *argv[])
+{
+ try
+ {
+ PortableInterceptor::ORBInitializer_ptr temp_orb_initializer =
+ PortableInterceptor::ORBInitializer::_nil ();
+ PortableInterceptor::ORBInitializer_var orb_initializer;
+
+ // Register the ClientRequest_Interceptor ORBInitializer.
+ ACE_NEW_RETURN (temp_orb_initializer,
+ ClientORBInitializer,
+ -1);
+
+ orb_initializer = temp_orb_initializer;
+
+ PortableInterceptor::register_orb_initializer (orb_initializer.in ());
+
+ CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);
+
+ if (parse_args (argc, argv) != 0)
+ return 1;
+
+ CORBA::Object_var tmp =
+ orb->string_to_object (ACE_TEXT_ALWAYS_CHAR (ior));
+
+ Test::Hello_var hello =
+ Test::Hello::_narrow(tmp.in () );
+
+ if (CORBA::is_nil (hello.in ()))
+ {
+ ACE_ERROR_RETURN ((LM_DEBUG,
+ "Nil Test::Hello reference <%s>\n",
+ ior),
+ 1);
+ }
+
+ ACE_DEBUG ((LM_DEBUG, "Client about to make method call that is doomed to failure...\n"));
+
+ CORBA::String_var the_string =
+ hello->get_string ();
+
+ ACE_ERROR_RETURN ((LM_DEBUG,
+ "Error - the remote call succeeded which is bloody miraculous given that no server is running !!\n"),
+ 1);
+ }
+ catch (const CORBA::Exception&)
+ {
+ if (ClientRequest_Interceptor::success_flag_)
+ {
+ ACE_DEBUG ((LM_DEBUG, "Success - the server was unreachable and PI receive_exception was invoked.\n"));
+ return 0;
+ }
+ else
+ {
+ ACE_ERROR_RETURN ((LM_DEBUG,
+ "Error: regression failed - interceptor receive_exception interception point was not invoked !!\n"),
+ 1);
+ }
+ }
+
+ return 1;
+}
diff --git a/TAO/orbsvcs/tests/Bug_3598b_Regression/run_test.pl b/TAO/orbsvcs/tests/Bug_3598b_Regression/run_test.pl
new file mode 100755
index 00000000000..0af02716e71
--- /dev/null
+++ b/TAO/orbsvcs/tests/Bug_3598b_Regression/run_test.pl
@@ -0,0 +1,76 @@
+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;
+
+$status = 0;
+$debug_level = '0';
+
+foreach $i (@ARGV) {
+ if ($i eq '-debug') {
+ $debug_level = '10';
+ }
+}
+
+my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
+my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
+
+my $iorbase = "server.ior";
+my $server_iorfile = $server->LocalFile ($iorbase);
+my $client_iorfile = $client->LocalFile ($iorbase);
+$server->DeleteFile($iorbase);
+$client->DeleteFile($iorbase);
+
+$SV = $server->CreateProcess ("server", "-ORBdebuglevel $debug_level -o $server_iorfile");
+$CL = $client->CreateProcess ("client", "-k file://$client_iorfile");
+$server_status = $SV->Spawn ();
+
+if ($server_status != 0) {
+ print STDERR "ERROR: server returned $server_status\n";
+ exit 1;
+}
+
+if ($server->WaitForFileTimed ($iorbase,
+ $server->ProcessStartWaitInterval()) == -1) {
+ print STDERR "ERROR: cannot find file <$server_iorfile>\n";
+ $SV->Kill (); $SV->TimedWait (1);
+ exit 1;
+}
+
+if ($server->GetFile ($iorbase) == -1) {
+ print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n";
+ $SV->Kill (); $SV->TimedWait (1);
+ exit 1;
+}
+if ($client->PutFile ($iorbase) == -1) {
+ print STDERR "ERROR: cannot set file <$client_iorfile>\n";
+ $SV->Kill (); $SV->TimedWait (1);
+ exit 1;
+}
+
+$client_status = $CL->SpawnWaitKill (60);
+
+if ($client_status != 0) {
+ print STDERR "ERROR: client returned $client_status\n";
+ $status = 1;
+}
+
+$server_status = $SV->WaitKill ($server->ProcessStopWaitInterval());
+
+if ($server_status != 0) {
+ print STDERR "ERROR: server returned $server_status\n";
+ $status = 1;
+}
+
+$server->GetStderrLog();
+$client->GetStderrLog();
+
+$server->DeleteFile($iorbase);
+$client->DeleteFile($iorbase);
+
+exit $status;
diff --git a/TAO/orbsvcs/tests/Bug_3598b_Regression/server.cpp b/TAO/orbsvcs/tests/Bug_3598b_Regression/server.cpp
new file mode 100644
index 00000000000..95d61429e99
--- /dev/null
+++ b/TAO/orbsvcs/tests/Bug_3598b_Regression/server.cpp
@@ -0,0 +1,99 @@
+// $Id$
+
+#include "Hello.h"
+#include "ace/Get_Opt.h"
+#include "ace/OS_NS_stdio.h"
+
+ACE_RCSID (Hello,
+ server,
+ "server.cpp,v 1.6 2003/11/01 11:15:11 dhinton Exp")
+
+const ACE_TCHAR *ior_output_file = ACE_TEXT("test.ior");
+
+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':
+ 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;
+}
+
+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;
+
+ Hello *hello_impl = 0;
+ ACE_NEW_RETURN (hello_impl,
+ Hello (orb.in ()),
+ 1);
+ PortableServer::ServantBase_var owner_transfer(hello_impl);
+
+ Test::Hello_var hello =
+ hello_impl->_this ();
+
+ CORBA::String_var ior =
+ orb->object_to_string (hello.in () );
+
+ // Output the IOR to the <ior_output_file>
+ 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);
+
+ root_poa->destroy (1, 1 );
+
+ orb->destroy ();
+
+ ACE_DEBUG ((LM_DEBUG, "Event loop finished.\n"));
+ }
+ catch (const CORBA::Exception& ex)
+ {
+ ex._tao_print_exception ("Exception caught:");
+ return 1;
+ }
+
+ return 0;
+}
diff --git a/TAO/orbsvcs/tests/ImplRepo/Bug_2604_Regression/Messenger_i.cpp b/TAO/orbsvcs/tests/ImplRepo/Bug_2604_Regression/Messenger_i.cpp
index a6e927cdee9..dd804403c50 100644
--- a/TAO/orbsvcs/tests/ImplRepo/Bug_2604_Regression/Messenger_i.cpp
+++ b/TAO/orbsvcs/tests/ImplRepo/Bug_2604_Regression/Messenger_i.cpp
@@ -9,6 +9,7 @@ Messenger_i::send_message (const char *user_name, const char *subject,
ACE_TEXT ("Message from: %C\nSubject: %C\nMessage: %C\n"),
user_name, subject, message));
const char *reply = "A reply from the server.";
+ CORBA::string_free (message);
message = CORBA::string_dup (reply);
if (++this->count_ == 6)
{
diff --git a/TAO/orbsvcs/tests/ImplRepo/Bug_2604_Regression/run_test.pl b/TAO/orbsvcs/tests/ImplRepo/Bug_2604_Regression/run_test.pl
index 17d3baacc3e..c0690e1d2a3 100755
--- a/TAO/orbsvcs/tests/ImplRepo/Bug_2604_Regression/run_test.pl
+++ b/TAO/orbsvcs/tests/ImplRepo/Bug_2604_Regression/run_test.pl
@@ -72,7 +72,7 @@ sub RunImRUtil {
my $cmd = shift;
print ">>> " . $imr_util->CommandLine() . "\n";
$imr_util->Arguments("$imr_init_ref $cmd");
- return $imr_util->SpawnWaitKill(5);
+ return $imr_util->SpawnWaitKill(15);
}
CleanupOutput();
diff --git a/TAO/orbsvcs/tests/ImplRepo/nestea_client_i.cpp b/TAO/orbsvcs/tests/ImplRepo/nestea_client_i.cpp
index e6deec621e4..bce2b51d639 100644
--- a/TAO/orbsvcs/tests/ImplRepo/nestea_client_i.cpp
+++ b/TAO/orbsvcs/tests/ImplRepo/nestea_client_i.cpp
@@ -63,18 +63,20 @@ Nestea_Client_i::run ()
this->server_->drink (40);
this->server_->drink (100);
+ CORBA::String_var praise = this->server_->get_praise ();
ACE_DEBUG ((LM_DEBUG, "Cans: %d\n"
"Praise: %s\n",
this->server_->bookshelf_size (),
- this->server_->get_praise ()));
+ praise.in ()));
this->server_->drink (500);
this->server_->crush (200);
+ praise = this->server_->get_praise ();
ACE_DEBUG ((LM_DEBUG, "Cans: %d\n"
"Praise: %s\n",
this->server_->bookshelf_size (),
- this->server_->get_praise ()));
+ praise.in ()));
if (shutdown_server_)
server_->shutdown();
diff --git a/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/IFR_Application_Test.mpc b/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/IFR_Application_Test.mpc
index 944ad98a87a..aba13d6261e 100644
--- a/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/IFR_Application_Test.mpc
+++ b/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/IFR_Application_Test.mpc
@@ -1,7 +1,7 @@
// -*- MPC -*-
// $Id$
-project(*server): taoexe, portableserver, ifr_client, avoids_minimum_corba, avoids_corba_e_compact, avoids_corba_e_micro {
+project(*server): taoexe, portableserver, ifr_client, avoids_minimum_corba, avoids_corba_e_compact, avoids_corba_e_micro, svc_utils {
exename = server
Source_Files {
test_i.cpp
diff --git a/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/Makefile.am b/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/Makefile.am
index 6517b5c8c06..4aaef665047 100644
--- a/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/Makefile.am
+++ b/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/Makefile.am
@@ -84,7 +84,9 @@ server_CPPFLAGS = \
-I$(ACE_ROOT) \
-I$(ACE_BUILDDIR) \
-I$(TAO_ROOT) \
- -I$(TAO_BUILDDIR)
+ -I$(TAO_BUILDDIR) \
+ -I$(TAO_ROOT)/orbsvcs \
+ -I$(TAO_BUILDDIR)/orbsvcs
server_SOURCES = \
server.cpp \
@@ -98,6 +100,7 @@ server_SOURCES = \
test_i.h
server_LDADD = \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_Svc_Utils.la \
$(TAO_BUILDDIR)/tao/libTAO_IFR_Client.la \
$(TAO_BUILDDIR)/tao/libTAO_PortableServer.la \
$(TAO_BUILDDIR)/tao/libTAO_AnyTypeCode.la \
diff --git a/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/server.cpp b/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/server.cpp
index 0b1c27df492..1b10ffa023a 100644
--- a/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/server.cpp
+++ b/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/server.cpp
@@ -3,11 +3,31 @@
#include "test_i.h"
#include "ace/OS_NS_stdio.h"
+#include "orbsvcs/Shutdown_Utilities.h"
ACE_RCSID(Application_Test, server, "$Id$")
static const ACE_TCHAR *ior_output_file = ACE_TEXT("iorfile");
+class Service_Shutdown_Functor : public Shutdown_Functor
+{
+public:
+ Service_Shutdown_Functor (CORBA::ORB_ptr orb)
+ : orb_(CORBA::ORB::_duplicate (orb))
+ {
+ }
+
+ void operator() (int which_signal)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "shutting down on signal %d\n", which_signal));
+ (void) this->orb_->shutdown ();
+ }
+
+private:
+ CORBA::ORB_var orb_;
+};
+
static int
write_ior_to_file (const char *ior)
{
@@ -41,10 +61,13 @@ write_ior_to_file (const char *ior)
int
ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
- try
- {
+ try
+ {
CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);
+ Service_Shutdown_Functor killer (orb.in ());
+ Service_Shutdown kill_contractor (killer);
+
CORBA::Object_var poa_object =
orb->resolve_initial_references ("RootPOA");
@@ -78,6 +101,8 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[])
root_poa->destroy (1,
1);
+
+ orb->destroy ();
}
catch (const CORBA::Exception& ex)
{
diff --git a/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/test_i.cpp b/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/test_i.cpp
index c1fdcb889ee..08a803ea8d8 100644
--- a/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/test_i.cpp
+++ b/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/test_i.cpp
@@ -20,6 +20,8 @@ inventory_i::getCDinfo (const char * artist,
price = 0.0f;
ACE_CString name_key ("Beatles");
ACE_CString name (artist);
+ CORBA::String_var tmp = title;
+ ACE_UNUSED_ARG (tmp);
if (name.strstr (name_key) != ACE_CString::npos)
{
diff --git a/TAO/orbsvcs/tests/InterfaceRepo/Bug_2962_Regression/client.cpp b/TAO/orbsvcs/tests/InterfaceRepo/Bug_2962_Regression/client.cpp
index d349656112e..af3c68e0cd8 100644
--- a/TAO/orbsvcs/tests/InterfaceRepo/Bug_2962_Regression/client.cpp
+++ b/TAO/orbsvcs/tests/InterfaceRepo/Bug_2962_Regression/client.cpp
@@ -10,7 +10,7 @@ const char *member_type_id= "IDL:arrayOfStruct:1.0";
int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
- CORBA::ORB_ptr the_orb = CORBA::ORB_init (argc, argv);
+ CORBA::ORB_var the_orb = CORBA::ORB_init (argc, argv);
CORBA::Object_var obj = the_orb->string_to_object (ifr_ior);
if (CORBA::is_nil (obj.in()))
@@ -57,8 +57,10 @@ int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
tc_content = orig_type->type ();
const CORBA::ULong
length= tc_content->length ();
+ CORBA::TypeCode_var
+ cont_type = tc_content->content_type ();
const char
- *name= tc_content->content_type ()->name ();
+ *name= cont_type->name ();
ACE_DEBUG ((LM_DEBUG,
" = %C [%u]\n",
name,
diff --git a/TAO/orbsvcs/tests/InterfaceRepo/Bug_3155_Regression/test_idl.cpp b/TAO/orbsvcs/tests/InterfaceRepo/Bug_3155_Regression/test_idl.cpp
index 5cd83c41ae5..a1a1980214a 100644
--- a/TAO/orbsvcs/tests/InterfaceRepo/Bug_3155_Regression/test_idl.cpp
+++ b/TAO/orbsvcs/tests/InterfaceRepo/Bug_3155_Regression/test_idl.cpp
@@ -1,8 +1,8 @@
// $Id$
+#include "tao/IFR_Client/IFR_ComponentsC.h"
#include "ace/Get_Opt.h"
#include "tao/ORB.h"
-#include "tao/IFR_Client/IFR_ComponentsC.h"
namespace
{
@@ -100,7 +100,7 @@ int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
// get value type definition
CORBA::ExtValueDef_var value_def =
CORBA::ExtValueDef::_narrow (current_contained.in ());
- CORBA::ExtValueDef::ExtFullValueDescription * value_descr;
+ CORBA::ExtValueDef::ExtFullValueDescription_var value_descr;
try
{
value_descr = value_def->describe_ext_value ();
diff --git a/TAO/orbsvcs/tests/InterfaceRepo/IFR_Inheritance_Test/main.cpp b/TAO/orbsvcs/tests/InterfaceRepo/IFR_Inheritance_Test/main.cpp
index 78ac2742dfe..3b0c332f536 100644
--- a/TAO/orbsvcs/tests/InterfaceRepo/IFR_Inheritance_Test/main.cpp
+++ b/TAO/orbsvcs/tests/InterfaceRepo/IFR_Inheritance_Test/main.cpp
@@ -10,42 +10,40 @@ ACE_RCSID (IFR_Inheritance_Test,
main,
"$Id$")
-void printContents( const CORBA::ContainedSeq& cont )
+void printContents (const CORBA::ContainedSeq& cont)
{
try
{
- for( unsigned int i=0; i<cont.length(); i++ )
+ for (CORBA::ULong i = 0; i < cont.length(); ++i)
{
- if( cont[i]->describe()->kind == CORBA::dk_Interface )
+ CORBA::Contained::Description_var topdesc = cont[i]->describe ();
+ if (topdesc->kind == CORBA::dk_Interface)
{
CORBA::InterfaceDef_var intDef =
- CORBA::InterfaceDef::_narrow (cont[i]
- );
+ CORBA::InterfaceDef::_narrow (cont[i]);
- CORBA::InterfaceDef::FullInterfaceDescription* desc =
+ CORBA::InterfaceDef::FullInterfaceDescription_var desc =
intDef->describe_interface ();
- //printf( "-- %s:\n", (const char*)(desc->name) );
+ //printf ("-- %s:\n", desc->name.in ());
- for( unsigned int j1=0; j1 < desc->operations.length (); j1++ )
- ACE_OS::printf( "operation %s::%s\n",
- (const char*)(desc->name),
- (const char*)((desc->operations[j1]).name) );
+ for (CORBA::ULong j1 = 0; j1 < desc->operations.length (); ++j1)
+ ACE_OS::printf ("operation %s::%s\n",
+ desc->name.in (),
+ desc->operations[j1].name.in ());
- for( unsigned int j2=0; j2 < desc->attributes.length (); j2++ )
- ACE_OS::printf( "attribute %s::%s\n",
- (const char*)(desc->name),
- (const char*)((desc->attributes[j2]).name) );
+ for (CORBA::ULong j2 = 0; j2 < desc->attributes.length (); ++j2)
+ ACE_OS::printf ("attribute %s::%s\n",
+ desc->name.in (),
+ desc->attributes[j2].name.in ());
}
- else if( cont[i]->describe ()->kind == CORBA::dk_Module )
+ else if (topdesc->kind == CORBA::dk_Module)
{
CORBA::ModuleDef_var moduleDef =
- CORBA::ModuleDef::_narrow (cont[i]
- );
+ CORBA::ModuleDef::_narrow (cont[i]);
CORBA::ContainedSeq_var moduleContents =
- moduleDef->contents (CORBA::dk_all,1
- );
+ moduleDef->contents (CORBA::dk_all, 1);
printContents (moduleContents.in ());
}
}
@@ -61,7 +59,7 @@ int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
try
{
- CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);
+ CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);
CORBA::Object_var object =
orb->resolve_initial_references ("InterfaceRepository");
@@ -69,10 +67,8 @@ int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
ACE_ERROR_RETURN ((
LM_ERROR,
- "Null objref from resolve_initial_references\n"
- ),
- -1
- );
+ "Null objref from resolve_initial_references\n"),
+ -1);
}
CORBA::Repository_var ifr =
@@ -85,12 +81,11 @@ int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
-1);
}
- CORBA::ContainedSeq_var cont = ifr->contents (CORBA::dk_all, 0);
+ CORBA::ContainedSeq_var cont = ifr->contents (CORBA::dk_all, 0);
- printContents (cont.in ());
-
- orb->shutdown ();
+ printContents (cont.in ());
+ orb->destroy ();
}
catch (const CORBA::Exception& ex)
{
diff --git a/TAO/orbsvcs/tests/InterfaceRepo/IFR_Inheritance_Test/run_test.pl b/TAO/orbsvcs/tests/InterfaceRepo/IFR_Inheritance_Test/run_test.pl
index 7e43769cedf..ce9cf02cfaa 100755
--- a/TAO/orbsvcs/tests/InterfaceRepo/IFR_Inheritance_Test/run_test.pl
+++ b/TAO/orbsvcs/tests/InterfaceRepo/IFR_Inheritance_Test/run_test.pl
@@ -81,7 +81,7 @@ if (PerlACE::waitforfile_timed ($iorfile, $PerlACE::wait_interval_for_process_cr
exit 1;
}
-if( $TAO_IFR->SpawnWaitKill(10) != 0 )
+if( $TAO_IFR->SpawnWaitKill(20) != 0 )
{
print STDERR "ERROR: can't compile IDL\n";
$TAO_IFR->Kill ();
@@ -151,6 +151,6 @@ if ($server != 0) {
}
unlink $iorfile;
+unlink $testoutputfilename;
exit $status;
-
diff --git a/TAO/orbsvcs/tests/Notify/Bug_1884_Regression/Bug_1884_Regression.mpc b/TAO/orbsvcs/tests/Notify/Bug_1884_Regression/Bug_1884_Regression.mpc
new file mode 100644
index 00000000000..d900bd56fd6
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/Bug_1884_Regression/Bug_1884_Regression.mpc
@@ -0,0 +1,26 @@
+// -*- MPC -*-
+// $Id$
+
+project(*Consumer) : orbsvcsexe, notification, notification_skel, naming {
+ exename = consumer
+ Source_Files {
+ consumer.cpp
+ }
+}
+
+
+project(*Supplier) : orbsvcsexe, notification, notification_skel, naming {
+ exename = supplier
+
+ Source_Files {
+ supplier.cpp
+ }
+}
+
+project(*Filter) : orbsvcsexe, notification, notification_skel, naming {
+ exename = filter
+
+ Source_Files {
+ filter.cpp
+ }
+}
diff --git a/TAO/orbsvcs/tests/Notify/Bug_1884_Regression/common.h b/TAO/orbsvcs/tests/Notify/Bug_1884_Regression/common.h
new file mode 100644
index 00000000000..18df456f8d4
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/Bug_1884_Regression/common.h
@@ -0,0 +1,83 @@
+// $Id$
+
+#include "orbsvcs/orbsvcs/CosNotifyChannelAdminC.h"
+#include "orbsvcs/orbsvcs/CosNotifyChannelAdminS.h"
+#include <iostream>
+const char *ior = "file://ecf.ior";
+
+CosNotifyChannelAdmin::EventChannel_var
+get_event_channel(CORBA::ORB_ptr orb)
+
+{
+ CosNotifyChannelAdmin::EventChannel_var ec;
+ CosNotifyChannelAdmin::ChannelID id;
+ CosNotification::QoSProperties init_qos(0);
+ CosNotification::AdminProperties init_admin(0);
+
+ std::cout << "Get CosNotifyChannelAdmin::EventChannelFactory" << std::endl;
+ std::cout << "IorEventChannelFactory=" << ior << std::endl;
+ CORBA::Object_var obj = orb->string_to_object(ior);
+
+ if (CORBA::is_nil(obj.in ()))
+ {
+ std::cerr << "Bad ec_fact.ior " << std::endl;
+ ACE_OS::exit (1);
+ }
+
+ CosNotifyChannelAdmin::EventChannelFactory_var factory =
+ CosNotifyChannelAdmin::EventChannelFactory::_narrow(obj.in ());
+ if (CORBA::is_nil(factory.in()))
+ {
+ std::cerr << "Could not _narrow object to type CosNotifyChannelAdmin::EventChannelFactory" << std::endl;
+ ACE_OS::exit(1);
+ }
+
+ //Get the first ec
+ CosNotifyChannelAdmin::ChannelIDSeq_var channelIdSeq;
+ try
+ {
+ channelIdSeq = factory->get_all_channels();
+ }
+ catch (CORBA::SystemException& se )
+ {
+ std::cerr << "System exception occurred during get_all_channels: "
+ << se << std::endl;
+ throw;
+ }
+
+ if( channelIdSeq->length() == 0 )
+ {
+ try
+ {
+ ec = factory->create_channel( init_qos, init_admin, id);
+ }
+ catch (CORBA::SystemException& se )
+ {
+ std::cerr << "System exception occurred during find_channel: "
+ << se << std::endl;
+ throw;
+ }
+ }
+ else {
+ try
+ {
+ ec = factory->get_event_channel(channelIdSeq[0]);
+ }
+ catch (CosNotifyChannelAdmin::ChannelNotFound& )
+ {
+ std::cerr << "ChannelNotFound: "
+ << channelIdSeq[0] << std::endl;
+ throw;
+ }
+
+ catch (CORBA::SystemException& se )
+ {
+ std::cerr << "System exception occurred during get_event_channel: "
+ << se << std::endl;
+ throw;
+ }
+ }
+
+ return ec._retn();
+}
+
diff --git a/TAO/orbsvcs/tests/Notify/Bug_1884_Regression/consumer.cpp b/TAO/orbsvcs/tests/Notify/Bug_1884_Regression/consumer.cpp
new file mode 100644
index 00000000000..e95740fec0d
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/Bug_1884_Regression/consumer.cpp
@@ -0,0 +1,205 @@
+// $Id$
+
+#include "common.h"
+
+#include "ace/Get_Opt.h"
+#include "ace/OS_NS_stdlib.h"
+
+int runtime = 5; //sec
+
+
+namespace CosNotifyCommImpl{
+ class StructuredPushConsumer: public virtual POA_CosNotifyComm:: StructuredPushConsumer
+ {
+ public:
+ StructuredPushConsumer () : received_ (false) {};
+ virtual ~ StructuredPushConsumer () {};
+
+ void push_structured_event(
+ const CosNotification::StructuredEvent &event)
+ {
+ std::cout << "Received an event...," << std::endl;
+ std::cout << "event.header.fixed_header.event_type.domain_name = "
+ << event.header.fixed_header.event_type.domain_name
+ << std::endl;
+ std::cout << "event.header.fixed_header.event_type.type_name = "
+ << event.header.fixed_header.event_type.type_name
+ << std::endl;
+
+ };
+
+ void disconnect_structured_push_consumer()
+ {};
+
+ void offer_change (
+ const CosNotification::EventTypeSeq &,
+ const CosNotification::EventTypeSeq &)
+ {};
+
+ bool received_events ()
+ {
+ return this->received_;
+ };
+
+ private:
+ bool received_;
+ };
+}
+
+int parse_args (int argc, ACE_TCHAR *argv[])
+{
+ ACE_Get_Opt get_opts (argc, argv, "t:");
+ int x;
+
+ while ((x = get_opts ()) != -1)
+ switch (x)
+ {
+ case 't':
+ runtime = ACE_OS::atoi (get_opts.optarg);
+ break;
+
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("usage: %s -t <runtime>\n"),
+ argv [0]),
+ -1);
+ }
+
+ return 0; // successful parse
+}
+
+int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
+{
+ try
+ {
+ PortableServer::POAManager_var poa_manager;
+
+ CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
+
+ CORBA::Object_var poa_obj = orb->resolve_initial_references("RootPOA");
+ PortableServer::POA_var root_poa = PortableServer::POA::_narrow(poa_obj.in());
+
+ poa_manager = root_poa->the_POAManager();
+
+ if (parse_args (argc, argv) != 0)
+ return 1;
+
+ poa_manager->activate();
+
+ /*Get event_channel*/
+ std::cout << "Get event_channel now" << std::endl;
+ CosNotifyChannelAdmin::EventChannel_var ec = get_event_channel(orb.in());
+
+ //Instanciating the Consumer
+ CosNotifyComm::StructuredPushConsumer_var spc =
+ CosNotifyComm::StructuredPushConsumer::_nil();
+
+ CosNotifyCommImpl::StructuredPushConsumer *pImpl_spc = new CosNotifyCommImpl::StructuredPushConsumer;
+ spc = pImpl_spc->_this();
+
+ //Obtain a Consumer Admin
+ CosNotifyChannelAdmin::AdminID adminid = 0;
+ CosNotifyChannelAdmin::ConsumerAdmin_var ca =
+ ec->new_for_consumers (CosNotifyChannelAdmin::AND_OP, adminid);
+
+ if( ca.in() == CosNotifyChannelAdmin::ConsumerAdmin::_nil() ){
+ std::cerr << "ca is nil!" << std::endl;
+ return 1;
+ }
+
+ //Obtain a Proxy Consumer
+ CosNotifyChannelAdmin::ProxyID proxy_id;
+ CosNotifyChannelAdmin::ClientType ctype = CosNotifyChannelAdmin::STRUCTURED_EVENT;
+
+ CosNotifyChannelAdmin::ProxySupplier_var proxySupplier_obj;
+ try
+ {
+ proxySupplier_obj = ca->obtain_notification_push_supplier(ctype, proxy_id);
+ }
+ catch(CosNotifyChannelAdmin::AdminLimitExceeded err)
+ {
+ std::cerr << "CosNotifyChannelAdmin::AdminLimitExceeded Exception!" << std::endl;
+ throw;
+ }
+
+ CosNotifyChannelAdmin::StructuredProxyPushSupplier_var pps =
+ CosNotifyChannelAdmin::StructuredProxyPushSupplier::_narrow(proxySupplier_obj.in());
+
+
+ //Attaching a filter to pps
+ CosNotifyFilter::FilterFactory_var dff =
+ ec->default_filter_factory();
+
+ ACE_ASSERT(!CORBA::is_nil(dff.in()));
+
+ CosNotifyFilter::Filter_var filter = dff->create_filter("EXTENDED_TCL");
+
+ CosNotification::EventTypeSeq event_types(1);
+ event_types.length(2);
+
+ event_types[0].domain_name = CORBA::string_dup("DomainA");
+ event_types[0].type_name = CORBA::string_dup("TypeA");
+ event_types[1].domain_name = CORBA::string_dup("DomainB");
+ event_types[1].type_name = CORBA::string_dup("TypeB");
+
+ CosNotifyFilter::ConstraintExpSeq constraints(1);
+ constraints.length(1);
+
+ constraints[0].event_types = event_types;
+ constraints[0].constraint_expr = CORBA::string_dup(
+ "");
+
+ filter->add_constraints(constraints);
+
+ pps->add_filter(filter.in());
+
+ std::cout << "Attached a filter to ProxyPushSupplier" << std::endl;
+ std::cout << "The filter's event_types[0].domain_name=" << event_types[0].domain_name << std::endl;
+ std::cout << "The filter's event_types[0].type_name=" << event_types[0].type_name << std::endl;
+ std::cout << "The filter's event_types[1].domain_name=" << event_types[1].domain_name << std::endl;
+ std::cout << "The filter's event_types[1].type_name=" << event_types[1].type_name << std::endl;
+
+
+ //Connecting a Supplier to a Proxy Consumer
+ try
+ {
+ pps->connect_structured_push_consumer(spc.in());
+ }
+ catch (CosEventChannelAdmin::AlreadyConnected ac)
+ {
+ std::cerr << "CosEventChannelAdmin::AlreadyConnected" << std::endl;
+ throw;
+ }
+ catch (CORBA::SystemException& se)
+ {
+ std::cerr << "System exception occurred during connect: " <<
+ se << std::endl;
+ throw;
+ }
+
+
+ ACE_Time_Value tv (runtime);
+ orb->run (tv);
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Consumer done.\n")));
+
+ if (pImpl_spc->received_events ())
+ {
+ //Consumer should not receive any events as it's filtered with event type.
+ std::cerr << "Test failed - received test events." << std::endl;
+ return 1;
+ }
+ else
+ {
+ std::cerr << "Test passed - did not receive test events as expected." << std::endl;
+ }
+ }
+ catch(...)
+ {
+ std::cerr << "Consumer: Some exceptions was caught!" << std::endl;
+ return 1;
+ }
+
+
+ return 0;
+}
+
diff --git a/TAO/orbsvcs/tests/Notify/Bug_1884_Regression/ecf.conf b/TAO/orbsvcs/tests/Notify/Bug_1884_Regression/ecf.conf
new file mode 100644
index 00000000000..8c29f3485b8
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/Bug_1884_Regression/ecf.conf
@@ -0,0 +1,2 @@
+dynamic Topology_Factory Service_Object* TAO_CosNotification_Persist:_make_TAO_Notify_XML_Topology_Factory() "-save_base_path ./persistency.notif -load_base_path ./persistency.notif -backup_count 1 -v"
+
diff --git a/TAO/orbsvcs/tests/Notify/Bug_1884_Regression/filter.cpp b/TAO/orbsvcs/tests/Notify/Bug_1884_Regression/filter.cpp
new file mode 100644
index 00000000000..6be470f7276
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/Bug_1884_Regression/filter.cpp
@@ -0,0 +1,246 @@
+// $Id$
+
+#include "orbsvcs/orbsvcs/CosNotifyChannelAdminC.h"
+#include "orbsvcs/orbsvcs/CosNotifyChannelAdminS.h"
+
+#include <iostream>
+
+
+const char *ior = "file://ecf.ior";
+
+CosNotifyChannelAdmin::EventChannel_var
+get_event_channel(CORBA::ORB_ptr orb)
+
+{
+ CosNotifyChannelAdmin::EventChannel_var ec;
+ CosNotifyChannelAdmin::ChannelID id;
+ CosNotification::QoSProperties init_qos(0);
+ CosNotification::AdminProperties init_admin(0);
+
+
+
+ std::cout << "Get CosNotifyChannelAdmin::EventChannelFactory" << std::endl;
+ std::cout << "IorEventChannelFactory=" << ior << std::endl;
+ CORBA::Object_var obj = orb->string_to_object(ior);
+
+ if (CORBA::is_nil(obj.in ()))
+ {
+ std::cerr << "Bad ec_fact.ior " << std::endl;
+ exit(1);
+ }
+
+
+ CosNotifyChannelAdmin::EventChannelFactory_var factory =
+ CosNotifyChannelAdmin::EventChannelFactory::_narrow(obj.in ());
+ if (CORBA::is_nil(factory.in()))
+ {
+ std::cerr << "Could not _narrow object to type CosNotifyChannelAdmin::EventChannelFactory" << std::endl;
+ exit(1);
+ }
+
+ //Get the first ec
+ CosNotifyChannelAdmin::ChannelIDSeq_var channelIdSeq;
+ try
+ {
+ channelIdSeq = factory->get_all_channels();
+ }
+ catch (CORBA::SystemException& se )
+ {
+ std::cerr << "System exception occurred during get_all_channels: "
+ << se << std::endl;
+ exit(1);
+ }
+
+ if( channelIdSeq->length() == 0 )
+ {
+
+ try
+ {
+ ec = factory->create_channel( init_qos, init_admin, id);
+ }
+ catch (CORBA::SystemException& se )
+ {
+ std::cerr << "System exception occurred during find_channel: "
+ << se << std::endl;
+ exit(1);
+ }
+ }
+ else {
+ try
+ {
+ ec = factory->get_event_channel(channelIdSeq[0]);
+ }
+ catch (CosNotifyChannelAdmin::ChannelNotFound&)
+ {
+ std::cerr << "ChannelNotFound: "
+ << channelIdSeq[0] << std::endl;
+ exit(1);
+ }
+
+ catch (CORBA::SystemException& se )
+ {
+ std::cerr << "System exception occurred during get_event_channel: "
+ << se << std::endl;
+ exit(1);
+ }
+
+ }
+
+ return ec._retn();
+}
+
+
+void match_structure_test (const CosNotifyFilter::Filter_var& filter,
+ const CosNotification::StructuredEvent& event,
+ bool & expected_result)
+{
+ bool bResult = false;
+ try{
+ bResult = filter->match_structured(event);
+ }
+ catch(CosNotifyFilter::UnsupportedFilterableData)
+ {
+ std::cerr << "UnsupportedFilterableData!" << std::endl;
+ }
+ catch (CORBA::SystemException& se )
+ {
+ std::cerr << "System exception occurred during match_structured: "
+ << se << std::endl;
+ exit(1);
+ }
+
+ std::cout << "The result is:" << (bResult?"Match":"Unmatch") << std::endl;
+
+ if (bResult != expected_result)
+ {
+ // The result should be unmatched as it's filtered with event type.
+ std::cerr << "filter test failed." << std::endl;
+ exit(1);
+ }
+}
+
+
+void update_constraints (const CosNotifyFilter::Filter_var& filter,
+ const char* domain1, const char* type1,
+ const char* domain2, const char* type2)
+{
+ filter->remove_all_constraints ();
+
+ CosNotification::EventTypeSeq event_types(2);
+ event_types.length(2);
+
+ event_types[0].domain_name = CORBA::string_dup(domain1);
+ event_types[0].type_name = CORBA::string_dup(type1);
+
+ event_types[1].domain_name = CORBA::string_dup(domain2);
+ event_types[1].type_name = CORBA::string_dup(type2);
+
+ CosNotifyFilter::ConstraintExpSeq constraints(1);
+ constraints.length(1);
+
+ constraints[0].event_types = event_types;
+ constraints[0].constraint_expr = CORBA::string_dup("");
+
+ CosNotifyFilter::ConstraintInfoSeq_var cons_info
+ = filter->add_constraints(constraints);
+
+ std::cout << "Constructing a filter..." << std::endl;
+
+ for (CORBA::ULong i = 0; i < event_types.length(); ++i)
+ {
+ std::cout << "\tevent_types[" << i << "].domain_name="
+ << event_types[i].domain_name
+ << std::endl;
+ std::cout << "\tevent_types[" << i << "].type_name="
+ << event_types[i].type_name
+ << std::endl;
+ }
+
+ std::cout << "\tIts constraint ="
+ << constraints[0].constraint_expr.in ()
+ << std::endl;
+}
+
+
+int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
+{
+ try
+ {
+ PortableServer::POAManager_var poa_manager;
+
+ CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
+
+ CORBA::Object_var poa_obj = orb->resolve_initial_references("RootPOA");
+ PortableServer::POA_var root_poa = PortableServer::POA::_narrow(poa_obj.in());
+
+ poa_manager = root_poa->the_POAManager();
+
+ poa_manager->activate();
+
+ /*Get event_channel*/
+ std::cout << "Get event_channel now" << std::endl;
+ CosNotifyChannelAdmin::EventChannel_var ec = get_event_channel(orb.in());
+
+ //Attaching a filter to pps
+ CosNotifyFilter::FilterFactory_var dff =
+ ec->default_filter_factory();
+
+ ACE_ASSERT(!CORBA::is_nil(dff.in()));
+
+ std::cout << "Test CosNotifyFilter::Filter::match_structured" << std::endl;
+
+ //Constructing a test event
+ CosNotification::StructuredEvent event;
+
+ event.header.fixed_header.event_type.domain_name =
+ CORBA::string_dup("Test_domain");
+ event.header.fixed_header.event_type.type_name =
+ CORBA::string_dup("Test_type_name");
+
+ event.header.variable_header.length(0);
+ event.remainder_of_body <<= "";
+
+ std::cout << "Constructing a test event" << std::endl;
+ std::cout << "\tIts header.fixed_header.event_type.domain_name="
+ << event.header.fixed_header.event_type.domain_name
+ << std::endl;
+ std::cout << "\tIts header.fixed_header.event_type.type_name="
+ << event.header.fixed_header.event_type.type_name
+ << std::endl;
+
+ CosNotifyFilter::Filter_var filter = dff->create_filter("EXTENDED_TCL");
+ update_constraints (filter, "DomainA", "TypeA", "DomainB", "TypeB");
+
+ bool expected_result = false;
+ match_structure_test (filter, event, expected_result);
+
+ update_constraints (filter, "*", "%ALL", "DomainB", "TypeB");
+ expected_result = true;
+ match_structure_test (filter, event, expected_result);
+
+ update_constraints (filter, "Test_domain", "%ALL", "DomainB", "TypeB");
+ expected_result = true;
+ match_structure_test (filter, event, expected_result);
+
+ update_constraints (filter, "*", "Test_type_name", "DomainB", "TypeB");
+ expected_result = true;
+ match_structure_test (filter, event, expected_result);
+
+ update_constraints (filter, "*", "*", "*", "*");
+ expected_result = true;
+ match_structure_test (filter, event, expected_result);
+
+ orb->shutdown();
+
+ }
+ catch(...)
+ {
+ std::cerr << "Filter: Some exceptions was caught!" << std::endl;
+ exit(1);
+ }
+
+
+ return 0;
+}
+
+
diff --git a/TAO/orbsvcs/tests/Notify/Bug_1884_Regression/run_test.pl b/TAO/orbsvcs/tests/Notify/Bug_1884_Regression/run_test.pl
new file mode 100755
index 00000000000..f40dd5eee68
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/Bug_1884_Regression/run_test.pl
@@ -0,0 +1,118 @@
+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;
+use strict;
+
+my $persistent_test = 0;
+my $notifyior = PerlACE::LocalFile("ecf.ior");
+my $notify2ior = PerlACE::LocalFile("ecf2.ior");
+my $notify_conf = PerlACE::LocalFile("ecf$PerlACE::svcconf_ext");
+my $port = PerlACE::uniqueid () + 10005;
+my $nts_ref = "NotifyService=iioploc://localhost:$port/NotifyService";
+my $svcconf = "";
+my $consumer_runtime = 5;
+my $persistent_file = PerlACE::LocalFile ("persistency.notif.xml");
+my $persistent_file_backup = PerlACE::LocalFile ("persistency.notif.000");
+
+
+if ($#ARGV >= 0 && $ARGV[0] eq '-p') {
+ $persistent_test = 1;
+ $svcconf = " -ORBSvcConf $notify_conf";
+ $consumer_runtime = 20;
+}
+
+my $NTS = new PerlACE::Process("../../../Notify_Service/Notify_Service",
+ "-ORBDebugLevel 1 ".
+ "-NoNameSvc -IORoutput $notifyior $svcconf " .
+ "-ORBEndpoint iiop://localhost:$port");
+my $SUPPLIER = new PerlACE::Process("supplier", "$nts_ref");
+my $CONSUMER = new PerlACE::Process("consumer", "$nts_ref -t $consumer_runtime");
+my $FILTER = new PerlACE::Process("filter", "$nts_ref");
+
+unlink($notifyior, $persistent_file, $persistent_file_backup);
+
+
+print "\n*********** Starting the Notify_Service ***********\n\n";
+$NTS->Spawn();
+if (PerlACE::waitforfile_timed($notifyior, 20) == -1) {
+ print STDERR "ERROR: waiting for the notify service to start\n";
+ $NTS->Kill();
+ exit(1);
+}
+
+if ($persistent_test == 0)
+{
+ print "\n*********** Starting the filter test ***********\n\n";
+ my $filter = $FILTER->SpawnWaitKill (10);
+ if ($filter != 0) {
+ $NTS->Kill();
+ exit(1);
+ }
+
+ print "\n*********** Filter test passed ***********\n\n";
+}
+
+print "\n*********** Starting the notification Consumer ***********\n\n";
+print STDERR $CONSUMER->CommandLine (). "\n";
+
+my $client = $CONSUMER->Spawn();
+if ($client != 0) {
+ $NTS->Kill();
+ exit(1);
+}
+
+sleep(5);
+
+if ($persistent_test == 1)
+{
+ print "*********** Killing the first Notify_Service ***********\n";
+ $NTS->Kill();
+ sleep(1);
+
+ unlink ($notifyior);
+
+ print "*********** Starting the second Notify_Service ***********\n";
+print STDERR $NTS->CommandLine (). "\n";
+ $NTS->Spawn();
+ if (PerlACE::waitforfile_timed($notifyior, 20) == -1) {
+ print STDERR "ERROR: waiting for the notify service to start\n";
+ $SUPPLIER->Kill();
+ exit(1);
+ }
+
+ sleep(5);
+}
+
+print "\n*********** Starting the notification Supplier ***********\n\n";
+print STDERR $SUPPLIER->CommandLine (). "\n";
+
+my $server = $SUPPLIER->Spawn();
+if ($server != 0) {
+ $NTS->Kill();
+ $CONSUMER->Kill();
+ exit(1);
+}
+
+$server = $SUPPLIER->WaitKill(10);
+if ($server != 0) {
+ $NTS->Kill();
+ $CONSUMER->Kill();
+ exit(1);
+}
+
+$client = $CONSUMER->WaitKill($consumer_runtime + 10);
+if ($client != 0) {
+ $NTS->Kill();
+ exit(1);
+}
+
+$NTS->Kill();
+
+#unlink($notifyior, $persistent_file, $persistent_file_backup);
+exit(0);
diff --git a/TAO/orbsvcs/tests/Notify/Bug_1884_Regression/supplier.cpp b/TAO/orbsvcs/tests/Notify/Bug_1884_Regression/supplier.cpp
new file mode 100644
index 00000000000..5088b562343
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/Bug_1884_Regression/supplier.cpp
@@ -0,0 +1,148 @@
+// $Id$
+
+#include "common.h"
+#include "ace/OS.h"
+
+
+namespace CosNotifyCommImpl{
+ class StructuredPushSupplier: public virtual POA_CosNotifyComm:: StructuredPushSupplier
+ {
+ public:
+ void disconnect_structured_push_supplier()
+ {};
+ void subscription_change( const CosNotification::EventTypeSeq&,
+ const CosNotification::EventTypeSeq&)
+ {};
+
+ };
+}
+
+
+int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
+{
+ try
+ {
+ PortableServer::POAManager_var poa_manager;
+
+ CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
+
+ CORBA::Object_var poa_obj = orb->resolve_initial_references("RootPOA");
+ PortableServer::POA_var root_poa = PortableServer::POA::_narrow(poa_obj.in());
+
+ poa_manager = root_poa->the_POAManager();
+
+ poa_manager->activate();
+
+ /*Get event_channel*/
+ std::cout << "Create event_channel now" << std::endl;
+ CosNotifyChannelAdmin::EventChannel_var ec = get_event_channel(orb.in());
+
+ //Instanciating the Supplier
+ CosNotifyComm::StructuredPushSupplier_var sps =
+ CosNotifyComm::StructuredPushSupplier::_nil();
+
+
+ CosNotifyCommImpl::StructuredPushSupplier *pImpl_sps = new CosNotifyCommImpl::StructuredPushSupplier;
+ sps = pImpl_sps->_this();
+
+ //Obtain a Supplier Admin
+ CosNotifyChannelAdmin::SupplierAdmin_var sa = ec->default_supplier_admin();
+ if( sa.in() == CosNotifyChannelAdmin::SupplierAdmin::_nil() ){
+ std::cerr << "sa is nil!" << std::endl;
+ return 1;
+ }
+
+ //Obtain a Proxy Consumer
+ CosNotifyChannelAdmin::ProxyID proxy_id;
+ CosNotifyChannelAdmin::ClientType ctype = CosNotifyChannelAdmin::STRUCTURED_EVENT;
+
+ CosNotifyChannelAdmin::ProxyConsumer_var proxyCon_obj;
+ try
+ {
+ proxyCon_obj = sa->obtain_notification_push_consumer(ctype, proxy_id);
+ }
+ catch(CosNotifyChannelAdmin::AdminLimitExceeded err)
+ {
+ std::cerr << "CosNotifyChannelAdmin::AdminLimitExceeded Exception!" << std::endl;
+ throw;
+ }
+
+ CosNotifyChannelAdmin::StructuredProxyPushConsumer_var ppc =
+ CosNotifyChannelAdmin::StructuredProxyPushConsumer::_narrow(proxyCon_obj.in());
+
+ //Connecting a Supplier to a Proxy Consumer
+ try
+ {
+ ppc->connect_structured_push_supplier(sps.in());
+ }
+ catch (CosEventChannelAdmin::AlreadyConnected ac)
+ {
+ std::cerr << "CosEventChannelAdmin::AlreadyConnected" << std::endl;
+ throw;
+ }
+ catch (CORBA::SystemException& se)
+ {
+ std::cerr << "System exception occurred during connect: " <<
+ se << std::endl;
+ throw;
+ }
+
+
+ //Demo::demo_send_heart_beat(ppc);
+ //Send a Demo Notification
+
+ CosNotification::StructuredEvent event;
+
+ event.header.fixed_header.event_type.domain_name =
+ CORBA::string_dup("Test_domain");
+ event.header.fixed_header.event_type.type_name =
+ CORBA::string_dup("Test_type_name");
+
+ event.header.variable_header.length(0);
+ event.remainder_of_body <<= "";
+
+ std::cout << "Sending a demo event...," << std::endl;
+ std::cout << "event.header.fixed_header.event_type.domain_name = "
+ << event.header.fixed_header.event_type.domain_name
+ << std::endl;
+ std::cout << "event.header.fixed_header.event_type.type_name = "
+ << event.header.fixed_header.event_type.type_name
+ << std::endl;
+
+
+ try{
+ ppc->push_structured_event(event);
+ }
+ catch (CORBA::SystemException& se)
+ {
+ std::cerr << "System exception occurred during push: "
+ << se << std::endl;
+ throw;
+ }
+ catch (CORBA::Exception&)
+ {
+ std::cerr << "Unknown exception occurred during push" << std::endl;
+ throw;
+ }
+
+ try{
+ ppc->disconnect_structured_push_consumer();
+ }
+ catch(CORBA::Exception&)
+ {
+ std::cerr << "Disconnect fail!" << std::endl;
+ }
+
+ orb->shutdown();
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Supplier done.\n")));
+ }
+ catch(...)
+ {
+ std::cerr << "Supplier: Some exceptions was caught!" << std::endl;
+ return 1;
+ }
+
+
+ return 0;
+}
+
diff --git a/TAO/orbsvcs/tests/Notify/Makefile.am b/TAO/orbsvcs/tests/Notify/Makefile.am
index 7411a1a6d95..fd57f40dcae 100644
--- a/TAO/orbsvcs/tests/Notify/Makefile.am
+++ b/TAO/orbsvcs/tests/Notify/Makefile.am
@@ -20,6 +20,7 @@ SUBDIRS = \
Sequence_Multi_ETCL_Filter \
Reconnecting \
RT_lib \
+ Persistent_Filter \
Persistent_POA \
Ordering \
MT_Dispatching \
@@ -31,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/Persistent_Filter/Filter.cpp b/TAO/orbsvcs/tests/Notify/Persistent_Filter/Filter.cpp
new file mode 100644
index 00000000000..3176f89fcdd
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/Persistent_Filter/Filter.cpp
@@ -0,0 +1,752 @@
+/* -*- C++ -*- $Id$ */
+
+#include "Filter.h"
+#include "ace/Get_Opt.h"
+#include "ace/OS.h"
+
+ACE_RCSID(Filter, Filter, "Filter.cpp,v 1.13 2002/05/28 20:24:16 pradeep Exp")
+
+#define NOTIFY_FACTORY_NAME "NotifyEventChannelFactory"
+#define NAMING_SERVICE_NAME "NameService"
+#define CA_FILTER "threshold < 20"
+#define SA_FILTER "threshold > 10"
+
+#define MOD_CA_FILTER "threshold < 15"
+#define MOD_SA_FILTER "threshold > 10"
+
+#define TCL_GRAMMAR "TCL"
+#define EVENTS_TO_SEND 30
+int EVENTS_EXPECTED_TO_RECEIVE = 9*4; // 2 consumers get the same events from 2 suppliers
+#define DOMAIN_NAME "*"
+#define TYPE_NAME "*"
+
+ ACE_Atomic_Op <TAO_SYNCH_MUTEX, int> g_result_count = 0;
+
+FilterClient::FilterClient (void)
+ :consumer_1 (0),
+ consumer_2 (0),
+ supplier_1 (0),
+ supplier_2 (0),
+ adminid_1_id_ (0),
+ adminid_2_id_ (0),
+ channel_id_ (0),
+ use_persistent_ (false),
+ modify_constraint_ (false),
+ done_ (0)
+{
+ g_result_count = 0;
+ // No-Op.
+ ifgop_ = CosNotifyChannelAdmin::AND_OP;
+}
+
+FilterClient::~FilterClient ()
+{
+}
+
+
+int
+FilterClient::parse_args (int argc, ACE_TCHAR *argv[])
+{
+ ACE_Get_Opt opts (argc, argv, ACE_TEXT("pm"));
+ int c;
+
+ while ((c = opts ()) != -1)
+ switch (c)
+ {
+ case 'p':
+ this->use_persistent_ = true;
+ break;
+ case 'm':
+ this->modify_constraint_ = true;
+ EVENTS_EXPECTED_TO_RECEIVE = 4*4;
+ break;
+ case '?':
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("usage: %C [-p] [-m]\n"),
+ argv [0]),
+ -1);
+ }
+
+ return 0;
+}
+
+void
+FilterClient::init_supplier (int argc, ACE_TCHAR *argv [])
+{
+ init_ORB (argc, argv);
+
+ if (parse_args (argc, argv) == -1)
+ {
+ ACE_OS::exit (1);
+ }
+
+ resolve_naming_service ();
+
+ resolve_Notify_factory ();
+
+ if (this->use_persistent_)
+ {
+ get_EC ();
+ }
+ else
+ {
+ create_EC ();
+ }
+
+ if (this->use_persistent_)
+ {
+ get_supplieradmin ();
+ }
+ else
+ {
+ create_supplieradmin ();
+ }
+
+ create_suppliers ();
+}
+
+
+void
+FilterClient::init_consumer (int argc, ACE_TCHAR *argv [])
+{
+ init_ORB (argc, argv);
+
+ if (parse_args (argc, argv) == -1)
+ {
+ ACE_OS::exit (1);
+ }
+
+ resolve_naming_service ();
+
+ resolve_Notify_factory ();
+
+ get_EC ();
+
+ if (this->use_persistent_)
+ {
+ get_consumeradmin ();
+ }
+ else
+ {
+ create_consumeradmin ();
+ }
+
+ create_consumers ();
+}
+
+void
+FilterClient::wait_ready ()
+{
+ while ( 1 )
+ {
+ CosNotifyChannelAdmin::AdminIDSeq_var cons_ids
+ = ec_->get_all_consumeradmins ();
+
+ CosNotifyChannelAdmin::AdminIDSeq_var sup_ids
+ = ec_->get_all_supplieradmins ();
+
+ if (cons_ids->length () + sup_ids->length () == 3)
+ break;
+ else
+ ACE_OS::sleep (1);
+ }
+}
+
+
+void
+FilterClient::wait_consumer_complete ()
+{
+ int i = 0;
+ const int TIMEOUT = 30;
+
+ while ( i < TIMEOUT )
+ {
+ try
+ {
+ CosNotifyChannelAdmin::AdminIDSeq_var ids
+ = this->ec_->get_all_consumeradmins();
+
+ if (ids->length () > 0)
+ {
+ ACE_OS::sleep (1);
+ ++i;
+ }
+ else
+ break;
+ }
+ catch (const CORBA::OBJECT_NOT_EXIST&)
+ {
+ break;
+ }
+ }
+}
+
+
+void
+FilterClient::run_supplier ()
+{
+ this->wait_ready ();
+
+ //Add delay so consumer won't miss any events.
+ ACE_OS::sleep (5);
+
+ send_events ();
+
+ this->wait_consumer_complete ();
+}
+
+void
+FilterClient::run_consumer ()
+{
+ this->wait_ready ();
+
+ if (g_result_count != EVENTS_EXPECTED_TO_RECEIVE)
+ { // if we still need to wait for events, run the orb.
+ while (!this->done_)
+ if (this->orb_->work_pending ())
+ this->orb_->perform_work ();
+ }
+
+ //ACE_DEBUG ((LM_DEBUG, "(%P|%t)destroying consumer admins ... \n"));
+
+ //this->consumer_admin_1_->destroy ();
+ //this->consumer_admin_2_->destroy ();
+}
+
+void
+FilterClient::done (void)
+{
+ this->done_ = 1;
+}
+
+void
+FilterClient::init_ORB (int& argc, ACE_TCHAR **& argv)
+{
+ this->orb_ = CORBA::ORB_init (argc, argv);
+
+
+ CORBA::Object_ptr poa_object =
+ this->orb_->resolve_initial_references("RootPOA");
+
+ if (CORBA::is_nil (poa_object))
+ {
+ ACE_ERROR ((LM_ERROR,
+ " (%P|%t) Unable to initialize the POA.\n"));
+ return;
+ }
+ this->root_poa_ =
+ PortableServer::POA::_narrow (poa_object);
+
+ PortableServer::POAManager_var poa_manager =
+ root_poa_->the_POAManager ();
+
+ poa_manager->activate ();
+}
+
+void
+FilterClient::resolve_naming_service ()
+{
+ CORBA::Object_var naming_obj =
+ this->orb_->resolve_initial_references (NAMING_SERVICE_NAME);
+
+ // Need to check return value for errors.
+ if (CORBA::is_nil (naming_obj.in ()))
+ throw CORBA::UNKNOWN ();
+
+ this->naming_context_ =
+ CosNaming::NamingContext::_narrow (naming_obj.in ());
+}
+
+void
+FilterClient::resolve_Notify_factory ()
+{
+ CosNaming::Name name (1);
+ name.length (1);
+ name[0].id = CORBA::string_dup (NOTIFY_FACTORY_NAME);
+
+ CORBA::Object_var obj =
+ this->naming_context_->resolve (name);
+
+ this->notify_factory_ =
+ CosNotifyChannelAdmin::EventChannelFactory::_narrow (obj.in ());
+}
+
+void
+FilterClient::create_EC ()
+{
+ ec_ = notify_factory_->create_channel (initial_qos_,
+ initial_admin_,
+ channel_id_);
+
+ ACE_ASSERT (!CORBA::is_nil (ec_.in ()));
+}
+
+void
+FilterClient::get_EC ()
+{
+ int i = 0;
+ const int TIMEOUT = 20;
+ while (i < TIMEOUT)
+ {
+ CosNotifyChannelAdmin::ChannelIDSeq_var ids
+ = notify_factory_->get_all_channels ();
+
+ if (ids->length () > 0)
+ {
+ //ACE_DEBUG ((LM_DEBUG, "(%P|%t)get_EC %d \n", ids->length ()));
+ ec_ = notify_factory_->get_event_channel (ids[0]);
+
+ ACE_ASSERT (!CORBA::is_nil (ec_.in ()));
+ break;
+ }
+ else
+ {
+ ++ i;
+ ACE_OS::sleep (1);
+ }
+ }
+}
+
+void
+FilterClient::create_supplieradmin ()
+{
+ CosNotifyChannelAdmin::AdminID adminid = 0;
+
+ supplier_admin_ =
+ ec_->new_for_suppliers (this->ifgop_, adminid);
+
+ ACE_ASSERT (!CORBA::is_nil (supplier_admin_.in ()));
+
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("(%P|%t)create_supplieradmin %d \n"), adminid));
+
+ CosNotifyFilter::FilterFactory_var ffact =
+ ec_->default_filter_factory ();
+
+ // setup a filter at the consumer admin
+ CosNotifyFilter::Filter_var sa_filter =
+ ffact->create_filter (TCL_GRAMMAR);
+
+ ACE_ASSERT (!CORBA::is_nil (sa_filter.in ()));
+
+ CosNotifyFilter::ConstraintExpSeq constraint_list (2);
+ constraint_list.length (2);
+
+ constraint_list[0].event_types.length (1);
+ constraint_list[0].event_types[0].domain_name = CORBA::string_dup(DOMAIN_NAME);
+ constraint_list[0].event_types[0].type_name = CORBA::string_dup(TYPE_NAME);
+
+ constraint_list[0].constraint_expr = CORBA::string_dup (SA_FILTER);
+ constraint_list[1].event_types.length (1);
+ constraint_list[1].event_types[0].domain_name = CORBA::string_dup(DOMAIN_NAME);
+ constraint_list[1].event_types[0].type_name = CORBA::string_dup(TYPE_NAME);
+ constraint_list[1].constraint_expr = CORBA::string_dup (SA_FILTER);
+
+ sa_filter->add_constraints (constraint_list);
+
+ supplier_admin_->add_filter (sa_filter.in ());
+}
+
+
+void
+FilterClient::get_supplieradmin ()
+{
+ CosNotifyChannelAdmin::AdminIDSeq_var ids
+ = ec_->get_all_supplieradmins();
+
+ ACE_ASSERT (ids->length () == 1);
+
+ supplier_admin_ = ec_->get_supplieradmin (ids[0]);
+
+ ACE_ASSERT (!CORBA::is_nil (supplier_admin_.in ()));
+
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("(%P|%t)get_supplieradmin %d \n"), ids[0]));
+
+ CosNotifyFilter::FilterAdmin_var admin
+ = CosNotifyFilter::FilterAdmin::_narrow (supplier_admin_.in ());
+ verify_filter (admin, SA_FILTER, MOD_SA_FILTER);
+}
+
+
+void
+FilterClient::create_consumeradmin ()
+{
+ consumer_admin_1_ =
+ ec_->new_for_consumers (this->ifgop_, this->adminid_1_id_);
+
+ ACE_ASSERT (!CORBA::is_nil (consumer_admin_1_.in ()));
+
+ consumer_admin_2_ =
+ ec_->new_for_consumers (this->ifgop_, this->adminid_2_id_);
+
+ ACE_ASSERT (!CORBA::is_nil (consumer_admin_2_.in ()));
+
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("(%P|%t)create_consumeradmin %d %d\n"),
+ adminid_1_id_, adminid_2_id_));
+
+ CosNotifyFilter::FilterFactory_var ffact =
+ ec_->default_filter_factory ();
+
+ // setup a filter at the consumer admin
+ CosNotifyFilter::Filter_var ca_filter_1 =
+ ffact->create_filter (TCL_GRAMMAR);
+
+ ACE_ASSERT (!CORBA::is_nil (ca_filter_1.in ()));
+
+ // setup a filter at the consumer admin
+ CosNotifyFilter::Filter_var ca_filter_2 =
+ ffact->create_filter (TCL_GRAMMAR);
+
+ ACE_ASSERT (!CORBA::is_nil (ca_filter_2.in ()));
+
+ /* struct ConstraintExp {
+ CosNotification::EventTypeSeq event_types;
+ string constraint_expr;
+ };
+ */
+ CosNotifyFilter::ConstraintExpSeq constraint_list (2);
+ constraint_list.length (2);
+
+ constraint_list[0].event_types.length (1);
+ constraint_list[0].event_types[0].domain_name = CORBA::string_dup(DOMAIN_NAME);
+ constraint_list[0].event_types[0].type_name = CORBA::string_dup(TYPE_NAME);
+
+ constraint_list[0].constraint_expr = CORBA::string_dup (CA_FILTER);
+ constraint_list[1].event_types.length (1);
+ constraint_list[1].event_types[0].domain_name = CORBA::string_dup(DOMAIN_NAME);
+ constraint_list[1].event_types[0].type_name = CORBA::string_dup(TYPE_NAME);
+ constraint_list[1].constraint_expr = CORBA::string_dup (CA_FILTER);
+
+ ca_filter_1->add_constraints (constraint_list);
+ ca_filter_2->add_constraints (constraint_list);
+
+ consumer_admin_1_->add_filter (ca_filter_1.in ());
+
+ consumer_admin_2_->add_filter (ca_filter_2.in ());
+}
+
+void
+FilterClient::get_consumeradmin ()
+{
+ CosNotifyChannelAdmin::AdminIDSeq_var ids
+ = ec_->get_all_consumeradmins();
+
+ ACE_ASSERT (ids->length () == 2);
+
+ this->adminid_1_id_ = ids[0];
+ this->adminid_2_id_ = ids[1];
+
+ consumer_admin_1_ = ec_->get_consumeradmin (this->adminid_1_id_);
+ consumer_admin_2_ = ec_->get_consumeradmin (this->adminid_2_id_);
+
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("(%P|%t)get_consumeradmin %d %d\n"),
+ adminid_1_id_, adminid_2_id_));
+
+ CosNotifyFilter::FilterAdmin_var admin
+ = CosNotifyFilter::FilterAdmin::_narrow (consumer_admin_1_.in ());
+ verify_filter (admin, CA_FILTER, MOD_CA_FILTER);
+ admin = CosNotifyFilter::FilterAdmin::_narrow (consumer_admin_2_.in ());
+ verify_filter (admin, CA_FILTER, MOD_CA_FILTER);
+}
+
+
+void
+FilterClient::verify_filter (CosNotifyFilter::FilterAdmin_var& admin,
+ const char* constraint_expr,
+ const char* mod_constraint_expr)
+{
+ ACE_UNUSED_ARG (constraint_expr);
+ // only used to validate assert, which is
+ // compiled out for nondebug builds.
+ CosNotifyFilter::FilterIDSeq_var ids
+ = admin->get_all_filters ();
+
+ ACE_ASSERT (ids->length () == 1);
+
+ CosNotifyFilter::Filter_var filter
+ = admin->get_filter (ids[0]);
+
+ ACE_ASSERT (! CORBA::is_nil (filter.in ()));
+
+ CosNotifyFilter::ConstraintInfoSeq_var infos
+ = filter->get_all_constraints();
+
+ ACE_ASSERT (infos->length () == 2);
+
+ u_int index = 0;
+
+ for (index = 0; index < infos->length (); ++ index)
+ {
+ CosNotifyFilter::ConstraintID id = infos[index].constraint_id;
+ ACE_UNUSED_ARG (id);
+ // only used to validate assert, which is
+ // compiled out for nondebug builds.
+ ACE_ASSERT (id != 0);
+ ACE_ASSERT (ACE_OS::strcmp (infos[index].constraint_expression.constraint_expr.in (), constraint_expr) == 0);
+
+ CosNotification::EventTypeSeq& events = infos[index].constraint_expression.event_types;
+ ACE_UNUSED_ARG (events);
+ // only used to validate assert, which is
+ // compiled out for nondebug builds.
+ ACE_ASSERT (events.length () == 1);
+
+ ACE_ASSERT (ACE_OS::strcmp (events[0].domain_name.in (), DOMAIN_NAME) == 0);
+ ACE_ASSERT (ACE_OS::strcmp (events[0].type_name.in (), TYPE_NAME) == 0);
+ }
+
+ if (modify_constraint_)
+ {
+ CosNotifyFilter::ConstraintIDSeq_var ids = new CosNotifyFilter::ConstraintIDSeq (2);
+ ids->length (2);
+ for (index = 0; index < infos->length (); ++ index)
+ {
+ ids[index] = infos[index].constraint_id;
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("(%P|%t)modify constraint %d \n"), ids[index]));
+
+ infos[index].constraint_expression.constraint_expr
+ = CORBA::string_dup (mod_constraint_expr);
+ }
+
+ filter->modify_constraints (ids.in (), infos.in());
+ }
+}
+
+
+void
+FilterClient::create_consumers ()
+{
+ // startup the first consumer.
+ ACE_NEW_THROW_EX (consumer_1,
+ Filter_StructuredPushConsumer (this, "consumer1"),
+ CORBA::NO_MEMORY ());
+
+ consumer_1->connect (consumer_admin_1_.in ());
+
+ // startup the second consumer.
+ ACE_NEW_THROW_EX (consumer_2,
+ Filter_StructuredPushConsumer (this, "consumer2"),
+ CORBA::NO_MEMORY ());
+
+ consumer_2->connect (consumer_admin_2_.in ());
+}
+
+void
+FilterClient::create_suppliers ()
+{
+ // startup the first supplier
+ ACE_NEW_THROW_EX (supplier_1,
+ Filter_StructuredPushSupplier ("supplier1"),
+ CORBA::NO_MEMORY ());
+
+ supplier_1->connect (supplier_admin_.in ());
+
+ // startup the second supplier
+ ACE_NEW_THROW_EX (supplier_2,
+ Filter_StructuredPushSupplier ("supplier2"),
+ CORBA::NO_MEMORY ());
+
+ supplier_2->connect (supplier_admin_.in ());
+}
+
+void
+FilterClient::send_events ()
+{
+ // operations:
+ CosNotification::StructuredEvent event;
+
+ // EventHeader
+
+ // FixedEventHeader
+ // EventType
+ // string
+ event.header.fixed_header.event_type.domain_name = CORBA::string_dup(DOMAIN_NAME);
+ // string
+ event.header.fixed_header.event_type.type_name = CORBA::string_dup(TYPE_NAME);
+ // string
+ event.header.fixed_header.event_name = CORBA::string_dup("myevent");
+
+ // OptionalHeaderFields
+ // PropertySeq
+ // sequence<Property>: string name, any value
+ event.header.variable_header.length (1); // put nothing here
+
+ // FilterableEventBody
+ // PropertySeq
+ // sequence<Property>: string name, any value
+ event.filterable_data.length (3);
+ event.filterable_data[0].name = CORBA::string_dup("threshold");
+
+ event.filterable_data[1].name = CORBA::string_dup("temperature");
+ event.filterable_data[1].value <<= (CORBA::Long)70;
+
+ event.filterable_data[2].name = CORBA::string_dup("pressure");
+ event.filterable_data[2].value <<= (CORBA::Long)80;
+
+ event.filterable_data[0].value <<= (CORBA::Long)4;
+
+ // any
+ event.remainder_of_body <<= (CORBA::Long)4;
+
+ for (int i = 0; i < EVENTS_TO_SEND; i++)
+ {
+ event.filterable_data[0].value <<= (CORBA::Long)i;
+
+ // any
+ event.remainder_of_body <<= (CORBA::Long)i;
+
+ supplier_1->send_event (event);
+
+ supplier_2->send_event (event);
+ }
+}
+
+
+Filter_StructuredPushConsumer::Filter_StructuredPushConsumer (FilterClient* filter, const char* my_name)
+ :filter_ (filter),
+ my_name_ (my_name)
+{
+}
+
+Filter_StructuredPushConsumer::~Filter_StructuredPushConsumer (void)
+{
+}
+
+void
+Filter_StructuredPushConsumer::connect (CosNotifyChannelAdmin::ConsumerAdmin_ptr consumer_admin)
+{
+ // Activate the consumer with the default_POA_
+ CosNotifyComm::StructuredPushConsumer_var objref =
+ this->_this ();
+
+ CosNotifyChannelAdmin::ProxySupplier_var proxysupplier =
+ consumer_admin->obtain_notification_push_supplier (CosNotifyChannelAdmin::STRUCTURED_EVENT, proxy_supplier_id_);
+
+ ACE_ASSERT (!CORBA::is_nil (proxysupplier.in ()));
+
+ // narrow
+ this->proxy_supplier_ =
+ CosNotifyChannelAdmin::StructuredProxyPushSupplier::
+ _narrow (proxysupplier.in ());
+
+ ACE_ASSERT (!CORBA::is_nil (proxy_supplier_.in ()));
+
+ proxy_supplier_->connect_structured_push_consumer (objref.in ());
+}
+
+void
+Filter_StructuredPushConsumer::disconnect ()
+{
+ this->proxy_supplier_->
+ disconnect_structured_push_supplier();
+}
+
+void
+Filter_StructuredPushConsumer::offer_change
+ (const CosNotification::EventTypeSeq & /*added*/,
+ const CosNotification::EventTypeSeq & /*removed*/)
+{
+ // No-Op.
+}
+
+void
+Filter_StructuredPushConsumer::push_structured_event
+ (const CosNotification::StructuredEvent & notification)
+{
+ CORBA::Long val;
+
+ notification.remainder_of_body >>= val;
+
+ // @@ Pradeep: for your tests try to make sure that you count the
+ // number of expected and sent events to verify that things work
+ // correctly in an automatic way...
+
+
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("%C received event, %d\n"),
+ my_name_.fast_rep (), val));
+
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("event count %d\n"), g_result_count.value ()));
+
+ if (++g_result_count == EVENTS_EXPECTED_TO_RECEIVE)
+ this->filter_->done (); // all events received, we're done.
+}
+
+void
+Filter_StructuredPushConsumer::disconnect_structured_push_consumer ()
+{
+ // No-Op.
+}
+
+
+/*****************************************************************/
+
+Filter_StructuredPushSupplier::Filter_StructuredPushSupplier (const char* my_name)
+ :my_name_ (my_name)
+{
+}
+
+Filter_StructuredPushSupplier::~Filter_StructuredPushSupplier ()
+{
+}
+
+void
+Filter_StructuredPushSupplier::connect (CosNotifyChannelAdmin::SupplierAdmin_ptr supplier_admin)
+{
+ CosNotifyComm::StructuredPushSupplier_var objref =
+ this->_this ();
+
+ CosNotifyChannelAdmin::ProxyConsumer_var proxyconsumer =
+ supplier_admin->obtain_notification_push_consumer (CosNotifyChannelAdmin::STRUCTURED_EVENT, proxy_consumer_id_);
+
+ ACE_ASSERT (!CORBA::is_nil (proxyconsumer.in ()));
+
+ // narrow
+ this->proxy_consumer_ =
+ CosNotifyChannelAdmin::StructuredProxyPushConsumer::_narrow (proxyconsumer.in ());
+
+ ACE_ASSERT (!CORBA::is_nil (proxy_consumer_.in ()));
+
+ proxy_consumer_->connect_structured_push_supplier (objref.in ());
+}
+
+void
+Filter_StructuredPushSupplier::disconnect ()
+{
+ ACE_ASSERT (!CORBA::is_nil (this->proxy_consumer_.in ()));
+
+ this->proxy_consumer_->disconnect_structured_push_consumer();
+}
+
+void
+Filter_StructuredPushSupplier::subscription_change
+ (const CosNotification::EventTypeSeq & /*added*/,
+ const CosNotification::EventTypeSeq & /*removed */)
+{
+ //No-Op.
+}
+
+void
+Filter_StructuredPushSupplier::send_event
+ (const CosNotification::StructuredEvent& event)
+{
+ ACE_ASSERT (!CORBA::is_nil (this->proxy_consumer_.in ()));
+
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("%C is sending an event \n"), my_name_.fast_rep ()));
+
+ proxy_consumer_->push_structured_event (event);
+}
+
+void
+Filter_StructuredPushSupplier::disconnect_structured_push_supplier ()
+{
+ // No-Op.
+}
+
+
diff --git a/TAO/orbsvcs/tests/Notify/Persistent_Filter/Filter.h b/TAO/orbsvcs/tests/Notify/Persistent_Filter/Filter.h
new file mode 100644
index 00000000000..98c27a6d436
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/Persistent_Filter/Filter.h
@@ -0,0 +1,270 @@
+/* -*- C++ -*- */
+// $Id$
+// ==========================================================================
+//
+// = FILENAME
+// Filter.h
+//
+// = DESCRIPTION
+// Class to demo structured event filtering.
+//
+// = AUTHOR
+// Pradeep Gore <pradeep@cs.wustl.edu>
+//
+// ==========================================================================
+
+#ifndef NOTIFY_FILTER_CLIENT_H
+#define NOTIFY_FILTER_CLIENT_H
+
+#include "orbsvcs/orbsvcs/CosNotifyChannelAdminS.h"
+#include "orbsvcs/orbsvcs/CosNotifyCommC.h"
+#include "orbsvcs/orbsvcs/CosNamingC.h"
+#include "ace/SString.h"
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+class Filter_StructuredPushConsumer;
+class Filter_StructuredPushSupplier;
+
+class FilterClient
+{
+ // = TITLE
+ // Filter Client
+ // = DESCRIPTION
+ // Client example that shows how to do Structured Event filtering
+ // in the Notification Service.
+
+ public:
+ // = Initialization and Termination
+ FilterClient (void);
+ // Constructor
+
+ ~FilterClient ();
+ // Destructor
+
+ void init_supplier (int argc, ACE_TCHAR *argv []);
+ void init_consumer (int argc, ACE_TCHAR *argv []);
+ // Init the Client.
+
+ void run_supplier ();
+ void run_consumer ();
+ // Run the demo.
+
+ void done (void);
+ // Consumer calls done, We're done.
+
+ protected:
+
+ int parse_args (int argc,
+ ACE_TCHAR *argv[]);
+
+ void init_ORB (int& argc, ACE_TCHAR **& argv);
+ // Initializes the ORB.
+
+ void resolve_naming_service ();
+ // Try to get hold of a running naming service.
+
+ void resolve_Notify_factory ();
+ // Try to resolve the Notify factory from the Naming service.
+
+ void create_EC ();
+ void get_EC ();
+ // Create an EC.
+
+ void create_supplieradmin();
+ // Create the Supplier Admin.
+ void get_supplieradmin();
+
+ void create_consumeradmin ();
+ // Create the Consumer Admin.
+ void get_consumeradmin ();
+
+ void create_consumers ();
+ // Create and initialize the consumers.
+
+ void create_suppliers ();
+ // create and initialize the suppliers.
+
+ void send_events ();
+ // send the events.
+
+ void wait_ready ();
+
+ void wait_consumer_complete ();
+
+ void verify_filter (CosNotifyFilter::FilterAdmin_var& admin,
+ const char* constraint_expr,
+ const char* mod_constraint_expr);
+
+ // = Data Members
+ PortableServer::POA_var root_poa_;
+ // Reference to the root poa.
+
+ CORBA::ORB_var orb_;
+ // The ORB that we use.
+
+ CosNaming::NamingContext_var naming_context_;
+ // Handle to the name service.
+
+ CosNotifyChannelAdmin::EventChannelFactory_var notify_factory_;
+ // Channel factory.
+
+ CosNotifyChannelAdmin::EventChannel_var ec_;
+ // The one channel that we create using the factory.
+
+ CosNotifyChannelAdmin::InterFilterGroupOperator ifgop_;
+ // The group operator between admin-proxy's.
+
+ CosNotification::QoSProperties initial_qos_;
+ // Initial qos specified to the factory when creating the EC.
+
+ CosNotification::AdminProperties initial_admin_;
+ // Initial admin props specified to the factory when creating the EC.
+
+ CosNotifyChannelAdmin::ConsumerAdmin_var consumer_admin_1_;
+ CosNotifyChannelAdmin::ConsumerAdmin_var consumer_admin_2_;
+ // The consumer admin used by consumers.
+
+ CosNotifyChannelAdmin::SupplierAdmin_var supplier_admin_;
+ // The supplier admin used by suppliers.
+
+ Filter_StructuredPushConsumer* consumer_1;
+ // Consumer #1
+
+ Filter_StructuredPushConsumer* consumer_2;
+ // Consumer #2
+
+ Filter_StructuredPushSupplier* supplier_1;
+ // Supplier #1
+
+ Filter_StructuredPushSupplier* supplier_2;
+ // Supplier #2
+
+ CosNotifyChannelAdmin::AdminID adminid_1_id_;
+ CosNotifyChannelAdmin::AdminID adminid_2_id_;
+
+ CosNotifyChannelAdmin::ChannelID channel_id_;
+
+ bool use_persistent_;
+
+ bool modify_constraint_;
+
+ // Set this flag to exit the run loop.
+ CORBA::Boolean done_;
+};
+
+/*****************************************************************/
+class Filter_StructuredPushConsumer : public POA_CosNotifyComm::StructuredPushConsumer
+{
+ // = TITLE
+ // Filter_StructuredPushConsumer
+ //
+ // = DESCRIPTION
+ // Consumer for the Filter example.
+ //
+
+ public:
+ // = Initialization and Termination code
+ Filter_StructuredPushConsumer (FilterClient* filter, const char *my_name);
+ // Constructor.
+
+ void connect (CosNotifyChannelAdmin::ConsumerAdmin_ptr consumer_admin);
+ // Connect the Consumer to the EventChannel.
+ // Creates a new proxy supplier and connects to it.
+
+ virtual void disconnect ();
+ // Disconnect from the supplier.
+
+protected:
+ // = Data members
+
+ FilterClient* filter_;
+ // The callback for <done>
+
+ ACE_CString my_name_;
+ // The name of this consumer.
+
+ CosNotifyChannelAdmin::StructuredProxyPushSupplier_var proxy_supplier_;
+ // The proxy that we are connected to.
+
+ CosNotifyChannelAdmin::ProxyID proxy_supplier_id_;
+ // The proxy_supplier id.
+
+ // = Methods
+ virtual ~Filter_StructuredPushConsumer (void);
+ // Destructor
+
+ // = NotifyPublish method
+ virtual void offer_change (
+ const CosNotification::EventTypeSeq & added,
+ const CosNotification::EventTypeSeq & removed
+ );
+
+ // = StructuredPushSupplier methods
+ virtual void push_structured_event (
+ const CosNotification::StructuredEvent & notification
+ );
+
+ virtual void disconnect_structured_push_consumer ();
+};
+
+/*****************************************************************/
+
+class Filter_StructuredPushSupplier : public POA_CosNotifyComm::StructuredPushSupplier
+{
+ // = TITLE
+ // Filter_StructuredPushSupplier
+ //
+ // = DESCRIPTION
+ // Supplier for the filter example.
+ //
+ public:
+ // = Initialization and Termination code
+ Filter_StructuredPushSupplier (const char* my_name);
+ // Constructor.
+
+ void connect (CosNotifyChannelAdmin::SupplierAdmin_ptr supplier_admin);
+ // Connect the Supplier to the EventChannel.
+ // Creates a new proxy supplier and connects to it.
+
+ void disconnect ();
+ // Disconnect from the supplier.
+
+ virtual void send_event (const CosNotification::StructuredEvent& event);
+ // Send one event.
+
+protected:
+ // = Data members
+ ACE_CString my_name_;
+ // The name of this consumer.
+
+ CosNotifyChannelAdmin::StructuredProxyPushConsumer_var proxy_consumer_;
+ // The proxy that we are connected to.
+
+ CosNotifyChannelAdmin::ProxyID proxy_consumer_id_;
+ // This supplier's id.
+
+ // = Protected Methods
+ virtual ~Filter_StructuredPushSupplier ();
+ // Destructor
+
+ // = NotifySubscribe
+ virtual void subscription_change (
+ const CosNotification::EventTypeSeq & added,
+ const CosNotification::EventTypeSeq & removed
+ );
+
+ // = StructuredPushSupplier method
+ virtual void disconnect_structured_push_supplier ();
+};
+
+/***************************************************************************/
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#endif /* NOTIFY_FILTER_CLIENT_H */
diff --git a/TAO/orbsvcs/tests/Notify/Persistent_Filter/Makefile.am b/TAO/orbsvcs/tests/Notify/Persistent_Filter/Makefile.am
new file mode 100644
index 00000000000..83d7ba78ff8
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/Persistent_Filter/Makefile.am
@@ -0,0 +1,95 @@
+## 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:
+## ../bin/mwc.pl -type automake -noreldefs TAO.mwc
+
+ACE_BUILDDIR = $(top_builddir)/..
+ACE_ROOT = $(top_srcdir)/..
+TAO_BUILDDIR = $(top_builddir)
+TAO_ROOT = $(top_srcdir)
+
+noinst_PROGRAMS =
+
+## Makefile.consumer.am
+
+if BUILD_EXCEPTIONS
+
+noinst_PROGRAMS += consumer
+
+consumer_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR) \
+ -I$(TAO_ROOT) \
+ -I$(TAO_BUILDDIR) \
+ -I$(TAO_ROOT)/orbsvcs \
+ -I$(TAO_BUILDDIR)/orbsvcs \
+ -DTAO_HAS_TYPED_EVENT_CHANNEL
+
+consumer_SOURCES = \
+ Filter.cpp \
+ consumer.cpp \
+ Filter.h
+
+consumer_LDADD = \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosNaming.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosNotification_Skel.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosEvent_Skel.la \
+ $(TAO_BUILDDIR)/tao/libTAO_PortableServer.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosNotification.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosEvent.la \
+ $(TAO_BUILDDIR)/tao/libTAO_AnyTypeCode.la \
+ $(TAO_BUILDDIR)/tao/libTAO.la \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+endif BUILD_EXCEPTIONS
+
+## Makefile.supplier.am
+
+if BUILD_EXCEPTIONS
+
+noinst_PROGRAMS += supplier
+
+supplier_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR) \
+ -I$(TAO_ROOT) \
+ -I$(TAO_BUILDDIR) \
+ -I$(TAO_ROOT)/orbsvcs \
+ -I$(TAO_BUILDDIR)/orbsvcs \
+ -DTAO_HAS_TYPED_EVENT_CHANNEL
+
+supplier_SOURCES = \
+ Filter.cpp \
+ supplier.cpp \
+ Filter.h
+
+supplier_LDADD = \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosNaming.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosNotification_Skel.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosEvent_Skel.la \
+ $(TAO_BUILDDIR)/tao/libTAO_PortableServer.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosNotification.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosEvent.la \
+ $(TAO_BUILDDIR)/tao/libTAO_AnyTypeCode.la \
+ $(TAO_BUILDDIR)/tao/libTAO.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/Persistent_Filter/NS.conf b/TAO/orbsvcs/tests/Notify/Persistent_Filter/NS.conf
new file mode 100644
index 00000000000..b5fc33c0af7
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/Persistent_Filter/NS.conf
@@ -0,0 +1,5 @@
+static TAO_CosNotify_Service "-AllocateTaskPerProxy -DispatchingThreads 1 -SourceThreads 1 -AllowReconnect -ValidateClient -ValidateClientDelay 1 -ValidateClientInterval 10 "
+
+dynamic Topology_Factory Service_Object* TAO_CosNotification_Persist:_make_TAO_Notify_XML_Topology_Factory() "-save_base_path ./persistency.notif -load_base_path ./persistency.notif -backup_count 1 -v"
+
+#dynamic Logging_Strategy Service_Object* ACE:_make_ACE_Logging_Strategy() "-s NS -f OSTREAM -t 0 -m 1024 -w"
diff --git a/TAO/orbsvcs/tests/Notify/Persistent_Filter/Persistent_Filter.mpc b/TAO/orbsvcs/tests/Notify/Persistent_Filter/Persistent_Filter.mpc
new file mode 100644
index 00000000000..64f8381180d
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/Persistent_Filter/Persistent_Filter.mpc
@@ -0,0 +1,19 @@
+// -*- MPC -*-
+// $Id$
+
+
+project(supplier) : orbsvcsexe, notification, notification_skel, naming {
+ Source_Files {
+ supplier.cpp
+ Filter.cpp
+ }
+}
+
+
+project(consumer) : orbsvcsexe, notification, notification_skel, naming {
+ Source_Files {
+ consumer.cpp
+ Filter.cpp
+ }
+}
+
diff --git a/TAO/orbsvcs/tests/Notify/Persistent_Filter/README b/TAO/orbsvcs/tests/Notify/Persistent_Filter/README
new file mode 100644
index 00000000000..c3963500c29
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/Persistent_Filter/README
@@ -0,0 +1,10 @@
+This test is based on the Filter example.
+It tests the persistent filter changes. The filter constraints
+are saved to persistent data instead of filter IOR.
+
+The run_test.pl starts NotificationService, consumer and supplier.
+After they complete, restart them again with using the persistent
+data. The restarted consumer and supplier will verify the filters
+and modify the constraints. The test finally should pass with no
+errors.
+
diff --git a/TAO/orbsvcs/tests/Notify/Persistent_Filter/consumer.cpp b/TAO/orbsvcs/tests/Notify/Persistent_Filter/consumer.cpp
new file mode 100644
index 00000000000..33f0e181f1d
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/Persistent_Filter/consumer.cpp
@@ -0,0 +1,30 @@
+// -*- C++ -*-
+// $Id$
+
+#include "Filter.h"
+
+int
+ACE_TMAIN (int argc, ACE_TCHAR *argv [])
+{
+ FilterClient client;
+
+ try
+ {
+ client.init_consumer (argc, argv); //Init the Client
+
+ client.run_consumer ();
+ }
+ catch (const CORBA::UserException& ue)
+ {
+ ue._tao_print_exception (
+ "TLS_Client user error: ");
+ return 1;
+ }
+ catch (const CORBA::SystemException& se)
+ {
+ se._tao_print_exception ("Consumer system error: ");
+ return 1;
+ }
+
+ return 0;
+}
diff --git a/TAO/orbsvcs/tests/Notify/Persistent_Filter/run_test.pl b/TAO/orbsvcs/tests/Notify/Persistent_Filter/run_test.pl
new file mode 100755
index 00000000000..d22a0800507
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/Persistent_Filter/run_test.pl
@@ -0,0 +1,132 @@
+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;
+
+
+$experiment_timeout = 60;
+$startup_timeout = 60;
+
+$notify_ior = PerlACE::LocalFile ("notify.ior");
+
+$naming_ior = PerlACE::LocalFile ("naming.ior");
+
+$svc_conf = PerlACE::LocalFile ("NS.conf");
+
+$persistent_prefix = "persistency.notif";
+
+$status = 0;
+
+$Naming = new PerlACE::Process ("../../../Naming_Service/Naming_Service",
+ "-o $naming_ior");
+
+$Notification = new PerlACE::Process ("../../../Notify_Service/Notify_Service");
+#-ORBDebugLevel 10 -ORBVerboseLogging 1
+$Notify_Args = "-ORBSvcConf $svc_conf -ORBInitRef NameService=file://$naming_ior -IORoutput $notify_ior ";
+
+$Supplier = new PerlACE::Process ("supplier");
+
+$Supplier_Args = "-ORBInitRef NameService=file://$naming_ior";
+
+$Consumer = new PerlACE::Process ("consumer");
+
+$Consumer_Args = "-ORBInitRef NameService=file://$naming_ior";
+
+unlink $naming_ior;
+$Naming->Spawn ();
+
+if (PerlACE::waitforfile_timed ($naming_ior, $startup_timeout) == -1) {
+ print STDERR "ERROR: waiting for the naming service to start\n";
+ $Naming->Kill ();
+ exit 1;
+}
+
+sub run_test
+{
+ my $client_args = shift;
+
+ unlink $notify_ior;
+ $Notification->Arguments ($Notify_Args);
+ $args = $Notification->Arguments ();
+ print STDERR "Running Notification with arguments: $args\n";
+ $Notification->Spawn ();
+
+ if (PerlACE::waitforfile_timed ($notify_ior, $startup_timeout) == -1) {
+ print STDERR "ERROR: waiting for the notify service to start\n";
+ $Notification->Kill ();
+ $Naming->Kill ();
+ exit 1;
+ }
+
+ sleep (5);
+
+ $Supplier->Arguments ($client_args . $Supplier_Args);
+ $Consumer->Arguments ($client_args . $Consumer_Args);
+ $args = $Supplier->Arguments ();
+ print STDERR "Running Supplier with arguments: $args\n";
+ $args = $Consumer->Arguments ();
+ print STDERR "Running Consumer with arguments: $args\n";
+
+ $status = $Supplier->Spawn ();
+
+ if ($status != 0)
+ {
+ print STDERR "ERROR: Supplier Spawn returned $status\n";
+ $Notification->Kill ();
+ $Naming->Kill ();
+ exit 1;
+ }
+
+ $status = $Consumer->Spawn ();
+
+ if ($status != 0)
+ {
+ print STDERR "ERROR: Consumer returned $status\n";
+ $Supplier->Kill ();
+ $Notification->Kill ();
+ $Naming->Kill ();
+ exit 1;
+ }
+
+ $status = $Consumer->WaitKill ($experiment_timeout);
+
+ if ($status != 0)
+ {
+ print STDERR "ERROR: Consumer WaitKill returned $status\n";
+ $Consumer->Kill ();
+ $Supplier->Kill ();
+ $Notification->Kill ();
+ $Naming->Kill ();
+ exit 1;
+ }
+
+ $status = $Supplier->WaitKill ($experiment_timeout);
+
+ if ($status != 0)
+ {
+ print STDERR "ERROR: Supplier WaitKill returned $status\n";
+ $Supplier->Kill ();
+ $Notification->Kill ();
+ $Naming->Kill ();
+ exit 1;
+ }
+
+ $Notification->Kill ();
+ unlink $notify_ior;
+}
+
+unlink <$persistent_prefix.*>;
+
+run_test ();
+run_test ("-m -p ");
+
+
+$Naming->Kill ();
+unlink $naming_ior;
+
+exit $status;
diff --git a/TAO/orbsvcs/tests/Notify/Persistent_Filter/supplier.cpp b/TAO/orbsvcs/tests/Notify/Persistent_Filter/supplier.cpp
new file mode 100644
index 00000000000..c2aca21a2c1
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/Persistent_Filter/supplier.cpp
@@ -0,0 +1,29 @@
+// -*- C++ -*-
+// $Id$
+
+#include "Filter.h"
+
+int
+ACE_TMAIN (int argc, ACE_TCHAR *argv [])
+{
+ FilterClient client;
+
+ try
+ {
+ client.init_supplier (argc, argv); //Init the Client
+
+ client.run_supplier ();
+ }
+ catch (const CORBA::UserException& ue)
+ {
+ ue._tao_print_exception ("TLS_Client user error: ");
+ return 1;
+ }
+ catch (const CORBA::SystemException& se)
+ {
+ se._tao_print_exception ("Supplier system error: ");
+ return 1;
+ }
+
+ return 0;
+}
diff --git a/TAO/orbsvcs/tests/Notify/Test_Filter/RT_Test_FilterFactory.cpp b/TAO/orbsvcs/tests/Notify/Test_Filter/RT_Test_FilterFactory.cpp
index e4ba6c4b92e..f5a5401b6d2 100644
--- a/TAO/orbsvcs/tests/Notify/Test_Filter/RT_Test_FilterFactory.cpp
+++ b/TAO/orbsvcs/tests/Notify/Test_Filter/RT_Test_FilterFactory.cpp
@@ -21,8 +21,6 @@ TAO_Notify_Tests_RT_Test_FilterFactory::create (PortableServer::POA_ptr filter_p
{
this->filter_poa_ = PortableServer::POA::_duplicate(filter_poa); // save the filter poa.
- PortableServer::ServantBase_var servant_var (this);
-
PortableServer::ObjectId_var id = filter_poa->activate_object (this);
CORBA::Object_var object = filter_poa->id_to_reference (id.in ());
@@ -32,6 +30,24 @@ TAO_Notify_Tests_RT_Test_FilterFactory::create (PortableServer::POA_ptr filter_p
return filter._retn();
}
+void
+TAO_Notify_Tests_RT_Test_FilterFactory::destroy (void)
+{
+ if (CORBA::is_nil(this->filter_poa_.in ()))
+ return;
+ PortableServer::ServantBase_var guard(this);
+ try
+ {
+ PortableServer::ObjectId_var id =
+ this->filter_poa_->servant_to_id (this);
+ this->filter_poa_->deactivate_object (id.in());
+ }
+ catch (CORBA::Exception&)
+ {
+ }
+
+}
+
CosNotifyFilter::Filter_ptr
TAO_Notify_Tests_RT_Test_FilterFactory::create_filter (const char *constraint_grammar)
{
@@ -70,4 +86,29 @@ TAO_Notify_Tests_RT_Test_FilterFactory::create_mapping_filter (const char * /*co
throw CORBA::NO_IMPLEMENT ();
}
+TAO_Notify_Object::ID
+TAO_Notify_Tests_RT_Test_FilterFactory::get_filter_id (CosNotifyFilter::Filter_ptr /*filter*/)
+{
+ throw CORBA::NO_IMPLEMENT ();
+}
+
+CosNotifyFilter::Filter_ptr
+TAO_Notify_Tests_RT_Test_FilterFactory::get_filter (const TAO_Notify_Object::ID& /*id*/)
+{
+ throw CORBA::NO_IMPLEMENT ();
+}
+
+void
+TAO_Notify_Tests_RT_Test_FilterFactory::release (void)
+{
+ delete this;
+ //@@ inform factory
+}
+
+void
+TAO_Notify_Tests_RT_Test_FilterFactory::save_persistent (TAO_Notify::Topology_Saver& /*saver*/)
+{
+ throw CORBA::NO_IMPLEMENT ();
+}
+
ACE_FACTORY_DEFINE (TAO_RT_Test_Filter, TAO_Notify_Tests_RT_Test_FilterFactory)
diff --git a/TAO/orbsvcs/tests/Notify/Test_Filter/RT_Test_FilterFactory.h b/TAO/orbsvcs/tests/Notify/Test_Filter/RT_Test_FilterFactory.h
index 734b409a9e1..34d0240c104 100644
--- a/TAO/orbsvcs/tests/Notify/Test_Filter/RT_Test_FilterFactory.h
+++ b/TAO/orbsvcs/tests/Notify/Test_Filter/RT_Test_FilterFactory.h
@@ -47,6 +47,7 @@ public:
///= TAO_Notify_Tests_FilterFactory methods.
virtual CosNotifyFilter::FilterFactory_ptr create (PortableServer::POA_ptr filter_poa);
+ virtual void destroy (void);
///= CosNotifyFilter::FilterFactory methods
@@ -55,7 +56,14 @@ public:
virtual CosNotifyFilter::MappingFilter_ptr create_mapping_filter (const char * constraint_grammar,
const CORBA::Any & default_value);
+ virtual TAO_Notify_Object::ID get_filter_id (CosNotifyFilter::Filter_ptr filter);
+ virtual CosNotifyFilter::Filter_ptr get_filter (const TAO_Notify_Object::ID& id);
+ virtual void save_persistent (TAO_Notify::Topology_Saver& saver);
+
protected:
+ /// Release this object.
+ virtual void release (void);
+
/// The POA in which to activate the Filters.
PortableServer::POA_var filter_poa_;
};
diff --git a/TAO/orbsvcs/tests/Notify/Test_Filter/Test_Filter.mpc b/TAO/orbsvcs/tests/Notify/Test_Filter/Test_Filter.mpc
index 75e32c6a6fa..5ea99aa09d5 100644
--- a/TAO/orbsvcs/tests/Notify/Test_Filter/Test_Filter.mpc
+++ b/TAO/orbsvcs/tests/Notify/Test_Filter/Test_Filter.mpc
@@ -1,7 +1,7 @@
// -*- MPC -*-
// $Id$
-project(TAO_RT_NotifyTests_Filter): orbsvcslib, notification_skel, rtcorba, etcl, dynamicany, portableserver, iortable {
+project(TAO_RT_NotifyTests_Filter): orbsvcslib, notification_skel, notify_serv, rtcorba, etcl, dynamicany, portableserver, iortable {
sharedname = TAO_RT_NotifyTests_Filter
dynamicflags = TAO_RT_Test_Filter_BUILD_DLL
IDL_Files {
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..93b3f902784
--- /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/libTAO_AnyTypeCode.la \
+ $(TAO_BUILDDIR)/tao/libTAO.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
new file mode 100644
index 00000000000..4bf085ce6e9
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/Validate_Client/README
@@ -0,0 +1,13 @@
+This test is to verify the Notification Service client 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/notify.conf b/TAO/orbsvcs/tests/Notify/Validate_Client/notify.conf
new file mode 100644
index 00000000000..2d7e425ac16
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/Validate_Client/notify.conf
@@ -0,0 +1,4 @@
+static TAO_CosNotify_Service "-AllocateTaskPerProxy -DispatchingThreads 1 -SourceThreads 1 -AllowReconnect -ValidateClient -ValidateClientDelay 1 -ValidateClientInterval 2"
+
+dynamic Topology_Factory Service_Object* TAO_CosNotification_Persist:_make_TAO_Notify_XML_Topology_Factory() "-save_base_path ./persistency.notif -load_base_path ./persistency.notif -backup_count 1 -v"
+
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 =
+ "<?xml version=\"1.0\"?>\n"
+ "<notification_service version=\"1.0\" timestamp=\"197568243541\">\n"
+ " <channel_factory>\n"
+ " <channel TopologyID=\"2\" MaxQueueLength=\"0\" MaxConsumers=\"0\" MaxSuppliers=\"0\" RejectNewEvents=\"false\">\n"
+ " <filter_factory>\n"
+ " <filter FilterId=\"1\" Grammar=\"TCL\">\n"
+ " <constraint ConstraintId=\"3\" Expression=\"threshold &gt; 10\">\n"
+ " <EventType Domain=\"*\" Type=\"*\">\n"
+ " </EventType>\n"
+ " </constraint>\n"
+ " <constraint ConstraintId=\"4\" Expression=\"threshold &gt; 10\">\n"
+ " <EventType Domain=\"*\" Type=\"*\">\n"
+ " </EventType>\n"
+ " </constraint>\n"
+ " </filter>\n"
+ " <filter FilterId=\"2\" Grammar=\"TCL\">\n"
+ " <constraint ConstraintId=\"3\" Expression=\"threshold &lt; 15\">\n"
+ " <EventType Domain=\"*\" Type=\"*\">\n"
+ " </EventType>\n"
+ " </constraint>\n"
+ " <constraint ConstraintId=\"4\" Expression=\"threshold &lt; 15\">\n"
+ " <EventType Domain=\"*\" Type=\"*\">\n"
+ " </EventType>\n"
+ " </constraint>\n"
+ " </filter>\n"
+ " <filter FilterId=\"3\" Grammar=\"TCL\">\n"
+ " <constraint ConstraintId=\"3\" Expression=\"threshold &lt; 15\">\n"
+ " <EventType Domain=\"*\" Type=\"*\">\n"
+ " </EventType>\n"
+ " </constraint>\n"
+ " <constraint ConstraintId=\"4\" Expression=\"threshold &lt; 15\">\n"
+ " <EventType Domain=\"*\" Type=\"*\">\n"
+ " </EventType>\n"
+ " </constraint>\n"
+ " </filter>\n"
+ " </filter_factory>\n"
+ " <consumer_admin TopologyID=\"6\" InterFilterGroupOperator=\"0\">\n"
+ " <filter_admin>\n"
+ " <filter TopologyID=\"1\" MapId=\"2\">\n"
+ " </filter>\n"
+ " </filter_admin>\n"
+ " <subscriptions>\n"
+ " <subscription Domain=\"*\" Type=\"%%ALL\">\n"
+ " </subscription>\n"
+ " </subscriptions>\n"
+ " <structured_proxy_push_supplier TopologyID=\"11\" PeerIOR=\"%s\">\n"
+ " <subscriptions>\n"
+ " <subscription Domain=\"*\" Type=\"%%ALL\">\n"
+ " </subscription>\n"
+ " </subscriptions>\n"
+ " </structured_proxy_push_supplier>\n"
+ " </consumer_admin>\n"
+ " <consumer_admin TopologyID=\"7\" InterFilterGroupOperator=\"0\">\n"
+ " <filter_admin>\n"
+ " <filter TopologyID=\"1\" MapId=\"3\">\n"
+ " </filter>\n"
+ " </filter_admin>\n"
+ " <subscriptions>\n"
+ " <subscription Domain=\"*\" Type=\"%%ALL\">\n"
+ " </subscription>\n"
+ " </subscriptions>\n"
+ " <structured_proxy_push_supplier TopologyID=\"12\" PeerIOR=\"%s\">\n"
+ " <subscriptions>\n"
+ " <subscription Domain=\"*\" Type=\"%%ALL\">\n"
+ " </subscription>\n"
+ " </subscriptions>\n"
+ " </structured_proxy_push_supplier>\n"
+ " </consumer_admin>\n"
+ " <supplier_admin TopologyID=\"3\" InterFilterGroupOperator=\"0\">\n"
+ " <filter_admin>\n"
+ " <filter TopologyID=\"1\" MapId=\"1\">\n"
+ " </filter>\n"
+ " </filter_admin>\n"
+ " <subscriptions>\n"
+ " <subscription Domain=\"*\" Type=\"%%ALL\">\n"
+ " </subscription>\n"
+ " </subscriptions>\n"
+ " <structured_proxy_push_consumer TopologyID=\"9\" PeerIOR=\"%s\">\n"
+ " <subscriptions>\n"
+ " <subscription Domain=\"*\" Type=\"%%ALL\">\n"
+ " </subscription>\n"
+ " </subscriptions>\n"
+ " </structured_proxy_push_consumer>\n"
+ " <structured_proxy_push_consumer TopologyID=\"10\" PeerIOR=\"%s\">\n"
+ " <subscriptions>\n"
+ " <subscription Domain=\"*\" Type=\"%%ALL\">\n"
+ " </subscription>\n"
+ " </subscriptions>\n"
+ " </structured_proxy_push_consumer>\n"
+ " </supplier_admin>\n"
+ " </channel>\n"
+ " <reconnect_registry>\n"
+ " </reconnect_registry>\n"
+ " </channel_factory>\n"
+ "</notification_service>\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 <output file> ")
+ 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
new file mode 100755
index 00000000000..14e3e0632ac
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/Validate_Client/run_test.pl
@@ -0,0 +1,80 @@
+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;
+use File::Copy;
+
+PerlACE::check_privilege_group();
+
+$notifyior = PerlACE::LocalFile ("notify.ior");
+$notify_conf = PerlACE::LocalFile ("notify$PerlACE::svcconf_ext");
+
+$persistent_file_prefix = "persistency.notif";
+$persistent_file = PerlACE::LocalFile ("persistency.notif.xml");
+
+$status = 0;
+
+$port = PerlACE::uniqueid () + 10001;
+$TS = new PerlACE::Process ("../../../Notify_Service/Notify_Service",
+ "-NoNameSvc " .
+ "-IORoutput $notifyior -ORBSvcConf " .
+ "$notify_conf");
+
+unlink $notifyior;
+unlink <$persistent_file_prefix.*>;
+
+$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 ();
+ $DUMMY->Kill ();
+ exit 1;
+}
+
+sleep (10);
+
+$found = 0 ;
+open (I_FILE, "$persistent_file") ;
+while( <I_FILE> )
+{
+ chomp ;
+ if( $_ =~ /proxy/ )
+ {
+ $found = 1 ;
+ last ;
+ }
+}
+if( $found == 1 )
+{
+ print STDERR "ERROR: validate consumer/supplier test failed.\n" ;
+ $status = 1 ;
+}
+else
+{
+ print STDOUT "validate consumer/supplier test succeeded.\n";
+}
+
+$TS->Kill ();
+$DUMMY->Kill ();
+
+unlink <$persistent_file_prefix.*>;
+unlink $notifyior;
+
+
+exit $status;
+
diff --git a/TAO/orbsvcs/tests/Security/mixed_security_test/server.cpp b/TAO/orbsvcs/tests/Security/mixed_security_test/server.cpp
index ed2b89e645e..2615b696aa4 100644
--- a/TAO/orbsvcs/tests/Security/mixed_security_test/server.cpp
+++ b/TAO/orbsvcs/tests/Security/mixed_security_test/server.cpp
@@ -71,14 +71,14 @@ init_and_setup (int& argc,
TAO::SL2::AccessDecision_var& sl2ad)
{
orb = CORBA::ORB_init (argc, argv);
- rootpoa = rir<PortableServer::POA> (orb, "RootPOA");
+ rootpoa = rir<PortableServer::POA> (orb.in (), "RootPOA");
poamgr = rootpoa->the_POAManager();
sl3current =
- rir<SecurityLevel3::SecurityCurrent>(orb, "SecurityLevel3:SecurityCurrent");
+ rir<SecurityLevel3::SecurityCurrent>(orb.in (), "SecurityLevel3:SecurityCurrent");
SecurityLevel2::SecurityManager_var sl2sm =
- rir<SecurityLevel2::SecurityManager> (orb,
+ rir<SecurityLevel2::SecurityManager> (orb.in (),
"SecurityLevel2:SecurityManager");
SecurityLevel2::AccessDecision_var ad = sl2sm->access_decision ();
@@ -172,9 +172,9 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[])
"non-secure invocations\n"));
// 5. publish references to #1 and #2 to distinct files
- publish_ior (orb, server1_obj,
+ publish_ior (orb.in (), server1_obj.in (),
TAO_Mixed_Security_Test::restricted_ior_file);
- publish_ior (orb, server2_obj,
+ publish_ior (orb.in (), server2_obj.in (),
TAO_Mixed_Security_Test::permitted_ior_file);
ACE_DEBUG ((LM_DEBUG, "mixed_security/server: "
"published IORs for objects\n"));