summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/tests/Notify/lib
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/orbsvcs/tests/Notify/lib')
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Activation_Manager.cpp296
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Activation_Manager.h139
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Activation_Manager.idl32
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Application_Command.cpp224
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Application_Command.h83
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Command.cpp59
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Command.h78
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Command_Builder.cpp92
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Command_Builder.h74
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Command_Factory.cpp14
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Command_Factory.h44
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Command_Factory_T.cpp53
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Command_Factory_T.h64
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/ConsumerAdmin_Command.cpp180
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/ConsumerAdmin_Command.h90
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Consumer_T.cpp107
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Consumer_T.h98
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Direct_Consumer.cpp37
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Direct_Consumer.h44
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Direct_Supplier.cpp56
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Direct_Supplier.h59
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Direct_Supplier.inl3
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Driver.cpp325
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Driver.h151
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Driver_Base.h38
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/EventChannel_Command.cpp225
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/EventChannel_Command.h95
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Factories_Define.cpp23
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Factories_Define.h38
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Filter_Command.cpp208
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Filter_Command.h83
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/LookupManager.cpp256
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/LookupManager.h120
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Makefile.am183
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Name.cpp37
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Name.h63
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Notify_PushConsumer.h36
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Notify_PushSupplier.h12
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Notify_SequencePushConsumer.h30
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Notify_SequencePushSupplier.h29
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Notify_StructuredPushConsumer.h29
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Notify_StructuredPushSupplier.h29
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Notify_Test_Client.cpp242
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Notify_Test_Client.h116
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Notify_lib.mpc8
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Options_Parser.cpp149
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Options_Parser.h48
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Peer.cpp94
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Peer.h80
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Peer.inl3
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Peer_T.cpp251
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Peer_T.h121
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Periodic_Consumer.cpp273
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Periodic_Consumer.h102
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Periodic_Consumer_Command.cpp273
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Periodic_Consumer_Command.h95
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Periodic_Supplier.cpp358
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Periodic_Supplier.h115
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Periodic_Supplier_Command.cpp261
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Periodic_Supplier_Command.h95
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Priority_Mapping.cpp25
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Priority_Mapping.h45
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/PushConsumer.cpp56
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/PushConsumer.h104
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/PushConsumer.inl3
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/PushSupplier.cpp55
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/PushSupplier.h97
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/PushSupplier.inl3
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/README10
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Relay_Consumer.cpp44
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Relay_Consumer.h56
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Relay_Consumer.inl3
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/SequencePushConsumer.cpp57
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/SequencePushConsumer.h104
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/SequencePushConsumer.inl3
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/SequencePushSupplier.cpp57
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/SequencePushSupplier.h98
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/SequencePushSupplier.inl3
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/StructuredEvent.cpp88
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/StructuredEvent.h67
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/StructuredPushConsumer.cpp57
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/StructuredPushConsumer.h104
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/StructuredPushConsumer.inl3
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/StructuredPushSupplier.cpp58
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/StructuredPushSupplier.h98
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/StructuredPushSupplier.inl3
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/SupplierAdmin_Command.cpp179
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/SupplierAdmin_Command.h89
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Supplier_T.cpp104
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Supplier_T.h99
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Task_Callback.cpp7
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Task_Callback.h40
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Task_Stats.cpp149
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Task_Stats.h101
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Task_Stats.inl54
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/common.cpp56
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/common.h36
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/notify_test_export.h40
98 files changed, 8875 insertions, 0 deletions
diff --git a/TAO/orbsvcs/tests/Notify/lib/Activation_Manager.cpp b/TAO/orbsvcs/tests/Notify/lib/Activation_Manager.cpp
new file mode 100644
index 00000000000..86b477c1bba
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/Activation_Manager.cpp
@@ -0,0 +1,296 @@
+// $Id$
+
+#include "Activation_Manager.h"
+#include "ace/OS_NS_unistd.h"
+#include "ace/os_include/os_netdb.h"
+
+ACE_RCSID (lib,
+ TAO_Activation_Manager,
+ "$Id$")
+
+#include "LookupManager.h"
+#include "Command_Builder.h"
+#include "Name.h"
+#include "ace/Barrier.h"
+
+TAO_Notify_Tests_Activation_Manager::TAO_Notify_Tests_Activation_Manager (void)
+ : barrier_ (0)
+ , active_suppliers_ (0)
+ , active_consumers_ (0)
+ , active_done_ (lock_)
+ , ior_output_file_ (0)
+ , started_ (0)
+ , started_condition_ (lock_)
+{
+ LOOKUP_MANAGER->_register (this);
+}
+
+TAO_Notify_Tests_Activation_Manager::~TAO_Notify_Tests_Activation_Manager ()
+{
+ delete this->barrier_;
+
+ if (this->ior_output_file_)
+ ACE_OS::fclose(this->ior_output_file_);
+}
+
+int
+TAO_Notify_Tests_Activation_Manager::ior_output_file (const ACE_TCHAR *file_name)
+{
+ this->ior_output_file_ = ACE_OS::fopen (file_name, ACE_TEXT("w"));
+
+ if (this->ior_output_file_ == 0)
+ return -1;
+ else
+ return 0;
+}
+
+int
+TAO_Notify_Tests_Activation_Manager::ior_input_file (const ACE_TCHAR *file_name)
+{
+ this->ior_input_file_ = file_name;
+ return 0;
+}
+
+void
+TAO_Notify_Tests_Activation_Manager::done (TAO_Notify_Tests_Periodic_Supplier* /*supplier*/)
+{
+ ACE_GUARD (TAO_SYNCH_MUTEX, mon, this->lock_);
+
+ --active_suppliers_;
+
+ if (active_suppliers_ == 0)
+ this->active_done_.broadcast ();
+}
+
+void
+TAO_Notify_Tests_Activation_Manager::done (TAO_Notify_Tests_Periodic_Consumer* /*consumer*/)
+{
+ ACE_GUARD (TAO_SYNCH_MUTEX, mon, this->lock_);
+
+ --active_consumers_;
+
+ if (active_consumers_ == 0)
+ this->active_done_.broadcast ();
+}
+
+void
+TAO_Notify_Tests_Activation_Manager::wait_for_completion (void)
+{
+ ACE_GUARD (TAO_SYNCH_MUTEX, mon, this->lock_);
+
+ while (active_suppliers_ != 0 || active_consumers_ != 0)
+ this->active_done_.wait (); //@@ use timed wait.
+}
+
+int
+TAO_Notify_Tests_Activation_Manager::supplier_count (void)
+{
+ return this->supplier_map_.current_size ();
+}
+
+int
+TAO_Notify_Tests_Activation_Manager::consumer_count (void)
+{
+ return this->consumer_map_.current_size ();
+}
+
+void
+TAO_Notify_Tests_Activation_Manager::_register (TAO_Notify_Tests_Periodic_Supplier* supplier, const char* obj_name ACE_ENV_ARG_DECL_NOT_USED)
+{
+ ACE_GUARD (TAO_SYNCH_MUTEX, mon, this->lock_);
+
+ // Register in supplier map.
+ ACE_CString name (obj_name);
+
+ if (this->supplier_map_.bind (name, supplier) == -1)
+ ACE_ERROR ((LM_ERROR, "Failed to bind supplier %s in LookupMap\n", obj_name));
+
+ // Designate application manager as the callback object.
+ supplier->task_callback (this);
+
+ active_suppliers_++;
+}
+
+void
+TAO_Notify_Tests_Activation_Manager::_register (TAO_Notify_Tests_Periodic_Consumer* consumer, const char* obj_name ACE_ENV_ARG_DECL_NOT_USED)
+{
+ ACE_GUARD (TAO_SYNCH_MUTEX, mon, this->lock_);
+
+ // Register in consumer map.
+ ACE_CString name (obj_name);
+
+ if (this->consumer_map_.bind (name, consumer) == -1)
+ ACE_ERROR ((LM_ERROR, "Failed to bind consumer %s in LookupMap\n", obj_name));
+
+ // Designate application manager as the callback object.
+ consumer->task_callback (this);
+
+ active_consumers_++;
+}
+
+void
+TAO_Notify_Tests_Activation_Manager::resolve (TAO_Notify_Tests_Periodic_Supplier*& supplier, const char* obj_name ACE_ENV_ARG_DECL_NOT_USED)
+{
+ ACE_GUARD (TAO_SYNCH_MUTEX, mon, this->lock_);
+
+ ACE_CString name (obj_name);
+
+ if (this->supplier_map_.find (name, supplier) == -1)
+ ACE_ERROR ((LM_ERROR, "Failed to find supplier %s in LookupMap\n", obj_name));
+}
+
+void
+TAO_Notify_Tests_Activation_Manager::resolve (TAO_Notify_Tests_Periodic_Consumer*& consumer, const char* obj_name ACE_ENV_ARG_DECL_NOT_USED)
+{
+ ACE_GUARD (TAO_SYNCH_MUTEX, mon, this->lock_);
+
+ ACE_CString name (obj_name);
+
+ if (this->consumer_map_.find (name, consumer) == -1)
+ ACE_ERROR ((LM_ERROR, "Failed to find consumer %s in LookupMap\n", obj_name));
+}
+
+int
+TAO_Notify_Tests_Activation_Manager::activate_suppliers (void)
+{
+ TAO_Notify_Tests_PeriodicSupplier_Iterator iter(this->supplier_map_);
+
+ TAO_Notify_Tests_PeriodicSupplier_Entry* entry;
+
+ // Create the barrier to synch activated auppiers.
+ this->barrier_ = new ACE_Barrier (this->supplier_count () + 1);
+
+ // For each supplier : activate
+ TAO_Notify_Tests_Periodic_Supplier* supplier = 0;
+
+ for (u_int index = 0; iter.done () == 0; iter.advance (), ++index)
+ {
+ if (iter.next (entry) != 0)
+ {
+ supplier = entry->int_id_;
+
+ if (supplier->activate_task (this->barrier_) != 0)
+ {
+ ACE_DEBUG ((LM_DEBUG, "Supplier list activation failed\n"));
+ return -1;
+ }
+ }
+ }
+
+ this->barrier_->wait ();
+ return 0;
+}
+
+void
+TAO_Notify_Tests_Activation_Manager::dump_stats (int dump_samples)
+{
+ char hostname[MAXHOSTNAMELEN];
+ ACE_OS::hostname (hostname, MAXHOSTNAMELEN);
+
+ /// dump suppliers:
+ char msg[BUFSIZ];
+ ACE_OS::sprintf (msg, "# Stats generated on %s\n", hostname);
+
+ TAO_Notify_Tests_PeriodicSupplier_Iterator sup_iter(this->supplier_map_);
+
+ TAO_Notify_Tests_PeriodicSupplier_Entry* sup_entry;
+
+ // For each supplier
+ TAO_Notify_Tests_Periodic_Supplier* supplier = 0;
+
+ u_int index = 0;
+ for (; sup_iter.done () == 0; sup_iter.advance (), ++index)
+ {
+ if (sup_iter.next (sup_entry) != 0)
+ {
+ supplier = sup_entry->int_id_;
+ supplier->dump_stats (msg, dump_samples);
+ }
+ }
+
+ // dump consumers
+ TAO_Notify_Tests_PeriodicConsumer_Iterator cons_iter(this->consumer_map_);
+
+ TAO_Notify_Tests_PeriodicConsumer_Entry* cons_entry;
+
+ TAO_Notify_Tests_Periodic_Consumer* consumer = 0;
+ for (index = 0; cons_iter.done () == 0; cons_iter.advance (), ++index)
+ {
+ if (cons_iter.next (cons_entry) != 0)
+ {
+ consumer = cons_entry->int_id_;
+ consumer->dump_stats (msg, dump_samples);
+ }
+ }
+}
+
+void
+TAO_Notify_Tests_Activation_Manager::write_ior (ACE_ENV_SINGLE_ARG_DECL)
+{
+ PortableServer::ServantBase_var servant_var (this);
+
+ Notify_Test::Activation_Manager_var am_object = _this (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ CORBA::ORB_var orb;
+ LOOKUP_MANAGER->resolve (orb);
+
+ // Write IOR to a file, if asked.
+ CORBA::String_var str =
+ orb->object_to_string (am_object.in () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (this->ior_output_file_)
+ {
+ ACE_OS::fprintf (this->ior_output_file_,
+ "%s",
+ str.in ());
+ ACE_OS::fclose (this->ior_output_file_);
+ this->ior_output_file_ = 0;
+ }
+}
+
+void
+TAO_Notify_Tests_Activation_Manager::wait_for_start_signal (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+{
+ ACE_GUARD (TAO_SYNCH_MUTEX, mon, this->lock_);
+
+ while (this->started_ == 0)
+ this->started_condition_.wait (); //@@ use timed wait.
+}
+
+void
+TAO_Notify_Tests_Activation_Manager::start (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ ACE_GUARD (TAO_SYNCH_MUTEX, mon, this->lock_);
+
+ this->started_ = 1;
+
+ this->started_condition_.signal (); //@@ use timed wait.
+}
+
+void
+TAO_Notify_Tests_Activation_Manager::signal_peer (ACE_ENV_SINGLE_ARG_DECL)
+{
+ CORBA::ORB_var orb;
+ LOOKUP_MANAGER->resolve (orb);
+
+ CORBA::Object_var object =
+ orb->string_to_object (this->ior_input_file_.c_str () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ Notify_Test::Activation_Manager_var peer = Notify_Test::Activation_Manager::_narrow (object.in () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (CORBA::is_nil (peer.in ()))
+ {
+ ACE_ERROR ((LM_ERROR,
+ "Object reference <%s> is nil\n",
+ this->ior_input_file_.c_str ()));
+ }
+
+ peer->start (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
diff --git a/TAO/orbsvcs/tests/Notify/lib/Activation_Manager.h b/TAO/orbsvcs/tests/Notify/lib/Activation_Manager.h
new file mode 100644
index 00000000000..838516b3d64
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/Activation_Manager.h
@@ -0,0 +1,139 @@
+/* -*- C++ -*- */
+/**
+ * @file Activation_Manager.h
+ *
+ * $Id$
+ *
+ * @author Pradeep Gore <pradeep@oomworks.com>
+ *
+ *
+ */
+
+#ifndef TAO_Notify_Tests_ACTIVATION_MANAGER_H
+#define TAO_Notify_Tests_ACTIVATION_MANAGER_H
+#include /**/ "ace/pre.h"
+
+#include "notify_test_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Null_Mutex.h"
+#include "ace/SString.h"
+#include "ace/Hash_Map_Manager.h"
+#include "Task_Callback.h"
+#include "Periodic_Supplier.h"
+#include "Periodic_Consumer.h"
+#include "Activation_ManagerS.h"
+
+ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+class ACE_Barrier;
+ACE_END_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_Notify_Tests_Activation_Manager
+ *
+ * @brief Class to handle Suppliers and Consumers.
+ *
+ */
+class TAO_NOTIFY_TEST_Export TAO_Notify_Tests_Activation_Manager : public TAO_Notify_Tests_Task_Callback
+ , public POA_Notify_Test::Activation_Manager
+{
+ typedef ACE_Hash_Map_Manager<ACE_CString, TAO_Notify_Tests_Periodic_Supplier*, ACE_SYNCH_NULL_MUTEX> TAO_Notify_Tests_PeriodicSupplier_Map;
+ typedef ACE_Hash_Map_Manager<ACE_CString, TAO_Notify_Tests_Periodic_Consumer*, ACE_SYNCH_NULL_MUTEX> TAO_Notify_Tests_PeriodicConsumer_Map;
+ typedef ACE_Hash_Map_Iterator<ACE_CString, TAO_Notify_Tests_Periodic_Supplier*, ACE_SYNCH_NULL_MUTEX> TAO_Notify_Tests_PeriodicSupplier_Iterator;
+ typedef ACE_Hash_Map_Iterator<ACE_CString, TAO_Notify_Tests_Periodic_Consumer*, ACE_SYNCH_NULL_MUTEX> TAO_Notify_Tests_PeriodicConsumer_Iterator;
+ typedef ACE_Hash_Map_Entry<ACE_CString, TAO_Notify_Tests_Periodic_Supplier*> TAO_Notify_Tests_PeriodicSupplier_Entry;
+ typedef ACE_Hash_Map_Entry<ACE_CString, TAO_Notify_Tests_Periodic_Consumer*> TAO_Notify_Tests_PeriodicConsumer_Entry;
+
+public:
+ /// Constuctor
+ TAO_Notify_Tests_Activation_Manager (void);
+
+ /// Destructor
+ virtual ~TAO_Notify_Tests_Activation_Manager ();
+
+ /// Interface impl.
+ virtual void start (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ /// Register Supplier
+ void _register (TAO_Notify_Tests_Periodic_Supplier* supplier, const char* obj_name ACE_ENV_ARG_DECL);
+ /// Register Consumer
+ void _register (TAO_Notify_Tests_Periodic_Consumer* consumer, const char* obj_name ACE_ENV_ARG_DECL);
+
+ /// Resolve Supplier
+ void resolve (TAO_Notify_Tests_Periodic_Supplier*& supplier, const char* obj_name ACE_ENV_ARG_DECL);
+
+ /// Resolve Consumer
+ void resolve (TAO_Notify_Tests_Periodic_Consumer*& consumer, const char* obj_name ACE_ENV_ARG_DECL);
+
+ // Activate the tasks for each supplier.
+ int activate_suppliers (void);
+
+ // Supplier Count
+ int supplier_count (void);
+
+ // Consumer Count
+ int consumer_count (void);
+
+ /// Wait till active suppliers and consumers are done.
+ void wait_for_completion (void);
+
+ /// TAO_Notify_Tests_Task_Callback methods
+ virtual void done (TAO_Notify_Tests_Periodic_Supplier* supplier);
+ virtual void done (TAO_Notify_Tests_Periodic_Consumer* consumer);
+
+ // Dump stats gathered during exec..
+ void dump_stats (int dump_samples);
+
+ // Returns 0 if the file could be opened for write.
+ int ior_output_file (const ACE_TCHAR *file_name);
+
+ // Returns 1 if the file could be opened for read.
+ int ior_input_file (const ACE_TCHAR *file_name);
+
+ void write_ior (ACE_ENV_SINGLE_ARG_DECL);
+ void wait_for_start_signal (ACE_ENV_SINGLE_ARG_DECL);
+ void signal_peer (ACE_ENV_SINGLE_ARG_DECL);
+
+protected:
+ /// Lock to serialize internal state.
+ TAO_SYNCH_MUTEX lock_;
+
+ /// The barrier to synch all supplier on so that everyone starts at the same instance.
+ ACE_Barrier* barrier_;
+
+ /// Number of Active suppliers (still running a ACE_Task and sending events)
+ int active_suppliers_;
+
+ /// Number of Active consumers (still receiving events)
+ int active_consumers_;
+
+ // Condition that all active suppliers and consumers are done.
+ TAO_SYNCH_CONDITION active_done_;
+
+ // Map that stores suppliers.
+ TAO_Notify_Tests_PeriodicSupplier_Map supplier_map_;
+
+ // Map that stores consumers.
+ TAO_Notify_Tests_PeriodicConsumer_Map consumer_map_;
+
+ /// The file for output
+ FILE *ior_output_file_;
+
+ /// The file for input
+ ACE_CString ior_input_file_;
+
+ /// Set when the start method is called.
+ CORBA::Boolean started_;
+
+ // Condition that the start method has been called.
+ TAO_SYNCH_CONDITION started_condition_;
+};
+
+#include /**/ "ace/post.h"
+#endif /* TAO_Notify_Tests_ACTIVATION_MANAGER_H */
diff --git a/TAO/orbsvcs/tests/Notify/lib/Activation_Manager.idl b/TAO/orbsvcs/tests/Notify/lib/Activation_Manager.idl
new file mode 100644
index 00000000000..21c7b985ab4
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/Activation_Manager.idl
@@ -0,0 +1,32 @@
+/**
+ * @file Activation_Manager.idl
+ *
+ * @brief
+ *
+ * $Id$
+ *
+ * @author Pradeep Gore <pradeep@oomworks.com>
+ */
+
+#ifndef _NOTIFY_TEST_IDL_
+#define _NOTIFY_TEST_IDL_
+
+#pragma prefix ""
+
+/**
+ * @namespace Activation_Manager
+ *
+ * @brief Notify Test
+ */
+module Notify_Test
+{
+ interface Activation_Manager
+ {
+ /*
+ * Prompts the Activation Manager to start.
+ */
+ void start ();
+ };
+};
+
+#endif /* _NOTIFY_TEST_IDL_ */
diff --git a/TAO/orbsvcs/tests/Notify/lib/Application_Command.cpp b/TAO/orbsvcs/tests/Notify/lib/Application_Command.cpp
new file mode 100644
index 00000000000..5172ae18620
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/Application_Command.cpp
@@ -0,0 +1,224 @@
+// $Id$
+
+#include "Application_Command.h"
+
+ACE_RCSID(lib, TAO_Application_Command, "$Id$")
+
+#include "tao/PortableServer/PortableServer.h"
+#include "LookupManager.h"
+#include "Name.h"
+#include "Activation_Manager.h"
+#include "Driver_Base.h"
+#include "Priority_Mapping.h"
+
+TAO_Notify_Tests_Application_Command::TAO_Notify_Tests_Application_Command (void)
+ : dump_samples_ (0)
+{
+}
+
+TAO_Notify_Tests_Application_Command::~TAO_Notify_Tests_Application_Command ()
+{
+}
+
+const char*
+TAO_Notify_Tests_Application_Command::get_name (void)
+{
+ return TAO_Notify_Tests_Application_Command::name ();
+}
+
+const char*
+TAO_Notify_Tests_Application_Command::name (void)
+{
+ return TAO_Notify_Tests_Name::application_command;
+}
+
+void
+TAO_Notify_Tests_Application_Command::init (ACE_Arg_Shifter& arg_shifter)
+{
+ if (arg_shifter.is_anything_left ())
+ {
+ /// -Init | Run | Shutdown
+ if (arg_shifter.cur_arg_strncasecmp ("-Init") == 0)
+ {
+ this->command_ = INIT;
+
+ arg_shifter.consume_arg ();
+ }
+ else if (arg_shifter.cur_arg_strncasecmp ("-Run") == 0)
+ {
+ this->command_ = RUN;
+
+ arg_shifter.consume_arg ();
+ }
+ else if (arg_shifter.cur_arg_strncasecmp ("-WaitForEvents") == 0)
+ {
+ this->command_ = WAIT_FOR_EVENTS;
+
+ arg_shifter.consume_arg ();
+ }
+ else if (arg_shifter.cur_arg_strncasecmp ("-Shutdown") == 0)
+ {
+ this->command_ = SHUTDOWN;
+
+ arg_shifter.consume_arg ();
+ }
+ else if (arg_shifter.cur_arg_strncasecmp ("-DumpStats") == 0)
+ {
+ this->command_ = DUMP_STATE;
+
+ arg_shifter.consume_arg ();
+
+ if (arg_shifter.cur_arg_strncasecmp ("-Samples") == 0)
+ {
+ this->dump_samples_ = 1;
+
+ arg_shifter.consume_arg ();
+ }
+ }
+ else if (arg_shifter.cur_arg_strncasecmp ("-SignalPeer") == 0)
+ {
+ this->command_ = SIGNAL_PEER;
+
+ arg_shifter.consume_arg ();
+ }
+ else if (arg_shifter.cur_arg_strncasecmp ("-WaitToStart") == 0)
+ {
+ this->command_ = WAIT_TO_START;
+
+ arg_shifter.consume_arg ();
+ }
+
+ }
+}
+
+void
+TAO_Notify_Tests_Application_Command::handle_init (ACE_ENV_SINGLE_ARG_DECL)
+{
+ /// Fetch the root poa.
+ PortableServer::POA_var root_poa;
+ LOOKUP_MANAGER->resolve (root_poa);
+ ACE_CHECK;
+
+ PortableServer::POAManager_var poa_manager =
+ root_poa->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ /// Activate the root POA.
+ poa_manager->activate (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ TAO_Notify_Tests_Priority_Mapping* mapping = new TAO_Notify_Tests_Priority_Mapping ();
+
+ LOOKUP_MANAGER->_register (mapping);
+}
+
+void
+TAO_Notify_Tests_Application_Command::handle_wait_for_completion (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+{
+ ACE_DEBUG ((LM_DEBUG, "(%P, %t) Waiting for suppliers and consumers to finish...\n"));
+
+ TAO_Notify_Tests_Activation_Manager* act_mgr = 0;
+ LOOKUP_MANAGER->resolve (act_mgr);
+
+ act_mgr->wait_for_completion ();
+}
+
+void
+TAO_Notify_Tests_Application_Command::handle_shutdown (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+{
+ ACE_DEBUG ((LM_DEBUG, "(%P, %t)Shutting down the Application...\n"));
+
+ TAO_Notify_Tests_Driver_Base* driver = 0;
+ LOOKUP_MANAGER->resolve (driver);
+
+ driver->shutdown ();
+
+}
+
+void
+TAO_Notify_Tests_Application_Command::handle_dump_stats (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+{
+ ACE_DEBUG ((LM_DEBUG, "(%P, %t)Dumpimg stats...\n"));
+
+ TAO_Notify_Tests_Activation_Manager* act_mgr = 0;
+ LOOKUP_MANAGER->resolve (act_mgr);
+
+ act_mgr->dump_stats (this->dump_samples_);
+}
+
+void
+TAO_Notify_Tests_Application_Command::handle_run (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+{
+ // Run the Consumers
+
+
+ //= Run the Suppliers
+ TAO_Notify_Tests_Activation_Manager* act_mgr = 0;
+ LOOKUP_MANAGER->resolve (act_mgr);
+
+ if (act_mgr->activate_suppliers () == 0)
+ ACE_DEBUG ((LM_DEBUG, "Suppliers activated...\n"));
+ else
+ ACE_DEBUG ((LM_DEBUG, "Suppliers activation failed!...\n"));
+}
+
+void
+TAO_Notify_Tests_Application_Command::handle_signal_peer (ACE_ENV_SINGLE_ARG_DECL)
+{
+ TAO_Notify_Tests_Activation_Manager* act_mgr = 0;
+ LOOKUP_MANAGER->resolve (act_mgr);
+
+ act_mgr->signal_peer (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+void
+TAO_Notify_Tests_Application_Command::handle_wait_to_start (ACE_ENV_SINGLE_ARG_DECL)
+{
+ TAO_Notify_Tests_Activation_Manager* act_mgr = 0;
+ LOOKUP_MANAGER->resolve (act_mgr);
+
+ act_mgr->write_ior (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ act_mgr->wait_for_start_signal (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+void
+TAO_Notify_Tests_Application_Command::execute_i (ACE_ENV_SINGLE_ARG_DECL)
+{
+ if (this->command_ == INIT)
+ {
+ this->handle_init (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else if (this->command_ == RUN)
+ {
+ this->handle_run (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else if (this->command_ == WAIT_FOR_EVENTS)
+ {
+ this->handle_wait_for_completion (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else if (this->command_ == SHUTDOWN)
+ {
+ this->handle_shutdown (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else if (this->command_ == DUMP_STATE)
+ {
+ this->handle_dump_stats (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else if (this->command_ == SIGNAL_PEER)
+ {
+ this->handle_signal_peer (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else if (this->command_ == WAIT_TO_START)
+ {
+ this->handle_wait_to_start (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+}
diff --git a/TAO/orbsvcs/tests/Notify/lib/Application_Command.h b/TAO/orbsvcs/tests/Notify/lib/Application_Command.h
new file mode 100644
index 00000000000..ff267fc37a3
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/Application_Command.h
@@ -0,0 +1,83 @@
+/* -*- C++ -*- */
+/**
+ * @file Application_Command.h
+ *
+ * $Id$
+ *
+ * @author Pradeep Gore <pradeep@oomworks.com>
+ *
+ *
+ */
+
+#ifndef TAO_Notify_Tests_APPLICATION_COMMAND_H
+#define TAO_Notify_Tests_APPLICATION_COMMAND_H
+#include /**/ "ace/pre.h"
+
+#include "notify_test_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/ORB.h"
+#include "Command.h"
+
+class TAO_Notify_Tests_Application_Command;
+
+/**
+ * @class TAO_Notify_Tests_Application_Command
+ *
+ * @brief Command to control the Application.
+ *
+ */
+class TAO_NOTIFY_TEST_Export TAO_Notify_Tests_Application_Command : public TAO_Notify_Tests_Command
+{
+public:
+ /// Constuctor
+ TAO_Notify_Tests_Application_Command (void);
+
+ /// Destructor
+ ~TAO_Notify_Tests_Application_Command ();
+
+ /// Parse args and populate options.
+ virtual void init (ACE_Arg_Shifter& arg_shifter);
+
+ /// Execute the command.
+ virtual void execute_i (ACE_ENV_SINGLE_ARG_DECL);
+
+ /// Get the command name.
+ virtual const char* get_name (void);
+ static const char* name (void);
+
+protected:
+#ifdef HPUX_11
+ // Remove clash with /usr/include/machine/cpu.h and /usr/include/pa/cpu.h
+#undef COMMAND
+#endif
+ enum COMMAND
+ {
+ INIT,
+ RUN,
+ WAIT_FOR_EVENTS,
+ SHUTDOWN,
+ DUMP_STATE,
+ SIGNAL_PEER,
+ WAIT_TO_START
+ };
+
+ /// Flag used with the DUMP_STATE command that asks for all samples to be put into the
+ /// output data file.
+ int dump_samples_;
+
+ ///= Handlers
+ virtual void handle_init (ACE_ENV_SINGLE_ARG_DECL);
+ void handle_run (ACE_ENV_SINGLE_ARG_DECL);
+ void handle_wait_for_completion (ACE_ENV_SINGLE_ARG_DECL);
+ void handle_shutdown (ACE_ENV_SINGLE_ARG_DECL);
+ void handle_dump_stats (ACE_ENV_SINGLE_ARG_DECL);
+ void handle_signal_peer (ACE_ENV_SINGLE_ARG_DECL);
+ void handle_wait_to_start (ACE_ENV_SINGLE_ARG_DECL);
+};
+
+#include /**/ "ace/post.h"
+#endif /* TAO_Notify_Tests_APPLICATION_COMMAND_H */
diff --git a/TAO/orbsvcs/tests/Notify/lib/Command.cpp b/TAO/orbsvcs/tests/Notify/lib/Command.cpp
new file mode 100644
index 00000000000..4e63d4ba284
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/Command.cpp
@@ -0,0 +1,59 @@
+// $Id$
+
+#include "Command.h"
+
+#include "tao/Exception.h"
+#include "tao/Environment.h"
+
+#include "ace/Log_Msg.h"
+
+ACE_RCSID(lib, TAO_Command, "$Id$")
+
+TAO_Notify_Tests_Command::TAO_Notify_Tests_Command (void)
+ :next_ (0), command_ (INVALID)
+{
+}
+
+TAO_Notify_Tests_Command::~TAO_Notify_Tests_Command ()
+{
+}
+
+void
+TAO_Notify_Tests_Command::init (ACE_Arg_Shifter& /*arg_shifter*/)
+{
+ // default: do nothing.
+}
+
+void
+TAO_Notify_Tests_Command::next (TAO_Notify_Tests_Command* command)
+{
+ this->next_ = command;
+}
+
+void
+TAO_Notify_Tests_Command::execute (ACE_ENV_SINGLE_ARG_DECL)
+{
+ if (this->command_ == INVALID)
+ {
+ ACE_DEBUG ((LM_DEBUG, "Invalid command: %s\n", this->get_name ()));
+ }
+ else
+ {
+ ACE_DEBUG ((LM_DEBUG, "Executing command: %s\n", this->get_name ()));
+
+ ACE_TRY
+ {
+ this->execute_i (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ ACE_TEXT("Error: Exception running command\n"));
+ }
+ ACE_ENDTRY;
+ }
+
+ if (this->next_)
+ this->next_->execute (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
diff --git a/TAO/orbsvcs/tests/Notify/lib/Command.h b/TAO/orbsvcs/tests/Notify/lib/Command.h
new file mode 100644
index 00000000000..41f23995f0b
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/Command.h
@@ -0,0 +1,78 @@
+/* -*- C++ -*- */
+/**
+ * @file Command.h
+ *
+ * $Id$
+ *
+ * @author Pradeep Gore <pradeep@oomworks.com>
+ *
+ *
+ */
+
+#ifndef TAO_Notify_Tests_COMMAND_H
+#define TAO_Notify_Tests_COMMAND_H
+#include /**/ "ace/pre.h"
+
+#include "notify_test_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/orbconf.h"
+#include "ace/Arg_Shifter.h"
+#include "ace/CORBA_macros.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+namespace CORBA
+{
+ class Environment;
+}
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_Notify_Tests_Command
+ *
+ * @brief Base Class for all command objects.
+ *
+ */
+class TAO_NOTIFY_TEST_Export TAO_Notify_Tests_Command
+{
+ friend class TAO_Notify_Tests_Command_Builder;
+public:
+ /// Constuctor
+ TAO_Notify_Tests_Command (void);
+
+ /// Destructor
+ virtual ~TAO_Notify_Tests_Command ();
+
+ /// Parse args and populate options.
+ virtual void init (ACE_Arg_Shifter& arg_shifter);
+
+ /// Implement command execution.
+ virtual void execute_i (ACE_ENV_SINGLE_ARG_DECL) = 0;
+
+ /// Return the name of this command.
+ virtual const char* get_name (void)= 0;
+
+ ///= Each derived type must also implement the following signature:
+ // static const char* name (void);
+
+protected:
+ /// Next command after this one.
+ TAO_Notify_Tests_Command* next_;
+
+ enum {INVALID = -1};
+
+ int command_;
+
+private:
+ /// Execute the command.
+ void execute (ACE_ENV_SINGLE_ARG_DECL);
+
+ /// Save the next command to exec.
+ void next (TAO_Notify_Tests_Command* command);
+};
+
+#include /**/ "ace/post.h"
+#endif /* TAO_Notify_Tests_COMMAND_H */
diff --git a/TAO/orbsvcs/tests/Notify/lib/Command_Builder.cpp b/TAO/orbsvcs/tests/Notify/lib/Command_Builder.cpp
new file mode 100644
index 00000000000..e95b8ed81b2
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/Command_Builder.cpp
@@ -0,0 +1,92 @@
+// $Id$
+
+#include "Command_Builder.h"
+#include "ace/Arg_Shifter.h"
+#include "ace/Get_Opt.h"
+#include "Command.h"
+#include "Command_Factory.h"
+#include "Name.h"
+
+ACE_RCSID(lib, TAO_Command_Builder, "$Id$")
+
+TAO_Notify_Tests_Command_Builder::TAO_Notify_Tests_Command_Builder (void)
+ :start_command_ (0)
+{
+}
+
+TAO_Notify_Tests_Command_Builder::~TAO_Notify_Tests_Command_Builder ()
+{
+}
+
+int
+TAO_Notify_Tests_Command_Builder::init (int argc, char *argv[])
+{
+ ACE_Arg_Shifter arg_shifter (argc, argv);
+
+ ACE_CString current_arg;
+ TAO_Notify_Tests_Command_Factory* factory = 0;
+
+ if (arg_shifter.is_anything_left ())
+ {
+ current_arg = arg_shifter.get_current ();
+
+ arg_shifter.consume_arg ();
+
+ // obtain the factory
+ if (this->factory_map_.find (current_arg, factory) == -1)
+ ACE_DEBUG ((LM_DEBUG, "NS Command: %s not recognized!\n", current_arg.c_str ()));
+ else
+ {
+ TAO_Notify_Tests_Command* new_command = factory->create ();
+
+ new_command->init (arg_shifter);
+
+ if (this->start_command_ == 0)
+ {
+ this->start_command_ = new_command;
+ this->last_command_ = new_command;
+ }
+ else
+ {
+ // linked list
+ this->last_command_->next (new_command);
+ this->last_command_ = new_command;
+ }
+ }
+ }
+
+ return 0;
+}
+
+int
+TAO_Notify_Tests_Command_Builder::fini (void)
+{
+ return 0;
+}
+
+void
+TAO_Notify_Tests_Command_Builder::_register (ACE_CString command_factory_name, TAO_Notify_Tests_Command_Factory* command_factory)
+{
+ if (this->factory_map_.bind (command_factory_name, command_factory) == -1)
+ ACE_DEBUG ((LM_DEBUG, "Failed to register command factory for %s\n", command_factory_name.c_str ()));
+ else
+ ACE_DEBUG ((LM_DEBUG, "Registered command factory for %s\n", command_factory_name.c_str ()));
+}
+
+void
+TAO_Notify_Tests_Command_Builder::execute (ACE_ENV_SINGLE_ARG_DECL)
+{
+ if (this->start_command_)
+ this->start_command_->execute (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+ACE_STATIC_SVC_DEFINE(TAO_Notify_Tests_Command_Builder,
+ TAO_Notify_Tests_Name::command_builder,
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (TAO_Notify_Tests_Command_Builder),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0)
+
+ACE_FACTORY_DEFINE (TAO_NOTIFY_TEST, TAO_Notify_Tests_Command_Builder)
+
+ACE_STATIC_SVC_REQUIRE (TAO_Notify_Tests_Command_Builder)
diff --git a/TAO/orbsvcs/tests/Notify/lib/Command_Builder.h b/TAO/orbsvcs/tests/Notify/lib/Command_Builder.h
new file mode 100644
index 00000000000..7ca63765dbe
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/Command_Builder.h
@@ -0,0 +1,74 @@
+/* -*- C++ -*- */
+/**
+ * @file Command_Builder.h
+ *
+ * $Id$
+ *
+ * @author Pradeep Gore <pradeep@oomworks.com>
+ *
+ *
+ */
+
+#ifndef TAO_Notify_Tests_COMMAND_BUILDER_H
+#define TAO_Notify_Tests_COMMAND_BUILDER_H
+#include /**/ "ace/pre.h"
+
+#include "notify_test_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Service_Config.h"
+#include "ace/Service_Object.h"
+#include "ace/Unbounded_Queue.h"
+#include "ace/SString.h"
+#include "ace/CORBA_macros.h"
+#include "ace/Hash_Map_Manager.h"
+#include "tao/ORB.h"
+
+class TAO_Notify_Tests_Command_Factory;
+class TAO_Notify_Tests_Command;
+
+/**
+ * @class TAO_Notify_Tests_Command_Builder
+ *
+ * @brief Class for collating and serially executing command objects.
+ *
+ */
+class TAO_NOTIFY_TEST_Export TAO_Notify_Tests_Command_Builder : public ACE_Service_Object
+{
+public:
+ /// Constuctor
+ TAO_Notify_Tests_Command_Builder (void);
+
+ /// Destructor
+ ~TAO_Notify_Tests_Command_Builder ();
+
+ /// = Service_Object virtual method overloads.
+ virtual int init (int argc, char *argv[]);
+ virtual int fini (void);
+
+ /// Register the factory against the name of the factory.
+ void _register (ACE_CString command_factory_name, TAO_Notify_Tests_Command_Factory* command_factory);
+
+ /// Execute the <start_command_>.
+ void execute (ACE_ENV_SINGLE_ARG_DECL);
+
+protected:
+ /// The starting command. each command executes the next one when done.
+ TAO_Notify_Tests_Command* start_command_;
+
+ /// Last command initialized.
+ TAO_Notify_Tests_Command* last_command_;
+
+ /// The factory map.
+ ACE_Hash_Map_Manager <ACE_CString, TAO_Notify_Tests_Command_Factory*, TAO_SYNCH_MUTEX> factory_map_;
+};
+
+ACE_STATIC_SVC_DECLARE_EXPORT (TAO_NOTIFY_TEST, TAO_Notify_Tests_Command_Builder)
+
+ACE_FACTORY_DECLARE (TAO_NOTIFY_TEST, TAO_Notify_Tests_Command_Builder)
+
+#include /**/ "ace/post.h"
+#endif /* TAO_Notify_Tests_COMMAND_BUILDER_H */
diff --git a/TAO/orbsvcs/tests/Notify/lib/Command_Factory.cpp b/TAO/orbsvcs/tests/Notify/lib/Command_Factory.cpp
new file mode 100644
index 00000000000..5005641fe4a
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/Command_Factory.cpp
@@ -0,0 +1,14 @@
+// $Id$
+
+
+#include "Command_Factory.h"
+
+ACE_RCSID(lib, TAO_Command_Factory, "$Id$")
+
+TAO_Notify_Tests_Command_Factory::TAO_Notify_Tests_Command_Factory (void)
+{
+}
+
+TAO_Notify_Tests_Command_Factory::~TAO_Notify_Tests_Command_Factory ()
+{
+}
diff --git a/TAO/orbsvcs/tests/Notify/lib/Command_Factory.h b/TAO/orbsvcs/tests/Notify/lib/Command_Factory.h
new file mode 100644
index 00000000000..5101acad53f
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/Command_Factory.h
@@ -0,0 +1,44 @@
+/* -*- C++ -*- */
+/**
+ * @file Command_Factory.h
+ *
+ * $Id$
+ *
+ * @author Pradeep Gore <pradeep@oomworks.com>
+ *
+ *
+ */
+
+#ifndef TAO_Notify_Tests_COMMAND_FACTORY_H
+#define TAO_Notify_Tests_COMMAND_FACTORY_H
+#include /**/ "ace/pre.h"
+
+#include "notify_test_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+class TAO_Notify_Tests_Command;
+
+/**
+ * @class TAO_Notify_Tests_Command_Factory
+ *
+ * @brief Base class for Factory to create command objects.
+ *
+ */
+class TAO_NOTIFY_TEST_Export TAO_Notify_Tests_Command_Factory
+{
+public:
+ /// Constuctor
+ TAO_Notify_Tests_Command_Factory (void);
+
+ /// Destructor
+ virtual ~TAO_Notify_Tests_Command_Factory ();
+
+ /// Create the command.
+ virtual TAO_Notify_Tests_Command* create (void) = 0;
+};
+
+#include /**/ "ace/post.h"
+#endif /* TAO_Notify_Tests_COMMAND_FACTORY_H */
diff --git a/TAO/orbsvcs/tests/Notify/lib/Command_Factory_T.cpp b/TAO/orbsvcs/tests/Notify/lib/Command_Factory_T.cpp
new file mode 100644
index 00000000000..8b3cd92b48f
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/Command_Factory_T.cpp
@@ -0,0 +1,53 @@
+// $Id$
+
+#ifndef TAO_Notify_Tests_COMMAND_FACTORY_T_CPP
+#define TAO_Notify_Tests_COMMAND_FACTORY_T_CPP
+
+#include "Command_Factory_T.h"
+
+ACE_RCSID(Notify, TAO_Command_Factory_T, "$Id$")
+
+#include "ace/Dynamic_Service.h"
+#include "tao/debug.h"
+#include "Command_Builder.h"
+#include "Name.h"
+
+template <class COMMAND>
+TAO_Notify_Tests_Command_Factory_T<COMMAND>::TAO_Notify_Tests_Command_Factory_T (void)
+{
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG, "Creating command factory for %s\n", COMMAND::name()));
+}
+
+template <class COMMAND>
+TAO_Notify_Tests_Command_Factory_T<COMMAND>::~TAO_Notify_Tests_Command_Factory_T ()
+{
+}
+
+template <class COMMAND> int
+TAO_Notify_Tests_Command_Factory_T<COMMAND>::init (int /*argc*/, char/*argv*/ *[])
+{
+ /// register with Command builder
+ TAO_Notify_Tests_Command_Builder* cmd_builder =
+ ACE_Dynamic_Service<TAO_Notify_Tests_Command_Builder>::instance (TAO_Notify_Tests_Name::command_builder);
+
+ if (cmd_builder)
+ cmd_builder->_register (COMMAND::name(), this);
+ else
+ ACE_DEBUG ((LM_DEBUG, "Could not register command builder %s\n", COMMAND::name()));
+ return 0;
+}
+
+template <class COMMAND> int
+TAO_Notify_Tests_Command_Factory_T<COMMAND>::fini (void)
+{
+ return 0;
+}
+
+template <class COMMAND> TAO_Notify_Tests_Command*
+TAO_Notify_Tests_Command_Factory_T<COMMAND>::create (void)
+{
+ return new COMMAND ();
+}
+
+#endif /* TAO_Notify_Tests_COMMAND_FACTORY_T_CPP */
diff --git a/TAO/orbsvcs/tests/Notify/lib/Command_Factory_T.h b/TAO/orbsvcs/tests/Notify/lib/Command_Factory_T.h
new file mode 100644
index 00000000000..a7a8edce20a
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/Command_Factory_T.h
@@ -0,0 +1,64 @@
+/* -*- C++ -*- */
+/**
+ * @file Command_Factory_T.h
+ *
+ * $Id$
+ *
+ * @author Pradeep Gore <pradeep@oomworks.com>
+ *
+ *
+ */
+
+#ifndef TAO_COMMAND_FACTORY_T_H
+#define TAO_COMMAND_FACTORY_T_H
+#include /**/ "ace/pre.h"
+
+#include "ace/Service_Config.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Service_Object.h"
+#include "Command_Factory.h"
+
+class TAO_Notify_Tests_Command;
+
+/**
+ * @class TAO_Command_Factory_T
+ *
+ * @brief Template class to create COMMAND specific factories.
+ *
+ */
+#ifdef HPUX_11
+ // Remove clash with /usr/include/machine/cpu.h and /usr/include/pa/cpu.h
+#undef COMMAND
+#endif
+template <class COMMAND>
+class TAO_Notify_Tests_Command_Factory_T : public TAO_Notify_Tests_Command_Factory, public ACE_Service_Object
+{
+public:
+ /// Constuctor
+ TAO_Notify_Tests_Command_Factory_T (void);
+
+ /// Destructor
+ ~TAO_Notify_Tests_Command_Factory_T ();
+
+ /// = Service_Object virtual method overloads.
+ virtual int init (int argc, char *argv[]);
+ virtual int fini (void);
+
+ /// Create the <COMMAND> command.
+ TAO_Notify_Tests_Command* create (void);
+};
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "Command_Factory_T.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+#pragma implementation ("Command_Factory_T.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_COMMAND_FACTORY_T_H */
diff --git a/TAO/orbsvcs/tests/Notify/lib/ConsumerAdmin_Command.cpp b/TAO/orbsvcs/tests/Notify/lib/ConsumerAdmin_Command.cpp
new file mode 100644
index 00000000000..2965bc0094c
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/ConsumerAdmin_Command.cpp
@@ -0,0 +1,180 @@
+// $Id$
+
+#include "ConsumerAdmin_Command.h"
+
+ACE_RCSID(lib, TAO_ConsumerAdmin_Command, "$Id$")
+
+#include "LookupManager.h"
+#include "Name.h"
+#include "Options_Parser.h"
+
+TAO_Notify_Tests_ConsumerAdmin_Command::TAO_Notify_Tests_ConsumerAdmin_Command (void)
+ :ifgop_ (CosNotifyChannelAdmin::OR_OP), id_ (0)
+{
+}
+
+TAO_Notify_Tests_ConsumerAdmin_Command::~TAO_Notify_Tests_ConsumerAdmin_Command ()
+{
+}
+
+const char*
+TAO_Notify_Tests_ConsumerAdmin_Command::get_name (void)
+{
+ return TAO_Notify_Tests_ConsumerAdmin_Command::name ();
+}
+
+const char*
+TAO_Notify_Tests_ConsumerAdmin_Command::name (void)
+{
+ return TAO_Notify_Tests_Name::consumer_admin_command;
+}
+
+void
+TAO_Notify_Tests_ConsumerAdmin_Command::handle_create (ACE_ENV_SINGLE_ARG_DECL)
+{
+ CosNotifyChannelAdmin::EventChannel_var ec;
+
+ LOOKUP_MANAGER->resolve (ec, this->factory_.c_str () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // create consumer admin
+ CosNotifyChannelAdmin::ConsumerAdmin_var sa =
+ ec->new_for_consumers (this->ifgop_,
+ this->id_
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ LOOKUP_MANAGER->_register (sa.in(), this->name_.c_str () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+
+void
+TAO_Notify_Tests_ConsumerAdmin_Command::handle_subscriptions (ACE_ENV_SINGLE_ARG_DECL)
+{
+ CosNotifyChannelAdmin::ConsumerAdmin_var admin;
+
+ LOOKUP_MANAGER->resolve (admin, this->name_.c_str () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Let the user see what we're subscribed for,
+ ACE_DEBUG ((LM_DEBUG, "Calling ConsumerAdmin subscription_change : "));
+
+ CORBA::ULong i = 0;
+
+ for (; i < added_.length (); ++i)
+ {
+ ACE_DEBUG ((LM_DEBUG, "+(%s,%s), ", added_[i].domain_name.in (), added_[i].type_name.in ()));
+ }
+ for (i = 0; i < removed_.length (); ++i)
+ {
+ ACE_DEBUG ((LM_DEBUG, "-(%s,%s), ", removed_[i].domain_name.in (), removed_[i].type_name.in ()));
+ }
+
+ ACE_DEBUG ((LM_DEBUG, "\n"));
+
+ admin->subscription_change (this->added_, this->removed_ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void
+TAO_Notify_Tests_ConsumerAdmin_Command::handle_set_qos (ACE_ENV_SINGLE_ARG_DECL)
+{
+ CosNotifyChannelAdmin::ConsumerAdmin_var admin;
+
+ LOOKUP_MANAGER->resolve (admin, this->name_.c_str () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ admin->set_qos (this->qos_ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void
+TAO_Notify_Tests_ConsumerAdmin_Command::handle_status (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+{
+ //@@ TODO:
+}
+
+void
+TAO_Notify_Tests_ConsumerAdmin_Command::init (ACE_Arg_Shifter& arg_shifter)
+{
+ if (arg_shifter.is_anything_left ())
+ {
+ /// -Create ca_name factory_name
+ if (arg_shifter.cur_arg_strncasecmp ("-Create") == 0)
+ {
+ this->command_ = CREATE;
+
+ arg_shifter.consume_arg ();
+
+ this->name_ = arg_shifter.get_current ();
+ arg_shifter.consume_arg ();
+
+ this->factory_ = arg_shifter.get_current ();
+ arg_shifter.consume_arg ();
+
+ if (arg_shifter.cur_arg_strncasecmp ("-AND_OP") == 0)
+ {
+ arg_shifter.consume_arg ();
+
+ this->ifgop_ = CosNotifyChannelAdmin::AND_OP;
+ }
+ else if (arg_shifter.cur_arg_strncasecmp ("-OR_OP") == 0)
+ {
+ arg_shifter.consume_arg ();
+
+ this->ifgop_ = CosNotifyChannelAdmin::OR_OP;
+ }
+ }
+ else if (arg_shifter.cur_arg_strncasecmp ("-Subscription") == 0) // -Subscription admin_name +added_type1 +-added_type2 ... -added_type3 -added_type4..
+ {
+ this->command_ = SUBSCRIPTION;
+
+ arg_shifter.consume_arg ();
+
+ this->name_ = arg_shifter.get_current ();
+ arg_shifter.consume_arg ();
+
+ TAO_Notify_Tests_Options_Parser options_parser;
+ options_parser.execute (this->added_, this->removed_, arg_shifter);
+ }
+ else if (arg_shifter.cur_arg_strncasecmp ("-Set_QoS") == 0) // -Set_QoS admin_name [Qos Options]
+ {
+ this->command_ = SET_QOS;
+
+ arg_shifter.consume_arg ();
+
+ this->name_ = arg_shifter.get_current ();
+
+ arg_shifter.consume_arg ();
+
+ TAO_Notify_Tests_Options_Parser qos_parser;
+ qos_parser.execute (this->qos_, arg_shifter);
+ }
+ }
+}
+
+void
+TAO_Notify_Tests_ConsumerAdmin_Command::execute_i (ACE_ENV_SINGLE_ARG_DECL)
+{
+ if (this->command_ == CREATE)
+ {
+ this->handle_create (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else if (this->command_ == SUBSCRIPTION)
+ {
+ this->handle_subscriptions (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else if (this->command_ == SET_QOS)
+ {
+ this->handle_set_qos (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else if (this->command_ == DUMP_STATE)
+ {
+ this->handle_status (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+}
diff --git a/TAO/orbsvcs/tests/Notify/lib/ConsumerAdmin_Command.h b/TAO/orbsvcs/tests/Notify/lib/ConsumerAdmin_Command.h
new file mode 100644
index 00000000000..a94146e47bc
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/ConsumerAdmin_Command.h
@@ -0,0 +1,90 @@
+/* -*- C++ -*- */
+/**
+ * @file ConsumerAdmin_Command.h
+ *
+ * $Id$
+ *
+ * @author Pradeep Gore <pradeep@oomworks.com>
+ *
+ *
+ */
+
+#ifndef TAO_Notify_Tests_CONSUMERADMIN_COMMAND_H
+#define TAO_Notify_Tests_CONSUMERADMIN_COMMAND_H
+#include /**/ "ace/pre.h"
+
+#include "notify_test_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/SString.h"
+#include "orbsvcs/CosNotifyChannelAdminC.h"
+#include "Command.h"
+
+/**
+ * @class TAO_Notify_Tests_ConsumerAdmin_Command
+ *
+ * @brief Command for ConsumerAdmin objects.
+ *
+ */
+class TAO_NOTIFY_TEST_Export TAO_Notify_Tests_ConsumerAdmin_Command : public TAO_Notify_Tests_Command
+{
+public:
+ /// Constuctor
+ TAO_Notify_Tests_ConsumerAdmin_Command (void);
+
+ /// Destructor
+ ~TAO_Notify_Tests_ConsumerAdmin_Command ();
+
+ /// Parse args and populate options.
+ virtual void init (ACE_Arg_Shifter& arg_shifter);
+
+ /// Execute the command.
+ virtual void execute_i (ACE_ENV_SINGLE_ARG_DECL);
+
+ /// Name of object
+ virtual const char* get_name (void);
+ static const char* name (void);
+
+protected:
+
+ /// = Data Members
+#ifdef HPUX_11
+ // Remove clash with /usr/include/machine/cpu.h and /usr/include/pa/cpu.h
+#undef COMMAND
+#endif
+ enum COMMAND
+ {
+ CREATE,
+ DESTROY,
+ SET_QOS,
+ SET_ADMIN,
+ SUBSCRIPTION,
+ DUMP_STATE
+ };
+
+ ACE_CString name_;
+
+ ACE_CString factory_;
+
+ CosNotifyChannelAdmin::InterFilterGroupOperator ifgop_;
+
+ CosNotifyChannelAdmin::AdminID id_;
+
+ CosNotification::QoSProperties qos_;
+
+ // Subscription change
+ CosNotification::EventTypeSeq added_;
+ CosNotification::EventTypeSeq removed_;
+
+ /// = Handlers
+ void handle_create (ACE_ENV_SINGLE_ARG_DECL);
+ void handle_subscriptions (ACE_ENV_SINGLE_ARG_DECL);
+ void handle_status (ACE_ENV_SINGLE_ARG_DECL);
+ void handle_set_qos (ACE_ENV_SINGLE_ARG_DECL);
+};
+
+#include /**/ "ace/post.h"
+#endif /* TAO_Notify_Tests_CONSUMERADMIN_COMMAND_H */
diff --git a/TAO/orbsvcs/tests/Notify/lib/Consumer_T.cpp b/TAO/orbsvcs/tests/Notify/lib/Consumer_T.cpp
new file mode 100644
index 00000000000..9441287f68b
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/Consumer_T.cpp
@@ -0,0 +1,107 @@
+// $Id$
+#ifndef TAO_Notify_Tests_Consumer_T_CPP
+#define TAO_Notify_Tests_Consumer_T_CPP
+
+#include "Consumer_T.h"
+
+ACE_RCSID(Notify, TAO_Notify_Tests_Consumer_T, "$Id$")
+
+template <class Consumer_Traits>
+TAO_Notify_Tests_Consumer_T<Consumer_Traits>::TAO_Notify_Tests_Consumer_T (void)
+{
+}
+
+template <class Consumer_Traits>
+TAO_Notify_Tests_Consumer_T<Consumer_Traits>::~TAO_Notify_Tests_Consumer_T ()
+{
+}
+
+template <class Consumer_Traits> ACE_TYPENAME TAO_Notify_Tests_Consumer_T<Consumer_Traits>::Proxy_Traits_PTR
+TAO_Notify_Tests_Consumer_T<Consumer_Traits>::get_proxy_supplier (void)
+{
+ return this->get_proxy ();
+}
+
+template <class Consumer_Traits> ACE_TYPENAME TAO_Notify_Tests_Consumer_T<Consumer_Traits>::Proxy_Traits_PTR
+TAO_Notify_Tests_Consumer_T<Consumer_Traits>::obtain_proxy (ACE_TYPENAME TAO_Notify_Tests_Consumer_T<Consumer_Traits>::Admin_Traits_PTR admin_ptr ACE_ENV_ARG_DECL)
+{
+ Consumer_Traits traits;
+
+ CosNotifyChannelAdmin::ProxySupplier_var proxy_supplier =
+ admin_ptr->obtain_notification_push_supplier (traits.type_
+ , this->proxy_id_
+ ACE_ENV_ARG_PARAMETER
+ );
+
+ ACE_CHECK_RETURN (Proxy_Traits_INTERFACE::_nil ());
+
+ ACE_ASSERT (!CORBA::is_nil (proxy_supplier.in ()));
+
+ return Proxy_Traits_INTERFACE::_narrow (proxy_supplier.in ()
+ ACE_ENV_ARG_PARAMETER);
+}
+
+template <class Consumer_Traits> ACE_TYPENAME TAO_Notify_Tests_Consumer_T<Consumer_Traits>::Proxy_Traits_PTR
+TAO_Notify_Tests_Consumer_T<Consumer_Traits>::obtain_proxy (ACE_TYPENAME TAO_Notify_Tests_Consumer_T<Consumer_Traits>::Admin_Ext_Traits_PTR admin_ptr
+ , CosNotification::QoSProperties& qos
+ ACE_ENV_ARG_DECL)
+{
+ Consumer_Traits traits;
+
+ // create the proxy consumer
+ CosNotifyChannelAdmin::ProxySupplier_var proxy_supplier =
+ admin_ptr->obtain_notification_push_supplier_with_qos (traits.type_
+ , this->proxy_id_
+ , qos
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (Proxy_Traits_INTERFACE::_nil ());
+
+ ACE_ASSERT (!CORBA::is_nil (proxy_supplier.in ()));
+
+ return Proxy_Traits_INTERFACE::_narrow (proxy_supplier.in ()
+ ACE_ENV_ARG_PARAMETER);
+}
+
+template <class Consumer_Traits> void
+TAO_Notify_Tests_Consumer_T<Consumer_Traits>::subscription_change (CosNotification::EventTypeSeq &added, CosNotification::EventTypeSeq& removed ACE_ENV_ARG_DECL)
+{
+ // Let the user see what we're subscribed for,
+ ACE_DEBUG ((LM_DEBUG, "Calling Consumer subscription change: "));
+
+ CORBA::ULong i = 0;
+
+ for (; i < added.length (); ++i)
+ {
+ ACE_DEBUG ((LM_DEBUG, "+(%s,%s), ", added[i].domain_name.in (), added[i].type_name.in ()));
+ }
+ for (i = 0; i < removed.length (); ++i)
+ {
+ ACE_DEBUG ((LM_DEBUG, "-(%s,%s), ", removed[i].domain_name.in (), removed[i].type_name.in ()));
+ }
+
+ ACE_DEBUG ((LM_DEBUG, "\n"));
+
+ /// subscribe
+ ACE_TYPENAME Proxy_Traits::PTR proxy_supplier = this->get_proxy ();
+
+ if (proxy_supplier != 0)
+ {
+ proxy_supplier->subscription_change (added, removed ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else
+ ACE_DEBUG ((LM_DEBUG, "Proxy Supplier not available, subscription change not made."));
+}
+
+template <class Consumer_Traits> void
+TAO_Notify_Tests_Consumer_T<Consumer_Traits>::offer_change
+ (const CosNotification::EventTypeSeq & /*added*/,
+ const CosNotification::EventTypeSeq & /*removed*/
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ CosNotifyComm::InvalidEventType))
+{
+ // No-Op.
+}
+
+#endif /* TAO_Notify_Tests_Consumer_T_CPP */
diff --git a/TAO/orbsvcs/tests/Notify/lib/Consumer_T.h b/TAO/orbsvcs/tests/Notify/lib/Consumer_T.h
new file mode 100644
index 00000000000..82f23b0af2a
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/Consumer_T.h
@@ -0,0 +1,98 @@
+/* -*- C++ -*- */
+/**
+ * @file Consumer_T.h
+ *
+ * $Id$
+ *
+ * @author Pradeep Gore <pradeep@oomworks.com>
+ *
+ *
+ */
+
+#ifndef TAO_Notify_Tests_CONSUMER_T_H
+#define TAO_Notify_Tests_CONSUMER_T_H
+#include /**/ "ace/pre.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "Peer_T.h"
+
+class TAO_Notify_Tests_ConsumerAdmin_Traits
+{
+ public:
+ typedef CosNotifyChannelAdmin::ConsumerAdmin INTERFACE;
+ typedef CosNotifyChannelAdmin::ConsumerAdmin_ptr PTR;
+ typedef CosNotifyChannelAdmin::ConsumerAdmin_var VAR;
+};
+
+class TAO_Notify_Tests_ConsumerAdmin_Ext_Traits
+{
+ public:
+ typedef NotifyExt::ConsumerAdmin INTERFACE;
+ typedef NotifyExt::ConsumerAdmin_ptr PTR;
+ typedef NotifyExt::ConsumerAdmin_var VAR;
+};
+
+/**
+ * @class TAO_Notify_Tests_Consumer_T
+ *
+ * @brief Base template to implement Consumers.
+ *
+ */
+template <class Consumer_Traits>
+class TAO_Notify_Tests_Consumer_T : public TAO_Notify_Tests_Peer_T <Consumer_Traits>
+{
+ typedef ACE_TYPENAME Consumer_Traits::Admin_Traits Admin_Traits;
+ typedef ACE_TYPENAME Consumer_Traits::Admin_Ext_Traits Admin_Ext_Traits;
+ typedef ACE_TYPENAME Consumer_Traits::Proxy_Traits Proxy_Traits;
+
+ typedef ACE_TYPENAME Proxy_Traits::INTERFACE Proxy_Traits_INTERFACE;
+ typedef ACE_TYPENAME Proxy_Traits::PTR Proxy_Traits_PTR;
+ typedef ACE_TYPENAME Admin_Traits::PTR Admin_Traits_PTR;
+ typedef ACE_TYPENAME Admin_Ext_Traits::PTR Admin_Ext_Traits_PTR;
+
+public:
+ /// Constuctor
+ TAO_Notify_Tests_Consumer_T (void);
+
+ /// Destructor
+ ~TAO_Notify_Tests_Consumer_T ();
+
+ /// For backward compatibility. use <get_proxy> instead.
+ Proxy_Traits_PTR get_proxy_supplier (void);
+
+ /// Send subscription_change
+ virtual void subscription_change (CosNotification::EventTypeSeq &added, CosNotification::EventTypeSeq& removed ACE_ENV_ARG_DECL);
+
+protected:
+ /// Obtain Proxy.
+ virtual Proxy_Traits_PTR obtain_proxy (Admin_Traits_PTR admin_ptr ACE_ENV_ARG_DECL);
+
+ /// Obtain Proxy with QoS.
+ virtual Proxy_Traits_PTR obtain_proxy (Admin_Ext_Traits_PTR admin_ptr
+ , CosNotification::QoSProperties& qos
+ ACE_ENV_ARG_DECL);
+
+ // = NotifyPublish method
+ virtual void offer_change (const CosNotification::EventTypeSeq & added,
+ const CosNotification::EventTypeSeq & removed
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ CosNotifyComm::InvalidEventType
+ ));
+};
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "Consumer_T.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+#pragma implementation ("Consumer_T.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_Notify_Tests_CONSUMER_T_H */
diff --git a/TAO/orbsvcs/tests/Notify/lib/Direct_Consumer.cpp b/TAO/orbsvcs/tests/Notify/lib/Direct_Consumer.cpp
new file mode 100644
index 00000000000..502d535a91a
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/Direct_Consumer.cpp
@@ -0,0 +1,37 @@
+// $Id$
+
+#include "Direct_Consumer.h"
+
+ACE_RCSID(lib, TAO_Direct_Consumer, "$Id$")
+
+#include "LookupManager.h"
+
+TAO_Notify_Tests_Direct_Consumer::TAO_Notify_Tests_Direct_Consumer (void)
+{
+}
+
+TAO_Notify_Tests_Direct_Consumer::~TAO_Notify_Tests_Direct_Consumer ()
+{
+}
+
+void
+TAO_Notify_Tests_Direct_Consumer::connect (ACE_ENV_SINGLE_ARG_DECL)
+{
+ // Get the POA
+ PortableServer::POA_var poa;
+ LOOKUP_MANAGER->resolve (poa, this->poa_name_.c_str () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // set the POA
+ this->set_poa (poa.in () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Activate the consumer with the default_POA_.
+ CosNotifyComm::StructuredPushConsumer_var consumer_ref =
+ this->_this (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Register the activated object.
+ LOOKUP_MANAGER->_register (consumer_ref.in (), this->name_.c_str () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
diff --git a/TAO/orbsvcs/tests/Notify/lib/Direct_Consumer.h b/TAO/orbsvcs/tests/Notify/lib/Direct_Consumer.h
new file mode 100644
index 00000000000..d27c57924c0
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/Direct_Consumer.h
@@ -0,0 +1,44 @@
+/* -*- C++ -*- */
+/**
+ * @file Direct_Consumer.h
+ *
+ * $Id$
+ *
+ * @author Pradeep Gore <pradeep@oomworks.com>
+ *
+ *
+ */
+
+#ifndef TAO_Notify_Tests_DIRECT_CONSUMER_H
+#define TAO_Notify_Tests_DIRECT_CONSUMER_H
+#include /**/ "ace/pre.h"
+
+#include "notify_test_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "Periodic_Consumer.h"
+
+/**
+ * @class TAO_Notify_Tests_Direct_Consumer
+ *
+ * @brief Does not connect to the Notification Service. The Direct Supplier supplies events directly.
+ *
+ */
+class TAO_NOTIFY_TEST_Export TAO_Notify_Tests_Direct_Consumer : public TAO_Notify_Tests_Periodic_Consumer
+{
+public:
+ /// Constuctor
+ TAO_Notify_Tests_Direct_Consumer (void);
+
+ /// Destructor
+ ~TAO_Notify_Tests_Direct_Consumer ();
+
+ /// Connect using options parsed and set initial QoS.
+ virtual void connect (ACE_ENV_SINGLE_ARG_DECL);
+};
+
+#include /**/ "ace/post.h"
+#endif /* TAO_Notify_Tests_DIRECT_CONSUMER_H */
diff --git a/TAO/orbsvcs/tests/Notify/lib/Direct_Supplier.cpp b/TAO/orbsvcs/tests/Notify/lib/Direct_Supplier.cpp
new file mode 100644
index 00000000000..a647893b1f7
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/Direct_Supplier.cpp
@@ -0,0 +1,56 @@
+// $Id$
+
+#include "Direct_Supplier.h"
+
+#if ! defined (__ACE_INLINE__)
+#include "Direct_Supplier.inl"
+#endif /* __ACE_INLINE__ */
+
+ACE_RCSID(Notify, TAO_Notify_Tests_Direct_Supplier, "$Id$")
+
+#include "LookupManager.h"
+
+TAO_Notify_Tests_Direct_Supplier::TAO_Notify_Tests_Direct_Supplier (ACE_CString& target)
+ : target_ (target)
+{
+}
+
+TAO_Notify_Tests_Direct_Supplier::~TAO_Notify_Tests_Direct_Supplier ()
+{
+}
+
+void
+TAO_Notify_Tests_Direct_Supplier::connect (ACE_ENV_SINGLE_ARG_DECL)
+{
+ // Get the POA
+ PortableServer::POA_var poa;
+ LOOKUP_MANAGER->resolve (poa, this->poa_name_.c_str () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // set the POA
+ this->set_poa (poa.in () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Get hold of the reference.
+ CosNotifyComm::StructuredPushSupplier_var supplier_ref =
+ this->_this (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Register the activated object.
+ LOOKUP_MANAGER->_register (supplier_ref.in (), this->name_.c_str () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Resolve the target object.
+ LOOKUP_MANAGER->resolve (this->target_object_, this->target_.c_str () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void
+TAO_Notify_Tests_Direct_Supplier::send_event (const CosNotification::StructuredEvent& event
+ ACE_ENV_ARG_DECL)
+{
+ ACE_ASSERT (!CORBA::is_nil (this->target_object_.in ()));
+
+ this->target_object_->push_structured_event (event ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
diff --git a/TAO/orbsvcs/tests/Notify/lib/Direct_Supplier.h b/TAO/orbsvcs/tests/Notify/lib/Direct_Supplier.h
new file mode 100644
index 00000000000..999bf7463ec
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/Direct_Supplier.h
@@ -0,0 +1,59 @@
+/* -*- C++ -*- */
+/**
+ * @file Direct_Supplier.h
+ *
+ * $Id$
+ *
+ * @author Pradeep Gore <pradeep@oomworks.com>
+ *
+ *
+ */
+
+#ifndef TAO_Notify_Tests_DIRECT_SUPPLIER_H
+#define TAO_Notify_Tests_DIRECT_SUPPLIER_H
+#include /**/ "ace/pre.h"
+
+#include "notify_test_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "Periodic_Supplier.h"
+
+/**
+ * @class TAO_Notify_Tests_Direct_Supplier
+ *
+ * @brief Send Directly to a consumer.
+ *
+ */
+class TAO_NOTIFY_TEST_Export TAO_Notify_Tests_Direct_Supplier : public TAO_Notify_Tests_Periodic_Supplier
+{
+public:
+ /// Constuctor
+ TAO_Notify_Tests_Direct_Supplier (ACE_CString& target);
+
+ /// Destructor
+ ~TAO_Notify_Tests_Direct_Supplier ();
+
+ /// Connect using options parsed and set initial QoS.
+ virtual void connect (ACE_ENV_SINGLE_ARG_DECL);
+
+ // Send one event. Bypass sending to the Notify and send directly to taget consumer.
+ virtual void send_event (const CosNotification::StructuredEvent& event
+ ACE_ENV_ARG_DECL);
+
+protected:
+ /// Target object.
+ ACE_CString target_;
+
+ /// This object is resolved in the connect method.
+ CosNotifyComm::StructuredPushConsumer_var target_object_;
+};
+
+#if defined (__ACE_INLINE__)
+#include "Direct_Supplier.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_Notify_Tests_DIRECT_SUPPLIER_H */
diff --git a/TAO/orbsvcs/tests/Notify/lib/Direct_Supplier.inl b/TAO/orbsvcs/tests/Notify/lib/Direct_Supplier.inl
new file mode 100644
index 00000000000..94e7f9bf7fa
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/Direct_Supplier.inl
@@ -0,0 +1,3 @@
+// $Id$
+
+#include "Direct_Supplier.h"
diff --git a/TAO/orbsvcs/tests/Notify/lib/Driver.cpp b/TAO/orbsvcs/tests/Notify/lib/Driver.cpp
new file mode 100644
index 00000000000..8985aa6f772
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/Driver.cpp
@@ -0,0 +1,325 @@
+// $Id$
+
+#include "Driver.h"
+
+ACE_RCSID(lib, TAO_Driver, "$Id$")
+
+#include "ace/Dynamic_Service.h"
+#include "ace/Thread_Manager.h"
+#include "ace/Arg_Shifter.h"
+#include "ace/Argv_Type_Converter.h"
+#include "tao/ORB.h"
+#include "tao/ORB_Core.h"
+#include "ace/Sched_Params.h"
+#include "LookupManager.h"
+#include "Command_Builder.h"
+#include "Name.h"
+#include "Activation_Manager.h"
+
+const char *
+sched_policy_name (int sched_policy)
+{
+ const char *name = 0;
+
+ switch (sched_policy)
+ {
+ case ACE_SCHED_OTHER:
+ name = "SCHED_OTHER";
+ break;
+ case ACE_SCHED_RR:
+ name = "SCHED_RR";
+ break;
+ case ACE_SCHED_FIFO:
+ name = "SCHED_FIFO";
+ break;
+ }
+
+ return name;
+}
+
+void
+check_supported_priorities (CORBA::ORB_ptr orb)
+{
+ int sched_policy =
+ orb->orb_core ()->orb_params ()->ace_sched_policy ();
+
+ // Check that we have sufficient priority range to run this test,
+ // i.e., more than 1 priority level.
+ int max_priority =
+ ACE_Sched_Params::priority_max (sched_policy);
+ int min_priority =
+ ACE_Sched_Params::priority_min (sched_policy);
+
+ if (max_priority == min_priority)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "Not enough priority levels with the %s scheduling policy\n"
+ "on this platform to run the test, terminating program....\n"
+ "Check svc.conf options\n",
+ sched_policy_name (sched_policy)));
+
+ ACE_OS::exit (2);
+ }
+}
+
+/*****************************************************************/
+TAO_Notify_Tests_Worker::TAO_Notify_Tests_Worker (void)
+{
+}
+
+void
+TAO_Notify_Tests_Worker::command_builder (TAO_Notify_Tests_Command_Builder* cmd_builder)
+{
+ this->cmd_builder_ = cmd_builder;
+}
+
+int
+TAO_Notify_Tests_Worker::svc (void)
+{
+#if 0
+ ACE_hthread_t current;
+ ACE_Thread::self (current);
+
+ int priority;
+ if (ACE_Thread::getprio (current, priority) == -1)
+ {
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("TAO (%P|%t) - Failed to get Worker thread priority\n")));
+ return -1;
+ }
+
+ ACE_DEBUG ((LM_ERROR, "Activated Worker Thread for commands @ priority:%d \n", priority));
+#endif
+
+ ACE_DECLARE_NEW_CORBA_ENV;
+
+ ACE_TRY
+ {
+ ACE_DEBUG ((LM_DEBUG, "Running Commands... \n"));
+ this->cmd_builder_->execute (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Error: ORB run error\n");
+ }
+ ACE_ENDTRY;
+
+
+ ACE_DEBUG ((LM_DEBUG, "Finished executing commands\n"));
+
+ return 0;
+}
+
+/*****************************************************************/
+
+TAO_Notify_Tests_ORB_Run_Worker::TAO_Notify_Tests_ORB_Run_Worker (void)
+{
+}
+
+void
+TAO_Notify_Tests_ORB_Run_Worker::orb (CORBA::ORB_ptr orb)
+{
+ orb_ = CORBA::ORB::_duplicate (orb);
+}
+
+void
+TAO_Notify_Tests_ORB_Run_Worker::run_period (ACE_Time_Value run_period)
+{
+ this->run_period_ = run_period;
+}
+
+int
+TAO_Notify_Tests_ORB_Run_Worker::svc (void)
+{
+#if 0
+ // ACE_Thread::getprio() fails on systems that do not support thread
+ // priorities. While we could just treat the failure as benign, I'm
+ // just disabling it altogether. It doesn't provide much value, and
+ // makes service startup needlessly more verbose. See bugzilla 2477
+ // for details.
+
+ ACE_hthread_t current;
+ ACE_Thread::self (current);
+
+ int priority;
+ if (ACE_Thread::getprio (current, priority) == -1)
+ {
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("TAO (%P|%t) - Failed to get Worker thread priority\n")));
+ return -1;
+ }
+
+ ACE_DEBUG ((LM_ERROR, "Activated ORB Run Worker Thread to run the ORB @ priority:%d \n", priority));
+#endif
+
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ ACE_DEBUG ((LM_ERROR, "Running ORB, timeout in %d sec\n", this->run_period_.sec ()));
+
+ this->orb_->run (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ }
+ ACE_CATCHANY
+ {
+ }
+ ACE_ENDTRY;
+ return 0;
+}
+
+/*****************************************************************/
+
+TAO_Notify_Tests_Driver::TAO_Notify_Tests_Driver (void)
+ :cmd_builder_ (0), activation_manager_ (0), run_period_ (0,0), skip_priority_levels_check_ (0)
+{
+ this->activation_manager_ = new TAO_Notify_Tests_Activation_Manager ();
+ LOOKUP_MANAGER->_register (this->activation_manager_);
+
+ LOOKUP_MANAGER->_register (this);
+}
+
+TAO_Notify_Tests_Driver::~TAO_Notify_Tests_Driver ()
+{
+ delete this->activation_manager_;
+}
+
+int
+TAO_Notify_Tests_Driver::parse_args (int argc, char *argv[])
+{
+ ACE_Arg_Shifter arg_shifter (argc, argv);
+
+ const ACE_TCHAR *current_arg = 0;
+
+ while (arg_shifter.is_anything_left ())
+ {
+ if ((current_arg = arg_shifter.get_the_parameter (ACE_TEXT("-Timeout")))) // -Timeout timeout_period_S
+ {
+ if (current_arg != 0)
+ {
+ this->run_period_ = ACE_Time_Value (ACE_OS::atoi (current_arg), 0);
+ }
+
+ arg_shifter.consume_arg ();
+ }
+ else if ((current_arg = arg_shifter.get_the_parameter (ACE_TEXT("-IORoutput")))) // -IORoutput file_name
+ {
+ if (this->activation_manager_->ior_output_file (current_arg) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Unable to open %s for writing: %p\n",
+ current_arg), -1);
+
+ arg_shifter.consume_arg ();
+ }
+ else if ((current_arg = arg_shifter.get_the_parameter (ACE_TEXT("-IORinput")))) // -IORinput file_name
+ {
+ if (this->activation_manager_->ior_input_file (current_arg) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Unable to open %s for reading: %p\n",
+ current_arg), -1);
+
+ arg_shifter.consume_arg ();
+ }
+ else if (arg_shifter.cur_arg_strncasecmp ("-Skip_Priority_Levels_Check") == 0) // Skip the check for multiple priority levels.
+ {
+ this->skip_priority_levels_check_ = 1;
+
+ arg_shifter.consume_arg ();
+ }
+ else
+ {
+ arg_shifter.ignore_arg ();
+ }
+ }
+
+ return 0;
+}
+
+int
+TAO_Notify_Tests_Driver::init (int argc, ACE_TCHAR *argv[] ACE_ENV_ARG_DECL)
+{
+ ACE_Argv_Type_Converter command_line(argc, argv);
+
+ this->orb_ = CORBA::ORB_init (command_line.get_argc(),
+ command_line.get_ASCII_argv(),
+ ""
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ if (this->parse_args (argc, argv) == -1)
+ return -1;
+
+ // Make sure we can support multiple priorities that are required
+ // for this test.
+ if (skip_priority_levels_check_ == 0)
+ check_supported_priorities (this->orb_.in());
+
+ LOOKUP_MANAGER->init (this->orb_.in () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ this->cmd_builder_ =
+ ACE_Dynamic_Service<TAO_Notify_Tests_Command_Builder>::instance (TAO_Notify_Tests_Name::command_builder);
+
+ worker_.command_builder (this->cmd_builder_);
+
+ // Set the run period.
+ if (this->run_period_ != ACE_Time_Value::zero)
+ this->orb_run_worker_.run_period (this->run_period_);
+
+ // Set the ORB
+ this->orb_run_worker_.orb (this->orb_.in ());
+
+ return 0;
+}
+
+void
+TAO_Notify_Tests_Driver::run (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+{
+ // Task activation flags.
+ long flags =
+ THR_NEW_LWP |
+ THR_JOINABLE |
+ this->orb_->orb_core ()->orb_params ()->thread_creation_flags ();
+
+ // Become an active object.
+ int priority = ACE_Sched_Params::priority_min (this->orb_->orb_core ()->orb_params ()->sched_policy ()
+ , this->orb_->orb_core ()->orb_params ()->scope_policy ());
+
+ // Become an active object.
+ if (this->worker_.activate (flags, 1, 0, priority) == -1)
+ {
+ if (ACE_OS::last_error () == EPERM)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("Insufficient privilege to activate ACE_Task.\n")));
+ else
+ ACE_DEBUG ((LM_ERROR,
+ ACE_TEXT ("(%t) Task activation at priority %d failed, ")
+ ACE_TEXT ("exiting!\n%a"),
+ ACE_DEFAULT_THREAD_PRIORITY,
+ -1));
+ }
+
+
+ // Activate the ORB run worker.
+ if (this->orb_run_worker_.activate (flags, 1, 0, priority) == -1)
+ {
+ if (ACE_OS::last_error () == EPERM)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("Insufficient privilege to activate ACE_Task.\n")));
+ else
+ ACE_DEBUG ((LM_ERROR,
+ ACE_TEXT ("(%t) Task activation at priority %d failed, ")
+ ACE_TEXT ("exiting!\n%a"),
+ ACE_DEFAULT_THREAD_PRIORITY,
+ -1));
+ }
+
+ // Wait till we're done.
+ this->orb_run_worker_.thr_mgr ()->wait ();
+ this->worker_.thr_mgr ()->wait ();
+}
+
+void
+TAO_Notify_Tests_Driver::shutdown (void)
+{
+ this->orb_->shutdown ();
+}
diff --git a/TAO/orbsvcs/tests/Notify/lib/Driver.h b/TAO/orbsvcs/tests/Notify/lib/Driver.h
new file mode 100644
index 00000000000..610e6b02e79
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/Driver.h
@@ -0,0 +1,151 @@
+/* -*- C++ -*- */
+/**
+ * @file Driver.h
+ *
+ * $Id$
+ *
+ * @author Pradeep Gore <pradeep@oomworks.com>
+ *
+ *
+ */
+
+#ifndef TAO_Notify_Tests_DRIVER_H
+#define TAO_Notify_Tests_DRIVER_H
+#include /**/ "ace/pre.h"
+
+#include "notify_test_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Service_Config.h"
+#include "ace/Task.h"
+
+#include "tao/ORB.h"
+
+#include "Driver_Base.h"
+
+class TAO_Notify_Tests_Command_Builder;
+class TAO_Notify_Tests_Activation_Manager;
+
+/**
+ * @class TAO_Notify_Tests_Worker
+ *
+ * @brief A Task to execute commands asynchronously.
+ *
+ */
+class TAO_Notify_Tests_Worker : public ACE_Task_Base
+{
+ // = TITLE
+ // Run a server thread
+ //
+ // = DESCRIPTION
+ // Use the ACE_Task_Base class to run server threads
+ //
+public:
+ TAO_Notify_Tests_Worker (void);
+ // ctor
+
+ /// Set the command builder.
+ void command_builder (TAO_Notify_Tests_Command_Builder* cmd_builder);
+
+ virtual int svc (void);
+ // The thread entry point.
+
+ void shutdown (void);
+
+private:
+ /// The command builder
+ TAO_Notify_Tests_Command_Builder* cmd_builder_;
+};
+
+
+
+class TAO_Notify_Tests_ORB_Run_Worker : public ACE_Task_Base
+{
+ // = TITLE
+ // Run a server thread
+ //
+ // = DESCRIPTION
+ // Use the ACE_Task_Base class to run server threads
+ //
+public:
+ TAO_Notify_Tests_ORB_Run_Worker (void);
+ // ctor
+
+ void orb (CORBA::ORB_ptr orb);
+
+ /// Srt the run period.
+ void run_period (ACE_Time_Value run_period);
+
+ virtual int svc (void);
+ // The thread entry point.
+
+private:
+ /// The orb
+ CORBA::ORB_var orb_;
+
+ /// ORB Run Period.
+ ACE_Time_Value run_period_;
+};
+
+
+/**
+ * @class TAO_Notify_Tests_Driver
+ *
+ * @brief A default Application Starter.
+ *
+ */
+class TAO_NOTIFY_TEST_Export TAO_Notify_Tests_Driver : public TAO_Notify_Tests_Driver_Base
+{
+public:
+ /// Constuctor
+ TAO_Notify_Tests_Driver (void);
+
+ /// Destructor
+ ~TAO_Notify_Tests_Driver ();
+
+ /// Init
+ int init (int argc, ACE_TCHAR *argv[] ACE_ENV_ARG_DECL);
+
+ /// Execute the commands.
+ void run (ACE_ENV_SINGLE_ARG_DECL);
+
+ /// Shutdown
+ virtual void shutdown (void);
+
+protected:
+ /// Parse command line parameters.
+ int parse_args (int argc, char *argv[]);
+
+ /// The command builder
+ TAO_Notify_Tests_Command_Builder* cmd_builder_;
+
+ /// Manage activation of periodic suppliers and consumers.
+ TAO_Notify_Tests_Activation_Manager* activation_manager_;
+
+ /// Thread in which to run commands.
+ TAO_Notify_Tests_Worker worker_;
+
+ /// Thread in which to run the orb.
+ TAO_Notify_Tests_ORB_Run_Worker orb_run_worker_;
+
+ /// The ORB we run.
+ CORBA::ORB_var orb_;
+
+ /// ORB Run Period.
+ ACE_Time_Value run_period_;
+
+ /// The file for output
+ ACE_CString ior_output_file_;
+
+ /// The file for input
+ ACE_CString ior_input_file_;
+
+ /// Set to skip the check for multiple priority levels.
+ int skip_priority_levels_check_;
+};
+
+#include /**/ "ace/post.h"
+#endif /* TAO_Notify_Tests_DRIVER_H */
diff --git a/TAO/orbsvcs/tests/Notify/lib/Driver_Base.h b/TAO/orbsvcs/tests/Notify/lib/Driver_Base.h
new file mode 100644
index 00000000000..fabec43f639
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/Driver_Base.h
@@ -0,0 +1,38 @@
+/* -*- C++ -*- */
+/**
+ * @file Driver_Base.h
+ *
+ * $Id$
+ *
+ * @author Pradeep Gore <pradeep@oomworks.com>
+ *
+ *
+ */
+
+#ifndef TAO_Notify_Tests_APPLICATION_STARTER_H
+#define TAO_Notify_Tests_APPLICATION_STARTER_H
+#include /**/ "ace/pre.h"
+
+#include "notify_test_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+/**
+ * @class TAO_Notify_Tests_Driver_Base
+ *
+ * @brief Base class for Driver.
+ *
+ */
+class TAO_NOTIFY_TEST_Export TAO_Notify_Tests_Driver_Base
+{
+public:
+ virtual ~TAO_Notify_Tests_Driver_Base () {};
+
+ /// Shutdown
+ virtual void shutdown (void) = 0;
+};
+
+#include /**/ "ace/post.h"
+#endif /* TAO_Notify_Tests_APPLICATION_STARTER_H */
diff --git a/TAO/orbsvcs/tests/Notify/lib/EventChannel_Command.cpp b/TAO/orbsvcs/tests/Notify/lib/EventChannel_Command.cpp
new file mode 100644
index 00000000000..519fee9fc45
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/EventChannel_Command.cpp
@@ -0,0 +1,225 @@
+// $Id$
+
+#include "EventChannel_Command.h"
+#include "ace/Log_Msg.h"
+
+ACE_RCSID(lib, TAO_EventChannel_Command, "$Id$")
+
+#include "LookupManager.h"
+#include "Name.h"
+#include "Options_Parser.h"
+#include "ace/Dynamic_Service.h"
+#include "../../../orbsvcs/Notify/Service.h"
+
+TAO_Notify_Tests_EventChannel_Command::TAO_Notify_Tests_EventChannel_Command (void)
+ : collocated_ (0)
+{
+}
+
+TAO_Notify_Tests_EventChannel_Command::~TAO_Notify_Tests_EventChannel_Command ()
+{
+}
+
+const char*
+TAO_Notify_Tests_EventChannel_Command::get_name (void)
+{
+ return TAO_Notify_Tests_EventChannel_Command::name ();
+}
+
+const char*
+TAO_Notify_Tests_EventChannel_Command::name (void)
+{
+ return TAO_Notify_Tests_Name::event_channel_command;
+}
+
+void
+TAO_Notify_Tests_EventChannel_Command::init (ACE_Arg_Shifter& arg_shifter)
+{
+ if (arg_shifter.is_anything_left ())
+ {
+ if (arg_shifter.cur_arg_strncasecmp ("-Create") == 0) // -Create ec_name factory_name [COLLOCATED]
+ {
+ this->command_ = CREATE;
+
+ arg_shifter.consume_arg ();
+
+ this->name_ = arg_shifter.get_current ();
+ arg_shifter.consume_arg ();
+
+ this->factory_ = arg_shifter.get_current ();
+ arg_shifter.consume_arg ();
+
+ if (arg_shifter.cur_arg_strncasecmp ("COLLOCATED") == 0)
+ {
+ this->collocated_ = 1;
+ }
+
+ if (arg_shifter.cur_arg_strncasecmp ("COLOCATED") == 0) // grandfather in misspelled
+ {
+ this->collocated_ = 1;
+ ACE_DEBUG ((LM_WARNING, "TAO_Notify_Tests_EventChannel_Command::init --"
+ " warning: deprecated misspelled COLOCATED option used.\n"));
+ }
+ }
+ else if (arg_shifter.cur_arg_strncasecmp ("-Destroy") == 0) // -Destroy ec_name
+ {
+ this->command_ = DESTROY;
+
+ arg_shifter.consume_arg ();
+
+ this->name_ = arg_shifter.get_current ();
+
+ arg_shifter.consume_arg ();
+ }
+ else if (arg_shifter.cur_arg_strncasecmp ("-Set_QoS") == 0) // -Set_QoS ec_name [Qos Options]
+ {
+ this->command_ = SET_QOS;
+
+ arg_shifter.consume_arg ();
+
+ this->name_ = arg_shifter.get_current ();
+
+ arg_shifter.consume_arg ();
+
+ TAO_Notify_Tests_Options_Parser qos_parser;
+ qos_parser.execute (this->qos_, arg_shifter);
+ }
+ }
+}
+
+void
+TAO_Notify_Tests_EventChannel_Command::create_collocated_ecf (ACE_ENV_SINGLE_ARG_DECL)
+{
+ CosNotifyChannelAdmin::EventChannelFactory_var notify_factory;
+
+ // The Service Object.
+ TAO_Notify_Service* notify_service = 0;
+
+ notify_service = ACE_Dynamic_Service<TAO_Notify_Service>::instance (TAO_NOTIFICATION_SERVICE_NAME);
+
+ if (notify_service == 0)
+ {
+ notify_service = ACE_Dynamic_Service<TAO_Notify_Service>::instance (TAO_NOTIFY_DEF_EMO_FACTORY_NAME);
+ }
+
+ if (notify_service == 0)
+ {
+ ACE_DEBUG ((LM_DEBUG, "Service not found! check conf. file\n"));
+ return;
+ }
+
+ // Resolve some helpers.
+ CORBA::ORB_var orb;
+ PortableServer::POA_var poa;
+ CosNaming::NamingContextExt_var naming;
+
+ LOOKUP_MANAGER->resolve (orb);
+
+ LOOKUP_MANAGER->resolve (poa);
+
+ LOOKUP_MANAGER->resolve (naming);
+
+ notify_service->init_service (orb.in () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Activate the factory
+ notify_factory =
+ notify_service->create (poa.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Register with the Naming Service
+ CosNaming::Name_var name =
+ naming->to_name (TAO_Notify_Tests_Name::event_channel_factory
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ naming->rebind (name.in (),
+ notify_factory.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void
+TAO_Notify_Tests_EventChannel_Command::handle_create (ACE_ENV_SINGLE_ARG_DECL)
+{
+ if (this->collocated_ == 1)
+ {
+ this->create_collocated_ecf (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ CosNotifyChannelAdmin::EventChannelFactory_var ec_factory;
+
+ LOOKUP_MANAGER->resolve (ec_factory , TAO_Notify_Tests_Name::event_channel_factory ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ CosNotification::QoSProperties qos;
+ CosNotification::AdminProperties admin;
+
+ // Create an event channel
+ CosNotifyChannelAdmin::EventChannel_var ec =
+ ec_factory->create_channel (qos,
+ admin,
+ this->id_
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ LOOKUP_MANAGER->_register (ec.in(), this->name_.c_str () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void
+TAO_Notify_Tests_EventChannel_Command::handle_destroy (ACE_ENV_SINGLE_ARG_DECL)
+{
+ ACE_DEBUG ((LM_DEBUG, "Destroying event channel %s\n", this->name_.c_str ()));
+ CosNotifyChannelAdmin::EventChannel_var ec;
+
+ LOOKUP_MANAGER->resolve (ec, this->name_.c_str () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ ec->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+}
+void
+TAO_Notify_Tests_EventChannel_Command::handle_set_qos (ACE_ENV_SINGLE_ARG_DECL)
+{
+ CosNotifyChannelAdmin::EventChannel_var ec;
+
+ LOOKUP_MANAGER->resolve (ec, this->name_.c_str () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ ec->set_qos (this->qos_ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void
+TAO_Notify_Tests_EventChannel_Command::handle_status (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+{
+ //@@ TODO: Implement
+}
+
+void
+TAO_Notify_Tests_EventChannel_Command::execute_i (ACE_ENV_SINGLE_ARG_DECL)
+{
+ if (this->command_ == CREATE)
+ {
+ this->handle_create (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else if (this->command_ == DESTROY)
+ {
+ this->handle_destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else if (this->command_ == SET_QOS)
+ {
+ this->handle_set_qos (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else if (this->command_ == DUMP_STATE)
+ {
+ this->handle_status (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+}
diff --git a/TAO/orbsvcs/tests/Notify/lib/EventChannel_Command.h b/TAO/orbsvcs/tests/Notify/lib/EventChannel_Command.h
new file mode 100644
index 00000000000..35a2baa4bb0
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/EventChannel_Command.h
@@ -0,0 +1,95 @@
+/* -*- C++ -*- */
+/**
+ * @file EventChannel_Command.h
+ *
+ * $Id$
+ *
+ * @author Pradeep Gore <pradeep@oomworks.com>
+ *
+ *
+ */
+
+#ifndef TAO_Notify_Tests_EVENTCHANNEL_COMMAND_H
+#define TAO_Notify_Tests_EVENTCHANNEL_COMMAND_H
+#include /**/ "ace/pre.h"
+
+#include "notify_test_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/SString.h"
+#include "orbsvcs/CosNotifyChannelAdminC.h"
+#include "Command.h"
+//#include "../../../orbsvcs/Notify/CosNotify_Initializer.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+class TAO_Notify_Service;
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+/**
+ * @class TAO_Notify_Tests_EventChannel_Command
+ *
+ * @brief Command object for event channels.
+ *
+ */
+class TAO_NOTIFY_TEST_Export TAO_Notify_Tests_EventChannel_Command : public TAO_Notify_Tests_Command
+{
+public:
+ /// Constuctor
+ TAO_Notify_Tests_EventChannel_Command (void);
+
+ /// Destructor
+ virtual ~TAO_Notify_Tests_EventChannel_Command ();
+
+ /// Parse args and populate options.
+ virtual void init (ACE_Arg_Shifter& arg_shifter);
+
+ /// Execute the command.
+ virtual void execute_i (ACE_ENV_SINGLE_ARG_DECL);
+
+ /// Name of object
+ virtual const char* get_name (void);
+ static const char* name (void);
+
+protected:
+ ///= Data Members
+#ifdef HPUX_11
+ // Remove clash with /usr/include/machine/cpu.h and /usr/include/pa/cpu.h
+#undef COMMAND
+#endif
+ enum COMMAND
+ {
+ CREATE,
+ DESTROY,
+ SET_QOS,
+ SET_ADMIN,
+ DUMP_STATE
+ };
+
+ ACE_CString name_;
+
+ ACE_CString factory_;
+
+ CosNotifyChannelAdmin::ChannelID id_;
+
+ CosNotification::QoSProperties qos_;
+
+ CosNotification::AdminProperties admin_;
+
+ /// Flag to tell if the Channel Factory should be collocated.
+ CORBA::Boolean collocated_;
+
+ /// Helper method to create a collocated ECF.
+ void create_collocated_ecf (ACE_ENV_SINGLE_ARG_DECL);
+
+ /// = Handlers
+ void handle_create (ACE_ENV_SINGLE_ARG_DECL);
+ void handle_destroy (ACE_ENV_SINGLE_ARG_DECL);
+ void handle_set_qos (ACE_ENV_SINGLE_ARG_DECL);
+ void handle_status (ACE_ENV_SINGLE_ARG_DECL);
+};
+
+#include /**/ "ace/post.h"
+#endif /* TAO_Notify_Tests_EVENTCHANNEL_COMMAND_H */
diff --git a/TAO/orbsvcs/tests/Notify/lib/Factories_Define.cpp b/TAO/orbsvcs/tests/Notify/lib/Factories_Define.cpp
new file mode 100644
index 00000000000..337e8651108
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/Factories_Define.cpp
@@ -0,0 +1,23 @@
+// $Id$
+#include "Factories_Define.h"
+
+ACE_RCSID(lib, TAO_Notify_Tests_Factories_Define, "$Id$")
+
+#include "Name.h"
+#include "Command_Factory_T.h"
+
+#include "EventChannel_Command.h"
+#include "Application_Command.h"
+#include "SupplierAdmin_Command.h"
+#include "ConsumerAdmin_Command.h"
+#include "Periodic_Supplier_Command.h"
+#include "Periodic_Consumer_Command.h"
+#include "Filter_Command.h"
+
+TAO_Notify_Tests_COMMAND_FACTORY_DEFINE(TAO_NOTIFY_TEST,TAO_Notify_Tests_EventChannel_Command,TAO_Notify_Tests_Name::event_channel_command_factory)
+TAO_Notify_Tests_COMMAND_FACTORY_DEFINE(TAO_NOTIFY_TEST,TAO_Notify_Tests_Application_Command,TAO_Notify_Tests_Name::application_command_factory)
+TAO_Notify_Tests_COMMAND_FACTORY_DEFINE(TAO_NOTIFY_TEST,TAO_Notify_Tests_SupplierAdmin_Command,TAO_Notify_Tests_Name::supplier_admin_command_factory)
+TAO_Notify_Tests_COMMAND_FACTORY_DEFINE(TAO_NOTIFY_TEST,TAO_Notify_Tests_ConsumerAdmin_Command,TAO_Notify_Tests_Name::consumer_admin_command_factory)
+TAO_Notify_Tests_COMMAND_FACTORY_DEFINE(TAO_NOTIFY_TEST,TAO_Notify_Tests_Periodic_Supplier_Command,TAO_Notify_Tests_Name::periodic_supplier_command_factory)
+TAO_Notify_Tests_COMMAND_FACTORY_DEFINE(TAO_NOTIFY_TEST,TAO_Notify_Tests_Periodic_Consumer_Command,TAO_Notify_Tests_Name::periodic_consumer_command_factory)
+TAO_Notify_Tests_COMMAND_FACTORY_DEFINE(TAO_NOTIFY_TEST,TAO_Notify_Tests_Filter_Command,TAO_Notify_Tests_Name::filter_command_factory)
diff --git a/TAO/orbsvcs/tests/Notify/lib/Factories_Define.h b/TAO/orbsvcs/tests/Notify/lib/Factories_Define.h
new file mode 100644
index 00000000000..59a5aadd8ec
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/Factories_Define.h
@@ -0,0 +1,38 @@
+/* -*- C++ -*- */
+/**
+ * @file Factories_Define.h
+ *
+ * $Id$
+ *
+ * @author Pradeep Gore <pradeep@oomworks.com>
+ *
+ *
+ */
+
+#ifndef TAO_FACTORIES_DEFINE_H
+#define TAO_FACTORIES_DEFINE_H
+#include /**/ "ace/pre.h"
+
+#include "Command_Factory_T.h"
+
+#define TAO_Notify_Tests_COMMAND_FACTORY_DEFINE(export, command, factory_name) \
+\
+typedef TAO_Notify_Tests_Command_Factory_T <command> command##_Factory;\
+\
+ACE_STATIC_SVC_DECLARE_EXPORT (export, command##_Factory) \
+\
+ACE_FACTORY_DECLARE (export, command##_Factory) \
+\
+ACE_STATIC_SVC_DEFINE(command##_Factory, \
+ factory_name, \
+ ACE_SVC_OBJ_T, \
+ &ACE_SVC_NAME (command##_Factory), \
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ, \
+ 0) \
+\
+ACE_FACTORY_DEFINE (export, command##_Factory) \
+\
+
+
+#include /**/ "ace/post.h"
+#endif /* TAO_FACTORIES_DEFINE_H */
diff --git a/TAO/orbsvcs/tests/Notify/lib/Filter_Command.cpp b/TAO/orbsvcs/tests/Notify/lib/Filter_Command.cpp
new file mode 100644
index 00000000000..2bb7bb716b4
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/Filter_Command.cpp
@@ -0,0 +1,208 @@
+// $Id$
+
+#include "Filter_Command.h"
+#include "ace/Log_Msg.h"
+
+ACE_RCSID(lib, TAO_Filter_Command, "$Id$")
+
+#include "LookupManager.h"
+#include "Name.h"
+
+TAO_Notify_Tests_Filter_Command::TAO_Notify_Tests_Filter_Command (void)
+{
+}
+
+TAO_Notify_Tests_Filter_Command::~TAO_Notify_Tests_Filter_Command ()
+{
+}
+
+const char*
+TAO_Notify_Tests_Filter_Command::get_name (void)
+{
+ return TAO_Notify_Tests_Filter_Command::name ();
+}
+
+const char*
+TAO_Notify_Tests_Filter_Command::name (void)
+{
+ return TAO_Notify_Tests_Name::filter_command;
+}
+
+void
+TAO_Notify_Tests_Filter_Command::init (ACE_Arg_Shifter& arg_shifter)
+{
+ if (arg_shifter.is_anything_left ())
+ {
+ if (arg_shifter.cur_arg_strncasecmp ("-CreateFactory") == 0) // -Create factory_name ec
+ {
+ this->command_ = CREATE_FACTORY;
+
+ arg_shifter.consume_arg ();
+
+ this->name_ = arg_shifter.get_current (); // FF name
+ arg_shifter.consume_arg ();
+
+ this->factory_ = arg_shifter.get_current (); //EC
+ arg_shifter.consume_arg ();
+ }
+ else if (arg_shifter.cur_arg_strncasecmp ("-CreateFilter") == 0) // -CreateFilter filter_name filterfactory_name
+ {
+ this->command_ = CREATE_FILTER;
+
+ arg_shifter.consume_arg ();
+
+ this->name_ = arg_shifter.get_current (); // Filter name
+
+ arg_shifter.consume_arg ();
+
+ this->factory_ = arg_shifter.get_current (); //FF
+ arg_shifter.consume_arg ();
+ }
+ else if (arg_shifter.cur_arg_strncasecmp ("-Add_Constraint") == 0) // -Add_Constraint filter_name constraint_expr
+ {
+ this->command_ = ADD_CONSTRAINT;
+
+ arg_shifter.consume_arg ();
+
+ this->name_ = arg_shifter.get_current (); // Filter name
+
+ arg_shifter.consume_arg ();
+
+ this->constraint_ = arg_shifter.get_current (); //Constraint
+ arg_shifter.consume_arg ();
+ }
+ else if (arg_shifter.cur_arg_strncasecmp ("-Add_Filter") == 0) // -Add_Filter filter_name FilterAdmin_Name
+ {
+ this->command_ = ADD_FILTER;
+
+ arg_shifter.consume_arg ();
+
+ this->name_ = arg_shifter.get_current (); // Filter name
+
+ arg_shifter.consume_arg ();
+
+ this->factory_ = arg_shifter.get_current (); //FilterAdmin
+ arg_shifter.consume_arg ();
+ }
+ else if (arg_shifter.cur_arg_strncasecmp ("-Destroy") == 0) // -Destroy filter_name
+ {
+ this->command_ = DESTROY;
+
+ arg_shifter.consume_arg ();
+
+ this->name_ = arg_shifter.get_current (); // filter
+
+ arg_shifter.consume_arg ();
+ }
+ }
+}
+
+void
+TAO_Notify_Tests_Filter_Command::handle_create_filter_factory (ACE_ENV_SINGLE_ARG_DECL)
+{
+ CosNotifyChannelAdmin::EventChannel_var ec;
+
+ LOOKUP_MANAGER->resolve (ec, this->factory_.c_str () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ CosNotifyFilter::FilterFactory_var ff =
+ ec->default_filter_factory (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ LOOKUP_MANAGER->_register (ff.in(), this->name_.c_str () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void
+TAO_Notify_Tests_Filter_Command::handle_create_filter (ACE_ENV_SINGLE_ARG_DECL)
+{
+ CosNotifyFilter::FilterFactory_var ff;
+
+ LOOKUP_MANAGER->resolve (ff , this->factory_.c_str () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ CosNotifyFilter::Filter_var filter =
+ ff->create_filter ("ETCL" ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ LOOKUP_MANAGER->_register (filter.in(), this->name_.c_str () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void
+TAO_Notify_Tests_Filter_Command::handle_add_constraint (ACE_ENV_SINGLE_ARG_DECL)
+{
+ CosNotifyFilter::Filter_var filter;
+
+ LOOKUP_MANAGER->resolve (filter , this->name_.c_str () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ CosNotifyFilter::ConstraintExpSeq constraint_list (1);
+ constraint_list.length (1);
+
+ constraint_list[0].event_types.length (0);
+ constraint_list[0].constraint_expr = CORBA::string_dup (this->constraint_.c_str ());
+
+ ACE_DEBUG ((LM_DEBUG, "Adding constraint %s\n", this->constraint_.c_str ()));
+ filter->add_constraints (constraint_list ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void
+TAO_Notify_Tests_Filter_Command::handle_add_filter (ACE_ENV_SINGLE_ARG_DECL)
+{
+ CosNotifyFilter::Filter_var filter;
+
+ LOOKUP_MANAGER->resolve (filter , this->name_.c_str () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ CosNotifyFilter::FilterAdmin_var filter_admin;
+
+ LOOKUP_MANAGER->resolve (filter_admin , this->factory_.c_str () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ filter_admin->add_filter (filter.in () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void
+TAO_Notify_Tests_Filter_Command::handle_destroy_filter (ACE_ENV_SINGLE_ARG_DECL)
+{
+ CosNotifyFilter::Filter_var filter;
+
+ LOOKUP_MANAGER->resolve (filter, this->name_.c_str () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ filter->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void
+TAO_Notify_Tests_Filter_Command::execute_i (ACE_ENV_SINGLE_ARG_DECL)
+{
+ if (this->command_ == CREATE_FACTORY)
+ {
+ this->handle_create_filter_factory (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else if (this->command_ == CREATE_FILTER)
+ {
+ this->handle_create_filter (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else if (this->command_ == ADD_CONSTRAINT)
+ {
+ this->handle_add_constraint (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else if (this->command_ == ADD_FILTER)
+ {
+ this->handle_add_filter (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else if (this->command_ == DESTROY)
+ {
+ this->handle_destroy_filter (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+}
diff --git a/TAO/orbsvcs/tests/Notify/lib/Filter_Command.h b/TAO/orbsvcs/tests/Notify/lib/Filter_Command.h
new file mode 100644
index 00000000000..2678b6c4437
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/Filter_Command.h
@@ -0,0 +1,83 @@
+/* -*- C++ -*- */
+/**
+ * @file Filter_Command.h
+ *
+ * $Id$
+ *
+ * @author Pradeep Gore <pradeep@oomworks.com>
+ *
+ *
+ */
+
+#ifndef TAO_Notify_Tests_FILTER_COMMAND_H
+#define TAO_Notify_Tests_FILTER_COMMAND_H
+#include /**/ "ace/pre.h"
+
+#include "notify_test_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/SString.h"
+#include "orbsvcs/CosNotifyChannelAdminC.h"
+#include "Command.h"
+
+/**
+ * @class TAO_Notify_Tests_Filter_Command
+ *
+ * @brief Command for Filter Objects.
+ *
+ */
+class TAO_NOTIFY_TEST_Export TAO_Notify_Tests_Filter_Command : public TAO_Notify_Tests_Command
+{
+public:
+ /// Constuctor
+ TAO_Notify_Tests_Filter_Command (void);
+
+ /// Destructor
+ ~TAO_Notify_Tests_Filter_Command ();
+
+ /// Parse args and populate options.
+ virtual void init (ACE_Arg_Shifter& arg_shifter);
+
+ /// Execute the command.
+ virtual void execute_i (ACE_ENV_SINGLE_ARG_DECL);
+
+ /// Name of object
+ virtual const char* get_name (void);
+ static const char* name (void);
+
+protected:
+
+#ifdef HPUX_11
+ // Remove clash with /usr/include/machine/cpu.h and /usr/include/pa/cpu.h
+#undef COMMAND
+#endif
+ enum COMMAND
+ {
+ CREATE_FACTORY,
+ CREATE_FILTER,
+ ADD_CONSTRAINT,
+ ADD_FILTER,
+ REMOVE_CONSTRAINT,
+ DESTROY,
+ DUMP_STATE
+ };
+
+ ACE_CString name_;
+
+ ACE_CString factory_;
+
+ ACE_CString constraint_;
+
+ ///= Handlers
+ void handle_create_filter_factory (ACE_ENV_SINGLE_ARG_DECL);
+ void handle_create_filter (ACE_ENV_SINGLE_ARG_DECL);
+ void handle_add_constraint (ACE_ENV_SINGLE_ARG_DECL);
+ void handle_add_filter (ACE_ENV_SINGLE_ARG_DECL);
+ void handle_destroy_filter (ACE_ENV_SINGLE_ARG_DECL);
+};
+
+#include /**/ "ace/post.h"
+#endif /* TAO_Notify_Tests_FILTER_COMMAND_H */
diff --git a/TAO/orbsvcs/tests/Notify/lib/LookupManager.cpp b/TAO/orbsvcs/tests/Notify/lib/LookupManager.cpp
new file mode 100644
index 00000000000..14ebdb482d8
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/LookupManager.cpp
@@ -0,0 +1,256 @@
+// $Id$
+
+#include "LookupManager.h"
+#include "ace/OS_NS_string.h"
+
+ACE_RCSID(lib, TAO_LookupManager, "$Id$")
+
+#include "Name.h"
+
+TAO_Notify_Tests_LookupManager::TAO_Notify_Tests_LookupManager (void)
+ : app_ (0)
+ , activation_manager_ (0)
+ , priority_mapping_ (0)
+{
+}
+
+TAO_Notify_Tests_LookupManager::~TAO_Notify_Tests_LookupManager ()
+{
+}
+
+void
+TAO_Notify_Tests_LookupManager::init (CORBA::ORB_ptr orb ACE_ENV_ARG_DECL)
+{
+ orb_ = CORBA::ORB::_duplicate (orb);
+
+ this->resolve (this->root_poa_, TAO_Notify_Tests_Name::root_poa ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->resolve (this->naming_, TAO_Notify_Tests_Name::naming_service ACE_ENV_ARG_PARAMETER);
+}
+
+void
+TAO_Notify_Tests_LookupManager::_register (CORBA::Object_ptr obj, const char* obj_name ACE_ENV_ARG_DECL)
+{
+ CosNaming::Name_var name =
+ this->naming_->to_name (obj_name
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ //@@ Warning: this is rebind..
+ this->naming_->rebind (name.in (),
+ obj
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ ACE_DEBUG ((LM_DEBUG, "Registered %s with Naming Service\n", obj_name));
+}
+
+void
+TAO_Notify_Tests_LookupManager::_register (TAO_Notify_Tests_Driver_Base* app)
+{
+ this->app_ = app;
+}
+
+void
+TAO_Notify_Tests_LookupManager::resolve (TAO_Notify_Tests_Driver_Base*& app)
+{
+ app = this->app_;
+}
+
+void
+TAO_Notify_Tests_LookupManager::_register (TAO_Notify_Tests_Activation_Manager* activation_manager)
+{
+ this->activation_manager_ = activation_manager;
+}
+
+void
+TAO_Notify_Tests_LookupManager::resolve (TAO_Notify_Tests_Activation_Manager*& activation_manager)
+{
+ activation_manager = this->activation_manager_;
+}
+
+void
+TAO_Notify_Tests_LookupManager::_register (TAO_Notify_Tests_Priority_Mapping* priority_mapping)
+{
+ this->priority_mapping_ = priority_mapping;
+}
+
+void
+TAO_Notify_Tests_LookupManager::resolve (TAO_Notify_Tests_Priority_Mapping* &priority_mapping)
+{
+ priority_mapping = this->priority_mapping_;
+}
+
+void
+TAO_Notify_Tests_LookupManager::resolve (CORBA::ORB_var& orb)
+{
+ orb = this->orb_;
+}
+
+void
+TAO_Notify_Tests_LookupManager::resolve (PortableServer::POA_var& poa)
+{
+ poa = this->root_poa_;
+}
+
+void
+TAO_Notify_Tests_LookupManager::resolve (CosNaming::NamingContextExt_var& naming)
+{
+ naming = this->naming_;
+}
+
+void
+TAO_Notify_Tests_LookupManager::resolve (PortableServer::POA_var& poa, const char *poa_name ACE_ENV_ARG_DECL)
+{
+ if (ACE_OS::strcmp (poa_name, TAO_Notify_Tests_Name::root_poa) == 0)
+ {
+ CORBA::Object_ptr poa_object =
+ this->orb_->resolve_initial_references(TAO_Notify_Tests_Name::root_poa ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (CORBA::is_nil (poa_object))
+ {
+ ACE_ERROR ((LM_ERROR,
+ " (%P|%t) Unable to resolve the Root POA.\n"));
+ return;
+ }
+
+ poa = PortableServer::POA::_narrow (poa_object ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->root_poa_ = poa;
+ }
+ else
+ {
+ poa = root_poa_->find_POA (poa_name, 0 ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+}
+
+void
+TAO_Notify_Tests_LookupManager::resolve (CosNaming::NamingContextExt_var& naming, const char *naming_name ACE_ENV_ARG_DECL)
+{
+ CORBA::Object_var naming_obj =
+ this->orb_->resolve_initial_references (naming_name ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Need to check return value for errors.
+ if (CORBA::is_nil (naming_obj.in ()))
+ ACE_THROW (CORBA::UNKNOWN ());
+
+ this->naming_ = CosNaming::NamingContextExt::_narrow (naming_obj.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ CosNaming::NamingContextExt::_duplicate (this->naming_.in ());
+
+ naming = this->naming_;
+}
+
+CORBA::Object_ptr
+TAO_Notify_Tests_LookupManager::resolve_object (const char* obj_name ACE_ENV_ARG_DECL)
+{
+ CosNaming::Name name (1);
+ name.length (1);
+ name[0].id = CORBA::string_dup (obj_name);
+
+ CORBA::Object_var obj =
+ this->naming_->resolve (name ACE_ENV_ARG_PARAMETER);
+
+ ACE_CHECK_RETURN (CORBA::Object::_nil ());
+ return obj._retn ();
+}
+
+void
+TAO_Notify_Tests_LookupManager::resolve (CosNotifyChannelAdmin::EventChannelFactory_var& ecf, const char * factory_name ACE_ENV_ARG_DECL)
+{
+ CORBA::Object_var object = this->resolve_object (factory_name ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ ecf = CosNotifyChannelAdmin::EventChannelFactory::_narrow (object.in() ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void
+TAO_Notify_Tests_LookupManager::resolve (CosNotifyChannelAdmin::EventChannel_var& ec, const char * channel_name ACE_ENV_ARG_DECL)
+{
+ CORBA::Object_var object = this->resolve_object (channel_name ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ ec = CosNotifyChannelAdmin::EventChannel::_narrow (object.in() ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void
+TAO_Notify_Tests_LookupManager::resolve (CosNotifyChannelAdmin::SupplierAdmin_var& sa, const char * admin_name ACE_ENV_ARG_DECL)
+{
+ CORBA::Object_var object = this->resolve_object (admin_name ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ sa = CosNotifyChannelAdmin::SupplierAdmin::_narrow (object.in() ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void
+TAO_Notify_Tests_LookupManager::resolve (CosNotifyChannelAdmin::ConsumerAdmin_var& ca , const char * admin_name ACE_ENV_ARG_DECL)
+{
+ CORBA::Object_var object = this->resolve_object (admin_name ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ ca = CosNotifyChannelAdmin::ConsumerAdmin::_narrow (object.in() ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void
+TAO_Notify_Tests_LookupManager::resolve (CosNotifyComm::StructuredPushSupplier_var& supplier, const char *supplier_name ACE_ENV_ARG_DECL)
+{
+ CORBA::Object_var object = this->resolve_object (supplier_name ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ supplier = CosNotifyComm::StructuredPushSupplier::_narrow (object.in() ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void
+TAO_Notify_Tests_LookupManager::resolve (CosNotifyComm::StructuredPushConsumer_var& consumer, const char * consumer_name ACE_ENV_ARG_DECL)
+{
+ CORBA::Object_var object = this->resolve_object (consumer_name ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ consumer = CosNotifyComm::StructuredPushConsumer::_narrow (object.in() ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void
+TAO_Notify_Tests_LookupManager::resolve (CosNotifyFilter::FilterFactory_var& ff, const char *filter_factory_name ACE_ENV_ARG_DECL)
+{
+ CORBA::Object_var object = this->resolve_object (filter_factory_name ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ ff = CosNotifyFilter::FilterFactory::_narrow (object.in() ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void
+TAO_Notify_Tests_LookupManager::resolve (CosNotifyFilter::Filter_var& filter, const char *filter_name ACE_ENV_ARG_DECL)
+{
+ CORBA::Object_var object = this->resolve_object (filter_name ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ filter = CosNotifyFilter::Filter::_narrow (object.in() ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void
+TAO_Notify_Tests_LookupManager::resolve (CosNotifyFilter::FilterAdmin_var& filter_admin, const char *filter_admin_name ACE_ENV_ARG_DECL)
+{
+ CORBA::Object_var object = this->resolve_object (filter_admin_name ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ filter_admin = CosNotifyFilter::FilterAdmin::_narrow (object.in() ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+#if defined (ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION)
+template ACE_Singleton<TAO_Notify_Tests_LookupManager, ACE_Thread_Mutex> *ACE_Singleton<TAO_Notify_Tests_LookupManager, ACE_Thread_Mutex>::singleton_;
+#endif /*ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION */
diff --git a/TAO/orbsvcs/tests/Notify/lib/LookupManager.h b/TAO/orbsvcs/tests/Notify/lib/LookupManager.h
new file mode 100644
index 00000000000..b7ebe49ef06
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/LookupManager.h
@@ -0,0 +1,120 @@
+/* -*- C++ -*- */
+/**
+ * @file LookupManager.h
+ *
+ * $Id$
+ *
+ * @author Pradeep Gore <pradeep@oomworks.com>
+ *
+ *
+ */
+
+#ifndef TAO_Notify_Tests_LOOKUPMANAGER_H
+#define TAO_Notify_Tests_LOOKUPMANAGER_H
+#include /**/ "ace/pre.h"
+
+#include "notify_test_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Singleton.h"
+#include "tao/PortableServer/PortableServer.h"
+#include "orbsvcs/CosNotifyChannelAdminC.h"
+#include "orbsvcs/CosNamingC.h"
+#include "ace/Hash_Map_Manager.h"
+
+class TAO_Notify_Tests_Periodic_Supplier;
+class TAO_Notify_Tests_Periodic_Consumer;
+class TAO_Notify_Tests_Driver_Base;
+class TAO_Notify_Tests_Activation_Manager;
+class TAO_Notify_Tests_Priority_Mapping;
+
+/**
+ * @class TAO_Notify_Tests_LookupManager
+ *
+ * @brief Utility to register and resolve object references.
+ *
+ */
+class TAO_NOTIFY_TEST_Export TAO_Notify_Tests_LookupManager
+{
+public:
+ /// Constuctor
+ TAO_Notify_Tests_LookupManager (void);
+
+ /// Destructor
+ ~TAO_Notify_Tests_LookupManager ();
+
+ /// Init
+ void init (CORBA::ORB_ptr orb ACE_ENV_ARG_DECL);
+
+ ///= Register Objects
+
+ /// Register the application starter object.
+ void _register (TAO_Notify_Tests_Driver_Base* app);
+ void _register (TAO_Notify_Tests_Activation_Manager* activation_manager);
+ void _register (TAO_Notify_Tests_Priority_Mapping *priority_mapping);
+
+ /// Register Objects with Naming Service
+ void _register(CORBA::Object_ptr obj, const char* obj_name ACE_ENV_ARG_DECL);
+
+ ///= Resolve methods
+
+ /// Resolve the application starter object.
+ void resolve (TAO_Notify_Tests_Driver_Base*& app);
+ void resolve (TAO_Notify_Tests_Activation_Manager*& activation_manager);
+ void resolve (TAO_Notify_Tests_Priority_Mapping* &priority_mapping);
+
+ /// Return the orb
+ void resolve (CORBA::ORB_var& orb);
+
+ /// Return the Root POA.
+ void resolve (PortableServer::POA_var& poa);
+
+ /// Return the default Naming context.
+ void resolve (CosNaming::NamingContextExt_var& naming);
+
+ void resolve (PortableServer::POA_var& poa, const char *poa_name ACE_ENV_ARG_DECL);
+ void resolve (CosNaming::NamingContextExt_var& naming, const char *naming_name ACE_ENV_ARG_DECL);
+ void resolve (CosNotifyChannelAdmin::EventChannelFactory_var& ecf, const char *factory_name ACE_ENV_ARG_DECL);
+ void resolve (CosNotifyChannelAdmin::EventChannel_var& ec, const char *channel_name ACE_ENV_ARG_DECL);
+ void resolve (CosNotifyChannelAdmin::SupplierAdmin_var& sa, const char *admin_name ACE_ENV_ARG_DECL);
+ void resolve (CosNotifyChannelAdmin::ConsumerAdmin_var& ca , const char *admin_name ACE_ENV_ARG_DECL);
+ void resolve (CosNotifyComm::StructuredPushSupplier_var& supplier, const char *supplier_name ACE_ENV_ARG_DECL);
+ void resolve (CosNotifyComm::StructuredPushConsumer_var& consumer, const char *consumer_name ACE_ENV_ARG_DECL);
+ void resolve (CosNotifyFilter::FilterFactory_var& ff, const char *filter_factory_name ACE_ENV_ARG_DECL);
+ void resolve (CosNotifyFilter::Filter_var& filter, const char *filter_name ACE_ENV_ARG_DECL);
+ void resolve (CosNotifyFilter::FilterAdmin_var& filter_admin, const char *filter_admin_name ACE_ENV_ARG_DECL);
+
+protected:
+ /// Application Starter
+ TAO_Notify_Tests_Driver_Base* app_;
+
+ /// Activation Manager
+ TAO_Notify_Tests_Activation_Manager* activation_manager_;
+
+ /// Resolve to CORBA::Object
+ CORBA::Object_ptr resolve_object (const char* obj_name ACE_ENV_ARG_DECL);
+
+ // The ORB that we use.
+ CORBA::ORB_var orb_;
+
+ // Reference to the root poa.
+ PortableServer::POA_var root_poa_;
+
+ // A naming context.
+ CosNaming::NamingContextExt_var naming_;
+
+ // Priority Mapping.
+ TAO_Notify_Tests_Priority_Mapping *priority_mapping_;
+};
+
+TAO_NOTIFY_TEST_SINGLETON_DECLARE (ACE_Singleton, TAO_Notify_Tests_LookupManager, TAO_SYNCH_MUTEX)
+
+typedef ACE_Singleton<TAO_Notify_Tests_LookupManager, TAO_SYNCH_MUTEX> _TAO_Notify_Tests_LookupManager;
+
+#define LOOKUP_MANAGER _TAO_Notify_Tests_LookupManager::instance()
+
+#include /**/ "ace/post.h"
+#endif /* TAO_Notify_Tests_LOOKUPMANAGER_H */
diff --git a/TAO/orbsvcs/tests/Notify/lib/Makefile.am b/TAO/orbsvcs/tests/Notify/lib/Makefile.am
new file mode 100644
index 00000000000..a209a46382e
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/Makefile.am
@@ -0,0 +1,183 @@
+## 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_IDL = ACE_ROOT=$(ACE_ROOT) TAO_ROOT=$(TAO_ROOT) $(TAO_BUILDDIR)/TAO_IDL/tao_idl
+TAO_IDL_DEP = $(TAO_BUILDDIR)/TAO_IDL/tao_idl
+TAO_IDLFLAGS = -Ge 1 -Wb,pre_include=ace/pre.h -Wb,post_include=ace/post.h -I$(TAO_ROOT) -I$(srcdir) -g $(ACE_BUILDDIR)/apps/gperf/src/gperf
+TAO_ROOT = $(top_srcdir)
+
+
+## Makefile.NotifyTests_Lib.am
+
+if BUILD_CORBA_MESSAGING
+if !BUILD_MINIMUM_CORBA
+
+BUILT_SOURCES = \
+ Activation_ManagerC.cpp \
+ Activation_ManagerC.h \
+ Activation_ManagerC.inl \
+ Activation_ManagerS.cpp \
+ Activation_ManagerS.h \
+ Activation_ManagerS.inl \
+ Activation_ManagerS_T.cpp \
+ Activation_ManagerS_T.h \
+ Activation_ManagerS_T.inl
+
+CLEANFILES = \
+ Activation_Manager-stamp \
+ Activation_ManagerC.cpp \
+ Activation_ManagerC.h \
+ Activation_ManagerC.inl \
+ Activation_ManagerS.cpp \
+ Activation_ManagerS.h \
+ Activation_ManagerS.inl \
+ Activation_ManagerS_T.cpp \
+ Activation_ManagerS_T.h \
+ Activation_ManagerS_T.inl
+
+Activation_ManagerC.cpp Activation_ManagerC.h Activation_ManagerC.inl Activation_ManagerS.cpp Activation_ManagerS.h Activation_ManagerS.inl Activation_ManagerS_T.cpp Activation_ManagerS_T.h Activation_ManagerS_T.inl: Activation_Manager-stamp
+
+Activation_Manager-stamp: $(srcdir)/Activation_Manager.idl $(TAO_IDL_DEP)
+ $(TAO_IDL) $(TAO_IDLFLAGS) -I$(TAO_ROOT)/orbsvcs -GT $(srcdir)/Activation_Manager.idl
+ @touch $@
+
+noinst_LTLIBRARIES = libTAO_NotifyTests.la
+
+libTAO_NotifyTests_la_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 \
+ -DTAO_NOTIFY_TEST_BUILD_DLL
+
+libTAO_NotifyTests_la_SOURCES = \
+ Activation_Manager.cpp \
+ Activation_ManagerC.cpp \
+ Activation_ManagerS.cpp \
+ Application_Command.cpp \
+ Command.cpp \
+ Command_Builder.cpp \
+ Command_Factory.cpp \
+ ConsumerAdmin_Command.cpp \
+ Direct_Consumer.cpp \
+ Direct_Supplier.cpp \
+ Driver.cpp \
+ EventChannel_Command.cpp \
+ Factories_Define.cpp \
+ Filter_Command.cpp \
+ LookupManager.cpp \
+ Name.cpp \
+ Notify_Test_Client.cpp \
+ Options_Parser.cpp \
+ Peer.cpp \
+ Periodic_Consumer.cpp \
+ Periodic_Consumer_Command.cpp \
+ Periodic_Supplier.cpp \
+ Periodic_Supplier_Command.cpp \
+ Priority_Mapping.cpp \
+ PushConsumer.cpp \
+ PushSupplier.cpp \
+ Relay_Consumer.cpp \
+ SequencePushConsumer.cpp \
+ SequencePushSupplier.cpp \
+ StructuredEvent.cpp \
+ StructuredPushConsumer.cpp \
+ StructuredPushSupplier.cpp \
+ SupplierAdmin_Command.cpp \
+ Task_Callback.cpp \
+ Task_Stats.cpp \
+ common.cpp
+
+noinst_HEADERS = \
+ Activation_Manager.h \
+ Activation_Manager.idl \
+ Activation_ManagerC.h \
+ Activation_ManagerC.inl \
+ Activation_ManagerS.h \
+ Activation_ManagerS.inl \
+ Activation_ManagerS_T.cpp \
+ Activation_ManagerS_T.h \
+ Activation_ManagerS_T.inl \
+ Application_Command.h \
+ Command.h \
+ Command_Builder.h \
+ Command_Factory.h \
+ Command_Factory_T.cpp \
+ Command_Factory_T.h \
+ ConsumerAdmin_Command.h \
+ Consumer_T.cpp \
+ Consumer_T.h \
+ Direct_Consumer.h \
+ Direct_Supplier.h \
+ Direct_Supplier.inl \
+ Driver.h \
+ Driver_Base.h \
+ EventChannel_Command.h \
+ Factories_Define.h \
+ Filter_Command.h \
+ LookupManager.h \
+ Name.h \
+ Notify_PushConsumer.h \
+ Notify_PushSupplier.h \
+ Notify_SequencePushConsumer.h \
+ Notify_SequencePushSupplier.h \
+ Notify_StructuredPushConsumer.h \
+ Notify_StructuredPushSupplier.h \
+ Notify_Test_Client.h \
+ Options_Parser.h \
+ Peer.h \
+ Peer.inl \
+ Peer_T.cpp \
+ Peer_T.h \
+ Periodic_Consumer.h \
+ Periodic_Consumer_Command.h \
+ Periodic_Supplier.h \
+ Periodic_Supplier_Command.h \
+ Priority_Mapping.h \
+ PushConsumer.h \
+ PushConsumer.inl \
+ PushSupplier.h \
+ PushSupplier.inl \
+ Relay_Consumer.h \
+ Relay_Consumer.inl \
+ SequencePushConsumer.h \
+ SequencePushConsumer.inl \
+ SequencePushSupplier.h \
+ SequencePushSupplier.inl \
+ StructuredEvent.h \
+ StructuredPushConsumer.h \
+ StructuredPushConsumer.inl \
+ StructuredPushSupplier.h \
+ StructuredPushSupplier.inl \
+ SupplierAdmin_Command.h \
+ Supplier_T.cpp \
+ Supplier_T.h \
+ Task_Callback.h \
+ Task_Stats.h \
+ Task_Stats.inl \
+ common.h \
+ notify_test_export.h
+
+endif !BUILD_MINIMUM_CORBA
+endif BUILD_CORBA_MESSAGING
+
+## 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/lib/Name.cpp b/TAO/orbsvcs/tests/Notify/lib/Name.cpp
new file mode 100644
index 00000000000..87e0c004674
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/Name.cpp
@@ -0,0 +1,37 @@
+// $Id$
+
+#include "Name.h"
+
+ACE_RCSID(lib, TAO_Name, "$Id$")
+
+#define TAO_Notify_Tests_DECLARE_NAME(target, name) \
+const char* const TAO_Notify_Tests_Name::target = ACE_TEXT (name);
+
+TAO_Notify_Tests_DECLARE_NAME (command_builder,"Command_Builder")
+TAO_Notify_Tests_DECLARE_NAME (root_poa,"RootPOA")
+TAO_Notify_Tests_DECLARE_NAME (event_channel_factory,"NotifyEventChannelFactory")
+TAO_Notify_Tests_DECLARE_NAME (naming_service,"NameService")
+
+TAO_Notify_Tests_DECLARE_NAME (application_command,"Application")
+TAO_Notify_Tests_DECLARE_NAME (application_command_factory,"Application_Command_Factory")
+
+TAO_Notify_Tests_DECLARE_NAME (event_channel_command,"EventChannel")
+TAO_Notify_Tests_DECLARE_NAME (event_channel_command_factory,"EventChannel_Command_Factory")
+
+TAO_Notify_Tests_DECLARE_NAME (consumer_admin_command,"ConsumerAdmin")
+TAO_Notify_Tests_DECLARE_NAME (consumer_admin_command_factory,"ConsumerAdmin_Command_Factory")
+
+TAO_Notify_Tests_DECLARE_NAME (supplier_admin_command,"SupplierAdmin")
+TAO_Notify_Tests_DECLARE_NAME (supplier_admin_command_factory,"SupplierAdmin_Command_Factory")
+
+TAO_Notify_Tests_DECLARE_NAME (periodic_supplier_command, "PeriodicSupplier")
+TAO_Notify_Tests_DECLARE_NAME (periodic_supplier_command_factory, "PeriodicSupplier_Command_Factory")
+
+TAO_Notify_Tests_DECLARE_NAME (periodic_consumer_command, "PeriodicConsumer")
+TAO_Notify_Tests_DECLARE_NAME (periodic_consumer_command_factory, "PeriodicConsumer_Command_Factory")
+
+TAO_Notify_Tests_DECLARE_NAME (poa_command, "POA")
+TAO_Notify_Tests_DECLARE_NAME (poa_command_factory, "POA_Command_Factory")
+
+TAO_Notify_Tests_DECLARE_NAME (filter_command, "Filter")
+TAO_Notify_Tests_DECLARE_NAME (filter_command_factory, "Filter_Command_Factory")
diff --git a/TAO/orbsvcs/tests/Notify/lib/Name.h b/TAO/orbsvcs/tests/Notify/lib/Name.h
new file mode 100644
index 00000000000..602f3d1e6de
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/Name.h
@@ -0,0 +1,63 @@
+/* -*- C++ -*- */
+/**
+ * @file Name.h
+ *
+ * $Id$
+ *
+ * @author Pradeep Gore <pradeep@oomworks.com>
+ *
+ *
+ */
+
+#ifndef TAO_Notify_Tests_NAME_H
+#define TAO_Notify_Tests_NAME_H
+#include /**/ "ace/pre.h"
+
+#include "notify_test_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+/**
+ * @class TAO_Notify_Tests_Name
+ *
+ * @brief Define the names for command objects and other common strings.
+ *
+ */
+class TAO_NOTIFY_TEST_Export TAO_Notify_Tests_Name
+{
+public:
+ static const char* const root_poa;
+ static const char* const event_channel_factory;
+ static const char* const naming_service;
+
+ static const char* const command_builder;
+
+ static const char* const application_command_factory;
+ static const char* const application_command;
+
+ static const char* const event_channel_command_factory;
+ static const char* const event_channel_command;
+
+ static const char* const supplier_admin_command_factory;
+ static const char* const supplier_admin_command;
+
+ static const char* const consumer_admin_command_factory;
+ static const char* const consumer_admin_command;
+
+ static const char* const periodic_supplier_command;
+ static const char* const periodic_supplier_command_factory;
+
+ static const char* const periodic_consumer_command;
+ static const char* const periodic_consumer_command_factory;
+
+ static const char* const poa_command;
+ static const char* const poa_command_factory;
+
+ static const char* const filter_command;
+ static const char* const filter_command_factory;
+};
+
+#include /**/ "ace/post.h"
+#endif /* TAO_Notify_Tests_NAME_H */
diff --git a/TAO/orbsvcs/tests/Notify/lib/Notify_PushConsumer.h b/TAO/orbsvcs/tests/Notify/lib/Notify_PushConsumer.h
new file mode 100644
index 00000000000..0a66baa40e3
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/Notify_PushConsumer.h
@@ -0,0 +1,36 @@
+// $Id$
+// ==========================================================================
+//
+// = LIBRARY
+// orbsvcs
+//
+// = FILENAME
+// Notify_PushConsumer.h
+//
+// = DESCRIPTION
+// This is a utility class is to be used by clients of the Notification
+// Service to implement the servant for CosNotifyComm::PushConsumer
+//
+// = HOW-TO
+// 1. Derive from Notify_ProxyConsumer and implement <push>.
+// 2. Create the servant on the heap.(refcounted servant).
+// 3. Initialize the object, provide a POA.
+// 4. To connect, call <connect>, this will activate the object in the POA.
+// You must provide a ConsumerAdmin to <connect>.
+// 5. To disconnect, call <disconnect> this will also deactivate the object.
+//
+// = AUTHOR
+// Pradeep Gore <pradeep@cs.wustl.edu>
+//
+// ==========================================================================
+
+#ifndef TAO_NOTIFY_PUSHCONSUMER_H
+#define TAO_NOTIFY_PUSHCONSUMER_H
+#include /**/ "ace/pre.h"
+
+#include "PushConsumer.h"
+
+typedef TAO_Notify_Tests_PushConsumer TAO_Notify_PushConsumer;
+
+#include /**/ "ace/post.h"
+#endif /* TAO_NOTIFY_PUSHCONSUMER_H */
diff --git a/TAO/orbsvcs/tests/Notify/lib/Notify_PushSupplier.h b/TAO/orbsvcs/tests/Notify/lib/Notify_PushSupplier.h
new file mode 100644
index 00000000000..502431afa05
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/Notify_PushSupplier.h
@@ -0,0 +1,12 @@
+// $Id$
+
+#ifndef TAO_NOTIFY_PUSHSUPPLIER_H
+#define TAO_NOTIFY_PUSHSUPPLIER_H
+#include /**/ "ace/pre.h"
+
+#include "PushSupplier.h"
+
+typedef TAO_Notify_Tests_PushSupplier TAO_Notify_PushSupplier;
+
+#include /**/ "ace/post.h"
+#endif /* TAO_NOTIFY_PUSHSUPPLIER_H */
diff --git a/TAO/orbsvcs/tests/Notify/lib/Notify_SequencePushConsumer.h b/TAO/orbsvcs/tests/Notify/lib/Notify_SequencePushConsumer.h
new file mode 100644
index 00000000000..453abae9d5a
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/Notify_SequencePushConsumer.h
@@ -0,0 +1,30 @@
+/* -*- C++ -*- */
+// $Id$
+// ==========================================================================
+//
+// = LIBRARY
+// orbsvcs
+//
+// = FILENAME
+// Notify_SequencePushConsumer.h
+//
+// = DESCRIPTION
+// This is a utility class is to be used by clients of the Notification
+// Service to implement the servant for CosNotifyComm::SequencePushConsumer
+//
+// = AUTHOR
+// Pradeep Gore <pradeep@cs.wustl.edu>
+//
+// ==========================================================================
+
+#ifndef NOTIFY_SEQUENCEPUSHCONSUMER_H
+#define NOTIFY_SEQUENCEPUSHCONSUMER_H
+#include /**/ "ace/pre.h"
+
+#include "SequencePushConsumer.h"
+
+typedef TAO_Notify_Tests_SequencePushConsumer TAO_Notify_SequencePushConsumer;
+
+#include /**/ "ace/post.h"
+
+#endif /* NOTIFY_SEQUENCEPUSHCONSUMER_H */
diff --git a/TAO/orbsvcs/tests/Notify/lib/Notify_SequencePushSupplier.h b/TAO/orbsvcs/tests/Notify/lib/Notify_SequencePushSupplier.h
new file mode 100644
index 00000000000..74fd09d4498
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/Notify_SequencePushSupplier.h
@@ -0,0 +1,29 @@
+/* -*- C++ -*- */
+// $Id$
+// ==========================================================================
+//
+// = LIBRARY
+// orbsvcs
+//
+// = FILENAME
+// Notify_SequencePushSupplier
+//
+// = DESCRIPTION
+// This class is to be used by clients of the Notification Service
+// to implement Sequence Push Suppliers.
+//
+// = AUTHOR
+// Pradeep Gore <pradeep@cs.wustl.edu>
+//
+// ==========================================================================
+
+#ifndef TAO_NOTIFY_SEQUENCEPUSHSUPPLIER_H
+#define TAO_NOTIFY_SEQUENCEPUSHSUPPLIER_H
+#include /**/ "ace/pre.h"
+
+#include "SequencePushSupplier.h"
+
+typedef TAO_Notify_Tests_SequencePushSupplier TAO_Notify_SequencePushSupplier;
+
+#include /**/ "ace/post.h"
+#endif /* TAO_NOTIFY_SequencePUSHSUPPLIER_H */
diff --git a/TAO/orbsvcs/tests/Notify/lib/Notify_StructuredPushConsumer.h b/TAO/orbsvcs/tests/Notify/lib/Notify_StructuredPushConsumer.h
new file mode 100644
index 00000000000..8364a0394b3
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/Notify_StructuredPushConsumer.h
@@ -0,0 +1,29 @@
+/* -*- C++ -*- */
+// $Id$
+// ==========================================================================
+//
+// = LIBRARY
+// orbsvcs
+//
+// = FILENAME
+// Notify_StructuredPushConsumer.h
+//
+// = DESCRIPTION
+// This is a utility class is to be used by clients of the Notification
+// Service to implement the servant for CosNotifyComm::PushConsumer
+//
+// = AUTHOR
+// Pradeep Gore <pradeep@cs.wustl.edu>
+//
+// ==========================================================================
+
+#ifndef NOTIFY_STRUCTUREDPUSHCONSUMER_H
+#define NOTIFY_STRUCTUREDPUSHCONSUMER_H
+#include /**/ "ace/pre.h"
+
+#include "StructuredPushConsumer.h"
+
+typedef TAO_Notify_Tests_StructuredPushConsumer TAO_Notify_StructuredPushConsumer;
+
+#include /**/ "ace/post.h"
+#endif /* NOTIFY_STRUCTUREDPUSHCONSUMER_H */
diff --git a/TAO/orbsvcs/tests/Notify/lib/Notify_StructuredPushSupplier.h b/TAO/orbsvcs/tests/Notify/lib/Notify_StructuredPushSupplier.h
new file mode 100644
index 00000000000..ecc804ae3aa
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/Notify_StructuredPushSupplier.h
@@ -0,0 +1,29 @@
+/* -*- C++ -*- */
+// $Id$
+// ==========================================================================
+//
+// = LIBRARY
+// orbsvcs
+//
+// = FILENAME
+// Notify_StructuredPushSupplier
+//
+// = DESCRIPTION
+// This class is to be used by clients of the Notification Service
+// to implement Structured Push Suppliers.
+//
+// = AUTHOR
+// Pradeep Gore <pradeep@cs.wustl.edu>
+//
+// ==========================================================================
+
+#ifndef TAO_NOTIFY_STRUCTUREDPUSHSUPPLIER_H
+#define TAO_NOTIFY_STRUCTUREDPUSHSUPPLIER_H
+#include /**/ "ace/pre.h"
+
+#include "StructuredPushSupplier.h"
+
+typedef TAO_Notify_Tests_StructuredPushSupplier TAO_Notify_StructuredPushSupplier;
+
+#include /**/ "ace/post.h"
+#endif /* TAO_NOTIFY_STRUCTUREDPUSHSUPPLIER_H */
diff --git a/TAO/orbsvcs/tests/Notify/lib/Notify_Test_Client.cpp b/TAO/orbsvcs/tests/Notify/lib/Notify_Test_Client.cpp
new file mode 100644
index 00000000000..cd6a689acfa
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/Notify_Test_Client.cpp
@@ -0,0 +1,242 @@
+// $Id$
+
+#include "Notify_Test_Client.h"
+
+ACE_RCSID (lib,
+ Notify_Test_Client,
+ "$Id$")
+
+#define NOTIFY_FACTORY_NAME "NotifyEventChannelFactory"
+#define NAMING_SERVICE_NAME "NameService"
+
+Notify_Test_Client::Notify_Test_Client (void)
+: num_clients_( 0 )
+, done_( false )
+{
+ // @@ Later: accept the inter filter operator as a param.
+ ifgop_ = CosNotifyChannelAdmin::OR_OP;
+}
+
+Notify_Test_Client::~Notify_Test_Client ()
+{
+ ACE_TRY_NEW_ENV
+ {
+ root_poa_->destroy(1, 1 ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ orb_->destroy(ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCH (CORBA::Exception, e)
+ {
+ ACE_PRINT_EXCEPTION (e, "\nError: ");
+ }
+ ACE_ENDTRY;
+}
+
+int
+Notify_Test_Client::init (int argc, char *argv [] ACE_ENV_ARG_DECL)
+{
+ int status = this->init_ORB (argc, argv ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+ if (status == 0)
+ {
+ this->resolve_naming_service (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+ this->resolve_Notify_factory (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+ }
+ return status;
+}
+
+int
+Notify_Test_Client::parse_args (int /*argc*/, char** /*argv*/)
+{
+ return 0;
+}
+
+
+int
+Notify_Test_Client::init_ORB (int argc,
+ char *argv []
+ ACE_ENV_ARG_DECL)
+{
+ this->orb_ = CORBA::ORB_init (argc,
+ argv,
+ ""
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ if (this->parse_args (argc, argv) != 0)
+ {
+ return -1;
+ }
+
+ CORBA::Object_ptr poa_object =
+ this->orb_->resolve_initial_references("RootPOA"
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ if (CORBA::is_nil (poa_object))
+ {
+ ACE_ERROR ((LM_ERROR,
+ " (%P|%t) Unable to initialize the POA.\n"));
+ return -1;
+ }
+ this->root_poa_ =
+ PortableServer::POA::_narrow (poa_object ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ PortableServer::POAManager_var poa_manager =
+ root_poa_->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ poa_manager->activate (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ return 0;
+}
+
+void
+Notify_Test_Client::resolve_naming_service (ACE_ENV_SINGLE_ARG_DECL)
+{
+ CORBA::Object_var naming_obj =
+ this->orb_->resolve_initial_references (NAMING_SERVICE_NAME
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Need to check return value for errors.
+ if (CORBA::is_nil (naming_obj.in ()))
+ ACE_THROW (CORBA::UNKNOWN ());
+
+ this->naming_context_ =
+ CosNaming::NamingContext::_narrow (naming_obj.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void
+Notify_Test_Client::resolve_Notify_factory (ACE_ENV_SINGLE_ARG_DECL)
+{
+ 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
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->notify_factory_ =
+ CosNotifyChannelAdmin::EventChannelFactory::_narrow (
+ obj.in ()
+ ACE_ENV_ARG_PARAMETER
+ );
+ ACE_CHECK;
+}
+
+int
+Notify_Test_Client::ORB_run (ACE_ENV_SINGLE_ARG_DECL)
+{
+ while (! is_done())
+ {
+ ACE_Time_Value tv(0, 10 * 1000);
+ orb_->run(tv ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN(-1);
+ }
+
+ ACE_DEBUG((LM_DEBUG, "\nWaiting for stray events...\n"));
+
+ ACE_Time_Value tv(2);
+ orb_->run(tv ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN(-1);
+
+ return 0;
+}
+
+void Notify_Test_Client::consumer_start (TAO_Notify_Tests_Peer*)
+{
+ num_clients_++;
+}
+
+void
+Notify_Test_Client::consumer_done (TAO_Notify_Tests_Peer*)
+{
+ int value = --num_clients_;
+ if ( value == 0 )
+ {
+ this->done_ = true;
+ }
+}
+
+bool
+Notify_Test_Client::is_done (void) const
+{
+ return this->done_;
+}
+
+CORBA::ORB_ptr
+Notify_Test_Client::orb (void)
+{
+ return this->orb_.in ();
+}
+
+
+PortableServer::POA_ptr
+Notify_Test_Client::root_poa (void)
+{
+ return this->root_poa_.in ();
+}
+
+
+CosNaming::NamingContext_ptr
+Notify_Test_Client::naming_context (void)
+{
+ return this->naming_context_.in ();
+}
+
+
+CosNotifyChannelAdmin::EventChannelFactory_ptr
+Notify_Test_Client::notify_factory (void)
+{
+ return this->notify_factory_.in ();
+}
+
+
+CosNotifyChannelAdmin::EventChannel_ptr
+Notify_Test_Client::create_event_channel (const char* cname,
+ int resolve
+ ACE_ENV_ARG_DECL)
+{
+ CosNotifyChannelAdmin::EventChannel_var ec;
+ CosNaming::Name name (1);
+ name.length (1);
+ name[0].id = CORBA::string_dup (cname);
+
+ if (resolve)
+ {
+ CORBA::Object_var obj = naming_context_->resolve (name);
+ ec = CosNotifyChannelAdmin::EventChannel::_narrow (obj.in ());
+ }
+ else
+ {
+ if (CORBA::is_nil (this->notify_factory_.in ()))
+ {
+ return CosNotifyChannelAdmin::EventChannel::_nil ();
+ }
+
+ CosNotifyChannelAdmin::ChannelID id;
+ CosNotification::QoSProperties initial_qos;
+ CosNotification::AdminProperties initial_admin;
+
+ ec = notify_factory_->create_channel (initial_qos,
+ initial_admin,
+ id
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CosNotifyChannelAdmin::EventChannel::_nil ());
+
+
+ naming_context_->rebind(name, ec.in());
+ }
+
+ return ec._retn ();
+}
diff --git a/TAO/orbsvcs/tests/Notify/lib/Notify_Test_Client.h b/TAO/orbsvcs/tests/Notify/lib/Notify_Test_Client.h
new file mode 100644
index 00000000000..39bbed208fe
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/Notify_Test_Client.h
@@ -0,0 +1,116 @@
+/* -*- C++ -*- */
+// $Id$
+// ==========================================================================
+//
+// = FILENAME
+// Notify_Test_Client.h
+//
+// = DESCRIPTION
+// Prototype Test Driver for all the Notify tests.
+//
+// = AUTHOR
+// Pradeep Gore <pradeep@cs.wustl.edu>
+//
+// ==========================================================================
+
+#ifndef NOTIFY_TEST_CLIENT_H
+#define NOTIFY_TEST_CLIENT_H
+
+#include "ace/Atomic_Op_T.h"
+#include "ace/Thread_Mutex.h"
+#include "orbsvcs/CosNotifyChannelAdminS.h"
+#include "orbsvcs/CosNotifyCommC.h"
+#include "orbsvcs/CosNamingC.h"
+#include "notify_test_export.h"
+
+class TAO_Notify_Tests_Peer;
+
+class TAO_NOTIFY_TEST_Export Notify_Test_Client
+{
+ // = TITLE
+ // Notify_Test_Client
+ // = DESCRIPTION
+ // Shows how consumers Notify_Test_Client for events.
+
+public:
+ // = Initialization and Termination
+ Notify_Test_Client (void);
+ virtual ~Notify_Test_Client ();
+
+ virtual int init (int argc, char *argv [] ACE_ENV_ARG_DECL);
+ // starts the orb and resolves the notify factory via a naming service.
+
+ virtual int parse_args (int argc, char* argv[]);
+ // Allow the user to override this empty method
+
+ int ORB_run (ACE_ENV_SINGLE_ARG_DECL);
+ // Call ORB::run to accept requests.
+
+ void consumer_start (TAO_Notify_Tests_Peer*);
+ // How many clients will call consumer_done.
+
+ void consumer_done (TAO_Notify_Tests_Peer*);
+ // Callback for clients to unregister themselves.
+
+ bool is_done (void) const;
+ // Access the done boolean.
+
+ CORBA::ORB_ptr orb (void);
+ // Access the ORB. This class retains ownership.
+
+ PortableServer::POA_ptr root_poa (void);
+ // Access the Root POA. This class retains ownership.
+
+ CosNaming::NamingContext_ptr naming_context (void);
+ // Access the Naming Context. This class retains ownership.
+
+ CosNotifyChannelAdmin::EventChannelFactory_ptr notify_factory (void);
+ // Access the Notify Factory. This class retains ownership.
+
+ CosNotifyChannelAdmin::EventChannel_ptr create_event_channel (
+ const char* name,
+ int resolve
+ ACE_ENV_ARG_DECL
+ );
+ // Create an Event Channel. Ownership is passed to the caller.
+
+protected:
+ int init_ORB (int argc,
+ char *argv []
+ ACE_ENV_ARG_DECL);
+ // Initializes the ORB.
+
+ void resolve_naming_service (ACE_ENV_SINGLE_ARG_DECL);
+ // Try to get hold of a running naming service.
+
+ void resolve_Notify_factory (ACE_ENV_SINGLE_ARG_DECL);
+ // Try to resolve the Notify factory from the Naming service.
+
+ // = 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::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.
+
+private:
+ ACE_Atomic_Op< TAO_SYNCH_MUTEX, int > num_clients_;
+ bool done_;
+};
+
+#endif /* NOTIFY_TEST_CLIENT_H */
diff --git a/TAO/orbsvcs/tests/Notify/lib/Notify_lib.mpc b/TAO/orbsvcs/tests/Notify/lib/Notify_lib.mpc
new file mode 100644
index 00000000000..293ba3bed29
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/Notify_lib.mpc
@@ -0,0 +1,8 @@
+// -*- MPC -*-
+// $Id$
+
+project(NotifyTests_Lib): orbsvcslib, notification_skel, notify_serv, naming, svc_utils {
+ sharedname = TAO_NotifyTests
+ dynamicflags = TAO_NOTIFY_TEST_BUILD_DLL
+}
+
diff --git a/TAO/orbsvcs/tests/Notify/lib/Options_Parser.cpp b/TAO/orbsvcs/tests/Notify/lib/Options_Parser.cpp
new file mode 100644
index 00000000000..fbcb5f8c03b
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/Options_Parser.cpp
@@ -0,0 +1,149 @@
+// $Id$
+
+#include "Options_Parser.h"
+
+ACE_RCSID (lib,
+ TAO_Options_Parser,
+ "$Id$")
+
+#include "orbsvcs/NotifyExtC.h"
+#include "tao/debug.h"
+#include "ace/Log_Msg.h"
+
+TAO_Notify_Tests_Options_Parser::TAO_Notify_Tests_Options_Parser (void)
+{
+}
+
+TAO_Notify_Tests_Options_Parser::~TAO_Notify_Tests_Options_Parser ()
+{
+}
+
+void
+TAO_Notify_Tests_Options_Parser::execute (CosNotification::EventTypeSeq& added, CosNotification::EventTypeSeq& removed, ACE_Arg_Shifter& arg_shifter)
+{
+ const ACE_TCHAR* current_arg = 0;
+
+ while (arg_shifter.is_anything_left ())
+ {
+ current_arg = arg_shifter.get_current ();
+ arg_shifter.consume_arg ();
+
+ if (current_arg[0] == '+')
+ {
+ // create 1 more space.
+ int seq_ln = added.length ();
+ added.length (seq_ln + 1);
+
+ added[seq_ln].domain_name = CORBA::string_dup ("*");
+ added[seq_ln].type_name = CORBA::string_dup (++current_arg); // Skip the '+' sign.
+ }
+ else if (current_arg[0] == '-')
+ {
+ // create 1 more space.
+ int seq_ln = removed.length ();
+ removed.length (seq_ln + 1);
+
+ removed[seq_ln].domain_name = CORBA::string_dup ("*");
+ removed[seq_ln].type_name = CORBA::string_dup (++current_arg); // Skip the '-' sign.
+ }
+ }
+}
+
+void
+TAO_Notify_Tests_Options_Parser::execute (CosNotification::QoSProperties& qos, ACE_Arg_Shifter& arg_shifter)
+{
+ const ACE_TCHAR *current_arg = 0;
+ int default_priority = ACE_DEFAULT_THREAD_PRIORITY;
+
+ if (arg_shifter.cur_arg_strncasecmp ("-ThreadPool") == 0) // -ThreadPool [-Threads static_threads] [-Priority default_priority]
+ {
+ arg_shifter.consume_arg ();
+
+ int static_threads = 1;
+
+ if (arg_shifter.cur_arg_strncasecmp ("-Threads") == 0)
+ {
+ arg_shifter.consume_arg ();
+
+ current_arg = arg_shifter.get_current ();
+
+ static_threads = ACE_OS::atoi (current_arg);
+
+ arg_shifter.consume_arg ();
+ }
+
+ if (arg_shifter.cur_arg_strncasecmp ("-Priority") == 0)
+ {
+ arg_shifter.consume_arg ();
+
+ current_arg = arg_shifter.get_current ();
+
+ default_priority = ACE_OS::atoi (current_arg);
+
+ arg_shifter.consume_arg ();
+ }
+
+ NotifyExt::ThreadPoolParams tp_params
+ = { NotifyExt::CLIENT_PROPAGATED, default_priority,
+ 0, static_threads, 0, default_priority, 0, 0, 0 };
+
+ qos.length (1);
+ qos[0].name = CORBA::string_dup (NotifyExt::ThreadPool);
+ qos[0].value <<= tp_params;
+
+ } /* ThreadPool */
+ else if (arg_shifter.cur_arg_strncasecmp ("-Lanes") == 0) // -Lanes lane_count -Lane prio static_thr dy_thr
+ {
+ arg_shifter.consume_arg ();
+
+ current_arg = arg_shifter.get_current ();
+ int lanecount = ACE_OS::atoi (current_arg);
+
+ arg_shifter.consume_arg ();
+
+ NotifyExt::ThreadPoolLanesParams tpl_params;
+
+ tpl_params.priority_model = NotifyExt::CLIENT_PROPAGATED;
+ tpl_params.server_priority = default_priority;
+ tpl_params.stacksize = 0;
+ tpl_params.lanes.length (lanecount);
+ tpl_params.allow_borrowing = 0;
+ tpl_params.allow_request_buffering = 0;
+ tpl_params.max_buffered_requests = 0;
+ tpl_params.max_request_buffer_size = 0;
+
+ int l_index = 0;
+ //parse lane values ...
+ while (arg_shifter.is_anything_left ())
+ {
+ if (arg_shifter.cur_arg_strncasecmp ("-Lane") == 0)
+ {
+ arg_shifter.consume_arg ();
+
+ // read priority
+ tpl_params.lanes[l_index].lane_priority = ACE_OS::atoi (arg_shifter.get_current ());
+ arg_shifter.consume_arg ();
+
+ // static thread count
+ tpl_params.lanes[l_index].static_threads = ACE_OS::atoi (arg_shifter.get_current ());
+ arg_shifter.consume_arg ();
+
+ // dynamic thread count
+ tpl_params.lanes[l_index].dynamic_threads = ACE_OS::atoi (arg_shifter.get_current ());
+ arg_shifter.consume_arg ();
+
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG, "QoS Parser parsed lane: - %d, %d, %d\n",
+ tpl_params.lanes[l_index].lane_priority, tpl_params.lanes[l_index].static_threads, tpl_params.lanes[l_index].dynamic_threads));
+ l_index++;
+ }
+ else
+ break;
+ } /* while -- lane values */
+
+ qos.length (1);
+ qos[0].name = CORBA::string_dup (NotifyExt::ThreadPoolLanes);
+ qos[0].value <<= tpl_params;
+
+ } /* ThreadPoolLane */
+}
diff --git a/TAO/orbsvcs/tests/Notify/lib/Options_Parser.h b/TAO/orbsvcs/tests/Notify/lib/Options_Parser.h
new file mode 100644
index 00000000000..009713d6d1e
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/Options_Parser.h
@@ -0,0 +1,48 @@
+/* -*- C++ -*- */
+/**
+ * @file Options_Parser.h
+ *
+ * $Id$
+ *
+ * @author Pradeep Gore <pradeep@oomworks.com>
+ *
+ *
+ */
+
+#ifndef TAO_Notify_Tests_OPTIONS_PARSER_H
+#define TAO_Notify_Tests_OPTIONS_PARSER_H
+#include /**/ "ace/pre.h"
+
+#include "notify_test_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "orbsvcs/CosNotificationC.h"
+#include "ace/Arg_Shifter.h"
+
+/**
+ * @class TAO_Notify_Tests_Options_Parser
+ *
+ * @brief Common Options parsing code.
+ *
+ */
+class TAO_NOTIFY_TEST_Export TAO_Notify_Tests_Options_Parser
+{
+public:
+ /// Constuctor
+ TAO_Notify_Tests_Options_Parser (void);
+
+ /// Destructor
+ ~TAO_Notify_Tests_Options_Parser ();
+
+ /// Populates <qos> with options apecified in <arg_shifter>
+ void execute (CosNotification::QoSProperties& qos, ACE_Arg_Shifter& arg_shifter);
+
+ /// Populates <added> and <removed> with options apecified in <arg_shifter>
+ void execute (CosNotification::EventTypeSeq& added, CosNotification::EventTypeSeq& removed, ACE_Arg_Shifter& arg_shifter);
+};
+
+#include /**/ "ace/post.h"
+#endif /* TAO_Notify_Tests_OPTIONS_PARSER_H */
diff --git a/TAO/orbsvcs/tests/Notify/lib/Peer.cpp b/TAO/orbsvcs/tests/Notify/lib/Peer.cpp
new file mode 100644
index 00000000000..f2e6347a9ea
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/Peer.cpp
@@ -0,0 +1,94 @@
+// $Id$
+
+#include "Peer.h"
+
+#if ! defined (__ACE_INLINE__)
+#include "Peer.inl"
+#endif /* __ACE_INLINE__ */
+
+ACE_RCSID (lib,
+ TAO_Peer,
+ "$Id$")
+
+#include "Name.h"
+#include "LookupManager.h"
+#include "Options_Parser.h"
+#include "orbsvcs/NotifyExtC.h"
+
+TAO_Notify_Tests_Peer::TAO_Notify_Tests_Peer (void)
+ : poa_name_ (TAO_Notify_Tests_Name::root_poa)
+ , ifgop_ (CosNotifyChannelAdmin::OR_OP)
+{
+}
+
+TAO_Notify_Tests_Peer::~TAO_Notify_Tests_Peer ()
+{
+}
+
+void
+TAO_Notify_Tests_Peer::init (PortableServer::POA_ptr poa ACE_ENV_ARG_DECL_NOT_USED)
+{
+ this->default_POA_ = PortableServer::POA::_duplicate (poa);
+}
+
+int
+TAO_Notify_Tests_Peer::init_state (ACE_Arg_Shifter& arg_shifter)
+{
+ while (arg_shifter.is_anything_left ())
+ {
+ if (arg_shifter.cur_arg_strncasecmp ("-Admin") == 0)
+ {
+ arg_shifter.consume_arg ();
+
+ this->admin_name_ = arg_shifter.get_current ();
+ arg_shifter.consume_arg ();
+ }
+ else if (arg_shifter.cur_arg_strncasecmp ("-Proxy") == 0)
+ {
+ arg_shifter.consume_arg ();
+
+ this->proxy_name_ = arg_shifter.get_current ();
+ arg_shifter.consume_arg ();
+ }
+ // Is a POA name specified?
+ else if (arg_shifter.cur_arg_strncasecmp ("-POA") == 0)
+ {
+ arg_shifter.consume_arg ();
+
+ this->poa_name_ = arg_shifter.get_current ();
+ arg_shifter.consume_arg ();
+ }
+ else if (arg_shifter.cur_arg_strncasecmp ("-Set_QoS") == 0) // -Set_QoS [Qos Options]
+ {
+ arg_shifter.consume_arg ();
+
+ TAO_Notify_Tests_Options_Parser qos_parser;
+ qos_parser.execute (this->qos_, arg_shifter);
+ }
+ else
+ {
+ break;
+ }
+ } /* while */
+
+ return 0;
+}
+
+void
+TAO_Notify_Tests_Peer::set_name (ACE_CString& name)
+{
+ this->name_ = name;
+}
+
+const ACE_CString&
+TAO_Notify_Tests_Peer::get_name (void)
+{
+ return this->name_;
+}
+
+void
+TAO_Notify_Tests_Peer::set_poa (PortableServer::POA_ptr poa ACE_ENV_ARG_DECL_NOT_USED)
+{
+ this->default_POA_ = PortableServer::POA::_duplicate (poa);
+}
+
diff --git a/TAO/orbsvcs/tests/Notify/lib/Peer.h b/TAO/orbsvcs/tests/Notify/lib/Peer.h
new file mode 100644
index 00000000000..cff35edb8fa
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/Peer.h
@@ -0,0 +1,80 @@
+/* -*- C++ -*- */
+/**
+ * @file Peer.h
+ *
+ * $Id$
+ *
+ * @author Pradeep Gore <pradeep@oomworks.com>
+ *
+ *
+ */
+
+#ifndef TAO_Notify_Tests_PEER_H
+#define TAO_Notify_Tests_PEER_H
+#include /**/ "ace/pre.h"
+
+#include "notify_test_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "orbsvcs/CosNotifyChannelAdminC.h"
+#include "tao/PortableServer/PortableServer.h"
+#include "ace/SString.h"
+#include "ace/Arg_Shifter.h"
+
+/**
+ * @class TAO_Notify_Tests_Peer
+ *
+ * @brief
+ *
+ */
+class TAO_NOTIFY_TEST_Export TAO_Notify_Tests_Peer
+{
+public:
+ /// Constuctor
+ TAO_Notify_Tests_Peer (void);
+
+ /// Destructor
+ virtual ~TAO_Notify_Tests_Peer ();
+
+ /// Init
+ void init (PortableServer::POA_ptr poa ACE_ENV_ARG_DECL_NOT_USED);
+
+ /// Init this object.
+ virtual int init_state (ACE_Arg_Shifter& arg_shifter);
+
+ /// Set POA
+ void set_poa (PortableServer::POA_ptr poa ACE_ENV_ARG_DECL);
+
+ // Accessor to set/get our name.
+ void set_name (ACE_CString& name);
+ const ACE_CString& get_name (void);
+
+protected:
+
+ /// My name.
+ ACE_CString name_;
+
+ /// Proxy Name.
+ ACE_CString proxy_name_;
+
+ ACE_CString admin_name_;
+
+ ACE_CString poa_name_;
+
+ CosNotifyChannelAdmin::InterFilterGroupOperator ifgop_;
+
+ CosNotification::QoSProperties qos_;
+
+ /// The default POA.
+ PortableServer::POA_var default_POA_;
+};
+
+#if defined (__ACE_INLINE__)
+#include "Peer.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_Notify_Tests_PEER_H */
diff --git a/TAO/orbsvcs/tests/Notify/lib/Peer.inl b/TAO/orbsvcs/tests/Notify/lib/Peer.inl
new file mode 100644
index 00000000000..b29bbd147fb
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/Peer.inl
@@ -0,0 +1,3 @@
+// $Id$
+
+#include "Peer.h"
diff --git a/TAO/orbsvcs/tests/Notify/lib/Peer_T.cpp b/TAO/orbsvcs/tests/Notify/lib/Peer_T.cpp
new file mode 100644
index 00000000000..556d11fb0f0
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/Peer_T.cpp
@@ -0,0 +1,251 @@
+// $Id$
+
+#ifndef TAO_Notify_Tests_Peer_T_CPP
+#define TAO_Notify_Tests_Peer_T_CPP
+
+#include "Peer_T.h"
+
+ACE_RCSID (Notify,
+ TAO_Notify_Tests_Peer_T,
+ "$Id$")
+
+#include "ace/Arg_Shifter.h"
+#include "Name.h"
+#include "LookupManager.h"
+#include "Options_Parser.h"
+#include "orbsvcs/NotifyExtC.h"
+
+template <class Peer_Traits>
+TAO_Notify_Tests_Peer_T<Peer_Traits>::TAO_Notify_Tests_Peer_T (void)
+ : proxy_id_ (0)
+{
+}
+
+template <class Peer_Traits>
+TAO_Notify_Tests_Peer_T<Peer_Traits>::~TAO_Notify_Tests_Peer_T ()
+{
+}
+
+template <class Peer_Traits>
+ACE_TYPENAME TAO_Notify_Tests_Peer_T<Peer_Traits>::Proxy_Traits_PTR
+TAO_Notify_Tests_Peer_T<Peer_Traits>::get_proxy (void)
+{
+ return proxy_.in ();
+}
+
+template <class Peer_Traits>
+ACE_TYPENAME TAO_Notify_Tests_Peer_T<Peer_Traits>::Peer_Traits_PTR
+TAO_Notify_Tests_Peer_T<Peer_Traits>::activate (ACE_ENV_SINGLE_ARG_DECL)
+{
+ return this->_this (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+template <class Peer_Traits>
+void
+TAO_Notify_Tests_Peer_T<Peer_Traits>::connect (Proxy_Traits_PTR proxy,
+ Proxy_Traits_ID proxy_id
+ ACE_ENV_ARG_DECL)
+{
+ // This will decr the ref count on exit.
+ // Clients of this class should use raw pointers, not vars.
+ PortableServer::ServantBase_var servant_var (this);
+
+ ACE_TYPENAME Peer_Traits::VAR peer_var =
+ this->activate (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->connect_to_peer (proxy, peer_var.in () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // save the proxy
+ this->proxy_ = Proxy_Traits_INTERFACE::_duplicate (proxy);
+ this->proxy_id_ = proxy_id;
+
+ // Register the proxy.
+ if (this->proxy_name_.length () != 0)
+ {
+ LOOKUP_MANAGER->_register (this->proxy_.in (),
+ this->proxy_name_.c_str ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+}
+
+template <class Peer_Traits>
+void
+TAO_Notify_Tests_Peer_T<Peer_Traits>::connect (Admin_Traits_PTR admin_ptr
+ ACE_ENV_ARG_DECL)
+{
+ ACE_TYPENAME Proxy_Traits::VAR proxy_var =
+ this->obtain_proxy (admin_ptr
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ ACE_ASSERT (!CORBA::is_nil (proxy_var.in ()));
+
+ this->connect (proxy_var.in (),
+ this->proxy_id_
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+
+template <class Peer_Traits>
+void
+TAO_Notify_Tests_Peer_T<Peer_Traits>::connect (ACE_ENV_SINGLE_ARG_DECL)
+{
+ // Get the POA
+ PortableServer::POA_var poa;
+ LOOKUP_MANAGER->resolve (poa,
+ this->poa_name_.c_str ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // set the POA
+ this->set_poa (poa.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Resolve the admin
+ ACE_TYPENAME Admin_Traits::VAR admin_var;
+
+ LOOKUP_MANAGER->resolve (admin_var,
+ this->admin_name_.c_str ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ ACE_TYPENAME Admin_Ext_Traits::VAR admin_ext_var =
+ Admin_Ext_Traits_INTERFACE::_narrow (admin_var.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ ACE_TYPENAME Proxy_Traits::VAR proxy_var =
+ this->obtain_proxy (admin_ext_var.in (),
+ this->qos_
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ ACE_ASSERT (!CORBA::is_nil (proxy_var.in ()));
+
+ // connect supplier to proxy,
+ // also activates the servant as CORBA object in the POA specified.
+ this->connect (proxy_var.in (),
+ this->proxy_id_
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+template <class Peer_Traits>
+void
+TAO_Notify_Tests_Peer_T<Peer_Traits>::set_qos (
+ CosNotification::QoSProperties& qos
+ ACE_ENV_ARG_DECL
+ )
+{
+ this->get_proxy ()->set_qos (qos ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+template <class Peer_Traits>
+void
+TAO_Notify_Tests_Peer_T<Peer_Traits>::status (ACE_ENV_SINGLE_ARG_DECL)
+{
+#if (TAO_HAS_MINIMUM_CORBA == 0)
+ ACE_TRY
+ {
+ CORBA::Boolean not_exist =
+ this->get_proxy ()->_non_existent (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (not_exist == 1)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "Peer %s, Proxy does not exist\n",
+ this->name_.c_str ()));
+ }
+ else
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "Peer %s, Proxy exists\n",
+ this->name_.c_str ()));
+ }
+ }
+ ACE_CATCH(CORBA::TRANSIENT, ex)
+ {
+ ACE_PRINT_EXCEPTION (ex, "Error: ");
+ ACE_DEBUG ((LM_DEBUG,
+ "Peer %s is_equivalent transient exception.",
+ this->name_.c_str ()));
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Error: ");
+ ACE_DEBUG ((LM_DEBUG,
+ "Peer %s is_equivanent other exception.",
+ this->name_.c_str ()));
+ }
+ ACE_ENDTRY;
+#else
+ ACE_ENV_ARG_NOT_USED;
+#endif /* TAO_HAS_MINIMUM_CORBA */
+}
+
+template <class Peer_Traits>
+void
+TAO_Notify_Tests_Peer_T<Peer_Traits>::disconnect (ACE_ENV_SINGLE_ARG_DECL)
+{
+ ACE_ASSERT (!CORBA::is_nil (this->proxy_.in ()));
+
+ ACE_TRY_EX(TRY1)
+ {
+ this->disconnect_from_proxy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK_EX(TRY1);
+ }
+ ACE_CATCHANY
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "Peer %s failed to disconnect from proxy.",
+ this->name_.c_str ()));
+ }
+ ACE_ENDTRY;
+
+ ACE_TRY_EX(TRY2)
+ {
+ this->deactivate (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK_EX(TRY2);
+ }
+ ACE_CATCHANY
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "Peer %s failed to deactivate.",
+ this->name_.c_str ()));
+ }
+ ACE_ENDTRY;
+}
+
+template <class Peer_Traits>
+PortableServer::POA_ptr
+TAO_Notify_Tests_Peer_T<Peer_Traits>::_default_POA (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED
+ )
+{
+ return PortableServer::POA::_duplicate (this->default_POA_.in ());
+}
+
+template <class Peer_Traits>
+void
+TAO_Notify_Tests_Peer_T<Peer_Traits>::deactivate (ACE_ENV_SINGLE_ARG_DECL)
+{
+ PortableServer::POA_var poa = this->_default_POA ();
+
+ PortableServer::ObjectId_var id =
+ poa->servant_to_id (this
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ poa->deactivate_object (id.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+#endif /* TAO_Notify_Tests_Peer_T_CPP */
diff --git a/TAO/orbsvcs/tests/Notify/lib/Peer_T.h b/TAO/orbsvcs/tests/Notify/lib/Peer_T.h
new file mode 100644
index 00000000000..0356c52d844
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/Peer_T.h
@@ -0,0 +1,121 @@
+/* -*- C++ -*- */
+/**
+ * @file Peer_T.h
+ *
+ * $Id$
+ *
+ * @author Pradeep Gore <pradeep@oomworks.com>
+ *
+ *
+ */
+
+#ifndef TAO_Notify_Tests_PEER_T_H
+#define TAO_Notify_Tests_PEER_T_H
+#include /**/ "ace/pre.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "Peer.h"
+#include "tao/PortableServer/Servant_Base.h"
+
+/**
+ * @class TAO_Notify_Tests_Peer_T
+ *
+ * @brief Base implementation for all Supplier and Consumer Classes.
+ *
+ */
+template <class Peer_Traits>
+class TAO_Notify_Tests_Peer_T : public TAO_Notify_Tests_Peer, public Peer_Traits::SKELETON
+{
+ typedef ACE_TYPENAME Peer_Traits::Admin_Traits Admin_Traits;
+ typedef ACE_TYPENAME Peer_Traits::Admin_Ext_Traits Admin_Ext_Traits;
+ typedef ACE_TYPENAME Peer_Traits::Proxy_Traits Proxy_Traits;
+
+ typedef ACE_TYPENAME Peer_Traits::PTR Peer_Traits_PTR;
+
+ typedef ACE_TYPENAME Proxy_Traits::INTERFACE Proxy_Traits_INTERFACE;
+ typedef ACE_TYPENAME Proxy_Traits::PTR Proxy_Traits_PTR;
+ typedef ACE_TYPENAME Proxy_Traits::ID Proxy_Traits_ID;
+
+ typedef ACE_TYPENAME Admin_Traits::PTR Admin_Traits_PTR;
+
+ typedef ACE_TYPENAME Admin_Ext_Traits::INTERFACE Admin_Ext_Traits_INTERFACE;
+ typedef ACE_TYPENAME Admin_Ext_Traits::PTR Admin_Ext_Traits_PTR;
+
+public:
+ /// Constuctor
+ TAO_Notify_Tests_Peer_T (void);
+
+ /// Destructor
+ virtual ~TAO_Notify_Tests_Peer_T ();
+
+ // Activates this servant with the POA supplied in init.
+ // Connects to given proxy.
+ void connect (Proxy_Traits_PTR proxy, Proxy_Traits_ID proxy_id ACE_ENV_ARG_DECL);
+
+ // Activates this servant with the POA supplied in init.
+ // Creates a new proxy supplier and connects to it.
+ void connect (Admin_Traits_PTR admin_ptr ACE_ENV_ARG_DECL);
+
+ /// Connect using options parsed and set initial QoS.
+ virtual void connect (ACE_ENV_SINGLE_ARG_DECL);
+
+ // Disconnect from the Peer.
+ void disconnect (ACE_ENV_SINGLE_ARG_DECL);
+
+ /// Set Qos
+ void set_qos (CosNotification::QoSProperties& qos ACE_ENV_ARG_DECL);
+
+ /// Dump status
+ void status (ACE_ENV_SINGLE_ARG_DECL);
+
+ // Accessor for <proxy_>.
+ Proxy_Traits_PTR get_proxy (void);
+
+ /// Deactivate the object.
+ void deactivate (ACE_ENV_SINGLE_ARG_DECL);
+
+ // = ServantBase operations
+ virtual PortableServer::POA_ptr _default_POA (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS);
+
+protected:
+ /// Activate this object in the default POA.
+ virtual Peer_Traits_PTR activate (ACE_ENV_SINGLE_ARG_DECL);
+
+ ///= To be implemented by specializations.
+
+ /// Connect to Peer.
+ virtual void connect_to_peer (Proxy_Traits_PTR proxy_ptr, Peer_Traits_PTR peer_ptr ACE_ENV_ARG_DECL) = 0;
+
+ /// Obtain Proxy.
+ virtual Proxy_Traits_PTR obtain_proxy (Admin_Traits_PTR admin_ptr ACE_ENV_ARG_DECL) = 0;
+
+ /// Obtain Proxy with QoS.
+ virtual Proxy_Traits_PTR obtain_proxy (Admin_Ext_Traits_PTR admin_ptr
+ , CosNotification::QoSProperties& qos
+ ACE_ENV_ARG_DECL) = 0;
+
+ /// Disconnect from proxy.
+ virtual void disconnect_from_proxy (ACE_ENV_SINGLE_ARG_DECL) = 0;
+
+ // = Data Members
+
+ /// The proxy that we are connected to.
+ ACE_TYPENAME Proxy_Traits::VAR proxy_;
+
+ /// This <proxy_> id.
+ ACE_TYPENAME Proxy_Traits::ID proxy_id_;
+};
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "Peer_T.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+#pragma implementation ("Peer_T.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_Notify_Tests_PEER_T_H */
diff --git a/TAO/orbsvcs/tests/Notify/lib/Periodic_Consumer.cpp b/TAO/orbsvcs/tests/Notify/lib/Periodic_Consumer.cpp
new file mode 100644
index 00000000000..a718deb73bf
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/Periodic_Consumer.cpp
@@ -0,0 +1,273 @@
+// $Id$
+
+#include "Periodic_Consumer.h"
+
+#include "ace/Arg_Shifter.h"
+#include "ace/High_Res_Timer.h"
+#include "ace/Task.h"
+#include "tao/debug.h"
+#include "orbsvcs/Time_Utilities.h"
+#include "StructuredEvent.h"
+#include "Task_Stats.h"
+#include "Task_Callback.h"
+#include "LookupManager.h"
+#include "Priority_Mapping.h"
+
+ACE_RCSID (RT_Notify,
+ TAO_Notify_Tests_Periodic_Consumer,
+ "$Id$")
+
+int WARMUP_COUNT = 10;
+
+TAO_Notify_Tests_Periodic_Consumer::TAO_Notify_Tests_Periodic_Consumer (void)
+ : count_ (-2)
+ , warmup_countdown_ (WARMUP_COUNT)
+ , max_count_ (-1)
+ , load_ (0)
+ , client_ (0)
+ , check_priority_ (0)
+ , stop_received_ (0)
+{
+}
+
+TAO_Notify_Tests_Periodic_Consumer::~TAO_Notify_Tests_Periodic_Consumer ()
+{
+}
+
+void
+TAO_Notify_Tests_Periodic_Consumer::task_callback (TAO_Notify_Tests_Task_Callback* client)
+{
+ this->client_ = client;
+}
+
+int
+TAO_Notify_Tests_Periodic_Consumer::init_state (ACE_Arg_Shifter& arg_shifter)
+{
+ // First, let the base class look for options.
+ if (TAO_Notify_Tests_StructuredPushConsumer::init_state (arg_shifter) == -1)
+ return -1;
+
+ const ACE_TCHAR *current_arg = 0;
+
+ while (arg_shifter.is_anything_left ())
+ {
+ if ((current_arg = arg_shifter.get_the_parameter ("-MaxCount")))
+ {
+ this->max_count_ = ACE_OS::atoi (current_arg);
+ arg_shifter.consume_arg ();
+
+ if (max_count_ == 0)
+ {
+ if (this->client_)
+ this->client_->done (this);
+ }
+ }
+ else if (arg_shifter.cur_arg_strncasecmp ("-Check_Priority") == 0)
+ {
+ this->check_priority_ = 1;
+
+ arg_shifter.consume_arg ();
+ }
+ else
+ {
+ break;
+ }
+ } /* while */
+
+ return 0;
+}
+
+void
+TAO_Notify_Tests_Periodic_Consumer::handle_start_event (const CosNotification::PropertySeq& prop_seq)
+{
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG, "(%P, %t)Consumer %s received inital (-1)th event \n", this->name_.c_str ()));
+
+ for (CORBA::ULong i = 0; i < prop_seq.length (); ++i)
+ {
+ if (ACE_OS::strcmp (prop_seq[i].name.in (), "BaseTime") == 0)
+ {
+ TimeBase::TimeT base_time;
+ ACE_hrtime_t base_time_hrtime;
+
+ prop_seq[i].value >>= base_time;
+
+ ORBSVCS_Time::TimeT_to_hrtime (base_time_hrtime, base_time);
+ stats_.base_time (base_time_hrtime);
+ }
+ // if max_count has not been already specified, get it from the supplier.
+ else if (this->max_count_ == -1 &&
+ ACE_OS::strcmp (prop_seq[i].name.in (), "MaxCount") == 0)
+ {
+ prop_seq[i].value >>= this->max_count_;
+ }
+ else if (ACE_OS::strcmp (prop_seq[i].name.in (), "Load") == 0)
+ {
+ prop_seq[i].value >>= this->load_;
+ }
+ }
+
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG, "(%P, %t) Maxcount = %d, Load = %d\n",
+ this->max_count_, this->load_));
+ }
+}
+
+void
+TAO_Notify_Tests_Periodic_Consumer::check_priority (const CosNotification::PropertySeq& prop_seq)
+{
+ // Check if the event carries a Priority.
+ int event_has_priority_set = 0;
+ CORBA::Short event_priority = 0;
+
+ for (CORBA::ULong i = 0; i < prop_seq.length (); ++i)
+ {
+ if (ACE_OS::strcmp (prop_seq[i].name.in (), CosNotification::Priority) == 0)
+ {
+ prop_seq[i].value >>= event_priority;
+
+ event_has_priority_set = 1;
+ break;
+ }
+ }
+
+ if (event_has_priority_set == 1)
+ {
+ // Confirm that the current thread is at the priority set in the event
+ ACE_hthread_t current;
+ ACE_Thread::self (current);
+
+ int priority;
+ if (ACE_Thread::getprio (current, priority) == -1)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) - ")
+ ACE_TEXT (" ACE_Thread::get_prio\n")));
+
+ return ;
+ }
+
+ CORBA::Short native_priority = CORBA::Short (priority);
+
+ TAO_Notify_Tests_Priority_Mapping* priority_mapping;
+ LOOKUP_MANAGER->resolve (priority_mapping);
+
+ CORBA::Short corba_priority;
+
+ priority_mapping->to_CORBA (native_priority, corba_priority);
+
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ "Periodic Consumer expected priority = %d, received priority = %d/%d (native/corba)\n",
+ event_priority, native_priority, corba_priority));
+
+ if (corba_priority != event_priority)
+ ACE_DEBUG ((LM_DEBUG,
+ "Error: Periodic Consumer expected priority = %d, received priority = %d\n",
+ event_priority, corba_priority));
+ }
+}
+
+void
+TAO_Notify_Tests_Periodic_Consumer::push_structured_event (const CosNotification::StructuredEvent & notification ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ CosEventComm::Disconnected
+ ))
+{
+ ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, ace_mon, this->lock_,
+ CORBA::INTERNAL ());
+ ACE_CHECK;
+
+ const CosNotification::PropertySeq& prop_seq =
+ notification.header.variable_header;
+
+ if (this->count_ == -2)
+ {
+ if (--warmup_countdown_ == 0)
+ this->count_ = -1;
+
+ return;
+ }
+ else if (this->count_ == -1)
+ {
+ this->handle_start_event (prop_seq);
+
+ if (this->max_count_ > 0)
+ this->stats_.init (this->max_count_);
+
+ this->count_ = 0;
+ return;
+ }
+
+ if (this->check_priority_)
+ {
+ this->check_priority (prop_seq);
+ }
+
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG, "(%P, %t)Consumer %s received %d event type (%s,%s) \n", this->name_.c_str (), this->count_,
+ notification.header.fixed_header.event_type.domain_name.in(),
+ notification.header.fixed_header.event_type.type_name.in()));
+ }
+
+ for (CORBA::ULong i = 0; i < prop_seq.length (); ++i)
+ {
+ if (ACE_OS::strcmp (prop_seq[i].name.in (), "Stop") == 0)
+ {
+ this->stop_received_ = 1;
+ }
+ }
+
+ TimeBase::TimeT send_time, now;
+ ACE_hrtime_t send_time_hrtime;
+
+ notification.remainder_of_body >>= send_time;
+
+ ORBSVCS_Time::TimeT_to_hrtime (send_time_hrtime, send_time);
+
+ now = ACE_OS::gethrtime ();
+
+ stats_.sample (send_time_hrtime, now);
+
+ // Eat CPU
+ static CORBA::ULong prime_number = 9619;
+
+ (void)ACE::gcd (prime_number, prime_number/2 -1);
+
+ for (CORBA::ULong load = this->load_; load != 0; --load)
+ ACE::is_prime (prime_number,
+ 2,
+ prime_number / 2);
+
+ // ---
+
+ if (++this->count_ >= this->max_count_ || this->stop_received_ == 1)
+ {
+ stats_.end_time (ACE_OS::gethrtime ());
+
+ if (this->client_)
+ this->client_->done (this);
+
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG, "(%P, %t)Consumer %s done \n", this->name_.c_str ()));
+ }
+}
+
+void
+TAO_Notify_Tests_Periodic_Consumer::dump_stats (ACE_TCHAR* msg, int dump_samples)
+{
+ char buf[BUFSIZ];
+ ACE_OS::sprintf (buf, "%s.dat", this->name_.c_str ());
+
+ ACE_CString fname (buf);
+
+ ACE_OS::sprintf (buf,
+ "%s# Consumer Name = %s, Proxy ID = %d Load = %u\n",
+ msg,
+ this->name_.c_str (), this->proxy_id_, this->load_);
+
+ stats_.dump_samples (fname.c_str (), buf, dump_samples);
+}
diff --git a/TAO/orbsvcs/tests/Notify/lib/Periodic_Consumer.h b/TAO/orbsvcs/tests/Notify/lib/Periodic_Consumer.h
new file mode 100644
index 00000000000..943d189c411
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/Periodic_Consumer.h
@@ -0,0 +1,102 @@
+/* -*- C++ -*- */
+/**
+ * @file Periodic_Consumer.h
+ *
+ * $Id$
+ *
+ * @author Pradeep Gore <pradeep@oomworks.com>
+ *
+ *
+ */
+
+#ifndef TAO_Notify_Tests_PERIODIC_CONSUMER_H
+#define TAO_Notify_Tests_PERIODIC_CONSUMER_H
+#include /**/ "ace/pre.h"
+
+#include "notify_test_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "Task_Stats.h"
+#include "Notify_StructuredPushConsumer.h"
+#include "ace/Arg_Shifter.h"
+
+ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+class ACE_Barrier;
+ACE_END_VERSIONED_NAMESPACE_DECL
+
+class TAO_Notify_Tests_Task_Callback;
+
+/**
+ * @class TAO_Notify_Tests_Periodic_Consumer
+ *
+ * @brief Receives Structured events periodically.
+ *
+ */
+class TAO_NOTIFY_TEST_Export TAO_Notify_Tests_Periodic_Consumer : public TAO_Notify_Tests_StructuredPushConsumer
+{
+public:
+ /// Constuctor
+ TAO_Notify_Tests_Periodic_Consumer (void);
+
+ /// Destructor
+ ~TAO_Notify_Tests_Periodic_Consumer ();
+
+ /// set the helper callback
+ void task_callback(TAO_Notify_Tests_Task_Callback* client);
+
+ /// Init the state of this object.
+ virtual int init_state (ACE_Arg_Shifter& arg_shifter);
+
+ /// dump stats
+ void dump_stats (ACE_TCHAR* msg, int dump_samples);
+
+protected:
+
+ virtual void push_structured_event (
+ const CosNotification::StructuredEvent & notification
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ CosEventComm::Disconnected
+ ));
+
+ void handle_start_event (const CosNotification::PropertySeq& prop_seq);
+ void check_priority (const CosNotification::PropertySeq& prop_seq);
+
+ /// = Data members.
+ /// Serialize state.
+ TAO_SYNCH_MUTEX lock_;
+
+ /// count of events received.
+ int count_;
+
+ /// We need to count down these initial events.
+ int warmup_countdown_;
+
+ /// max events expected.
+ /// Sometimes max count may not be the number of events that the supplier will send.
+ /// A filter might not allow some events to through. we can tell the consumer what to expect.
+ int max_count_;
+
+ /// The Load
+ CORBA::ULong load_;
+
+ /// Stats house keeping
+ Task_Stats stats_;
+
+ /// Client
+ TAO_Notify_Tests_Task_Callback* client_;
+
+ /// Flag to indicate if we want to check the expected priority.
+ int check_priority_;
+
+ /// This Flag is set if we received an event asking us to "Stop".
+ int stop_received_;
+};
+
+#include /**/ "ace/post.h"
+#endif /* TAO_Notify_Tests_PERIODIC_CONSUMER_H */
diff --git a/TAO/orbsvcs/tests/Notify/lib/Periodic_Consumer_Command.cpp b/TAO/orbsvcs/tests/Notify/lib/Periodic_Consumer_Command.cpp
new file mode 100644
index 00000000000..cfda2e788f8
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/Periodic_Consumer_Command.cpp
@@ -0,0 +1,273 @@
+// $Id$
+
+#include "Periodic_Consumer_Command.h"
+
+ACE_RCSID (lib,
+ TAO_Periodic_Consumer_Command,
+ "$Id$")
+
+#include "LookupManager.h"
+#include "Name.h"
+#include "Periodic_Consumer.h"
+#include "Relay_Consumer.h"
+#include "Direct_Consumer.h"
+#include "Activation_Manager.h"
+#include "Options_Parser.h"
+#include "orbsvcs/NotifyExtC.h"
+
+TAO_Notify_Tests_Periodic_Consumer_Command::TAO_Notify_Tests_Periodic_Consumer_Command (void)
+{
+}
+
+TAO_Notify_Tests_Periodic_Consumer_Command::~TAO_Notify_Tests_Periodic_Consumer_Command ()
+{
+}
+
+const char*
+TAO_Notify_Tests_Periodic_Consumer_Command::get_name (void)
+{
+ return TAO_Notify_Tests_Periodic_Consumer_Command::name ();
+}
+
+const char*
+TAO_Notify_Tests_Periodic_Consumer_Command::name (void)
+{
+ return TAO_Notify_Tests_Name::periodic_consumer_command;
+}
+
+void
+TAO_Notify_Tests_Periodic_Consumer_Command::init (ACE_Arg_Shifter& arg_shifter)
+{
+ if (arg_shifter.is_anything_left ())
+ {
+ /// -Create consumer_name admin_name -POA [POA_name] consumer_specific_options
+ if (arg_shifter.cur_arg_strncasecmp ("-Create") == 0)
+ {
+ this->command_ = CREATE;
+
+ arg_shifter.consume_arg ();
+
+ this->name_ = arg_shifter.get_current ();
+ arg_shifter.consume_arg ();
+
+ int is_relay = 0;
+ int is_direct = 0;
+ ACE_CString relay_destination;
+
+ if (arg_shifter.cur_arg_strncasecmp ("-Relay") == 0)
+ {
+ is_relay = 1;
+
+ arg_shifter.consume_arg ();
+
+ relay_destination = arg_shifter.get_current ();
+ arg_shifter.consume_arg ();
+ }
+ else if (arg_shifter.cur_arg_strncasecmp ("-Direct") == 0)
+ {
+ is_direct = 1;
+
+ arg_shifter.consume_arg ();
+ }
+
+ TAO_Notify_Tests_Periodic_Consumer* consumer = 0;
+
+ // create the consumer
+ if (is_relay == 1)
+ consumer = new TAO_Notify_Tests_Relay_Consumer (relay_destination);
+ else if (is_direct == 1)
+ consumer = new TAO_Notify_Tests_Direct_Consumer ();
+ else
+ consumer = new TAO_Notify_Tests_Periodic_Consumer ();
+
+ consumer->set_name (this->name_);
+
+ TAO_Notify_Tests_Activation_Manager* act_mgr = 0;
+ LOOKUP_MANAGER->resolve (act_mgr);
+
+ {
+ ACE_DECLARE_NEW_CORBA_ENV;
+ act_mgr->_register (consumer, this->name_.c_str () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ consumer->init_state (arg_shifter);
+
+ } /* -Create */
+ else if (arg_shifter.cur_arg_strncasecmp ("-Subscription") == 0) // -Subscription admin_name +added_type1 +-added_type2 ... -added_type3 -added_type4..
+ {
+ this->command_ = SUBSCRIPTION;
+
+ arg_shifter.consume_arg ();
+
+ this->name_ = arg_shifter.get_current ();
+ arg_shifter.consume_arg ();
+
+ TAO_Notify_Tests_Options_Parser options_parser;
+ options_parser.execute (this->added_, this->removed_, arg_shifter);
+ } /* Subscription */
+ else if (arg_shifter.cur_arg_strncasecmp ("-Disconnect") == 0) //
+ {
+ this->command_ = DISCONNECT;
+
+ arg_shifter.consume_arg ();
+
+ this->name_ = arg_shifter.get_current ();
+ arg_shifter.consume_arg ();
+ } /* disconnect */
+ else if (arg_shifter.cur_arg_strncasecmp ("-Deactivate") == 0) //
+ {
+ this->command_ = DEACTIVATE;
+
+ arg_shifter.consume_arg ();
+
+ this->name_ = arg_shifter.get_current ();
+ arg_shifter.consume_arg ();
+ } /* deactivate */
+ else if (arg_shifter.cur_arg_strncasecmp ("-Status") == 0) //
+ {
+ this->command_ = DUMP_STATE;
+
+ arg_shifter.consume_arg ();
+
+ this->name_ = arg_shifter.get_current ();
+ arg_shifter.consume_arg ();
+ } /* -Dump */
+ else if (arg_shifter.cur_arg_strncasecmp ("-Set_QoS") == 0) // -Set_QoS ec_name [Qos Options]
+ {
+ this->command_ = SET_QOS;
+
+ arg_shifter.consume_arg ();
+
+ this->name_ = arg_shifter.get_current ();
+
+ arg_shifter.consume_arg ();
+
+ TAO_Notify_Tests_Options_Parser qos_parser;
+ qos_parser.execute (this->qos_, arg_shifter);
+ }
+ }
+}
+
+TAO_Notify_Tests_Periodic_Consumer*
+TAO_Notify_Tests_Periodic_Consumer_Command::consumer (void)
+{
+ TAO_Notify_Tests_Activation_Manager* act_mgr = 0;
+
+ LOOKUP_MANAGER->resolve (act_mgr);
+
+ // Locate the consumer
+ TAO_Notify_Tests_Periodic_Consumer* consumer = 0;
+
+ {
+ ACE_DECLARE_NEW_CORBA_ENV;
+ act_mgr->resolve (consumer, this->name_.c_str () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+ }
+
+ if (consumer == 0)
+ ACE_DEBUG ((LM_DEBUG, "Consumer %s not found by Lookup Manager\n", this->name_.c_str ()));
+
+ return consumer;
+}
+
+void
+TAO_Notify_Tests_Periodic_Consumer_Command::handle_set_qos (ACE_ENV_SINGLE_ARG_DECL)
+{
+ this->consumer ()->set_qos (this->qos_ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void
+TAO_Notify_Tests_Periodic_Consumer_Command::handle_create (ACE_ENV_SINGLE_ARG_DECL)
+{
+ TAO_Notify_Tests_Periodic_Consumer* consumer = this->consumer ();
+
+ if (consumer == 0)
+ return;
+
+ consumer->connect (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ ACE_DEBUG ((LM_DEBUG, "Consumer %s is connected\n", this->name_.c_str ()));
+}
+
+void
+TAO_Notify_Tests_Periodic_Consumer_Command::handle_subscriptions (ACE_ENV_SINGLE_ARG_DECL)
+{
+ TAO_Notify_Tests_Periodic_Consumer* consumer= this->consumer ();
+ if (consumer == 0)
+ return;
+
+ consumer->subscription_change (this->added_, this->removed_ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void
+TAO_Notify_Tests_Periodic_Consumer_Command::handle_disconnect (ACE_ENV_SINGLE_ARG_DECL)
+{
+ TAO_Notify_Tests_Periodic_Consumer* consumer= this->consumer ();
+ if (consumer == 0)
+ return;
+
+ consumer->disconnect (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void
+TAO_Notify_Tests_Periodic_Consumer_Command::handle_deactivate (ACE_ENV_SINGLE_ARG_DECL)
+{
+ TAO_Notify_Tests_Periodic_Consumer* consumer = this->consumer ();
+ if (consumer == 0)
+ return;
+
+ consumer->deactivate (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void
+TAO_Notify_Tests_Periodic_Consumer_Command::handle_status (ACE_ENV_SINGLE_ARG_DECL)
+{
+ TAO_Notify_Tests_Periodic_Consumer* consumer = this->consumer ();
+
+ if (consumer == 0)
+ return;
+
+ consumer->status (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void
+TAO_Notify_Tests_Periodic_Consumer_Command::execute_i (ACE_ENV_SINGLE_ARG_DECL)
+{
+ if (this->command_ == CREATE)
+ {
+ this->handle_create (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else if (this->command_ == SUBSCRIPTION)
+ {
+ this->handle_subscriptions (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else if (this->command_ == DISCONNECT)
+ {
+ this->handle_disconnect (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else if (this->command_ == DEACTIVATE)
+ {
+ this->handle_deactivate (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else if (this->command_ == DUMP_STATE)
+ {
+ this->handle_status (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else if (this->command_ == SET_QOS)
+ {
+ this->handle_set_qos (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+}
diff --git a/TAO/orbsvcs/tests/Notify/lib/Periodic_Consumer_Command.h b/TAO/orbsvcs/tests/Notify/lib/Periodic_Consumer_Command.h
new file mode 100644
index 00000000000..d258c7e2e8a
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/Periodic_Consumer_Command.h
@@ -0,0 +1,95 @@
+/* -*- C++ -*- */
+/**
+ * @file Periodic_Consumer_Command.h
+ *
+ * $Id$
+ *
+ * @author Pradeep Gore <pradeep@oomworks.com>
+ *
+ *
+ */
+
+#ifndef TAO_Notify_Tests_PERIODICCONSUMER_COMMAND_H
+#define TAO_Notify_Tests_PERIODICCONSUMER_COMMAND_H
+#include /**/ "ace/pre.h"
+
+#include "notify_test_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/SString.h"
+#include "orbsvcs/CosNotifyChannelAdminC.h"
+#include "Command.h"
+
+class TAO_Notify_Tests_Periodic_Consumer;
+
+/**
+ * @class TAO_Notify_Tests_Periodic_Consumer_Command
+ *
+ * @brief Options for Periodic Consumers.
+ *
+ */
+class TAO_NOTIFY_TEST_Export TAO_Notify_Tests_Periodic_Consumer_Command : public TAO_Notify_Tests_Command
+{
+public:
+ /// Constuctor
+ TAO_Notify_Tests_Periodic_Consumer_Command (void);
+
+ /// Destructor
+ ~TAO_Notify_Tests_Periodic_Consumer_Command ();
+
+ /// Parse args and populate options.
+ virtual void init (ACE_Arg_Shifter& arg_shifter);
+
+ /// Execute the command.
+ virtual void execute_i (ACE_ENV_SINGLE_ARG_DECL);
+
+ /// Name of object
+ virtual const char* get_name (void);
+ static const char* name (void);
+
+protected:
+ ///= Data Members
+#ifdef HPUX_11
+ // Remove clash with /usr/include/machine/cpu.h and /usr/include/pa/cpu.h
+#undef COMMAND
+#endif
+ enum COMMAND
+ {
+ CREATE,
+ DESTROY,
+ SET_QOS,
+ SET_ADMIN,
+ SUBSCRIPTION,
+ DISCONNECT,
+ DEACTIVATE,
+ DUMP_STATE
+ };
+
+ /// My name.
+ ACE_CString name_;
+
+ /// QoS
+ CosNotification::QoSProperties qos_;
+
+ // Subscription change
+ CosNotification::EventTypeSeq added_;
+ CosNotification::EventTypeSeq removed_;
+
+ ///= Methods
+ // Retreive the consumer.
+ TAO_Notify_Tests_Periodic_Consumer* consumer (void);
+
+ ///= Handlers
+ void handle_create (ACE_ENV_SINGLE_ARG_DECL);
+ void handle_subscriptions (ACE_ENV_SINGLE_ARG_DECL);
+ void handle_disconnect (ACE_ENV_SINGLE_ARG_DECL);
+ void handle_deactivate (ACE_ENV_SINGLE_ARG_DECL);
+ void handle_status (ACE_ENV_SINGLE_ARG_DECL);
+ void handle_set_qos (ACE_ENV_SINGLE_ARG_DECL);
+};
+
+#include /**/ "ace/post.h"
+#endif /* TAO_Notify_Tests_PERIODICCONSUMER_COMMAND_H */
diff --git a/TAO/orbsvcs/tests/Notify/lib/Periodic_Supplier.cpp b/TAO/orbsvcs/tests/Notify/lib/Periodic_Supplier.cpp
new file mode 100644
index 00000000000..b2aea30f498
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/Periodic_Supplier.cpp
@@ -0,0 +1,358 @@
+// $Id$
+
+#include "Periodic_Supplier.h"
+
+#include "ace/Arg_Shifter.h"
+#include "ace/High_Res_Timer.h"
+#include "ace/Barrier.h"
+#include "ace/OS_NS_unistd.h"
+#include "tao/debug.h"
+#include "tao/ORB_Core.h"
+#include "orbsvcs/Time_Utilities.h"
+#include "StructuredEvent.h"
+#include "Task_Stats.h"
+#include "Task_Callback.h"
+#include "LookupManager.h"
+#include "Priority_Mapping.h"
+
+ACE_RCSID (RT_Notify,
+ TAO_Notify_Tests_Periodic_Supplier,
+ "$Id$")
+
+TAO_Notify_Tests_Periodic_Supplier::TAO_Notify_Tests_Periodic_Supplier (void)
+ : barrier_ (0),
+ priority_ (0),
+ period_ (0),
+ total_deadlines_missed_ (0),
+ run_time_ (0),
+ exec_time_ (0),
+ phase_ (0),
+ iter_ (0),
+ load_ (0),
+ client_ (0)
+{
+}
+
+TAO_Notify_Tests_Periodic_Supplier::~TAO_Notify_Tests_Periodic_Supplier ()
+{
+}
+
+
+void
+TAO_Notify_Tests_Periodic_Supplier::task_callback(TAO_Notify_Tests_Task_Callback* client)
+{
+ this->client_ = client;
+}
+
+int
+TAO_Notify_Tests_Periodic_Supplier::init_state (ACE_Arg_Shifter& arg_shifter)
+{
+ // First, let the base class look for options.
+ if (TAO_Notify_Tests_StructuredPushSupplier::init_state (arg_shifter) == -1)
+ return -1;
+
+ const ACE_TCHAR *current_arg = 0;
+
+ while (arg_shifter.is_anything_left ())
+ {
+ if ((current_arg = arg_shifter.get_the_parameter ("-EventType")))
+ {
+ this->event_.type ("*", current_arg) ;
+ zeroth_event.type ("*", current_arg) ;
+ arg_shifter.consume_arg ();
+ }
+ else if (arg_shifter.cur_arg_strncasecmp ("-FilterLongData") == 0) // -FilterLongData name value
+ {
+ arg_shifter.consume_arg ();
+
+ ACE_CString name = arg_shifter.get_current ();
+
+ arg_shifter.consume_arg ();
+
+ CORBA::Long value = (CORBA::Long)ACE_OS::atoi (arg_shifter.get_current ());
+
+ arg_shifter.consume_arg ();
+
+ CORBA::Any buffer;
+ buffer <<= (CORBA::Long) value;
+
+ this->event_.filter (name.c_str (), buffer);
+ }
+ else if ((current_arg = arg_shifter.get_the_parameter ("-Priority")))
+ {
+ priority_ = ACE_OS::atoi (current_arg);
+ arg_shifter.consume_arg ();
+
+ CORBA::Any buffer;
+ buffer <<= (CORBA::Short) this->priority_;
+ this->event_.qos (CosNotification::Priority, buffer);
+ }
+ else if ((current_arg = arg_shifter.get_the_parameter ("-Period")))
+ {
+ period_ = ACE_OS::atoi (current_arg);
+ arg_shifter.consume_arg ();
+ }
+ else if ((current_arg = arg_shifter.get_the_parameter ("-ExecTime")))
+ {
+ exec_time_ = ACE_OS::atoi (current_arg);
+ arg_shifter.consume_arg ();
+ }
+ else if ((current_arg = arg_shifter.get_the_parameter ("-Phase")))
+ {
+ phase_ = ACE_OS::atoi (current_arg);
+ arg_shifter.consume_arg ();
+ }
+ else if ((current_arg = arg_shifter.get_the_parameter ("-Iter")))
+ {
+ iter_ = ACE_OS::atoi (current_arg);
+ arg_shifter.consume_arg ();
+
+ if (stats_.init (iter_) == -1)
+ return -1;
+ }
+ else if ((current_arg = arg_shifter.get_the_parameter ("-Load")))
+ {
+ load_ = ACE_OS::atoi (current_arg);
+ arg_shifter.consume_arg ();
+ }
+ else if ((current_arg = arg_shifter.get_the_parameter ("-RunTime"))) // in seconds
+ {
+ run_time_ = ACE_OS::atoi (current_arg);
+ arg_shifter.consume_arg ();
+ }
+ else
+ {
+ ACE_DEBUG ((LM_DEBUG, "parse Task unknown option %s\n",
+ arg_shifter.get_current ()));
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG, "event type %s, priority %d, period %duS, exec_time %duS, phase %duS, iter %d, load %d\n",
+ event_.type(), priority_, period_, exec_time_, phase_, iter_, load_));
+ break;
+ }
+ }
+ return 0;
+}
+
+int
+TAO_Notify_Tests_Periodic_Supplier::activate_task (ACE_Barrier* barrier)
+{
+ barrier_ = barrier;
+
+ long flags = THR_NEW_LWP | THR_JOINABLE;
+
+ // Resolve the ORB
+ CORBA::ORB_var orb;
+ LOOKUP_MANAGER->resolve (orb);
+
+ flags |=
+ orb->orb_core ()->orb_params ()->thread_creation_flags ();
+
+ TAO_Notify_Tests_Priority_Mapping* priority_mapping;
+ LOOKUP_MANAGER->resolve (priority_mapping);
+
+ CORBA::Short native_prio;
+
+ priority_mapping->to_native (this->priority_, native_prio);
+
+ // Become an active object.
+ if (this->ACE_Task <ACE_SYNCH>::activate (flags,
+ 1,
+ 0,
+ native_prio) == -1)
+ {
+ if (ACE_OS::last_error () == EPERM)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("Insufficient privilege to activate ACE_Task.\n")),
+ -1);
+ else
+ ACE_DEBUG ((LM_ERROR,
+ ACE_TEXT ("(%t) Task activation at priority %d failed, ")
+ ACE_TEXT ("exiting!\n%a"),
+ this->priority_,
+ -1));
+ }
+
+ ACE_DEBUG ((LM_ERROR, "Activated Periodic Supplier Thread at priority %d\n", this->priority_));
+
+ return 0;
+}
+
+void
+TAO_Notify_Tests_Periodic_Supplier::send_warmup_events (ACE_ENV_SINGLE_ARG_DECL)
+{
+ int WARMUP_COUNT = 10;
+
+ for (int i = 0; i < WARMUP_COUNT ; ++i)
+ {
+ this->send_event (this->event_.event () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+}
+
+void
+TAO_Notify_Tests_Periodic_Supplier::send_prologue (ACE_ENV_SINGLE_ARG_DECL)
+{
+ // populate event.
+ // send the base time and max count.
+ TimeBase::TimeT base_time;
+ ORBSVCS_Time::hrtime_to_TimeT (base_time,
+ BASE_TIME::instance ()->base_time_);
+
+ CORBA::Any buffer;
+ buffer <<= base_time;
+ zeroth_event.opt_header ("BaseTime", buffer);
+
+ buffer <<= this->iter_;
+ zeroth_event.opt_header ("MaxCount", buffer);
+
+ buffer <<= this->load_;
+ zeroth_event.opt_header ("Load", buffer);
+
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG, "(%P, %t) Supplier (%s) sending event 0th event\n"));
+
+ this->send_event (zeroth_event.event () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void
+TAO_Notify_Tests_Periodic_Supplier::handle_svc (ACE_ENV_SINGLE_ARG_DECL)
+{
+ this->send_prologue (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ ACE_hrtime_t before, after;
+ TimeBase::TimeT time_t;
+
+ CORBA::Any buffer;
+
+ ACE_hrtime_t base_time = BASE_TIME::instance ()->base_time_;
+
+ for (int i = 0; i < iter_ ; ++i)
+ {
+ before = ACE_OS::gethrtime ();
+
+ ORBSVCS_Time::hrtime_to_TimeT (time_t,
+ before);
+
+ buffer <<= time_t;
+
+ this->event_.payload (buffer);
+
+ if (this->run_time_ != 0 &&
+ Task_Stats::diff_sec (base_time, before) > this->run_time_)
+ {
+ // Time up, send a "Stop" event.
+ buffer <<= (CORBA::Long) 1;
+ this->event_.opt_header ("Stop", buffer);
+
+ i = iter_; // Load the iter so that the loop exits.
+ }
+
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG, "(%P, %t) Supplier (%s) sending event #%d\n",
+ this->name_.c_str (), i));
+
+ this->send_event (this->event_.event () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ after = ACE_OS::gethrtime ();
+
+ stats_.sample (before, after);
+
+ if (period_ != 0) // blast mode, no sleep.
+ {
+ ACE_UINT32 elapsed_microseconds =
+ Task_Stats::diff_usec (before, after);
+
+ // did we miss any deadlines?
+ int missed =
+ (int)elapsed_microseconds > period_ ? elapsed_microseconds/period_ : 0;
+ this->total_deadlines_missed_ += missed;
+
+ /* Start -- "Immediate run if last call missed deadline" */
+ if (missed > 0) // if we missed
+ continue;
+
+ long sleep_time = period_ - elapsed_microseconds;
+ /* End -- "Immediate run if last call missed deadline" */
+
+ /*
+ * This logic sleeps till the next period.
+ * So, if we missed a deadline we wait.
+ *
+ long sleep_time = (missed + 1)*period_ ;
+ sleep_time -= elapsed_microseconds;
+ */
+
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG, "(%t) sleep time = %d uSec, missed %d deadlines\n", sleep_time, missed));
+
+ ACE_Time_Value t_sleep (0, sleep_time);
+ ACE_OS::sleep (t_sleep);
+ } /* period != 0 */
+
+ } /* for */
+
+ stats_.end_time (ACE_OS::gethrtime ());
+
+ if (this->client_)
+ this->client_->done (this);
+}
+
+int
+TAO_Notify_Tests_Periodic_Supplier::svc (void)
+{
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG, "Thread_Task (%t) - wait\n"));
+
+ ACE_TRY_NEW_ENV
+ {
+ // First, send warmup events.
+ this->send_warmup_events (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ // Next, wait for other threads.
+ this->barrier_->wait ();
+
+ // first thread here inits the Base_Time.
+ stats_.base_time (BASE_TIME::instance ()->base_time_);
+
+ // now wait till the phase_ period expires.
+ ACE_OS::sleep (ACE_Time_Value (0, phase_));
+
+ this->handle_svc (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCH (CORBA::UserException, ue)
+ {
+ ACE_PRINT_EXCEPTION (ue,
+ "Error: Periodic supplier: error sending event. ");
+ }
+ ACE_CATCH (CORBA::SystemException, se)
+ {
+ ACE_PRINT_EXCEPTION (se,
+ "Error: Periodic supplier: error sending event. ");
+ }
+ ACE_ENDTRY;
+
+ return 0;
+}
+
+void
+TAO_Notify_Tests_Periodic_Supplier::dump_stats (ACE_TCHAR* msg, int dump_samples)
+{
+ char buf[BUFSIZ];
+ ACE_OS::sprintf (buf, "%s.dat", this->name_.c_str ());
+
+ ACE_CString fname (buf);
+
+ ACE_OS::sprintf (buf,"%s# : Supplier Name = %s, Proxy ID = %d, Event Type = %s, priority %d, period %ld, exec_time %ld, phase %ld, iter_ %d , load_ %d, deadlines missed = %d\n",
+ msg, this->name_.c_str (), this->proxy_id_, this->event_.type (), priority_, period_, exec_time_, phase_, iter_, load_, this->total_deadlines_missed_);
+
+ stats_.dump_samples (fname.c_str (), buf, dump_samples);
+}
+
+#if defined (ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION)
+template ACE_Singleton<Base_Time, ACE_Thread_Mutex> *ACE_Singleton<Base_Time, ACE_Thread_Mutex>::singleton_;
+#endif /* ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION */
diff --git a/TAO/orbsvcs/tests/Notify/lib/Periodic_Supplier.h b/TAO/orbsvcs/tests/Notify/lib/Periodic_Supplier.h
new file mode 100644
index 00000000000..5bcdf57d34c
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/Periodic_Supplier.h
@@ -0,0 +1,115 @@
+/* -*- C++ -*- */
+/**
+ * @file Periodic_Supplier.h
+ *
+ * $Id$
+ *
+ * @author Pradeep Gore <pradeep@oomworks.com>
+ *
+ *
+ */
+
+#ifndef TAO_Notify_Tests_PERIODIC_SUPPLIER_H
+#define TAO_Notify_Tests_PERIODIC_SUPPLIER_H
+#include /**/ "ace/pre.h"
+
+#include "notify_test_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "Notify_StructuredPushSupplier.h"
+#include "Task_Stats.h"
+#include "StructuredEvent.h"
+#include "ace/Task.h"
+#include "ace/Barrier.h"
+#include "ace/Arg_Shifter.h"
+
+class TAO_Notify_Tests_Task_Callback;
+
+/**
+ * @class TAO_Notify_Tests_Periodic_Supplier
+ *
+ * @brief A Periodic Supplier.
+ *
+ */
+class TAO_NOTIFY_TEST_Export TAO_Notify_Tests_Periodic_Supplier : public TAO_Notify_Tests_StructuredPushSupplier, public ACE_Task <ACE_SYNCH>
+{
+public:
+ /// Constuctor
+ TAO_Notify_Tests_Periodic_Supplier (void);
+
+ /// Destructor
+ ~TAO_Notify_Tests_Periodic_Supplier ();
+
+ /// set the helper callback
+ void task_callback(TAO_Notify_Tests_Task_Callback* client);
+
+ /// Init the state of this object.
+ int init_state (ACE_Arg_Shifter& arg_shifter);
+
+ /// Activate this task, synch on the given barrier.
+ virtual int activate_task (ACE_Barrier* barrier);
+
+ /// task svc
+ virtual int svc (void);
+
+ /// Dump stats.
+ void dump_stats (ACE_TCHAR* msg, int dump_samples);
+
+ /// Get the name of the proxy
+ const char* proxy_name (void);
+
+protected:
+
+ /// svc method.
+ void handle_svc (ACE_ENV_SINGLE_ARG_DECL);
+
+ /// Send a few events before the actual measurements.
+ void send_warmup_events (ACE_ENV_SINGLE_ARG_DECL);
+
+ /// Send Prologue
+ void send_prologue (ACE_ENV_SINGLE_ARG_DECL);
+
+ /// All tasks synch at this barrier.
+ ACE_Barrier* barrier_;
+
+ /// The event to send.
+ TAO_Notify_Tests_StructuredEvent event_;
+
+ TAO_Notify_Tests_StructuredEvent zeroth_event;
+
+ /// The priority of this task.
+ CORBA::Short priority_;
+
+ /// Period
+ long period_;
+
+ /// Counts the total number of deadlines missed.
+ int total_deadlines_missed_;
+
+ /// RunTime - The Max. time to run the supplier.
+ long run_time_;
+
+ /// Worst case exec. time.
+ unsigned long exec_time_;
+
+ /// Phase
+ long phase_;
+
+ /// Number of times to exec. Job
+ int iter_;
+
+ /// A load factor supplied to each Job.
+ CORBA::ULong load_;
+
+ /// Stats house keeping
+ Task_Stats stats_;
+
+ /// Client
+ TAO_Notify_Tests_Task_Callback* client_;
+};
+
+#include /**/ "ace/post.h"
+#endif /* TAO_Notify_Tests_PERIODIC_SUPPLIER_H */
diff --git a/TAO/orbsvcs/tests/Notify/lib/Periodic_Supplier_Command.cpp b/TAO/orbsvcs/tests/Notify/lib/Periodic_Supplier_Command.cpp
new file mode 100644
index 00000000000..9cdfaccbb51
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/Periodic_Supplier_Command.cpp
@@ -0,0 +1,261 @@
+// $Id$
+
+#include "Periodic_Supplier_Command.h"
+
+ACE_RCSID (lib,
+ TAO_Periodic_Supplier_Command,
+ "$Id$")
+
+#include "LookupManager.h"
+#include "Name.h"
+#include "Periodic_Supplier.h"
+#include "Direct_Supplier.h"
+#include "Activation_Manager.h"
+#include "Options_Parser.h"
+#include "orbsvcs/NotifyExtC.h"
+
+TAO_Notify_Tests_Periodic_Supplier_Command::TAO_Notify_Tests_Periodic_Supplier_Command (void)
+{
+}
+
+TAO_Notify_Tests_Periodic_Supplier_Command::~TAO_Notify_Tests_Periodic_Supplier_Command ()
+{
+}
+
+const char*
+TAO_Notify_Tests_Periodic_Supplier_Command::get_name (void)
+{
+ return TAO_Notify_Tests_Periodic_Supplier_Command::name ();
+}
+
+const char*
+TAO_Notify_Tests_Periodic_Supplier_Command::name (void)
+{
+ return TAO_Notify_Tests_Name::periodic_supplier_command;
+}
+
+void
+TAO_Notify_Tests_Periodic_Supplier_Command::init (ACE_Arg_Shifter& arg_shifter)
+{
+ if (arg_shifter.is_anything_left ())
+ {
+ /// -Create supplier_name admin_name -POA [POA_name] supplier_specific_options
+ if (arg_shifter.cur_arg_strncasecmp ("-Create") == 0)
+ {
+ this->command_ = CREATE;
+
+ arg_shifter.consume_arg ();
+
+ this->name_ = arg_shifter.get_current ();
+ arg_shifter.consume_arg ();
+
+ int is_direct = 0;
+ ACE_CString direct_target;
+
+ if (arg_shifter.cur_arg_strncasecmp ("-Direct") == 0)
+ {
+ is_direct = 1;
+
+ arg_shifter.consume_arg ();
+
+ direct_target = arg_shifter.get_current ();
+ arg_shifter.consume_arg ();
+ }
+
+ TAO_Notify_Tests_Periodic_Supplier* supplier = 0;
+
+ // create the supplier
+ if (is_direct == 1)
+ supplier = new TAO_Notify_Tests_Direct_Supplier (direct_target);
+ else
+ supplier = new TAO_Notify_Tests_Periodic_Supplier ();
+
+ supplier->set_name (this->name_);
+
+ TAO_Notify_Tests_Activation_Manager* act_mgr = 0;
+ LOOKUP_MANAGER->resolve (act_mgr);
+
+ {
+ ACE_DECLARE_NEW_CORBA_ENV;
+ act_mgr->_register (supplier, this->name_.c_str () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ supplier->init_state (arg_shifter);
+ } /* -Create */
+ else if (arg_shifter.cur_arg_strncasecmp ("-Offer") == 0) // -Offer supplier_name +added_type1 +-added_type2 ... -added_type3 -added_type4..
+ {
+ this->command_ = OFFER;
+
+ arg_shifter.consume_arg ();
+
+ this->name_ = arg_shifter.get_current ();
+ arg_shifter.consume_arg ();
+
+ TAO_Notify_Tests_Options_Parser options_parser;
+ options_parser.execute (this->added_, this->removed_, arg_shifter);
+ }
+ else if (arg_shifter.cur_arg_strncasecmp ("-Disconnect") == 0) //
+ {
+ this->command_ = DISCONNECT;
+
+ arg_shifter.consume_arg ();
+
+ this->name_ = arg_shifter.get_current ();
+ arg_shifter.consume_arg ();
+ } /* disconnect */
+ else if (arg_shifter.cur_arg_strncasecmp ("-Deactivate") == 0) //
+ {
+ this->command_ = DEACTIVATE;
+
+ arg_shifter.consume_arg ();
+
+ this->name_ = arg_shifter.get_current ();
+ arg_shifter.consume_arg ();
+ } /* deactivate */
+ else if (arg_shifter.cur_arg_strncasecmp ("-Status") == 0) //
+ {
+ this->command_ = DUMP_STATE;
+
+ arg_shifter.consume_arg ();
+
+ this->name_ = arg_shifter.get_current ();
+ arg_shifter.consume_arg ();
+ } /* -Dump */
+ else if (arg_shifter.cur_arg_strncasecmp ("-Set_QoS") == 0) // -Set_QoS ec_name [Qos Options]
+ {
+ this->command_ = SET_QOS;
+
+ arg_shifter.consume_arg ();
+
+ this->name_ = arg_shifter.get_current ();
+
+ arg_shifter.consume_arg ();
+
+ TAO_Notify_Tests_Options_Parser qos_parser;
+ qos_parser.execute (this->qos_, arg_shifter);
+ }
+ } /* if */
+}
+
+TAO_Notify_Tests_Periodic_Supplier*
+TAO_Notify_Tests_Periodic_Supplier_Command::supplier (void)
+{
+ TAO_Notify_Tests_Activation_Manager* act_mgr = 0;
+ LOOKUP_MANAGER->resolve (act_mgr);
+
+ // Locate the supplier
+ TAO_Notify_Tests_Periodic_Supplier* supplier = 0;
+
+ ACE_DECLARE_NEW_CORBA_ENV;
+ act_mgr->resolve (supplier, this->name_.c_str () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ if (supplier == 0)
+ ACE_DEBUG ((LM_DEBUG, "Supplier %s not found by Lookup Manager\n", this->name_.c_str ()));
+
+ return supplier;
+}
+
+void
+TAO_Notify_Tests_Periodic_Supplier_Command::handle_create (ACE_ENV_SINGLE_ARG_DECL)
+{
+ TAO_Notify_Tests_Periodic_Supplier* supplier = this->supplier ();
+ if (supplier == 0)
+ return;
+
+ supplier->connect (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ ACE_DEBUG ((LM_DEBUG, "Supplier %s is connected\n", this->name_.c_str ()));
+}
+
+void
+TAO_Notify_Tests_Periodic_Supplier_Command::handle_offers (ACE_ENV_SINGLE_ARG_DECL)
+{
+ TAO_Notify_Tests_Periodic_Supplier* supplier = this->supplier ();
+ if (supplier == 0)
+ return;
+
+ supplier->offer_change (this->added_, this->removed_ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void
+TAO_Notify_Tests_Periodic_Supplier_Command::handle_disconnect (ACE_ENV_SINGLE_ARG_DECL)
+{
+ TAO_Notify_Tests_Periodic_Supplier* supplier= this->supplier ();
+ if (supplier == 0)
+ return;
+
+ supplier->disconnect (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void
+TAO_Notify_Tests_Periodic_Supplier_Command::handle_deactivate (ACE_ENV_SINGLE_ARG_DECL)
+{
+ TAO_Notify_Tests_Periodic_Supplier* supplier = this->supplier ();
+ if (supplier == 0)
+ return;
+
+ supplier->deactivate (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void
+TAO_Notify_Tests_Periodic_Supplier_Command::handle_status (ACE_ENV_SINGLE_ARG_DECL)
+{
+ TAO_Notify_Tests_Periodic_Supplier* supplier = this->supplier ();
+
+ if (supplier == 0)
+ return;
+
+ supplier->status (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+void
+TAO_Notify_Tests_Periodic_Supplier_Command::handle_set_qos (ACE_ENV_SINGLE_ARG_DECL)
+{
+ TAO_Notify_Tests_Periodic_Supplier* supplier = this->supplier ();
+
+ if (supplier == 0)
+ return;
+
+ supplier->set_qos (this->qos_ ACE_ENV_ARG_PARAMETER);
+}
+
+void
+TAO_Notify_Tests_Periodic_Supplier_Command::execute_i (ACE_ENV_SINGLE_ARG_DECL)
+{
+ if (this->command_ == CREATE)
+ {
+ this->handle_create (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else if (this->command_ == OFFER)
+ {
+ this->handle_offers (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else if (this->command_ == DISCONNECT)
+ {
+ this->handle_disconnect (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else if (this->command_ == DEACTIVATE)
+ {
+ this->handle_deactivate (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else if (this->command_ == DUMP_STATE)
+ {
+ this->handle_status (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else if (this->command_ == SET_QOS)
+ {
+ this->handle_set_qos (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+}
diff --git a/TAO/orbsvcs/tests/Notify/lib/Periodic_Supplier_Command.h b/TAO/orbsvcs/tests/Notify/lib/Periodic_Supplier_Command.h
new file mode 100644
index 00000000000..726d7cd0ddd
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/Periodic_Supplier_Command.h
@@ -0,0 +1,95 @@
+/* -*- C++ -*- */
+/**
+ * @file Periodic_Supplier_Command.h
+ *
+ * $Id$
+ *
+ * @author Pradeep Gore <pradeep@oomworks.com>
+ *
+ *
+ */
+
+#ifndef TAO_Notify_Tests_PERIODICSUPPLIER_COMMAND_H
+#define TAO_Notify_Tests_PERIODICSUPPLIER_COMMAND_H
+#include /**/ "ace/pre.h"
+
+#include "notify_test_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/SString.h"
+#include "orbsvcs/CosNotifyChannelAdminC.h"
+#include "Command.h"
+
+class TAO_Notify_Tests_Periodic_Supplier;
+
+/**
+ * @class TAO_Notify_Tests_Periodic_Supplier_Command
+ *
+ * @brief Command for Periodic Suppliers.
+ *
+ */
+class TAO_NOTIFY_TEST_Export TAO_Notify_Tests_Periodic_Supplier_Command : public TAO_Notify_Tests_Command
+{
+public:
+ /// Constuctor
+ TAO_Notify_Tests_Periodic_Supplier_Command (void);
+
+ /// Destructor
+ ~TAO_Notify_Tests_Periodic_Supplier_Command ();
+
+ /// Parse args and populate options.
+ virtual void init (ACE_Arg_Shifter& arg_shifter);
+
+ /// Execute the command.
+ virtual void execute_i (ACE_ENV_SINGLE_ARG_DECL);
+
+ /// Name of object
+ virtual const char* get_name (void);
+ static const char* name (void);
+
+protected:
+
+#ifdef HPUX_11
+ // Remove clash with /usr/include/machine/cpu.h and /usr/include/pa/cpu.h
+#undef COMMAND
+#endif
+ enum COMMAND
+ {
+ CREATE,
+ DESTROY,
+ SET_QOS,
+ SET_ADMIN,
+ OFFER,
+ DISCONNECT,
+ DEACTIVATE,
+ DUMP_STATE
+ };
+
+ /// My name.
+ ACE_CString name_;
+
+ /// QoS
+ CosNotification::QoSProperties qos_;
+
+ // Offer change
+ CosNotification::EventTypeSeq added_;
+ CosNotification::EventTypeSeq removed_;
+
+ ///= Methods
+ // Retreive the suppliers.
+ TAO_Notify_Tests_Periodic_Supplier* supplier (void);
+
+ ///= Handlers
+ void handle_create (ACE_ENV_SINGLE_ARG_DECL);
+ void handle_offers (ACE_ENV_SINGLE_ARG_DECL);
+ void handle_disconnect (ACE_ENV_SINGLE_ARG_DECL);
+ void handle_deactivate (ACE_ENV_SINGLE_ARG_DECL);
+ void handle_status (ACE_ENV_SINGLE_ARG_DECL);
+ void handle_set_qos (ACE_ENV_SINGLE_ARG_DECL);
+};
+
+#include /**/ "ace/post.h"
+#endif /* TAO_Notify_Tests_PERIODICSUPPLIER_COMMAND_H */
diff --git a/TAO/orbsvcs/tests/Notify/lib/Priority_Mapping.cpp b/TAO/orbsvcs/tests/Notify/lib/Priority_Mapping.cpp
new file mode 100644
index 00000000000..870eef04d59
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/Priority_Mapping.cpp
@@ -0,0 +1,25 @@
+// $Id$
+
+#include "Priority_Mapping.h"
+
+ACE_RCSID(lib, Priority_Mapping, "$Id$")
+
+TAO_Notify_Tests_Priority_Mapping::~TAO_Notify_Tests_Priority_Mapping (void)
+{
+}
+
+CORBA::Boolean
+TAO_Notify_Tests_Priority_Mapping::to_native (CORBA::Short corba_priority,
+ CORBA::Short &native_priority)
+{
+ native_priority = corba_priority;
+ return 1;
+}
+
+CORBA::Boolean
+TAO_Notify_Tests_Priority_Mapping::to_CORBA (CORBA::Short native_priority,
+ CORBA::Short &corba_priority)
+{
+ corba_priority = native_priority;
+ return 1;
+}
diff --git a/TAO/orbsvcs/tests/Notify/lib/Priority_Mapping.h b/TAO/orbsvcs/tests/Notify/lib/Priority_Mapping.h
new file mode 100644
index 00000000000..5a9389b1fb5
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/Priority_Mapping.h
@@ -0,0 +1,45 @@
+/* -*- C++ -*- */
+/**
+ * @file Priority_Mapping.h
+ *
+ * $Id$
+ *
+ * @author Pradeep Gore <pradeep@oomworks.com>
+ *
+ *
+ */
+
+#ifndef TAO_Notify_Tests_PRIORITY_MAPPING_H
+#define TAO_Notify_Tests_PRIORITY_MAPPING_H
+#include /**/ "ace/pre.h"
+
+#include "notify_test_export.h"
+
+#include "tao/Basic_Types.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+/**
+ * @class TAO_Notify_Tests_Priority_Mapping
+ *
+ * @brief A default Priority mapping. simply returns the same number.
+ *
+ */
+class TAO_NOTIFY_TEST_Export TAO_Notify_Tests_Priority_Mapping
+{
+public:
+ /// The destructor
+ virtual ~TAO_Notify_Tests_Priority_Mapping (void);
+
+ virtual CORBA::Boolean
+ to_native (CORBA::Short corba_priority,
+ CORBA::Short &native_priority);
+ virtual CORBA::Boolean
+ to_CORBA (CORBA::Short native_priority,
+ CORBA::Short &corba_priority);
+};
+
+#include /**/ "ace/post.h"
+#endif /* TAO_Notify_Tests_PRIORITY_MAPPING_H */
diff --git a/TAO/orbsvcs/tests/Notify/lib/PushConsumer.cpp b/TAO/orbsvcs/tests/Notify/lib/PushConsumer.cpp
new file mode 100644
index 00000000000..4ab288212fb
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/PushConsumer.cpp
@@ -0,0 +1,56 @@
+// $Id$
+
+#include "PushConsumer.h"
+
+#if ! defined (__ACE_INLINE__)
+#include "PushConsumer.inl"
+#endif /* __ACE_INLINE__ */
+
+ACE_RCSID(lib, TAO_PushConsumer, "$Id$")
+
+TAO_Notify_Tests_PushConsumer_Traits::TAO_Notify_Tests_PushConsumer_Traits (void)
+ :type_ (CosNotifyChannelAdmin::ANY_EVENT)
+{
+}
+
+/*******************************************************************/
+
+TAO_Notify_Tests_PushConsumer::TAO_Notify_Tests_PushConsumer (void)
+{
+}
+
+TAO_Notify_Tests_PushConsumer::~TAO_Notify_Tests_PushConsumer ()
+{
+}
+
+void
+TAO_Notify_Tests_PushConsumer::connect_to_peer (Proxy_Traits::PTR proxy_ptr, Peer_Traits::PTR peer_ptr ACE_ENV_ARG_DECL)
+{
+ proxy_ptr->connect_any_push_consumer (peer_ptr ACE_ENV_ARG_PARAMETER);
+}
+
+void
+TAO_Notify_Tests_PushConsumer::disconnect_from_proxy (ACE_ENV_SINGLE_ARG_DECL)
+{
+ ACE_DEBUG((LM_DEBUG, "\nPush Consumer disconnecting from supplier.\n"));
+ this->proxy_->disconnect_push_supplier (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+void
+TAO_Notify_Tests_PushConsumer::disconnect_push_consumer (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ bool this_method_used_only_by_notify_service = false;
+ ACE_ASSERT(this_method_used_only_by_notify_service);
+ ACE_UNUSED_ARG(this_method_used_only_by_notify_service);
+}
+
+void
+TAO_Notify_Tests_PushConsumer::push (const CORBA::Any & /*data*/ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ CosEventComm::Disconnected
+ ))
+{
+ // NOP
+}
diff --git a/TAO/orbsvcs/tests/Notify/lib/PushConsumer.h b/TAO/orbsvcs/tests/Notify/lib/PushConsumer.h
new file mode 100644
index 00000000000..5aae9203447
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/PushConsumer.h
@@ -0,0 +1,104 @@
+/* -*- C++ -*- */
+/**
+ * @file PushConsumer.h
+ *
+ * $Id$
+ *
+ * @author Pradeep Gore <pradeep@oomworks.com>
+ *
+ *
+ */
+
+#ifndef TAO_Notify_Tests_PUSHCONSUMER_H
+#define TAO_Notify_Tests_PUSHCONSUMER_H
+#include /**/ "ace/pre.h"
+
+#include "notify_test_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "orbsvcs/CosNotifyChannelAdminS.h"
+#include "orbsvcs/NotifyExtC.h"
+
+#include "Consumer_T.h"
+
+class TAO_NOTIFY_TEST_Export TAO_Notify_Tests_ProxyPushSupplier_Traits
+{
+public:
+ typedef CosNotifyChannelAdmin::ProxyPushSupplier INTERFACE;
+ typedef CosNotifyChannelAdmin::ProxyPushSupplier_ptr PTR;
+ typedef CosNotifyChannelAdmin::ProxyPushSupplier_var VAR;
+ typedef CosNotifyChannelAdmin::ProxyID ID;
+};
+
+class TAO_NOTIFY_TEST_Export TAO_Notify_Tests_PushConsumer_Traits
+{
+public:
+ TAO_Notify_Tests_PushConsumer_Traits (void);
+
+ typedef CosNotifyComm::PushConsumer INTERFACE;
+ typedef CosNotifyComm::PushConsumer_ptr PTR;
+ typedef CosNotifyComm::PushConsumer_var VAR;
+ typedef POA_CosNotifyComm::PushConsumer SKELETON;
+
+ typedef TAO_Notify_Tests_ProxyPushSupplier_Traits Proxy_Traits;
+ typedef TAO_Notify_Tests_ConsumerAdmin_Traits Admin_Traits;
+ typedef TAO_Notify_Tests_ConsumerAdmin_Ext_Traits Admin_Ext_Traits;
+
+ const CosNotifyChannelAdmin::ClientType type_;
+};
+
+typedef TAO_Notify_Tests_Consumer_T<TAO_Notify_Tests_PushConsumer_Traits> TAO_Notify_Tests_PushConsumer_Base;
+
+/**
+ * @class TAO_Notify_Tests_PushConsumer
+ *
+ * @brief PushConsumer implementation.
+ *
+ */
+class TAO_NOTIFY_TEST_Export TAO_Notify_Tests_PushConsumer : public TAO_Notify_Tests_PushConsumer_Base
+{
+ typedef TAO_Notify_Tests_PushConsumer_Traits Peer_Traits;
+ typedef Peer_Traits::Admin_Traits Admin_Traits;
+ typedef Peer_Traits::Admin_Ext_Traits Admin_Ext_Traits;
+ typedef Peer_Traits::Proxy_Traits Proxy_Traits;
+
+public:
+ /// Constuctor
+ TAO_Notify_Tests_PushConsumer (void);
+
+ /// Destructor
+ virtual ~TAO_Notify_Tests_PushConsumer ();
+
+protected:
+ /// Connect to Peer.
+ virtual void connect_to_peer (Proxy_Traits::PTR proxy_ptr, Peer_Traits::PTR peer_ptr ACE_ENV_ARG_DECL);
+
+ /// Disconnect from proxy.
+ virtual void disconnect_from_proxy (ACE_ENV_SINGLE_ARG_DECL);
+
+ // = PushConsumer methods
+ virtual void disconnect_push_consumer (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ /// Default does nothing.
+ void push (
+ const CORBA::Any & data
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ CosEventComm::Disconnected
+ ));
+};
+
+#if defined (__ACE_INLINE__)
+#include "PushConsumer.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_Notify_Tests_PUSHCONSUMER_H */
diff --git a/TAO/orbsvcs/tests/Notify/lib/PushConsumer.inl b/TAO/orbsvcs/tests/Notify/lib/PushConsumer.inl
new file mode 100644
index 00000000000..e557d6a7eda
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/PushConsumer.inl
@@ -0,0 +1,3 @@
+// $Id$
+
+#include "PushConsumer.h"
diff --git a/TAO/orbsvcs/tests/Notify/lib/PushSupplier.cpp b/TAO/orbsvcs/tests/Notify/lib/PushSupplier.cpp
new file mode 100644
index 00000000000..f5c3f4d94bd
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/PushSupplier.cpp
@@ -0,0 +1,55 @@
+// $Id$
+
+#include "PushSupplier.h"
+
+#if ! defined (__ACE_INLINE__)
+#include "PushSupplier.inl"
+#endif /* __ACE_INLINE__ */
+
+ACE_RCSID(lib, TAO_PushSupplier, "$Id$")
+
+TAO_Notify_Tests_PushSupplier_Traits::TAO_Notify_Tests_PushSupplier_Traits (void)
+ :type_ (CosNotifyChannelAdmin::ANY_EVENT)
+{
+}
+
+/*******************************************************************/
+
+TAO_Notify_Tests_PushSupplier::TAO_Notify_Tests_PushSupplier (void)
+{
+}
+
+TAO_Notify_Tests_PushSupplier::~TAO_Notify_Tests_PushSupplier ()
+{
+}
+
+void
+TAO_Notify_Tests_PushSupplier::send_event (const CORBA::Any& any ACE_ENV_ARG_DECL)
+{
+ ACE_ASSERT (!CORBA::is_nil (this->proxy_.in ()));
+
+ this->proxy_->push (any ACE_ENV_ARG_PARAMETER);
+}
+
+void
+TAO_Notify_Tests_PushSupplier::connect_to_peer (Proxy_Traits::PTR proxy_ptr, Peer_Traits::PTR peer_ptr ACE_ENV_ARG_DECL)
+{
+ proxy_ptr->connect_any_push_supplier (peer_ptr
+ ACE_ENV_ARG_PARAMETER);
+}
+
+void
+TAO_Notify_Tests_PushSupplier::disconnect_from_proxy (ACE_ENV_SINGLE_ARG_DECL)
+{
+ ACE_DEBUG((LM_DEBUG, "\nPush Supplier disconnecting from consumer.\n"));
+ this->proxy_->disconnect_push_consumer (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+void
+TAO_Notify_Tests_PushSupplier::disconnect_push_supplier (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ bool this_method_used_only_by_notify_service = false;
+ ACE_ASSERT(this_method_used_only_by_notify_service);
+ ACE_UNUSED_ARG(this_method_used_only_by_notify_service);
+}
diff --git a/TAO/orbsvcs/tests/Notify/lib/PushSupplier.h b/TAO/orbsvcs/tests/Notify/lib/PushSupplier.h
new file mode 100644
index 00000000000..edf2753e87d
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/PushSupplier.h
@@ -0,0 +1,97 @@
+/* -*- C++ -*- */
+/**
+ * @file PushSupplier.h
+ *
+ * $Id$
+ *
+ * @author Pradeep Gore <pradeep@oomworks.com>
+ *
+ *
+ */
+
+#ifndef TAO_Notify_Tests_PUSHSUPPLIER_H
+#define TAO_Notify_Tests_PUSHSUPPLIER_H
+#include /**/ "ace/pre.h"
+
+#include "notify_test_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "orbsvcs/CosNotifyChannelAdminS.h"
+#include "orbsvcs/NotifyExtC.h"
+
+#include "Supplier_T.h"
+
+class TAO_NOTIFY_TEST_Export TAO_Notify_Tests_ProxyPushConsumer_Traits
+{
+public:
+ typedef CosNotifyChannelAdmin::ProxyPushConsumer INTERFACE;
+ typedef CosNotifyChannelAdmin::ProxyPushConsumer_ptr PTR;
+ typedef CosNotifyChannelAdmin::ProxyPushConsumer_var VAR;
+ typedef CosNotifyChannelAdmin::ProxyID ID;
+};
+
+class TAO_NOTIFY_TEST_Export TAO_Notify_Tests_PushSupplier_Traits
+{
+public:
+ TAO_Notify_Tests_PushSupplier_Traits (void);
+
+ typedef CosNotifyComm::PushSupplier INTERFACE;
+ typedef CosNotifyComm::PushSupplier_ptr PTR;
+ typedef CosNotifyComm::PushSupplier_var VAR;
+ typedef POA_CosNotifyComm::PushSupplier SKELETON;
+
+ typedef TAO_Notify_Tests_ProxyPushConsumer_Traits Proxy_Traits;
+ typedef TAO_Notify_Tests_SupplierAdmin_Traits Admin_Traits;
+ typedef TAO_Notify_Tests_SupplierAdmin_Ext_Traits Admin_Ext_Traits;
+
+ const CosNotifyChannelAdmin::ClientType type_;
+};
+
+typedef TAO_Notify_Tests_Supplier_T<TAO_Notify_Tests_PushSupplier_Traits> TAO_Notify_Tests_PushSupplier_Base;
+
+/**
+ * @class TAO_Notify_Tests_PushSupplier
+ *
+ * @brief PushSupplier Implementation.
+ *
+ */
+class TAO_NOTIFY_TEST_Export TAO_Notify_Tests_PushSupplier : public TAO_Notify_Tests_PushSupplier_Base
+{
+ typedef TAO_Notify_Tests_PushSupplier_Traits Peer_Traits;
+ typedef Peer_Traits::Admin_Traits Admin_Traits;
+ typedef Peer_Traits::Admin_Ext_Traits Admin_Ext_Traits;
+ typedef Peer_Traits::Proxy_Traits Proxy_Traits;
+
+public:
+ /// Constuctor
+ TAO_Notify_Tests_PushSupplier (void);
+
+ /// Destructor
+ virtual ~TAO_Notify_Tests_PushSupplier ();
+
+ /// Send one event.
+ virtual void send_event (const CORBA::Any & data ACE_ENV_ARG_DECL);
+
+protected:
+ /// Connect to Peer.
+ virtual void connect_to_peer (Proxy_Traits::PTR proxy_ptr, Peer_Traits::PTR peer_ptr ACE_ENV_ARG_DECL);
+
+ /// Disconnect from proxy.
+ virtual void disconnect_from_proxy (ACE_ENV_SINGLE_ARG_DECL);
+
+ // = PushSupplier method
+ virtual void disconnect_push_supplier (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+};
+
+#if defined (__ACE_INLINE__)
+#include "PushSupplier.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_Notify_Tests_PUSHSUPPLIER_H */
diff --git a/TAO/orbsvcs/tests/Notify/lib/PushSupplier.inl b/TAO/orbsvcs/tests/Notify/lib/PushSupplier.inl
new file mode 100644
index 00000000000..9f9bf75ff2f
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/PushSupplier.inl
@@ -0,0 +1,3 @@
+// $Id$
+
+#include "PushSupplier.h"
diff --git a/TAO/orbsvcs/tests/Notify/lib/README b/TAO/orbsvcs/tests/Notify/lib/README
new file mode 100644
index 00000000000..3e8a49d1c22
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/README
@@ -0,0 +1,10 @@
+//$Id$
+
+This directory has the library used by the test examples to test the
+Notification Service.
+
+Helper classes TAO_Notify_Tests_StructuredPushConsumer,
+ TAO_Notify_Tests_StructuredPushSupplier,
+ TAO_Notify_Tests_PushConsumer,
+ TAO_Notify_Tests_PushSupplier,
+to help write client consumers and suppliers.
diff --git a/TAO/orbsvcs/tests/Notify/lib/Relay_Consumer.cpp b/TAO/orbsvcs/tests/Notify/lib/Relay_Consumer.cpp
new file mode 100644
index 00000000000..629639070b5
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/Relay_Consumer.cpp
@@ -0,0 +1,44 @@
+// $Id$
+
+#include "Relay_Consumer.h"
+
+ACE_RCSID(Notify, TAO_Notify_Tests_Relay_Consumer, "$Id$")
+
+#include "LookupManager.h"
+
+TAO_Notify_Tests_Relay_Consumer::TAO_Notify_Tests_Relay_Consumer (ACE_CString& destination)
+ : destination_ (destination)
+{
+}
+
+TAO_Notify_Tests_Relay_Consumer::~TAO_Notify_Tests_Relay_Consumer ()
+{
+}
+
+void
+TAO_Notify_Tests_Relay_Consumer::connect (ACE_ENV_SINGLE_ARG_DECL)
+{
+ TAO_Notify_Tests_Direct_Consumer::connect (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Resolve the destination object.
+ LOOKUP_MANAGER->resolve (this->destination_object_, this->destination_.c_str () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void
+TAO_Notify_Tests_Relay_Consumer::push_structured_event (const CosNotification::StructuredEvent &notification
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ CosEventComm::Disconnected))
+{
+ // The Periodic Consumer will record the run statistics.
+ //TAO_Notify_Tests_Periodic_Consumer::push_structured_event (notification ACE_ENV_ARG_PARAMETER);
+ //ACE_CHECK;
+
+ // Forward the event.
+ if (CORBA::is_nil (this->destination_object_.in ()))
+ ACE_DEBUG ((LM_DEBUG, "(%P,%t) Cannot Relay - Destination object %s is nil", this->destination_.c_str ()));
+ else
+ this->destination_object_->push_structured_event (notification ACE_ENV_ARG_PARAMETER);
+}
diff --git a/TAO/orbsvcs/tests/Notify/lib/Relay_Consumer.h b/TAO/orbsvcs/tests/Notify/lib/Relay_Consumer.h
new file mode 100644
index 00000000000..87fe1ecf44a
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/Relay_Consumer.h
@@ -0,0 +1,56 @@
+/* -*- C++ -*- */
+/**
+ * @file Relay_Consumer.h
+ *
+ * $Id$
+ *
+ * @author Pradeep Gore <pradeep@oomworks.com>
+ *
+ *
+ */
+
+#ifndef TAO_Notify_Tests_RELAY_CONSUMER_H
+#define TAO_Notify_Tests_RELAY_CONSUMER_H
+#include /**/ "ace/pre.h"
+
+#include "notify_test_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "Direct_Consumer.h"
+
+/**
+ * @class TAO_Notify_Tests_Relay_Consumer
+ *
+ * @brief Relay events to a destination consumer.
+ *
+ */
+class TAO_NOTIFY_TEST_Export TAO_Notify_Tests_Relay_Consumer : public TAO_Notify_Tests_Direct_Consumer
+{
+public:
+ /// Constuctor
+ TAO_Notify_Tests_Relay_Consumer (ACE_CString& destination);
+
+ /// Destructor
+ ~TAO_Notify_Tests_Relay_Consumer ();
+
+ /// Connect using options parsed and set initial QoS.
+ virtual void connect (ACE_ENV_SINGLE_ARG_DECL);
+
+ void push_structured_event (const CosNotification::StructuredEvent &/*notification*/
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ CosEventComm::Disconnected));
+
+protected:
+ /// Destination object.
+ ACE_CString destination_;
+
+ /// This object is resolved in the connect method.
+ CosNotifyComm::StructuredPushConsumer_var destination_object_;
+};
+
+#include /**/ "ace/post.h"
+#endif /* TAO_Notify_Tests_RELAY_CONSUMER_H */
diff --git a/TAO/orbsvcs/tests/Notify/lib/Relay_Consumer.inl b/TAO/orbsvcs/tests/Notify/lib/Relay_Consumer.inl
new file mode 100644
index 00000000000..d38d4639901
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/Relay_Consumer.inl
@@ -0,0 +1,3 @@
+// $Id$
+
+#include "Relay_Consumer.h"
diff --git a/TAO/orbsvcs/tests/Notify/lib/SequencePushConsumer.cpp b/TAO/orbsvcs/tests/Notify/lib/SequencePushConsumer.cpp
new file mode 100644
index 00000000000..e63d3661671
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/SequencePushConsumer.cpp
@@ -0,0 +1,57 @@
+// $Id$
+
+#include "SequencePushConsumer.h"
+
+#if ! defined (__ACE_INLINE__)
+#include "SequencePushConsumer.inl"
+#endif /* __ACE_INLINE__ */
+
+ACE_RCSID(lib, TAO_SequencePushConsumer, "$Id$")
+
+TAO_Notify_Tests_SequencePushConsumer_Traits::TAO_Notify_Tests_SequencePushConsumer_Traits (void)
+ :type_ (CosNotifyChannelAdmin::SEQUENCE_EVENT)
+{
+}
+
+/*******************************************************************/
+
+TAO_Notify_Tests_SequencePushConsumer::TAO_Notify_Tests_SequencePushConsumer (void)
+{
+}
+
+TAO_Notify_Tests_SequencePushConsumer::~TAO_Notify_Tests_SequencePushConsumer ()
+{
+}
+
+void
+TAO_Notify_Tests_SequencePushConsumer::connect_to_peer (Proxy_Traits::PTR proxy_ptr, Peer_Traits::PTR peer_ptr ACE_ENV_ARG_DECL)
+{
+ proxy_ptr->connect_sequence_push_consumer (peer_ptr
+ ACE_ENV_ARG_PARAMETER);
+}
+
+void
+TAO_Notify_Tests_SequencePushConsumer::disconnect_from_proxy (ACE_ENV_SINGLE_ARG_DECL)
+{
+ ACE_DEBUG((LM_DEBUG, "\nPush Consumer disconnecting from supplier.\n"));
+ this->proxy_->disconnect_sequence_push_supplier (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+void
+TAO_Notify_Tests_SequencePushConsumer::disconnect_sequence_push_consumer (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ bool this_method_used_only_by_notify_service = false;
+ ACE_ASSERT(this_method_used_only_by_notify_service);
+ ACE_UNUSED_ARG(this_method_used_only_by_notify_service);
+}
+
+void
+TAO_Notify_Tests_SequencePushConsumer::push_structured_events
+ (const CosNotification::EventBatch &/*notifications*/
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ CosEventComm::Disconnected))
+{
+ // NOP
+}
diff --git a/TAO/orbsvcs/tests/Notify/lib/SequencePushConsumer.h b/TAO/orbsvcs/tests/Notify/lib/SequencePushConsumer.h
new file mode 100644
index 00000000000..7e4a4773b27
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/SequencePushConsumer.h
@@ -0,0 +1,104 @@
+/* -*- C++ -*- */
+/**
+ * @file SequencePushConsumer.h
+ *
+ * $Id$
+ *
+ * @author Pradeep Gore <pradeep@oomworks.com>
+ *
+ *
+ */
+
+#ifndef TAO_Notify_Tests_SEQUENCEPUSHCONSUMER_H
+#define TAO_Notify_Tests_SEQUENCEPUSHCONSUMER_H
+#include /**/ "ace/pre.h"
+
+#include "notify_test_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "orbsvcs/CosNotifyChannelAdminS.h"
+#include "orbsvcs/NotifyExtC.h"
+
+#include "Consumer_T.h"
+
+class TAO_NOTIFY_TEST_Export TAO_Notify_Tests_SequenceProxyPushSupplier_Traits
+{
+public:
+ typedef CosNotifyChannelAdmin::SequenceProxyPushSupplier INTERFACE;
+ typedef CosNotifyChannelAdmin::SequenceProxyPushSupplier_ptr PTR;
+ typedef CosNotifyChannelAdmin::SequenceProxyPushSupplier_var VAR;
+ typedef CosNotifyChannelAdmin::ProxyID ID;
+};
+
+class TAO_NOTIFY_TEST_Export TAO_Notify_Tests_SequencePushConsumer_Traits
+{
+public:
+ TAO_Notify_Tests_SequencePushConsumer_Traits (void);
+
+ typedef CosNotifyComm::SequencePushConsumer INTERFACE;
+ typedef CosNotifyComm::SequencePushConsumer_ptr PTR;
+ typedef CosNotifyComm::SequencePushConsumer_var VAR;
+ typedef POA_CosNotifyComm::SequencePushConsumer SKELETON;
+
+ typedef TAO_Notify_Tests_SequenceProxyPushSupplier_Traits Proxy_Traits;
+ typedef TAO_Notify_Tests_ConsumerAdmin_Traits Admin_Traits;
+ typedef TAO_Notify_Tests_ConsumerAdmin_Ext_Traits Admin_Ext_Traits;
+
+ const CosNotifyChannelAdmin::ClientType type_;
+};
+
+typedef TAO_Notify_Tests_Consumer_T<TAO_Notify_Tests_SequencePushConsumer_Traits> TAO_Notify_Tests_SequencePushConsumer_Base;
+
+/**
+ * @class TAO_Notify_Tests_SequencePushConsumer
+ *
+ * @brief SequencePushConsumer Implementation.
+ *
+ */
+class TAO_NOTIFY_TEST_Export TAO_Notify_Tests_SequencePushConsumer : public TAO_Notify_Tests_SequencePushConsumer_Base
+{
+ typedef TAO_Notify_Tests_SequencePushConsumer_Traits Peer_Traits;
+ typedef Peer_Traits::Admin_Traits Admin_Traits;
+ typedef Peer_Traits::Admin_Ext_Traits Admin_Ext_Traits;
+ typedef Peer_Traits::Proxy_Traits Proxy_Traits;
+
+public:
+ /// Constuctor
+ TAO_Notify_Tests_SequencePushConsumer (void);
+
+ /// Destructor
+ virtual ~TAO_Notify_Tests_SequencePushConsumer ();
+
+protected:
+ /// Connect to Peer.
+ virtual void connect_to_peer (Proxy_Traits::PTR proxy_ptr, Peer_Traits::PTR peer_ptr ACE_ENV_ARG_DECL);
+
+ /// Disconnect from proxy.
+ virtual void disconnect_from_proxy (ACE_ENV_SINGLE_ARG_DECL);
+
+ // = SequencePushConsumer methods
+ virtual void disconnect_sequence_push_consumer (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ /// Default does nothing.
+ virtual void push_structured_events (
+ const CosNotification::EventBatch & notifications
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ CosEventComm::Disconnected
+ ));
+};
+
+#if defined (__ACE_INLINE__)
+#include "SequencePushConsumer.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_Notify_Tests_SEQUENCEPUSHCONSUMER_H */
diff --git a/TAO/orbsvcs/tests/Notify/lib/SequencePushConsumer.inl b/TAO/orbsvcs/tests/Notify/lib/SequencePushConsumer.inl
new file mode 100644
index 00000000000..d050292323e
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/SequencePushConsumer.inl
@@ -0,0 +1,3 @@
+// $Id$
+
+#include "SequencePushConsumer.h"
diff --git a/TAO/orbsvcs/tests/Notify/lib/SequencePushSupplier.cpp b/TAO/orbsvcs/tests/Notify/lib/SequencePushSupplier.cpp
new file mode 100644
index 00000000000..76151253271
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/SequencePushSupplier.cpp
@@ -0,0 +1,57 @@
+// $Id$
+
+#include "SequencePushSupplier.h"
+
+#if ! defined (__ACE_INLINE__)
+#include "SequencePushSupplier.inl"
+#endif /* __ACE_INLINE__ */
+
+ACE_RCSID(lib, TAO_SequencePushSupplier, "$Id$")
+
+TAO_Notify_Tests_SequencePushSupplier_Traits::TAO_Notify_Tests_SequencePushSupplier_Traits (void)
+ :type_ (CosNotifyChannelAdmin::SEQUENCE_EVENT)
+{
+}
+
+/*******************************************************************/
+
+TAO_Notify_Tests_SequencePushSupplier::TAO_Notify_Tests_SequencePushSupplier (void)
+{
+}
+
+TAO_Notify_Tests_SequencePushSupplier::~TAO_Notify_Tests_SequencePushSupplier ()
+{
+}
+
+void
+TAO_Notify_Tests_SequencePushSupplier::send_events (const CosNotification::EventBatch& events
+ ACE_ENV_ARG_DECL
+ )
+{
+ ACE_ASSERT (!CORBA::is_nil (this->proxy_.in ()));
+
+ this->proxy_->push_structured_events (events ACE_ENV_ARG_PARAMETER);
+}
+
+void
+TAO_Notify_Tests_SequencePushSupplier::connect_to_peer (Proxy_Traits::PTR proxy_ptr, Peer_Traits::PTR peer_ptr ACE_ENV_ARG_DECL)
+{
+ proxy_ptr->connect_sequence_push_supplier (peer_ptr
+ ACE_ENV_ARG_PARAMETER);
+}
+
+void
+TAO_Notify_Tests_SequencePushSupplier::disconnect_from_proxy (ACE_ENV_SINGLE_ARG_DECL)
+{
+ ACE_DEBUG((LM_DEBUG, "\nPush Supplier disconnecting from consumer.\n"));
+ this->proxy_->disconnect_sequence_push_consumer (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+void
+TAO_Notify_Tests_SequencePushSupplier::disconnect_sequence_push_supplier (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ bool this_method_used_only_by_notify_service = false;
+ ACE_ASSERT(this_method_used_only_by_notify_service);
+ ACE_UNUSED_ARG(this_method_used_only_by_notify_service);
+}
diff --git a/TAO/orbsvcs/tests/Notify/lib/SequencePushSupplier.h b/TAO/orbsvcs/tests/Notify/lib/SequencePushSupplier.h
new file mode 100644
index 00000000000..dad8bd6d0eb
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/SequencePushSupplier.h
@@ -0,0 +1,98 @@
+/* -*- C++ -*- */
+/**
+ * @file SequencePushSupplier.h
+ *
+ * $Id$
+ *
+ * @author Pradeep Gore <pradeep@oomworks.com>
+ *
+ *
+ */
+
+#ifndef TAO_Notify_Tests_SEQUENCEPUSHSUPPLIER_H
+#define TAO_Notify_Tests_SEQUENCEPUSHSUPPLIER_H
+#include /**/ "ace/pre.h"
+
+#include "notify_test_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "orbsvcs/CosNotifyChannelAdminS.h"
+#include "orbsvcs/NotifyExtC.h"
+
+#include "Supplier_T.h"
+
+class TAO_NOTIFY_TEST_Export TAO_Notify_Tests_SequenceProxyPushConsumer_Traits
+{
+public:
+ typedef CosNotifyChannelAdmin::SequenceProxyPushConsumer INTERFACE;
+ typedef CosNotifyChannelAdmin::SequenceProxyPushConsumer_ptr PTR;
+ typedef CosNotifyChannelAdmin::SequenceProxyPushConsumer_var VAR;
+ typedef CosNotifyChannelAdmin::ProxyID ID;
+};
+
+class TAO_NOTIFY_TEST_Export TAO_Notify_Tests_SequencePushSupplier_Traits
+{
+public:
+ TAO_Notify_Tests_SequencePushSupplier_Traits (void);
+
+ typedef CosNotifyComm::SequencePushSupplier INTERFACE;
+ typedef CosNotifyComm::SequencePushSupplier_ptr PTR;
+ typedef CosNotifyComm::SequencePushSupplier_var VAR;
+ typedef POA_CosNotifyComm::SequencePushSupplier SKELETON;
+
+ typedef TAO_Notify_Tests_SequenceProxyPushConsumer_Traits Proxy_Traits;
+ typedef TAO_Notify_Tests_SupplierAdmin_Traits Admin_Traits;
+ typedef TAO_Notify_Tests_SupplierAdmin_Ext_Traits Admin_Ext_Traits;
+
+ const CosNotifyChannelAdmin::ClientType type_;
+};
+
+typedef TAO_Notify_Tests_Supplier_T<TAO_Notify_Tests_SequencePushSupplier_Traits> TAO_Notify_Tests_SequencePushSupplier_Base;
+
+/**
+ * @class TAO_Notify_Tests_SequencePushSupplier
+ *
+ * @brief SequencePushSupplier Implementation.
+ *
+ */
+class TAO_NOTIFY_TEST_Export TAO_Notify_Tests_SequencePushSupplier : public TAO_Notify_Tests_SequencePushSupplier_Base
+{
+ typedef TAO_Notify_Tests_SequencePushSupplier_Traits Peer_Traits;
+ typedef Peer_Traits::Admin_Traits Admin_Traits;
+ typedef Peer_Traits::Admin_Ext_Traits Admin_Ext_Traits;
+ typedef Peer_Traits::Proxy_Traits Proxy_Traits;
+
+public:
+ /// Constuctor
+ TAO_Notify_Tests_SequencePushSupplier (void);
+
+ /// Destructor
+ virtual ~TAO_Notify_Tests_SequencePushSupplier ();
+
+ /// Send one event.
+ virtual void send_events (const CosNotification::EventBatch& events
+ ACE_ENV_ARG_DECL);
+
+protected:
+ /// Connect to Peer.
+ virtual void connect_to_peer (Proxy_Traits::PTR proxy_ptr, Peer_Traits::PTR peer_ptr ACE_ENV_ARG_DECL);
+
+ /// Disconnect from proxy.
+ virtual void disconnect_from_proxy (ACE_ENV_SINGLE_ARG_DECL);
+
+ // = SequencePushSupplier method
+ virtual void disconnect_sequence_push_supplier (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+};
+
+#if defined (__ACE_INLINE__)
+#include "SequencePushSupplier.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_Notify_Tests_SEQUENCEPUSHSUPPLIER_H */
diff --git a/TAO/orbsvcs/tests/Notify/lib/SequencePushSupplier.inl b/TAO/orbsvcs/tests/Notify/lib/SequencePushSupplier.inl
new file mode 100644
index 00000000000..507cd0b85c6
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/SequencePushSupplier.inl
@@ -0,0 +1,3 @@
+// $Id$
+
+#include "SequencePushSupplier.h"
diff --git a/TAO/orbsvcs/tests/Notify/lib/StructuredEvent.cpp b/TAO/orbsvcs/tests/Notify/lib/StructuredEvent.cpp
new file mode 100644
index 00000000000..6c6a9882916
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/StructuredEvent.cpp
@@ -0,0 +1,88 @@
+// $Id$
+
+#include "StructuredEvent.h"
+
+ACE_RCSID(RT_Notify, TAO_Notify_Tests_StructuredEvent, "$Id$")
+
+TAO_Notify_Tests_StructuredEvent::TAO_Notify_Tests_StructuredEvent (void)
+{
+}
+
+TAO_Notify_Tests_StructuredEvent::~TAO_Notify_Tests_StructuredEvent ()
+{
+}
+
+TAO_Notify_Tests_StructuredEvent::TAO_Notify_Tests_StructuredEvent (const char* name)
+{
+ event_.header.fixed_header.event_name = CORBA::string_dup(name);
+}
+
+TAO_Notify_Tests_StructuredEvent::TAO_Notify_Tests_StructuredEvent (const char* domain, const char* type)
+{
+ event_.header.fixed_header.event_type.domain_name = CORBA::string_dup(domain);
+ event_.header.fixed_header.event_type.type_name = CORBA::string_dup(type);
+}
+
+TAO_Notify_Tests_StructuredEvent::TAO_Notify_Tests_StructuredEvent (const char* name, const char* domain, const char* type)
+{
+ event_.header.fixed_header.event_name = CORBA::string_dup(name);
+ event_.header.fixed_header.event_type.domain_name = CORBA::string_dup(domain);
+ event_.header.fixed_header.event_type.type_name = CORBA::string_dup(type);
+}
+
+void
+TAO_Notify_Tests_StructuredEvent::name (const char* name)
+{
+ event_.header.fixed_header.event_name = CORBA::string_dup(name);
+}
+
+void
+TAO_Notify_Tests_StructuredEvent::type (const char* domain, const char* type)
+{
+ event_.header.fixed_header.event_type.domain_name = CORBA::string_dup(domain);
+ event_.header.fixed_header.event_type.type_name = CORBA::string_dup(type);
+}
+
+const char*
+TAO_Notify_Tests_StructuredEvent::type (void)
+{
+ return event_.header.fixed_header.event_type.type_name;
+}
+
+void
+TAO_Notify_Tests_StructuredEvent::opt_header (const char* name, CORBA::Any& value)
+{
+ CosNotification::PropertySeq& opt = event_.header.variable_header;
+ opt.length (opt.length () + 1);
+
+ opt[opt.length () - 1].name = CORBA::string_dup (name);
+ opt[opt.length () - 1].value = value;
+}
+
+void
+TAO_Notify_Tests_StructuredEvent::filter (const char* name, CORBA::Any& value)
+{
+ CosNotification::PropertySeq& filter = event_.filterable_data;
+ filter.length (filter.length () + 1);
+
+ filter[filter.length () - 1].name = CORBA::string_dup (name);
+ filter[filter.length () - 1].value = value;
+}
+
+void
+TAO_Notify_Tests_StructuredEvent::qos (const char* name, CORBA::Any& value)
+{
+ this->opt_header (name, value);
+}
+
+void
+TAO_Notify_Tests_StructuredEvent::payload (CORBA::Any& value)
+{
+ event_.remainder_of_body = value;
+}
+
+CosNotification::StructuredEvent&
+TAO_Notify_Tests_StructuredEvent::event (void)
+{
+ return this->event_;
+}
diff --git a/TAO/orbsvcs/tests/Notify/lib/StructuredEvent.h b/TAO/orbsvcs/tests/Notify/lib/StructuredEvent.h
new file mode 100644
index 00000000000..dddecec4dc1
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/StructuredEvent.h
@@ -0,0 +1,67 @@
+/* -*- C++ -*- */
+/**
+ * @file StructuredEvent.h
+ *
+ * $Id$
+ *
+ * @author Pradeep Gore <pradeep@oomworks.com>
+ *
+ *
+ */
+
+#ifndef TAO_Notify_Tests_STRUCTUREDEVENT_H
+#define TAO_Notify_Tests_STRUCTUREDEVENT_H
+
+#include /**/ "ace/pre.h"
+#include "notify_test_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "orbsvcs/CosNotificationC.h"
+
+/**
+ * @class TAO_Notify_Tests_StructuredEvent
+ *
+ * @brief Helper class to populate a CosNotification::StructuredEvent.
+ *
+ */
+class TAO_NOTIFY_TEST_Export TAO_Notify_Tests_StructuredEvent
+{
+public:
+ /// Constuctor
+ TAO_Notify_Tests_StructuredEvent (void);
+ TAO_Notify_Tests_StructuredEvent (const char* name);
+ TAO_Notify_Tests_StructuredEvent (const char* domain, const char* type);
+ TAO_Notify_Tests_StructuredEvent (const char* name, const char* domain, const char* type);
+
+ /// Destructor
+ ~TAO_Notify_Tests_StructuredEvent ();
+
+ void name (const char* name);
+ void type (const char* domain, const char* type);
+
+ const char* type (void);
+
+ /// add <name,value> to optional header sequence.
+ void opt_header (const char* name, CORBA::Any& value);
+
+ /// add <name,value> to filterable body sequence.
+ void filter (const char* name, CORBA::Any& value);
+
+ /// add <name,value> to variable header sequence.
+ void qos (const char* name, CORBA::Any& value);
+
+ /// The remainder_of_body
+ void payload (CORBA::Any& value);
+
+ /// access the underlying event.
+ CosNotification::StructuredEvent& event (void);
+
+private:
+ CosNotification::StructuredEvent event_;
+};
+
+#include /**/ "ace/post.h"
+#endif /* TAO_Notify_Tests_STRUCTUREDEVENT_H */
diff --git a/TAO/orbsvcs/tests/Notify/lib/StructuredPushConsumer.cpp b/TAO/orbsvcs/tests/Notify/lib/StructuredPushConsumer.cpp
new file mode 100644
index 00000000000..2db62342778
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/StructuredPushConsumer.cpp
@@ -0,0 +1,57 @@
+// $Id$
+
+#include "StructuredPushConsumer.h"
+
+#if ! defined (__ACE_INLINE__)
+#include "StructuredPushConsumer.inl"
+#endif /* __ACE_INLINE__ */
+
+ACE_RCSID(lib, TAO_StructuredPushConsumer, "$Id$")
+
+TAO_Notify_Tests_StructuredPushConsumer_Traits::TAO_Notify_Tests_StructuredPushConsumer_Traits (void)
+ :type_ (CosNotifyChannelAdmin::STRUCTURED_EVENT)
+{
+}
+
+/*******************************************************************/
+
+TAO_Notify_Tests_StructuredPushConsumer::TAO_Notify_Tests_StructuredPushConsumer (void)
+{
+}
+
+TAO_Notify_Tests_StructuredPushConsumer::~TAO_Notify_Tests_StructuredPushConsumer ()
+{
+}
+
+void
+TAO_Notify_Tests_StructuredPushConsumer::connect_to_peer (Proxy_Traits::PTR proxy_ptr, Peer_Traits::PTR peer_ptr ACE_ENV_ARG_DECL)
+{
+ proxy_ptr->connect_structured_push_consumer (peer_ptr
+ ACE_ENV_ARG_PARAMETER);
+}
+
+void
+TAO_Notify_Tests_StructuredPushConsumer::disconnect_from_proxy (ACE_ENV_SINGLE_ARG_DECL)
+{
+ ACE_DEBUG((LM_DEBUG, "\nPush Consumer disconnecting from supplier.\n"));
+ this->proxy_->disconnect_structured_push_supplier (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+void
+TAO_Notify_Tests_StructuredPushConsumer::disconnect_structured_push_consumer (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ bool this_method_used_only_by_notify_service = false;
+ ACE_ASSERT(this_method_used_only_by_notify_service);
+ ACE_UNUSED_ARG(this_method_used_only_by_notify_service);
+}
+
+void
+TAO_Notify_Tests_StructuredPushConsumer::push_structured_event
+ (const CosNotification::StructuredEvent &/*notification*/
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ CosEventComm::Disconnected))
+{
+ // NOP
+}
diff --git a/TAO/orbsvcs/tests/Notify/lib/StructuredPushConsumer.h b/TAO/orbsvcs/tests/Notify/lib/StructuredPushConsumer.h
new file mode 100644
index 00000000000..43ee9ffec52
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/StructuredPushConsumer.h
@@ -0,0 +1,104 @@
+/* -*- C++ -*- */
+/**
+ * @file StructuredPushConsumer.h
+ *
+ * $Id$
+ *
+ * @author Pradeep Gore <pradeep@oomworks.com>
+ *
+ *
+ */
+
+#ifndef TAO_Notify_Tests_STRUCTUREDPUSHCONSUMER_H
+#define TAO_Notify_Tests_STRUCTUREDPUSHCONSUMER_H
+#include /**/ "ace/pre.h"
+
+#include "notify_test_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "orbsvcs/CosNotifyChannelAdminS.h"
+#include "orbsvcs/NotifyExtC.h"
+
+#include "Consumer_T.h"
+
+class TAO_NOTIFY_TEST_Export TAO_Notify_Tests_StructuredProxyPushSupplier_Traits
+{
+public:
+ typedef CosNotifyChannelAdmin::StructuredProxyPushSupplier INTERFACE;
+ typedef CosNotifyChannelAdmin::StructuredProxyPushSupplier_ptr PTR;
+ typedef CosNotifyChannelAdmin::StructuredProxyPushSupplier_var VAR;
+ typedef CosNotifyChannelAdmin::ProxyID ID;
+};
+
+class TAO_NOTIFY_TEST_Export TAO_Notify_Tests_StructuredPushConsumer_Traits
+{
+public:
+ TAO_Notify_Tests_StructuredPushConsumer_Traits (void);
+
+ typedef CosNotifyComm::StructuredPushConsumer INTERFACE;
+ typedef CosNotifyComm::StructuredPushConsumer_ptr PTR;
+ typedef CosNotifyComm::StructuredPushConsumer_var VAR;
+ typedef POA_CosNotifyComm::StructuredPushConsumer SKELETON;
+
+ typedef TAO_Notify_Tests_StructuredProxyPushSupplier_Traits Proxy_Traits;
+ typedef TAO_Notify_Tests_ConsumerAdmin_Traits Admin_Traits;
+ typedef TAO_Notify_Tests_ConsumerAdmin_Ext_Traits Admin_Ext_Traits;
+
+ const CosNotifyChannelAdmin::ClientType type_;
+};
+
+typedef TAO_Notify_Tests_Consumer_T<TAO_Notify_Tests_StructuredPushConsumer_Traits> TAO_Notify_Tests_StructuredPushConsumer_Base;
+
+/**
+ * @class TAO_Notify_Tests_StructuredPushConsumer
+ *
+ * @brief StructuredPushConsumer Implementation.
+ *
+ */
+class TAO_NOTIFY_TEST_Export TAO_Notify_Tests_StructuredPushConsumer : public TAO_Notify_Tests_StructuredPushConsumer_Base
+{
+ typedef TAO_Notify_Tests_StructuredPushConsumer_Traits Peer_Traits;
+ typedef Peer_Traits::Admin_Traits Admin_Traits;
+ typedef Peer_Traits::Admin_Ext_Traits Admin_Ext_Traits;
+ typedef Peer_Traits::Proxy_Traits Proxy_Traits;
+
+public:
+ /// Constuctor
+ TAO_Notify_Tests_StructuredPushConsumer (void);
+
+ /// Destructor
+ virtual ~TAO_Notify_Tests_StructuredPushConsumer ();
+
+protected:
+ /// Connect to Peer.
+ virtual void connect_to_peer (Proxy_Traits::PTR proxy_ptr, Peer_Traits::PTR peer_ptr ACE_ENV_ARG_DECL);
+
+ /// Disconnect from proxy.
+ virtual void disconnect_from_proxy (ACE_ENV_SINGLE_ARG_DECL);
+
+ // = StructuredPushConsumer methods
+ virtual void disconnect_structured_push_consumer (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ /// Default does nothing.
+ virtual void push_structured_event (
+ const CosNotification::StructuredEvent & notification
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ CosEventComm::Disconnected
+ ));
+};
+
+#if defined (__ACE_INLINE__)
+#include "StructuredPushConsumer.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_Notify_Tests_STRUCTUREDPUSHCONSUMER_H */
diff --git a/TAO/orbsvcs/tests/Notify/lib/StructuredPushConsumer.inl b/TAO/orbsvcs/tests/Notify/lib/StructuredPushConsumer.inl
new file mode 100644
index 00000000000..24e952b7ae8
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/StructuredPushConsumer.inl
@@ -0,0 +1,3 @@
+// $Id$
+
+#include "StructuredPushConsumer.h"
diff --git a/TAO/orbsvcs/tests/Notify/lib/StructuredPushSupplier.cpp b/TAO/orbsvcs/tests/Notify/lib/StructuredPushSupplier.cpp
new file mode 100644
index 00000000000..289058864f1
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/StructuredPushSupplier.cpp
@@ -0,0 +1,58 @@
+// $Id$
+
+#include "StructuredPushSupplier.h"
+
+#if ! defined (__ACE_INLINE__)
+#include "StructuredPushSupplier.inl"
+#endif /* __ACE_INLINE__ */
+
+ACE_RCSID(lib, TAO_StructuredPushSupplier, "$Id$")
+
+TAO_Notify_Tests_StructuredPushSupplier_Traits::TAO_Notify_Tests_StructuredPushSupplier_Traits (void)
+ :type_ (CosNotifyChannelAdmin::STRUCTURED_EVENT)
+{
+}
+
+/*******************************************************************/
+
+TAO_Notify_Tests_StructuredPushSupplier::TAO_Notify_Tests_StructuredPushSupplier (void)
+{
+}
+
+TAO_Notify_Tests_StructuredPushSupplier::~TAO_Notify_Tests_StructuredPushSupplier ()
+{
+}
+
+void
+TAO_Notify_Tests_StructuredPushSupplier::send_event (
+ const CosNotification::StructuredEvent& event
+ ACE_ENV_ARG_DECL
+ )
+{
+ ACE_ASSERT (!CORBA::is_nil (this->proxy_.in ()));
+
+ this->proxy_->push_structured_event (event ACE_ENV_ARG_PARAMETER);
+}
+
+void
+TAO_Notify_Tests_StructuredPushSupplier::connect_to_peer (Proxy_Traits::PTR proxy_ptr, Peer_Traits::PTR peer_ptr ACE_ENV_ARG_DECL)
+{
+ proxy_ptr->connect_structured_push_supplier (peer_ptr
+ ACE_ENV_ARG_PARAMETER);
+}
+
+void
+TAO_Notify_Tests_StructuredPushSupplier::disconnect_from_proxy (ACE_ENV_SINGLE_ARG_DECL)
+{
+ ACE_DEBUG((LM_DEBUG, "\nPush Supplier disconnecting from consumer.\n"));
+ this->proxy_->disconnect_structured_push_consumer (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+void
+TAO_Notify_Tests_StructuredPushSupplier::disconnect_structured_push_supplier (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ bool this_method_used_only_by_notify_service = false;
+ ACE_ASSERT(this_method_used_only_by_notify_service);
+ ACE_UNUSED_ARG(this_method_used_only_by_notify_service);
+}
diff --git a/TAO/orbsvcs/tests/Notify/lib/StructuredPushSupplier.h b/TAO/orbsvcs/tests/Notify/lib/StructuredPushSupplier.h
new file mode 100644
index 00000000000..e1c11dc6a54
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/StructuredPushSupplier.h
@@ -0,0 +1,98 @@
+/* -*- C++ -*- */
+/**
+ * @file StructuredPushSupplier.h
+ *
+ * $Id$
+ *
+ * @author Pradeep Gore <pradeep@oomworks.com>
+ *
+ *
+ */
+
+#ifndef TAO_Notify_Tests_STRUCTUREDPUSHSUPPLIER_H
+#define TAO_Notify_Tests_STRUCTUREDPUSHSUPPLIER_H
+#include /**/ "ace/pre.h"
+
+#include "notify_test_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "orbsvcs/CosNotifyChannelAdminS.h"
+#include "orbsvcs/NotifyExtC.h"
+
+#include "Supplier_T.h"
+
+class TAO_NOTIFY_TEST_Export TAO_Notify_Tests_StructuredProxyPushConsumer_Traits
+{
+public:
+ typedef CosNotifyChannelAdmin::StructuredProxyPushConsumer INTERFACE;
+ typedef CosNotifyChannelAdmin::StructuredProxyPushConsumer_ptr PTR;
+ typedef CosNotifyChannelAdmin::StructuredProxyPushConsumer_var VAR;
+ typedef CosNotifyChannelAdmin::ProxyID ID;
+};
+
+class TAO_NOTIFY_TEST_Export TAO_Notify_Tests_StructuredPushSupplier_Traits
+{
+public:
+ TAO_Notify_Tests_StructuredPushSupplier_Traits (void);
+
+ typedef CosNotifyComm::StructuredPushSupplier INTERFACE;
+ typedef CosNotifyComm::StructuredPushSupplier_ptr PTR;
+ typedef CosNotifyComm::StructuredPushSupplier_var VAR;
+ typedef POA_CosNotifyComm::StructuredPushSupplier SKELETON;
+
+ typedef TAO_Notify_Tests_StructuredProxyPushConsumer_Traits Proxy_Traits;
+ typedef TAO_Notify_Tests_SupplierAdmin_Traits Admin_Traits;
+ typedef TAO_Notify_Tests_SupplierAdmin_Ext_Traits Admin_Ext_Traits;
+
+ const CosNotifyChannelAdmin::ClientType type_;
+};
+
+typedef TAO_Notify_Tests_Supplier_T<TAO_Notify_Tests_StructuredPushSupplier_Traits> TAO_Notify_Tests_StructuredPushSupplier_Base;
+
+/**
+ * @class TAO_Notify_Tests_StructuredPushSupplier
+ *
+ * @brief StructuredPushSupplier Implementation.
+ *
+ */
+class TAO_NOTIFY_TEST_Export TAO_Notify_Tests_StructuredPushSupplier : public TAO_Notify_Tests_StructuredPushSupplier_Base
+{
+ typedef TAO_Notify_Tests_StructuredPushSupplier_Traits Peer_Traits;
+ typedef Peer_Traits::Admin_Traits Admin_Traits;
+ typedef Peer_Traits::Admin_Ext_Traits Admin_Ext_Traits;
+ typedef Peer_Traits::Proxy_Traits Proxy_Traits;
+
+public:
+ /// Constuctor
+ TAO_Notify_Tests_StructuredPushSupplier (void);
+
+ /// Destructor
+ virtual ~TAO_Notify_Tests_StructuredPushSupplier ();
+
+ /// Send one event.
+ virtual void send_event (const CosNotification::StructuredEvent& event
+ ACE_ENV_ARG_DECL);
+
+protected:
+ /// Connect to Peer.
+ virtual void connect_to_peer (Proxy_Traits::PTR proxy_ptr, Peer_Traits::PTR peer_ptr ACE_ENV_ARG_DECL);
+
+ /// Disconnect from proxy.
+ virtual void disconnect_from_proxy (ACE_ENV_SINGLE_ARG_DECL);
+
+ // = StructuredPushSupplier method
+ virtual void disconnect_structured_push_supplier (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+};
+
+#if defined (__ACE_INLINE__)
+#include "StructuredPushSupplier.inl"
+#endif /* __ACE_INLINE__ */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_Notify_Tests_STRUCTUREDPUSHSUPPLIER_H */
diff --git a/TAO/orbsvcs/tests/Notify/lib/StructuredPushSupplier.inl b/TAO/orbsvcs/tests/Notify/lib/StructuredPushSupplier.inl
new file mode 100644
index 00000000000..12cb29daaef
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/StructuredPushSupplier.inl
@@ -0,0 +1,3 @@
+// $Id$
+
+#include "StructuredPushSupplier.h"
diff --git a/TAO/orbsvcs/tests/Notify/lib/SupplierAdmin_Command.cpp b/TAO/orbsvcs/tests/Notify/lib/SupplierAdmin_Command.cpp
new file mode 100644
index 00000000000..5adaa65c92c
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/SupplierAdmin_Command.cpp
@@ -0,0 +1,179 @@
+// $Id$
+
+#include "SupplierAdmin_Command.h"
+
+ACE_RCSID(lib, TAO_SupplierAdmin_Command, "$Id$")
+
+#include "LookupManager.h"
+#include "Name.h"
+#include "Options_Parser.h"
+
+TAO_Notify_Tests_SupplierAdmin_Command::TAO_Notify_Tests_SupplierAdmin_Command (void)
+: ifgop_ (CosNotifyChannelAdmin::OR_OP), id_ (0)
+{
+}
+
+TAO_Notify_Tests_SupplierAdmin_Command::~TAO_Notify_Tests_SupplierAdmin_Command ()
+{
+}
+
+const char*
+TAO_Notify_Tests_SupplierAdmin_Command::get_name (void)
+{
+ return TAO_Notify_Tests_SupplierAdmin_Command::name ();
+}
+
+const char*
+TAO_Notify_Tests_SupplierAdmin_Command::name (void)
+{
+ return TAO_Notify_Tests_Name::supplier_admin_command;
+}
+
+void
+TAO_Notify_Tests_SupplierAdmin_Command::init (ACE_Arg_Shifter& arg_shifter)
+{
+ if (arg_shifter.is_anything_left ())
+ {
+ /// -Create sa_name factory_name
+ if (arg_shifter.cur_arg_strncasecmp ("-Create") == 0)
+ {
+ this->command_ = CREATE;
+
+ arg_shifter.consume_arg ();
+
+ this->name_ = arg_shifter.get_current ();
+ arg_shifter.consume_arg ();
+
+ this->factory_ = arg_shifter.get_current ();
+ arg_shifter.consume_arg ();
+
+ if (arg_shifter.cur_arg_strncasecmp ("-AND_OP") == 0)
+ {
+ arg_shifter.consume_arg ();
+
+ this->ifgop_ = CosNotifyChannelAdmin::AND_OP;
+ }
+ else if (arg_shifter.cur_arg_strncasecmp ("-OR_OP") == 0)
+ {
+ arg_shifter.consume_arg ();
+
+ this->ifgop_ = CosNotifyChannelAdmin::OR_OP;
+ }
+ }
+ else if (arg_shifter.cur_arg_strncasecmp ("-Offer") == 0)
+ // -Subscription admin_name +added_type1 +-added_type2 ... -added_type3 -added_type4..
+ {
+ this->command_ = OFFER;
+
+ arg_shifter.consume_arg ();
+
+ this->name_ = arg_shifter.get_current ();
+ arg_shifter.consume_arg ();
+
+ TAO_Notify_Tests_Options_Parser options_parser;
+ options_parser.execute (this->added_, this->removed_, arg_shifter);
+ } // Subscription
+ else if (arg_shifter.cur_arg_strncasecmp ("-Set_QoS") == 0) // -Set_QoS ec_name [Qos Options]
+ {
+ this->command_ = SET_QOS;
+
+ arg_shifter.consume_arg ();
+
+ this->name_ = arg_shifter.get_current ();
+
+ arg_shifter.consume_arg ();
+
+ TAO_Notify_Tests_Options_Parser qos_parser;
+ qos_parser.execute (this->qos_, arg_shifter);
+ }
+ } /* if */
+}
+
+void
+TAO_Notify_Tests_SupplierAdmin_Command::handle_create (ACE_ENV_SINGLE_ARG_DECL)
+{
+ CosNotifyChannelAdmin::EventChannel_var ec;
+
+ LOOKUP_MANAGER->resolve (ec, this->factory_.c_str () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // create supplier admin
+ CosNotifyChannelAdmin::SupplierAdmin_var sa =
+ ec->new_for_suppliers (this->ifgop_,
+ this->id_
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ LOOKUP_MANAGER->_register (sa.in(), this->name_.c_str () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void
+TAO_Notify_Tests_SupplierAdmin_Command::handle_offers (ACE_ENV_SINGLE_ARG_DECL)
+{
+ CosNotifyChannelAdmin::SupplierAdmin_var admin;
+
+ LOOKUP_MANAGER->resolve (admin, this->name_.c_str () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Let the user see what we're subscribed for,
+ ACE_DEBUG ((LM_DEBUG, "Calling SupplierAdmin offer_change : "));
+
+ CORBA::ULong i = 0;
+
+ for (; i < added_.length (); ++i)
+ {
+ ACE_DEBUG ((LM_DEBUG, "+(%s,%s), ", added_[i].domain_name.in (), added_[i].type_name.in ()));
+ }
+ for (i = 0; i < removed_.length (); ++i)
+ {
+ ACE_DEBUG ((LM_DEBUG, "-(%s,%s), ", removed_[i].domain_name.in (), removed_[i].type_name.in ()));
+ }
+
+ ACE_DEBUG ((LM_DEBUG, "\n"));
+
+ admin->offer_change (this->added_, this->removed_ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void
+TAO_Notify_Tests_SupplierAdmin_Command::handle_status (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+{
+}
+
+void
+TAO_Notify_Tests_SupplierAdmin_Command::handle_set_qos (ACE_ENV_SINGLE_ARG_DECL)
+{
+ CosNotifyChannelAdmin::SupplierAdmin_var admin;
+
+ LOOKUP_MANAGER->resolve (admin, this->name_.c_str () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ admin->set_qos (this->qos_ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void
+TAO_Notify_Tests_SupplierAdmin_Command::execute_i (ACE_ENV_SINGLE_ARG_DECL)
+{
+ if (this->command_ == CREATE)
+ {
+ this->handle_create (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else if (this->command_ == OFFER)
+ {
+ this->handle_offers (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else if (this->command_ == SET_QOS)
+ {
+ this->handle_set_qos (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ else if (this->command_ == DUMP_STATE)
+ {
+ this->handle_status (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+}
diff --git a/TAO/orbsvcs/tests/Notify/lib/SupplierAdmin_Command.h b/TAO/orbsvcs/tests/Notify/lib/SupplierAdmin_Command.h
new file mode 100644
index 00000000000..fbed3172551
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/SupplierAdmin_Command.h
@@ -0,0 +1,89 @@
+/* -*- C++ -*- */
+/**
+ * @file SupplierAdmin_Command.h
+ *
+ * $Id$
+ *
+ * @author Pradeep Gore <pradeep@oomworks.com>
+ *
+ *
+ */
+
+#ifndef TAO_Notify_Tests_SUPPLIERADMIN_COMMAND_H
+#define TAO_Notify_Tests_SUPPLIERADMIN_COMMAND_H
+#include /**/ "ace/pre.h"
+
+#include "notify_test_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/SString.h"
+#include "orbsvcs/CosNotifyChannelAdminC.h"
+#include "Command.h"
+
+/**
+ * @class TAO_Notify_Tests_SupplierAdmin_Command
+ *
+ * @brief Command for Supplier Admins.
+ *
+ */
+class TAO_NOTIFY_TEST_Export TAO_Notify_Tests_SupplierAdmin_Command : public TAO_Notify_Tests_Command
+{
+public:
+ /// Constuctor
+ TAO_Notify_Tests_SupplierAdmin_Command (void);
+
+ /// Destructor
+ ~TAO_Notify_Tests_SupplierAdmin_Command ();
+
+ /// Parse args and populate options.
+ virtual void init (ACE_Arg_Shifter& arg_shifter);
+
+ /// Execute the command.
+ virtual void execute_i (ACE_ENV_SINGLE_ARG_DECL);
+
+ /// Name of object
+ virtual const char* get_name (void);
+ static const char* name (void);
+
+protected:
+
+#ifdef HPUX_11
+ // Remove clash with /usr/include/machine/cpu.h and /usr/include/pa/cpu.h
+#undef COMMAND
+#endif
+ enum COMMAND
+ {
+ CREATE,
+ OFFER,
+ DESTROY,
+ SET_QOS,
+ SET_ADMIN,
+ DUMP_STATE
+ };
+
+ ACE_CString name_;
+
+ ACE_CString factory_;
+
+ CosNotifyChannelAdmin::InterFilterGroupOperator ifgop_;
+
+ CosNotifyChannelAdmin::AdminID id_;
+
+ CosNotification::QoSProperties qos_;
+
+ // Subscription change
+ CosNotification::EventTypeSeq added_;
+ CosNotification::EventTypeSeq removed_;
+
+ /// = Handlers
+ void handle_create (ACE_ENV_SINGLE_ARG_DECL);
+ void handle_offers (ACE_ENV_SINGLE_ARG_DECL);
+ void handle_status (ACE_ENV_SINGLE_ARG_DECL);
+ void handle_set_qos (ACE_ENV_SINGLE_ARG_DECL);
+};
+
+#include /**/ "ace/post.h"
+#endif /* TAO_Notify_Tests_SUPPLIERADMIN_COMMAND_H */
diff --git a/TAO/orbsvcs/tests/Notify/lib/Supplier_T.cpp b/TAO/orbsvcs/tests/Notify/lib/Supplier_T.cpp
new file mode 100644
index 00000000000..3641ca65f32
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/Supplier_T.cpp
@@ -0,0 +1,104 @@
+// $Id$
+#ifndef TAO_Notify_Tests_Supplier_T_CPP
+#define TAO_Notify_Tests_Supplier_T_CPP
+
+#include "Supplier_T.h"
+
+ACE_RCSID(Notify, TAO_Notify_Tests_Supplier_T, "$Id$")
+
+template <class Supplier_Traits>
+TAO_Notify_Tests_Supplier_T<Supplier_Traits>::TAO_Notify_Tests_Supplier_T (void)
+{
+}
+
+template <class Supplier_Traits>
+TAO_Notify_Tests_Supplier_T<Supplier_Traits>::~TAO_Notify_Tests_Supplier_T ()
+{
+}
+
+template <class Supplier_Traits> ACE_TYPENAME TAO_Notify_Tests_Supplier_T<Supplier_Traits>::Proxy_Traits_PTR
+TAO_Notify_Tests_Supplier_T<Supplier_Traits>::get_proxy_consumer (void)
+{
+ return this->get_proxy ();
+}
+
+template <class Supplier_Traits> ACE_TYPENAME TAO_Notify_Tests_Supplier_T<Supplier_Traits>::Proxy_Traits_PTR
+TAO_Notify_Tests_Supplier_T<Supplier_Traits>::obtain_proxy (ACE_TYPENAME TAO_Notify_Tests_Supplier_T<Supplier_Traits>::Admin_Traits_PTR admin_ptr ACE_ENV_ARG_DECL)
+{
+ Supplier_Traits traits;
+
+ CosNotifyChannelAdmin::ProxyConsumer_var proxy_consumer =
+ admin_ptr->obtain_notification_push_consumer (traits.type_
+ , this->proxy_id_
+ ACE_ENV_ARG_PARAMETER
+ );
+
+ ACE_CHECK_RETURN (Proxy_Traits_INTERFACE::_nil ());
+
+ ACE_ASSERT (!CORBA::is_nil (proxy_consumer.in ()));
+
+ return Proxy_Traits_INTERFACE::_narrow (proxy_consumer.in ()
+ ACE_ENV_ARG_PARAMETER);
+}
+
+template <class Supplier_Traits> ACE_TYPENAME TAO_Notify_Tests_Supplier_T<Supplier_Traits>::Proxy_Traits_PTR
+TAO_Notify_Tests_Supplier_T<Supplier_Traits>::obtain_proxy (ACE_TYPENAME TAO_Notify_Tests_Supplier_T<Supplier_Traits>::Admin_Ext_Traits_PTR admin_ptr
+ , CosNotification::QoSProperties& qos
+ ACE_ENV_ARG_DECL)
+{
+ Supplier_Traits traits;
+
+ // create the proxy consumer
+ CosNotifyChannelAdmin::ProxyConsumer_var proxy_consumer =
+ admin_ptr->obtain_notification_push_consumer_with_qos (traits.type_
+ , this->proxy_id_
+ , qos
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (Proxy_Traits_INTERFACE::_nil ());
+
+ ACE_ASSERT (!CORBA::is_nil (proxy_consumer.in ()));
+
+ return Proxy_Traits_INTERFACE::_narrow (proxy_consumer.in ()
+ ACE_ENV_ARG_PARAMETER);
+}
+
+template <class Supplier_Traits> void
+TAO_Notify_Tests_Supplier_T<Supplier_Traits>::offer_change (CosNotification::EventTypeSeq &added, CosNotification::EventTypeSeq& removed ACE_ENV_ARG_DECL)
+{
+ // Let the user see what we're subscribed for,
+ ACE_DEBUG ((LM_DEBUG, "(%P, %t) Calling Supplier offer change: \n"));
+
+ CORBA::ULong i = 0;
+
+ for (; i < added.length (); ++i)
+ {
+ ACE_DEBUG ((LM_DEBUG, "+(%s,%s), ", added[i].domain_name.in (), added[i].type_name.in ()));
+ }
+ for (i = 0; i < removed.length (); ++i)
+ {
+ ACE_DEBUG ((LM_DEBUG, "-(%s,%s), ", removed[i].domain_name.in (), removed[i].type_name.in ()));
+ }
+
+ ACE_DEBUG ((LM_DEBUG, "\n"));
+
+ /// subscribe
+ ACE_TYPENAME Proxy_Traits::PTR proxy_consumer = this->get_proxy ();
+
+ proxy_consumer->offer_change (added, removed ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+template <class Supplier_Traits> void
+TAO_Notify_Tests_Supplier_T<Supplier_Traits>::subscription_change (
+ const CosNotification::EventTypeSeq & /*added*/,
+ const CosNotification::EventTypeSeq & /*removed*/
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ CosNotifyComm::InvalidEventType
+ ))
+{
+ // No op.
+}
+#endif /* TAO_Notify_Tests_Supplier_T_CPP */
diff --git a/TAO/orbsvcs/tests/Notify/lib/Supplier_T.h b/TAO/orbsvcs/tests/Notify/lib/Supplier_T.h
new file mode 100644
index 00000000000..54d2faba200
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/Supplier_T.h
@@ -0,0 +1,99 @@
+/* -*- C++ -*- */
+/**
+ * @file Supplier_T.h
+ *
+ * $Id$
+ *
+ * @author Pradeep Gore <pradeep@oomworks.com>
+ *
+ *
+ */
+
+#ifndef TAO_Notify_Tests_SUPPLIER_T_H
+#define TAO_Notify_Tests_SUPPLIER_T_H
+#include /**/ "ace/pre.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "Peer_T.h"
+
+class TAO_Notify_Tests_SupplierAdmin_Traits
+{
+ public:
+ typedef CosNotifyChannelAdmin::SupplierAdmin INTERFACE;
+ typedef CosNotifyChannelAdmin::SupplierAdmin_ptr PTR;
+ typedef CosNotifyChannelAdmin::SupplierAdmin_var VAR;
+};
+
+class TAO_Notify_Tests_SupplierAdmin_Ext_Traits
+{
+ public:
+ typedef NotifyExt::SupplierAdmin INTERFACE;
+ typedef NotifyExt::SupplierAdmin_ptr PTR;
+ typedef NotifyExt::SupplierAdmin_var VAR;
+};
+
+/**
+ * @class TAO_Notify_Tests_Supplier_T
+ *
+ * @brief Base template to implement Suppliers.
+ *
+ */
+template <class Supplier_Traits>
+class TAO_Notify_Tests_Supplier_T : public TAO_Notify_Tests_Peer_T <Supplier_Traits>
+{
+ typedef ACE_TYPENAME Supplier_Traits::Admin_Traits Admin_Traits;
+ typedef ACE_TYPENAME Supplier_Traits::Admin_Ext_Traits Admin_Ext_Traits;
+ typedef ACE_TYPENAME Supplier_Traits::Proxy_Traits Proxy_Traits;
+
+ typedef ACE_TYPENAME Proxy_Traits::INTERFACE Proxy_Traits_INTERFACE;
+ typedef ACE_TYPENAME Proxy_Traits::PTR Proxy_Traits_PTR;
+ typedef ACE_TYPENAME Admin_Traits::PTR Admin_Traits_PTR;
+ typedef ACE_TYPENAME Admin_Ext_Traits::PTR Admin_Ext_Traits_PTR;
+
+public:
+ /// Constuctor
+ TAO_Notify_Tests_Supplier_T (void);
+
+ /// Destructor
+ ~TAO_Notify_Tests_Supplier_T ();
+
+ /// For backward compatibility. use <get_proxy> instead.
+ Proxy_Traits_PTR get_proxy_consumer (void);
+
+ /// Send offer change.
+ void offer_change (CosNotification::EventTypeSeq &added, CosNotification::EventTypeSeq& removed ACE_ENV_ARG_DECL);
+
+protected:
+ /// Obtain Proxy.
+ virtual Proxy_Traits_PTR obtain_proxy (Admin_Traits_PTR admin_ptr ACE_ENV_ARG_DECL);
+
+ /// Obtain Proxy with QoS.
+ virtual Proxy_Traits_PTR obtain_proxy (Admin_Ext_Traits_PTR admin_ptr
+ , CosNotification::QoSProperties& qos
+ ACE_ENV_ARG_DECL);
+
+ // = NotifySubscribe
+ virtual void subscription_change (
+ const CosNotification::EventTypeSeq & added,
+ const CosNotification::EventTypeSeq & removed
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ CosNotifyComm::InvalidEventType
+ ));
+};
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "Supplier_T.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+#pragma implementation ("Supplier_T.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+#include /**/ "ace/post.h"
+#endif /* TAO_Notify_Tests_SUPPLIER_T_H */
diff --git a/TAO/orbsvcs/tests/Notify/lib/Task_Callback.cpp b/TAO/orbsvcs/tests/Notify/lib/Task_Callback.cpp
new file mode 100644
index 00000000000..aa20cd8a7d3
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/Task_Callback.cpp
@@ -0,0 +1,7 @@
+//$Id$
+
+#include "Task_Callback.h"
+
+TAO_Notify_Tests_Task_Callback::~TAO_Notify_Tests_Task_Callback (void)
+{
+}
diff --git a/TAO/orbsvcs/tests/Notify/lib/Task_Callback.h b/TAO/orbsvcs/tests/Notify/lib/Task_Callback.h
new file mode 100644
index 00000000000..97caae326e0
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/Task_Callback.h
@@ -0,0 +1,40 @@
+/* -*- C++ -*- */
+/**
+ * @file Task_Callback.h
+ *
+ * $Id$
+ *
+ * @author Pradeep Gore <pradeep@oomworks.com>
+ *
+ *
+ */
+
+#ifndef TAO_Notify_Tests_TASK_CALLBACK_H
+#define TAO_Notify_Tests_TASK_CALLBACK_H
+#include /**/ "ace/pre.h"
+
+#include "notify_test_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+class TAO_Notify_Tests_Periodic_Supplier;
+class TAO_Notify_Tests_Periodic_Consumer;
+
+/**
+ * @class TAO_Notify_Tests_Task_Callback
+ *
+ * @brief
+ *
+ */
+class TAO_NOTIFY_TEST_Export TAO_Notify_Tests_Task_Callback
+{
+public:
+ virtual ~TAO_Notify_Tests_Task_Callback (void);
+ virtual void done (TAO_Notify_Tests_Periodic_Supplier* supplier) = 0;
+ virtual void done (TAO_Notify_Tests_Periodic_Consumer* consumer) = 0;
+};
+
+#include /**/ "ace/post.h"
+#endif /* TAO_Notify_Tests_TASK_CALLBACK_H */
diff --git a/TAO/orbsvcs/tests/Notify/lib/Task_Stats.cpp b/TAO/orbsvcs/tests/Notify/lib/Task_Stats.cpp
new file mode 100644
index 00000000000..3669f3987a1
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/Task_Stats.cpp
@@ -0,0 +1,149 @@
+//$Id$
+
+#include "Task_Stats.h"
+#include "ace/OS.h"
+#include "ace/Log_Msg.h"
+
+#if !defined (__ACE_INLINE__)
+#include "Task_Stats.inl"
+#endif /* __ACE_INLINE__ */
+
+ACE_UINT32 Task_Stats::gsf_ = ACE_High_Res_Timer::global_scale_factor ();
+
+Base_Time::Base_Time (void)
+{
+ base_time_ = ACE_OS::gethrtime ();
+}
+
+Task_Stats::Task_Stats (void)
+ : base_time_(0),
+ end_time_ (0),
+ max_samples_ (0),
+ samples_count_ (0),
+ time_inv_ (0),
+ time_exec_ (0),
+ mean_ (0),
+ var_2_ (0)
+{
+}
+
+Task_Stats::~Task_Stats (void)
+{
+ delete[] this->time_inv_;
+ delete[] this->time_exec_;
+}
+
+int
+Task_Stats::init (size_t max_samples)
+{
+ this->max_samples_ = max_samples;
+
+ ACE_NEW_RETURN (this->time_inv_, ACE_UINT64[this->max_samples_], -1);
+ ACE_NEW_RETURN (this->time_exec_, ACE_UINT64[this->max_samples_], -1);
+ return 0;
+}
+
+void
+Task_Stats::base_time (ACE_UINT64 time)
+{
+ base_time_ = time;
+}
+
+void
+Task_Stats::end_time (ACE_UINT64 time)
+{
+ end_time_ = time;
+}
+
+void
+Task_Stats::dump_samples (const ACE_TCHAR *file_name, const ACE_TCHAR *msg, int dump_samples)
+{
+ FILE* output_file = ACE_OS::fopen (file_name, "w");
+
+ // first dump what the caller has to say.
+ ACE_OS::fprintf (output_file, "%s\n",msg);
+
+ // next, compose and dump what we want to say.
+
+ // calc throughput.
+ double seconds = this->diff_sec (base_time_, end_time_);
+
+ char out_msg[BUFSIZ];
+
+ if (seconds == 0 || samples_count_ == 0)
+ {
+ ACE_OS::sprintf (out_msg,
+ "# No samples recorded\n");
+ ACE_OS::fprintf (output_file, "%s",out_msg);
+ ACE_OS::fclose (output_file);
+
+ return;
+ }
+
+ double t_avg = samples_count_ / seconds;
+
+ ACE_OS::sprintf (out_msg,
+ "# Throughput: %.2f (events/second) [%u samples in %.2f seconds]\n",
+ t_avg, samples_count_, seconds);
+ ACE_OS::fprintf (output_file, "%s",out_msg);
+
+ // Calc the mean.
+ size_t i = 0;
+
+ for (i = 0; i != this->samples_count_; ++i)
+ {
+ ACE_UINT32 val_2 = Task_Stats::diff_usec (time_inv_[i], time_exec_[i]);
+
+ // Write the normalized value.
+ // we will need this to calculate the var^2
+ this->time_exec_[i] = val_2;
+
+ this->mean_ += val_2;
+ }
+
+ // calculate the mean.
+ this->mean_ /= this->samples_count_;
+
+ // Calculate the var^2
+
+ for (i = 0; i != this->samples_count_; ++i)
+ {
+ ACE_UINT64 diff = this->time_exec_[i] - this->mean_;
+
+ ACE_UINT64 diff_sq =
+#if defined ACE_LACKS_LONGLONG_T
+ diff * ACE_U64_TO_U32(diff);
+#else /* ! ACE_LACKS_LONGLONG_T */
+ diff * diff;
+#endif /* ! ACE_LACKS_LONGLONG_T */
+
+ this->var_2_ += diff_sq;
+ }
+
+ this->var_2_ /= this->samples_count_;
+
+ ACE_OS::fprintf (output_file, "## Latency: Avg = %u, Var^2 = %u\n"
+ , ACE_CU64_TO_CU32 (this->mean_)
+ , ACE_CU64_TO_CU32 (this->var_2_));
+
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG, " Latency: Avg = %u, Var^2 = %u\n"
+ , ACE_CU64_TO_CU32 (this->mean_)
+ , ACE_CU64_TO_CU32 (this->var_2_)));
+
+ // if we are asked to, dump the samples recorded.
+ if (dump_samples)
+ {
+ ACE_OS::fprintf (output_file, "#Invocation time \t Execution time\n");
+
+ for (i = 0; i != this->samples_count_; ++i)
+ {
+ ACE_UINT32 val_1 = Task_Stats::diff_usec (base_time_, time_inv_[i]);
+
+ ACE_OS::fprintf (output_file, "%u \t %u\n",val_1,
+ ACE_CU64_TO_CU32 (time_exec_[i]));
+ }
+ }
+
+ ACE_OS::fclose (output_file);
+}
diff --git a/TAO/orbsvcs/tests/Notify/lib/Task_Stats.h b/TAO/orbsvcs/tests/Notify/lib/Task_Stats.h
new file mode 100644
index 00000000000..cc4d7190887
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/Task_Stats.h
@@ -0,0 +1,101 @@
+/* -*- C++ -*- */
+//=============================================================================
+/**
+ * @file Task_Stats.h
+ *
+ * $Id$
+ *
+ * Utility Stats class that maintains the readings.
+ *
+ * @author Pradeep Gore <pradeep@cs.wustl.edu>
+ */
+//=============================================================================
+#ifndef TASK_STATS_H
+#define TASK_STATS_H
+
+#include "ace/OS_NS_time.h"
+#include "ace/Singleton.h"
+#include "tao/orbconf.h"
+#include "tao/debug.h"
+#include "notify_test_export.h"
+
+/**
+ * @class Base_Time
+ *
+ * @brief maintains readings recorded by tasks.
+ *
+ */
+class TAO_NOTIFY_TEST_Export Base_Time
+{
+ public:
+ Base_Time (void);
+ ACE_hrtime_t base_time_;
+};
+
+typedef ACE_Singleton<Base_Time, TAO_SYNCH_MUTEX> BASE_TIME;
+
+/**
+ * @class Task_Stats
+ *
+ * @brief maintains readings recorded by tasks.
+ *
+ */
+class TAO_NOTIFY_TEST_Export Task_Stats
+{
+ public:
+ /// Constructor
+ Task_Stats (void);
+
+ /// Destructor
+ ~Task_Stats (void);
+
+ /// Useful Global Scale Factor
+ static ACE_UINT32 gsf_;
+
+ /// Init
+ int init (size_t max_samples);
+
+ /// Useful helper to calculate diff in sec.
+ static double diff_sec (ACE_UINT64 before, ACE_UINT64 after);
+
+ /// Useful helper to calculate diff in usec.
+ static ACE_UINT32 diff_usec (ACE_UINT64 before, ACE_UINT64 after);
+
+ /// Set the base time value.
+ void base_time (ACE_UINT64 time);
+
+ /// Set the end time value.
+ void end_time (ACE_UINT64 time);
+
+ /// Record a sample
+ int sample (ACE_UINT64 inv_start_time, ACE_UINT64 inv_end_time);
+
+ void dump_samples (const ACE_TCHAR *file_name, const ACE_TCHAR *msg, int dump_samples);
+
+ protected:
+ /// Base and end times
+ ACE_UINT64 base_time_;
+ ACE_UINT64 end_time_;
+
+ /// The maximum number of samples
+ ACE_UINT32 max_samples_;
+
+ /// The number of samples
+ ACE_UINT32 samples_count_;
+
+ /// The samples : the time of invocation. and the recorded exec. time .
+ ACE_UINT64 *time_inv_;
+ ACE_UINT64 *time_exec_;
+
+ /// The mean of the data set.
+ ACE_UINT64 mean_;
+
+ /// The Var^2 of the data set.
+ ACE_UINT64 var_2_;
+};
+
+#if defined (__ACE_INLINE__)
+#include "Task_Stats.inl"
+#endif /* __ACE_INLINE__ */
+
+#endif /* TASK_STATS_H */
diff --git a/TAO/orbsvcs/tests/Notify/lib/Task_Stats.inl b/TAO/orbsvcs/tests/Notify/lib/Task_Stats.inl
new file mode 100644
index 00000000000..aed41117a3d
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/Task_Stats.inl
@@ -0,0 +1,54 @@
+//$Id$
+
+#include "ace/High_Res_Timer.h"
+#include "ace/Log_Msg.h"
+
+ACE_INLINE double
+Task_Stats::diff_sec (ACE_UINT64 before, ACE_UINT64 after)
+{
+ double seconds =
+#if defined ACE_LACKS_LONGLONG_T
+ (after - before) / gsf_;
+#else /* ! ACE_LACKS_LONGLONG_T */
+ static_cast<double> (ACE_UINT64_DBLCAST_ADAPTER((after - before) / gsf_));
+#endif /* ! ACE_LACKS_LONGLONG_T */
+ seconds /= ACE_HR_SCALE_CONVERSION;
+
+ return seconds;
+}
+
+ACE_INLINE ACE_UINT32
+Task_Stats::diff_usec (ACE_UINT64 before, ACE_UINT64 after)
+{
+ // convert to microseconds
+ #if !defined ACE_LACKS_LONGLONG_T
+ ACE_UINT32 elapsed_microseconds = ACE_UINT32((after - before) / gsf_);
+ #else /* ! ACE_LACKS_LONGLONG_T */
+
+ ACE_UINT32 elapsed_microseconds = (after - before) / gsf_;
+
+ #endif /* ! ACE_LACKS_LONGLONG_T */
+
+ #if defined (ACE_WIN32)
+ elapsed_microseconds*=1000; // convert to uSec on Win32
+ #endif /* ACE_WIN32 */
+
+ return elapsed_microseconds;
+}
+
+ACE_INLINE int
+Task_Stats::sample (ACE_UINT64 inv_start_time, ACE_UINT64 inv_end_time)
+{
+ if (this->samples_count_ >= this->max_samples_)
+ {
+ ACE_DEBUG ((LM_DEBUG, "Task_Stats::sample ret -1\n"));
+ return -1;
+ }
+
+ this->time_inv_[this->samples_count_] = inv_start_time;
+ this->time_exec_[this->samples_count_] = inv_end_time;
+
+ this->samples_count_++;
+
+ return 0;
+}
diff --git a/TAO/orbsvcs/tests/Notify/lib/common.cpp b/TAO/orbsvcs/tests/Notify/lib/common.cpp
new file mode 100644
index 00000000000..ff6f0bc6296
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/common.cpp
@@ -0,0 +1,56 @@
+// $Id$
+
+#include "common.h"
+
+#include "orbsvcs/CosNotifyCommC.h"
+#include "orbsvcs/CosNamingC.h"
+#include "ace/OS_NS_stdio.h"
+#include "ace/OS_NS_string.h"
+
+
+const char*
+Any_String (const CORBA::Any& any)
+{
+ static char out[256] = "";
+ CORBA::Short s;
+ CORBA::UShort us;
+ CORBA::Long l;
+ CORBA::ULong ul;
+ CORBA::ULongLong ull;
+ const char* str;
+
+ if (any >>= s)
+ {
+ ACE_OS::sprintf (out, ACE_INT16_FORMAT_SPECIFIER, s);
+ }
+ else if (any >>= us)
+ {
+ ACE_OS::sprintf (out, ACE_UINT16_FORMAT_SPECIFIER, us);
+ }
+ else if (any >>= l)
+ {
+ ACE_OS::sprintf (out, ACE_INT32_FORMAT_SPECIFIER, l);
+ }
+ else if (any >>= ul)
+ {
+ ACE_OS::sprintf (out, ACE_UINT32_FORMAT_SPECIFIER, ul);
+ }
+ else if (any >>= str)
+ {
+ ACE_OS::strcpy (out, str);
+ }
+ else if (any >>= ull)
+ {
+#if defined (ACE_LACKS_LONGLONG_T)
+ ACE_OS::strcpy (out, ull.as_string (out));
+#else
+ ACE_OS::sprintf (out, ACE_UINT64_FORMAT_SPECIFIER, ull);
+#endif /* ACE_LACKS_LONGLONG_T */
+ }
+ else
+ {
+ ACE_OS::strcpy (out, "Unsupported Any Type");
+ }
+
+ return out;
+}
diff --git a/TAO/orbsvcs/tests/Notify/lib/common.h b/TAO/orbsvcs/tests/Notify/lib/common.h
new file mode 100644
index 00000000000..7704baa6a25
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/common.h
@@ -0,0 +1,36 @@
+/* -*- C++ -*- */
+// $Id$
+// ==========================================================================
+//
+// = LIBRARY
+// TAO/orbsvcs/tests/Notify/lib
+//
+// = FILENAME
+// common.h
+//
+// = DESCRIPTION
+// A couple of useful functions
+//
+// = AUTHOR
+// Chad Elliott <elliott_c@ociweb.com>
+//
+// ==========================================================================
+#ifndef TAO_COMMON_H
+#define TAO_COMMON_H
+
+#include /**/ "ace/pre.h"
+
+#include "notify_test_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "orbsvcs/CosNotifyChannelAdminS.h"
+
+
+TAO_NOTIFY_TEST_Export
+const char* Any_String (const CORBA::Any& any);
+
+#include /**/ "ace/post.h"
+#endif /* TAO_COMMON_H */
diff --git a/TAO/orbsvcs/tests/Notify/lib/notify_test_export.h b/TAO/orbsvcs/tests/Notify/lib/notify_test_export.h
new file mode 100644
index 00000000000..867568dfe87
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/lib/notify_test_export.h
@@ -0,0 +1,40 @@
+
+// -*- C++ -*-
+// $Id$
+// Definition for Win32 Export directives.
+// This file is generated automatically by generate_export_file.pl
+// ------------------------------
+#ifndef TAO_NOTIFY_TEST_EXPORT_H
+#define TAO_NOTIFY_TEST_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if defined (TAO_AS_STATIC_LIBS)
+# if !defined (TAO_NOTIFY_TEST_HAS_DLL)
+# define TAO_NOTIFY_TEST_HAS_DLL 0
+# endif /* ! TAO_NOTIFY_TEST_HAS_DLL */
+#else
+# if !defined (TAO_NOTIFY_TEST_HAS_DLL)
+# define TAO_NOTIFY_TEST_HAS_DLL 1
+# endif /* ! TAO_NOTIFY_TEST_HAS_DLL */
+#endif
+
+#if defined (TAO_NOTIFY_TEST_HAS_DLL) && (TAO_NOTIFY_TEST_HAS_DLL == 1)
+# if defined (TAO_NOTIFY_TEST_BUILD_DLL)
+# define TAO_NOTIFY_TEST_Export ACE_Proper_Export_Flag
+# define TAO_NOTIFY_TEST_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define TAO_NOTIFY_TEST_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* TAO_NOTIFY_TEST_BUILD_DLL */
+# define TAO_NOTIFY_TEST_Export ACE_Proper_Import_Flag
+# define TAO_NOTIFY_TEST_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define TAO_NOTIFY_TEST_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* TAO_NOTIFY_TEST_BUILD_DLL */
+#else /* TAO_NOTIFY_TEST_HAS_DLL == 1 */
+# define TAO_NOTIFY_TEST_Export
+# define TAO_NOTIFY_TEST_SINGLETON_DECLARATION(T)
+# define TAO_NOTIFY_TEST_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* TAO_NOTIFY_TEST_HAS_DLL == 1 */
+
+#endif /* TAO_NOTIFY_TEST_EXPORT_H */
+
+// End of auto generated file.