summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/tests/Notify/Basic
diff options
context:
space:
mode:
authorWilliam R. Otte <wotte@dre.vanderbilt.edu>2006-07-24 15:50:21 +0000
committerWilliam R. Otte <wotte@dre.vanderbilt.edu>2006-07-24 15:50:21 +0000
commit3aff90f4a822fcf5d902bbfbcc9fa931d6191a8c (patch)
tree197c810e5f5bce17b1233a7cb8d7b50c0bcd25e2 /TAO/orbsvcs/tests/Notify/Basic
parent6b846cf03c0bcbd8c276cb0af61a181e5f98eaae (diff)
downloadATCD-3aff90f4a822fcf5d902bbfbcc9fa931d6191a8c.tar.gz
Repo restructuring
Diffstat (limited to 'TAO/orbsvcs/tests/Notify/Basic')
-rw-r--r--TAO/orbsvcs/tests/Notify/Basic/AdminProperties.cpp490
-rw-r--r--TAO/orbsvcs/tests/Notify/Basic/AdminProperties.h153
-rw-r--r--TAO/orbsvcs/tests/Notify/Basic/Basic.mpc73
-rw-r--r--TAO/orbsvcs/tests/Notify/Basic/ConnectDisconnect.cpp382
-rw-r--r--TAO/orbsvcs/tests/Notify/Basic/ConnectDisconnect.h136
-rw-r--r--TAO/orbsvcs/tests/Notify/Basic/Events.cpp355
-rw-r--r--TAO/orbsvcs/tests/Notify/Basic/Events.h132
-rw-r--r--TAO/orbsvcs/tests/Notify/Basic/Filter.cpp249
-rw-r--r--TAO/orbsvcs/tests/Notify/Basic/Filter.h92
-rw-r--r--TAO/orbsvcs/tests/Notify/Basic/IdAssignment.cpp489
-rw-r--r--TAO/orbsvcs/tests/Notify/Basic/IdAssignment.h71
-rw-r--r--TAO/orbsvcs/tests/Notify/Basic/LifeCycle.cpp271
-rw-r--r--TAO/orbsvcs/tests/Notify/Basic/LifeCycle.h49
-rw-r--r--TAO/orbsvcs/tests/Notify/Basic/Makefile.am494
-rw-r--r--TAO/orbsvcs/tests/Notify/Basic/MultiTypes.cpp412
-rw-r--r--TAO/orbsvcs/tests/Notify/Basic/MultiTypes.h169
-rw-r--r--TAO/orbsvcs/tests/Notify/Basic/README109
-rw-r--r--TAO/orbsvcs/tests/Notify/Basic/Sequence.cpp387
-rw-r--r--TAO/orbsvcs/tests/Notify/Basic/Sequence.h142
-rw-r--r--TAO/orbsvcs/tests/Notify/Basic/Simple.cpp271
-rw-r--r--TAO/orbsvcs/tests/Notify/Basic/Simple.h130
-rw-r--r--TAO/orbsvcs/tests/Notify/Basic/Updates.cpp488
-rw-r--r--TAO/orbsvcs/tests/Notify/Basic/Updates.h148
-rw-r--r--TAO/orbsvcs/tests/Notify/Basic/adminproperties.conf6
-rw-r--r--TAO/orbsvcs/tests/Notify/Basic/notify.mt.conf2
-rw-r--r--TAO/orbsvcs/tests/Notify/Basic/notify.reactive.conf2
-rw-r--r--TAO/orbsvcs/tests/Notify/Basic/notify.rt.conf5
-rwxr-xr-xTAO/orbsvcs/tests/Notify/Basic/run_test.pl152
-rwxr-xr-xTAO/orbsvcs/tests/Notify/Basic/run_test_ipv6.pl145
29 files changed, 6004 insertions, 0 deletions
diff --git a/TAO/orbsvcs/tests/Notify/Basic/AdminProperties.cpp b/TAO/orbsvcs/tests/Notify/Basic/AdminProperties.cpp
new file mode 100644
index 00000000000..08309efacca
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/Basic/AdminProperties.cpp
@@ -0,0 +1,490 @@
+// $Id$
+
+#include "AdminProperties.h"
+#include "ace/Arg_Shifter.h"
+#include "ace/Get_Opt.h"
+#include "ace/OS_NS_unistd.h"
+#include "tao/debug.h"
+
+/***************************************************************************/
+
+AdminProperties_Task::AdminProperties_Task (void)
+ : supplier_ (0)
+ , client_ (0)
+{
+}
+
+void
+AdminProperties_Task::init (TAO_Notify_Tests_StructuredPushSupplier *supplier, AdminProperties* client)
+{
+ supplier_ = supplier;
+ client_ = client;
+}
+
+int
+AdminProperties_Task::init (int argc, ACE_TCHAR *argv[])
+{
+ return ACE_Task_Base::init (argc, argv);
+}
+
+int
+AdminProperties_Task::svc (void)
+{
+ // operations:
+ CosNotification::StructuredEvent event;
+
+ // EventHeader
+
+ // FixedEventHeader
+ // EventType
+ // string
+ event.header.fixed_header.event_type.domain_name = CORBA::string_dup("*");
+ // string
+ event.header.fixed_header.event_type.type_name = CORBA::string_dup("*");
+ // string
+ event.header.fixed_header.event_name = CORBA::string_dup("myevent");
+
+ // OptionalHeaderFields
+ // PropertySeq
+ // sequence<Property>: string name, any value
+ event.header.variable_header.length (0); // put nothing here
+
+ // FilterableEventBody
+ // PropertySeq
+ // sequence<Property>: string name, any value
+ event.filterable_data.length (3);
+ event.filterable_data[0].name = CORBA::string_dup("threshold");
+
+ event.filterable_data[1].name = CORBA::string_dup("temperature");
+ event.filterable_data[1].value <<= (CORBA::Long)70;
+
+ event.filterable_data[2].name = CORBA::string_dup("pressure");
+ event.filterable_data[2].value <<= (CORBA::Long)80;
+
+ // @@ CORBA::Short prio = CosNotification::LowestPriority;
+
+ int event_count = this->client_->event_count_;
+
+ ACE_DEBUG ((LM_DEBUG, "\n1 supplier sending %d events...\n", event_count));
+
+ ACE_DECLARE_NEW_CORBA_ENV;
+
+ for (int i = 0 ; i < event_count; ++i)
+ {
+ event.filterable_data[0].value <<= (CORBA::Long)i;
+
+ event.remainder_of_body <<= (CORBA::Long)i;
+
+ ACE_TRY
+ {
+ ACE_DEBUG((LM_DEBUG, "+"));
+ this->supplier_->send_event (event ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCH (CORBA::IMP_LIMIT, impl_limit)
+ {
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG, "\nEvent %d was not send due to Impl Limit reached\n", i));
+
+ ++ this->client_->rejections_;
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Error: Exception sending event\n");
+ return 1;
+ }
+ ACE_ENDTRY;
+ }
+
+return 0;
+}
+/***************************************************************************/
+
+AdminProperties_StructuredPushConsumer::AdminProperties_StructuredPushConsumer (AdminProperties* client)
+ : client_ (client)
+ , events_received_ (0)
+{
+ client_->consumer_start(this);
+}
+
+void
+AdminProperties_StructuredPushConsumer::push_structured_event (const CosNotification::StructuredEvent & /*notification*/
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException,CosEventComm::Disconnected))
+{
+ ++events_received_;
+
+ if (events_received_ >= client_->max_queue_length_)
+ client_->consumer_done(this);
+
+ ACE_DEBUG((LM_DEBUG, "-"));
+
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG, "\nConsumer %x received event %d\n", this, events_received_.value ()));
+}
+
+/***************************************************************************/
+
+AdminProperties::AdminProperties (void)
+ : max_queue_length_ (10),
+ max_consumers_ (3),
+ max_suppliers_ (3),
+ reject_new_events_ (0),
+ consumers_ (4),
+ suppliers_ (4),
+ event_count_ (30),
+ suppliers_connected_count_ (0),
+ consumers_connected_count_ (0),
+ rejections_ (0)
+{
+}
+
+AdminProperties::~AdminProperties (void)
+{
+}
+
+int
+AdminProperties::parse_args(int argc, char *argv[])
+{
+ ACE_Arg_Shifter arg_shifter (argc, argv);
+
+ const char *current_arg = 0;
+
+ while (arg_shifter.is_anything_left ())
+ {
+ if ((current_arg = arg_shifter.get_the_parameter ("-max_queue_length")))
+ {
+ this->max_queue_length_ = ACE_OS::atoi (current_arg);
+ // Max. queue length.
+
+ arg_shifter.consume_arg ();
+ }
+ else if ((current_arg = arg_shifter.get_the_parameter ("-max_consumers")))
+ {
+ this->max_consumers_ = ACE_OS::atoi (current_arg);
+ // Max consumers allowed to connect.
+ arg_shifter.consume_arg ();
+ }
+ else if ((current_arg = arg_shifter.get_the_parameter ("-max_suppliers")))
+ {
+ this->max_suppliers_ = ACE_OS::atoi (current_arg);
+ // Max. number of suppliers allowed to connect.
+ arg_shifter.consume_arg ();
+ }
+ else if (arg_shifter.cur_arg_strncasecmp ("-reject_new_events") == 0)
+ {
+ this->reject_new_events_ = 1;
+ arg_shifter.consume_arg ();
+ }
+ else if ((current_arg = arg_shifter.get_the_parameter ("-consumers")))
+ {
+ this->consumers_ = ACE_OS::atoi (current_arg);
+ // Number of consumers to create.
+ arg_shifter.consume_arg ();
+ }
+ else if ((current_arg = arg_shifter.get_the_parameter ("-suppliers")))
+ {
+ this->suppliers_ = ACE_OS::atoi (current_arg);
+ // Number of suppliers to create.
+ arg_shifter.consume_arg ();
+ }
+ else if (arg_shifter.cur_arg_strncasecmp ("-?") == 0)
+ {
+ ACE_DEBUG((LM_DEBUG,
+ "usage: %s "
+ "-max_queue_length [max_queue_length] "
+ "-max_consumers [max_consumers] "
+ "-max_suppliers [max_suppliers] "
+ "-reject_new_events [reject_new_events] "
+ "-consumers [consumers] "
+ "-suppliers [suppliers] "
+ "-event_count [event_count] ",
+ argv[0],
+ argv[0]));
+
+ arg_shifter.consume_arg ();
+
+ return -1;
+ }
+ else
+ {
+ arg_shifter.ignore_arg ();
+ }
+ }
+ return 0;
+}
+
+void
+AdminProperties::create_channel(bool reject ACE_ENV_ARG_DECL)
+{
+ CosNotifyChannelAdmin::ChannelID id;
+
+ initial_admin_.length (4);
+
+ this->initial_admin_[0].name =
+ CORBA::string_dup (CosNotification::MaxQueueLength);
+ this->initial_admin_[0].value <<= this->max_queue_length_;
+
+
+ this->initial_admin_[1].name =
+ CORBA::string_dup (CosNotification::MaxSuppliers);
+ this->initial_admin_[1].value <<= this->max_suppliers_;
+
+ this->initial_admin_[2].name =
+ CORBA::string_dup (CosNotification::MaxConsumers);
+ this->initial_admin_[2].value <<= this->max_consumers_;
+
+
+ this->initial_admin_[3].name =
+ CORBA::string_dup (CosNotification::RejectNewEvents);
+ this->initial_admin_[3].value <<= CORBA::Any::from_boolean (reject);
+
+ this->ec_ = notify_factory_->create_channel (this->initial_qos_,
+ this->initial_admin_,
+ id
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ ACE_ASSERT (!CORBA::is_nil (ec_.in ()));
+
+
+ CosNotifyChannelAdmin::AdminID adminid;
+
+ this->supplier_admin_ = ec_->new_for_suppliers (this->ifgop_,
+ adminid
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ ACE_ASSERT (!CORBA::is_nil (supplier_admin_.in ()));
+
+ this->consumer_admin_ = ec_->new_for_consumers (this->ifgop_,
+ adminid
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ ACE_ASSERT (!CORBA::is_nil (consumer_admin_.in ()));
+}
+
+void
+AdminProperties::run_test (ACE_ENV_SINGLE_ARG_DECL)
+{
+ bool reject = true;
+ this->create_channel(reject ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ this->test_max_queue_length (reject ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->ec_->destroy(ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ reject = false;
+ this->create_channel(reject ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ this->test_max_queue_length (reject ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->test_max_clients (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->ec_->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+void
+AdminProperties::test_max_queue_length (bool reject ACE_ENV_ARG_DECL)
+{
+ // Create the consumer
+ AdminProperties_StructuredPushConsumer *consumer;
+ ACE_NEW (consumer, AdminProperties_StructuredPushConsumer (this));
+ consumer->init (root_poa_.in () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ consumer->connect (this->consumer_admin_.in () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Create the supplier
+ TAO_Notify_Tests_StructuredPushSupplier *supplier = 0;
+ ACE_NEW (supplier, TAO_Notify_Tests_StructuredPushSupplier ());
+ supplier->init (root_poa_.in () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ supplier->connect (this->supplier_admin_.in () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ AdminProperties_Task supplier_task;
+
+ // Init the Task to send events;
+ supplier_task.init (supplier, this);
+
+ if (supplier_task.activate (THR_NEW_LWP | THR_JOINABLE, 1) != 0)
+ {
+ ACE_ERROR ((LM_ERROR, "\nCannot activate supplier task\n"));
+ }
+
+ // All supplier events should be sent before the first consumer event is
+ // received. This relies on our use of -ORBClientConnectionHandler RW.
+ supplier_task.wait ();
+
+ this->ORB_run(ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // consumer is destroyed by consumer->disconnect()
+ CORBA::Long received_count = consumer->events_received_.value ();
+
+ // disconnect the participants.
+ consumer->disconnect (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ supplier->disconnect (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // If the reject_new_events setting == true, then the supplier should
+ // have received an imp_limit exception for each event it tried to push
+ // after the maximum was reached.
+ // If the reject_new_events setting == false, then the events should
+ // have been discarded according to the DiscardPolicy, which for this
+ // test we leave as AnyOrder.
+
+ ACE_DEBUG ((LM_DEBUG, "\nSupplier sent %d events, consumer received %d events, max_queue_length = %d\n",
+ event_count_, received_count, max_queue_length_));
+
+ int expected_min = max_queue_length_;
+ int expected_max = max_queue_length_ + max_consumers_;
+ if (reject)
+ {
+ expected_max = event_count_ - rejections_;
+ expected_min = expected_max;
+ }
+
+ if (reject && rejections_ != event_count_ - received_count)
+ {
+ ACE_ERROR ((LM_ERROR, "\nError: Expected %d rejections, but got %d\n",
+ event_count_ - received_count, rejections_));
+ return;
+ }
+
+ if (received_count < expected_min || received_count > expected_max)
+ {
+ ACE_ERROR ((LM_ERROR, "\nError: Expected %d to %d events, but received %d\n",
+ expected_min, expected_max, received_count));
+ }
+}
+
+void
+AdminProperties::test_max_clients (ACE_ENV_SINGLE_ARG_DECL)
+{
+ this->create_suppliers (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->create_consumers (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // check the results and print the assessment.
+ if (this->consumers_connected_count_ > this->max_consumers_)
+ ACE_DEBUG ((LM_ERROR, "\nConnected consumers %d, exceed MaxConsumers %d\n",
+ this->consumers_connected_count_ > this->max_consumers_));
+
+ if (this->suppliers_connected_count_ > this->max_suppliers_)
+ ACE_DEBUG ((LM_ERROR, "\nConnected suppliers %d, exceed MaxSuppliers %d\n",
+ this->suppliers_connected_count_ > this->max_suppliers_));
+}
+
+void
+AdminProperties::create_suppliers (ACE_ENV_SINGLE_ARG_DECL)
+{
+ // Create the requested number of suppliers.
+ // @@ CosNotifyChannelAdmin::AdminID adminid;
+ // @@ CosNotifyChannelAdmin::InterFilterGroupOperator ifgop =
+ // @@ CosNotifyChannelAdmin::OR_OP;
+
+ int index = 0;
+
+ ACE_TRY
+ {
+ TAO_Notify_Tests_StructuredPushSupplier *supplier;
+
+ for (index = 0; index < this->suppliers_; ++index)
+ {
+ ACE_NEW (supplier,
+ TAO_Notify_Tests_StructuredPushSupplier ());
+ supplier->init (root_poa_.in () ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ supplier->connect (this->supplier_admin_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ this->suppliers_connected_count_++;
+ }
+ }
+ ACE_CATCH (CORBA::IMP_LIMIT, impl_limit)
+ {
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG, "\nImpl Limit excpetion when connecting supplier\n"));
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "\nError: Exception in connecting supplier\n");
+ }
+ ACE_ENDTRY;
+}
+
+void
+AdminProperties::create_consumers (ACE_ENV_SINGLE_ARG_DECL)
+{
+ // Create the requested number of suppliers.
+ // @@ CosNotifyChannelAdmin::AdminID adminid;
+ // @@ CosNotifyChannelAdmin::InterFilterGroupOperator ifgop =
+ // @@ CosNotifyChannelAdmin::OR_OP;
+
+ int index = 0;
+
+ ACE_TRY
+ {
+ TAO_Notify_Tests_StructuredPushConsumer *consumer;
+
+ for (index = 0; index < this->consumers_; ++index)
+ {
+ ACE_NEW (consumer, TAO_Notify_Tests_StructuredPushConsumer ());
+ consumer->init (root_poa_.in () ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ consumer->connect (this->consumer_admin_.in () ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ this->consumers_connected_count_++;
+ }
+ }
+ ACE_CATCH (CORBA::IMP_LIMIT, impl_limit)
+ {
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG, "\nImpl Limit exception when connecting consumer\n"));
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "\nError: Exception in connecting consumer \n");
+ }
+ ACE_ENDTRY;
+}
+
+/***************************************************************************/
+
+int
+main (int argc, char* argv[])
+{
+ AdminProperties test;
+
+ ACE_TRY_NEW_ENV
+ {
+ test.init (argc, argv ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ test.run_test (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCH (CORBA::Exception, se)
+ {
+ ACE_PRINT_EXCEPTION (se, "Error: ");
+ return 1;
+ }
+ ACE_ENDTRY;
+ return 0;
+}
diff --git a/TAO/orbsvcs/tests/Notify/Basic/AdminProperties.h b/TAO/orbsvcs/tests/Notify/Basic/AdminProperties.h
new file mode 100644
index 00000000000..44abf483bf7
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/Basic/AdminProperties.h
@@ -0,0 +1,153 @@
+/* -*- C++ -*- */
+// $Id$
+// ==========================================================================
+//
+// = FILENAME
+// AdminProperties.h
+//
+// = DESCRIPTION
+// Test for EC Admin QoS properties.
+//
+// = AUTHOR
+// Pradeep Gore <pradeep@cs.wustl.edu>
+//
+// ==========================================================================
+
+#ifndef ADMINPROPERTIES
+#define ADMINPROPERTIES
+
+#include "ace/Task.h"
+#include "Notify_Test_Client.h"
+#include "Notify_StructuredPushConsumer.h"
+#include "Notify_StructuredPushSupplier.h"
+
+class AdminProperties;
+/***************************************************************************/
+
+class AdminProperties_StructuredPushConsumer : public TAO_Notify_Tests_StructuredPushConsumer
+{
+ friend class AdminProperties;
+public:
+ AdminProperties_StructuredPushConsumer (AdminProperties* client);
+
+ // = StructuredPushSupplier methods
+ virtual void push_structured_event (const CosNotification::StructuredEvent & notification
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ CosEventComm::Disconnected
+ ));
+
+protected:
+ AdminProperties* client_;
+
+ ACE_Atomic_Op <TAO_SYNCH_MUTEX, CORBA::Long> events_received_;
+};
+
+
+class AdminProperties_Task : public ACE_Task_Base
+{
+ // = TITLE
+ // Run a thread to dispatch events.
+ //
+ // = DESCRIPTION
+ // Use the ACE_Task_Base class.
+ //
+
+public:
+ AdminProperties_Task (void);
+ // Constructor.
+
+ /// Init this object.
+ void init (TAO_Notify_Tests_StructuredPushSupplier *supplier, AdminProperties* client);
+
+ virtual int init (int argc, ACE_TCHAR *argv []);
+
+ virtual int svc (void);
+ // The thread entry point.
+
+private:
+ /// Supplier
+ TAO_Notify_Tests_StructuredPushSupplier *supplier_;
+
+ /// Client Object.
+ AdminProperties* client_;
+};
+
+/***************************************************************************/
+
+class AdminProperties : public Notify_Test_Client
+{
+ // = TITLE
+ // AdminProperties
+ //
+ // = DESCRIPTION
+ // Test for Notify EC properties -
+ // max_queue_length
+ // max_consumers
+ // max_suppliers
+ // reject_new_events
+ //
+
+ friend class AdminProperties_StructuredPushConsumer;
+ friend class AdminProperties_Task;
+
+public:
+ AdminProperties (void);
+ ~AdminProperties (void);
+
+ int parse_args (int argc, char *argv[]) ;
+
+ // Initialization.
+
+ void run_test (ACE_ENV_SINGLE_ARG_DECL);
+ // Run the test.
+
+private:
+ void create_suppliers (ACE_ENV_SINGLE_ARG_DECL);
+ void create_consumers (ACE_ENV_SINGLE_ARG_DECL);
+ void create_channel(bool reject ACE_ENV_ARG_DECL);
+
+ /// Test MaxSuppliers and MaxConsumers
+ void test_max_clients (ACE_ENV_SINGLE_ARG_DECL);
+
+ /// Test MaxQueueLength properties
+ void test_max_queue_length (bool reject ACE_ENV_ARG_DECL);
+
+ // Data Members
+ CosNotifyChannelAdmin::EventChannel_var ec_;
+ // The one channel that we create using the factory.
+
+ CosNotifyChannelAdmin::ConsumerAdmin_var consumer_admin_;
+ // The consumer admin used by consumers.
+
+ CosNotifyChannelAdmin::SupplierAdmin_var supplier_admin_;
+ // The supplier admin used by suppliers.
+
+ CORBA::Long max_queue_length_;
+ CORBA::Long max_consumers_;
+ CORBA::Long max_suppliers_;
+ CORBA::Boolean reject_new_events_;
+ // Values for Admin Properties supplied by user.
+
+ /// Number of consumers to connect to check MaxConsumers property.
+ CORBA::Long consumers_;
+
+ /// Number of suppliers to connect to check MaxSuppliers property.
+ CORBA::Long suppliers_;
+
+ CORBA::Long event_count_;
+ // Number of events to send to the channel.
+
+ /// Count of consumers successfully connect to the EC.
+ int suppliers_connected_count_;
+
+ /// Count of consumers successfully connect to the EC.
+ int consumers_connected_count_;
+
+ // Number of supplier pushes that resulted in an IMP_LIMIT exception
+ int rejections_;
+};
+
+#endif /* ADMINPROPERTIES */
diff --git a/TAO/orbsvcs/tests/Notify/Basic/Basic.mpc b/TAO/orbsvcs/tests/Notify/Basic/Basic.mpc
new file mode 100644
index 00000000000..8ffdc65eb82
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/Basic/Basic.mpc
@@ -0,0 +1,73 @@
+// -*- MPC -*-
+// $Id$
+
+project(*Notify ConnectDisconnect): notifytest {
+ exename = ConnectDisconnect
+ Source_Files {
+ ConnectDisconnect.cpp
+ }
+}
+
+
+project(*Notify LifeCycle): notifytest {
+ exename = LifeCycle
+ Source_Files {
+ LifeCycle.cpp
+ }
+}
+
+project(*Notify IdAssignment): notifytest {
+ exename = IdAssignment
+ Source_Files {
+ IdAssignment.cpp
+ }
+}
+
+project(*Notify Events): notifytest {
+ exename = Events
+ Source_Files {
+ Events.cpp
+ }
+}
+
+project(*Notify AdminProperties): notifytest {
+ exename = AdminProperties
+ Source_Files {
+ AdminProperties.cpp
+ }
+}
+
+project(*Notify Simple): notifytest {
+ exename = Simple
+ Source_Files {
+ Simple.cpp
+ }
+}
+
+project(*Notify MultiTypes): notifytest {
+ exename = MultiTypes
+ Source_Files {
+ MultiTypes.cpp
+ }
+}
+
+project(*Notify Filter): notifytest {
+ exename = Filter
+ Source_Files {
+ Filter.cpp
+ }
+}
+
+project(*Notify Updates): notifytest {
+ exename = Updates
+ Source_Files {
+ Updates.cpp
+ }
+}
+
+project(*Notify Sequence): notifytest {
+ exename = Sequence
+ Source_Files {
+ Sequence.cpp
+ }
+}
diff --git a/TAO/orbsvcs/tests/Notify/Basic/ConnectDisconnect.cpp b/TAO/orbsvcs/tests/Notify/Basic/ConnectDisconnect.cpp
new file mode 100644
index 00000000000..f3087187a05
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/Basic/ConnectDisconnect.cpp
@@ -0,0 +1,382 @@
+//$Id$
+
+#include "ace/Arg_Shifter.h"
+#include "ace/Get_Opt.h"
+#include "tao/debug.h"
+#include "ConnectDisconnect.h"
+
+ACE_RCSID (Notify_Tests, ConnectDisconnect, "$Id$")
+
+#define CD_IMPLEMENT_ENTITY(X)\
+\
+CD_##X::CD_##X (ConnectDisconnect* cd, int id) \
+ :CD_Entity (cd, id) \
+{ \
+}
+
+CD_Entity::CD_Entity (ConnectDisconnect* cd, int id)
+ :id_ (id),
+ cd_ (cd)
+{
+}
+
+CD_Entity::~CD_Entity ()
+{
+ if (TAO_debug_level)
+ {
+ ACE_DEBUG ((LM_DEBUG, "Entity #%d destroyed\n", this->id_));
+ }
+
+ cd_->on_entity_destroyed ();
+}
+
+CD_IMPLEMENT_ENTITY(PushConsumer)
+CD_IMPLEMENT_ENTITY(StructuredPushConsumer)
+CD_IMPLEMENT_ENTITY(SequencePushConsumer)
+
+CD_IMPLEMENT_ENTITY(PushSupplier)
+CD_IMPLEMENT_ENTITY(StructuredPushSupplier)
+CD_IMPLEMENT_ENTITY(SequencePushSupplier)
+
+//*****************************************************************************************************
+
+ConnectDisconnect::ConnectDisconnect (void)
+ :any_consumer_ (0),
+ structured_consumer_ (0),
+ sequence_consumer_ (0),
+ any_supplier_ (0),
+ structured_supplier_ (0),
+ sequence_supplier_ (0),
+ count_ (3),
+ consumers_ (3),
+ suppliers_ (3)
+{
+}
+
+ConnectDisconnect::~ConnectDisconnect ()
+{
+ delete [] this->any_consumer_;
+ delete [] this->structured_consumer_;
+ delete [] this->sequence_consumer_;
+
+ delete [] this->any_supplier_;
+ delete [] this->structured_supplier_;
+ delete [] this->sequence_supplier_;
+}
+
+void
+ConnectDisconnect::on_entity_destroyed (void)
+{
+ this->result_count_++;
+
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG,
+ "result_count = %d\n",
+ this->result_count_.value ()));
+}
+
+int
+ConnectDisconnect::init (int argc,
+ char* argv []
+ ACE_ENV_ARG_DECL)
+{
+ // Initialize the base class.
+ Notify_Test_Client::init (argc,
+ argv
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);;
+
+ // Create all participants.
+ this->create_EC (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ CosNotifyChannelAdmin::AdminID adminid;
+
+ this->supplier_admin_ =
+ ec_->new_for_suppliers (this->ifgop_,
+ adminid
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);;
+
+ ACE_ASSERT (!CORBA::is_nil (supplier_admin_.in ()));
+
+ this->consumer_admin_ =
+ ec_->new_for_consumers (this->ifgop_,
+ adminid
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ ACE_ASSERT (!CORBA::is_nil (consumer_admin_.in ()));
+
+ // How many are we counting..?
+ this->expected_count_ = count_ * (consumers_ * 3 + suppliers_ * 3);
+
+ // Create the consumers and suppliers.
+
+ // Arrays of Consumers.
+ ACE_NEW_RETURN (this->any_consumer_,
+ TAO_Notify_Tests_PushConsumer*[this->consumers_],
+ -1);
+ ACE_NEW_RETURN (this->structured_consumer_,
+ TAO_Notify_Tests_StructuredPushConsumer*[this->consumers_],
+ -1);
+ ACE_NEW_RETURN (this->sequence_consumer_,
+ TAO_Notify_Tests_SequencePushConsumer*[this->consumers_],
+ -1);
+
+ // Arrays of Suppliers.
+ ACE_NEW_RETURN (this->any_supplier_,
+ TAO_Notify_Tests_PushSupplier*[this->suppliers_],
+ -1);
+ ACE_NEW_RETURN (this->structured_supplier_,
+ TAO_Notify_Tests_StructuredPushSupplier*[this->suppliers_],
+ -1);
+ ACE_NEW_RETURN (this->sequence_supplier_,
+ TAO_Notify_Tests_SequencePushSupplier*[this->suppliers_],
+ -1);
+
+ consumer_start( 0 );
+ return 0;
+}
+
+int
+ConnectDisconnect::parse_args(int argc, char *argv[])
+{
+ ACE_Arg_Shifter arg_shifter (argc,
+ argv);
+
+ const char *current_arg = 0;
+
+ while (arg_shifter.is_anything_left ())
+ {
+ if ((current_arg = arg_shifter.get_the_parameter ("-count")))
+ {
+ this->count_ = ACE_OS::atoi (current_arg);
+ arg_shifter.consume_arg ();
+ }
+ else if ((current_arg = arg_shifter.get_the_parameter ("-consumers")))
+ {
+ this->consumers_ = ACE_OS::atoi (current_arg);
+ arg_shifter.consume_arg ();
+ }
+ else if ((current_arg = arg_shifter.get_the_parameter ("-suppliers")))
+ {
+ this->suppliers_ = ACE_OS::atoi (current_arg);
+ arg_shifter.consume_arg ();
+ }
+ else if (arg_shifter.cur_arg_strncasecmp ("-?") == 0)
+ {
+ ACE_DEBUG((LM_DEBUG,
+ "usage: %s "
+ "-count testcount \n"
+ "-consumers number_of_consumers"
+ "-suppliers number_of_suppliers",
+ argv[0],
+ argv[0]));
+
+ arg_shifter.consume_arg ();
+
+ return -1;
+ }
+ else
+ {
+ arg_shifter.ignore_arg ();
+ }
+ }
+
+ return 0;
+}
+
+void
+ConnectDisconnect::create_EC (ACE_ENV_SINGLE_ARG_DECL)
+{
+ CosNotifyChannelAdmin::ChannelID id;
+
+ this->ec_ = notify_factory_->create_channel (this->initial_qos_,
+ this->initial_admin_,
+ id
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ ACE_ASSERT (!CORBA::is_nil (ec_.in ()));
+}
+
+void
+ConnectDisconnect::run_test (ACE_ENV_SINGLE_ARG_DECL)
+{
+ for (int iterations = 0; iterations < count_; ++iterations)
+ {
+ int i = 0;
+
+ for (i = 0; i < this->consumers_; ++i)
+ {
+ // Create and connect Any consumers.
+ ACE_NEW (this->any_consumer_[i],
+ CD_PushConsumer (this,
+ i));
+ this->any_consumer_[i]->init (root_poa_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ this->any_consumer_[i]->connect (this->consumer_admin_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Create and connect Structured consumers.
+ ACE_NEW (this->structured_consumer_[i],
+ CD_StructuredPushConsumer (this,
+ i));
+ this->structured_consumer_[i]->init (root_poa_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ this->structured_consumer_[i]->connect (this->consumer_admin_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Create and connect Sequence consumers.
+ ACE_NEW (this->sequence_consumer_[i],
+ CD_SequencePushConsumer (this,
+ i));
+ this->sequence_consumer_[i]->init (root_poa_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ this->sequence_consumer_[i]->connect (this->consumer_admin_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ }
+
+ for (i = 0; i < this->suppliers_; ++i)
+ {
+ ACE_NEW (this->any_supplier_[i],
+ CD_PushSupplier (this,
+ i));
+ this->any_supplier_[i]->init (root_poa_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ this->any_supplier_[i]->connect (this->supplier_admin_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Create and connect Structured suppliers.
+ ACE_NEW (this->structured_supplier_[i],
+ CD_StructuredPushSupplier (this,
+ i));
+ this->structured_supplier_[i]->init (root_poa_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ this->structured_supplier_[i]->connect (this->supplier_admin_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Create and connect Sequence suppliers.
+ ACE_NEW (this->sequence_supplier_[i],
+ CD_SequencePushSupplier (this,
+ i));
+ this->sequence_supplier_[i]->init (root_poa_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ this->sequence_supplier_[i]->connect (this->supplier_admin_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ for (i = 0; i < this->consumers_; ++i)
+ {
+ // Disconnnect Any consumers.
+ this->any_consumer_[i]->disconnect (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Disconnect Structured Consumers.
+ this->structured_consumer_[i]->disconnect (
+ ACE_ENV_SINGLE_ARG_PARAMETER
+ );
+ ACE_CHECK;
+
+ // Disconnect Sequence Consumers.
+ this->sequence_consumer_[i]->disconnect (
+ ACE_ENV_SINGLE_ARG_PARAMETER
+ );
+ ACE_CHECK;
+ }
+
+ for (i = 0; i < this->suppliers_; ++i)
+ {
+ // Disconnnect Any suppliers.
+ this->any_supplier_[i]->disconnect (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Disconnect Structured Suppliers.
+ this->structured_supplier_[i]->disconnect (
+ ACE_ENV_SINGLE_ARG_PARAMETER
+ );
+ ACE_CHECK;
+
+ // Disconnect Sequence Suppliers.
+ this->sequence_supplier_[i]->disconnect (
+ ACE_ENV_SINGLE_ARG_PARAMETER
+ );
+ ACE_CHECK;
+ }
+ }
+}
+
+void
+ConnectDisconnect::end_test (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+{
+ consumer_done( 0 );
+}
+
+int
+ConnectDisconnect::check_results (void)
+{
+ ACE_DEBUG ((LM_DEBUG, "result_count_ = %d", this->result_count_.value ()));
+ ACE_DEBUG ((LM_DEBUG, " expected_count_ = %d\n", this->expected_count_));
+
+ if (this->result_count_ != this->expected_count_)
+ {
+ ACE_DEBUG ((LM_DEBUG, "ConnectDisconnect test failed\n"));
+ }
+ else
+ {
+ ACE_DEBUG ((LM_DEBUG, "ConnectDisconnect test succeeded\n"));
+ }
+
+ // Destroy the channel.
+ ACE_DECLARE_NEW_CORBA_ENV;
+ this->ec_->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ return 0;
+}
+
+/***************************************************************************/
+
+int
+main (int argc, char* argv[])
+{
+ ConnectDisconnect client;
+
+ if (client.parse_args (argc, argv) == -1)
+ {
+ return 1;
+ }
+
+ ACE_TRY_NEW_ENV
+ {
+ client.init (argc, argv ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ client.run_test (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ client.end_test (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCH (CORBA::Exception, se)
+ {
+ ACE_PRINT_EXCEPTION (se, "Error: ");
+ return 1;
+ }
+ ACE_ENDTRY;
+
+ return client.check_results ();
+}
+
diff --git a/TAO/orbsvcs/tests/Notify/Basic/ConnectDisconnect.h b/TAO/orbsvcs/tests/Notify/Basic/ConnectDisconnect.h
new file mode 100644
index 00000000000..a08cd5dd3ad
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/Basic/ConnectDisconnect.h
@@ -0,0 +1,136 @@
+/* -*- C++ -*- */
+// $Id$
+// ==========================================================================
+//
+// = FILENAME
+// ConnectDisconnect.h
+//
+// = DESCRIPTION
+// Test connect-disconnect methods of Notify.
+//
+// = AUTHOR
+// Pradeep Gore <pradeep@cs.wustl.edu>
+//
+// ==========================================================================
+
+#ifndef NOTIFY_CONNECT_DISCONNECT_H
+#define NOTIFY_CONNECT_DISCONNECT_H
+
+#include "Notify_Test_Client.h"
+#include "Notify_StructuredPushConsumer.h"
+#include "Notify_StructuredPushSupplier.h"
+#include "Notify_PushConsumer.h"
+#include "Notify_PushSupplier.h"
+#include "Notify_SequencePushConsumer.h"
+#include "Notify_SequencePushSupplier.h"
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+class ConnectDisconnect;
+
+class CD_Entity
+{
+ // The entity that connects/disconnects.
+public:
+ CD_Entity (ConnectDisconnect* cd, int id);
+ ~CD_Entity ();
+private:
+ int id_;
+ ConnectDisconnect* cd_;
+};
+
+#define CD_DECLARE_ENTITY(X) \
+class CD_##X : public TAO_Notify_##X, public CD_Entity \
+{ \
+public: \
+ CD_##X (ConnectDisconnect* cd, int id); \
+};
+
+CD_DECLARE_ENTITY(PushConsumer)
+CD_DECLARE_ENTITY(StructuredPushConsumer)
+CD_DECLARE_ENTITY(SequencePushConsumer)
+
+CD_DECLARE_ENTITY(PushSupplier)
+CD_DECLARE_ENTITY(StructuredPushSupplier)
+CD_DECLARE_ENTITY(SequencePushSupplier)
+
+/***************************************************************************/
+
+class ConnectDisconnect : public Notify_Test_Client
+{
+public:
+ // Initialization and termination code.
+ ConnectDisconnect (void);
+ virtual ~ConnectDisconnect ();
+
+ void on_entity_destroyed (void);
+ // Keeps track of how many objects were destroyed.
+
+ int parse_args (int argc,
+ char *argv[]);
+
+ int init (int argc,
+ char *argv []
+ ACE_ENV_ARG_DECL);
+ // initialization.
+
+ void run_test (ACE_ENV_SINGLE_ARG_DECL);
+ // Run the test.
+
+ void end_test (ACE_ENV_SINGLE_ARG_DECL);
+ // End the test.
+
+ int check_results (void);
+ // Check if we got the expected results.
+
+protected:
+ void create_EC (ACE_ENV_SINGLE_ARG_DECL);
+ // Create EC.
+
+ CosNotifyChannelAdmin::EventChannel_var ec_;
+ // The one channel that we create using the factory.
+
+ CosNotifyChannelAdmin::ConsumerAdmin_var consumer_admin_;
+ // The consumer admin used by consumers.
+
+ CosNotifyChannelAdmin::SupplierAdmin_var supplier_admin_;
+ // The supplier admin used by suppliers.
+
+ TAO_Notify_Tests_PushConsumer** any_consumer_;
+ TAO_Notify_Tests_StructuredPushConsumer** structured_consumer_;
+ TAO_Notify_Tests_SequencePushConsumer** sequence_consumer_;
+ // Arrays of Consumers.
+
+ TAO_Notify_Tests_PushSupplier** any_supplier_;
+ TAO_Notify_Tests_StructuredPushSupplier** structured_supplier_;
+ TAO_Notify_Tests_SequencePushSupplier** sequence_supplier_;
+ // arrays of Suppliers
+
+ ACE_Atomic_Op <TAO_SYNCH_MUTEX, int> result_count_;
+ // Count of clients destroyed. for c consumers, s suppliers and for t times.
+ // this should be (s+c)*t.
+
+ int expected_count_; // (s+c)*t
+
+ // = command line params
+
+ int count_;
+ // The number of iterations to connect disconnect.
+
+ int consumers_;
+ // The number of counsumers to create.
+
+ int suppliers_;
+ // The number of suppliers to create.
+};
+
+/***************************************************************************/
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#endif /* NOTIFY_TESTS_UPDATES_H */
diff --git a/TAO/orbsvcs/tests/Notify/Basic/Events.cpp b/TAO/orbsvcs/tests/Notify/Basic/Events.cpp
new file mode 100644
index 00000000000..58d348d5859
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/Basic/Events.cpp
@@ -0,0 +1,355 @@
+//$Id$
+
+#include "ace/Arg_Shifter.h"
+#include "ace/Get_Opt.h"
+#include "tao/debug.h"
+#include "Events.h"
+
+ACE_RCSID (Notify_Tests, Events, "$Id$")
+
+/***************************************************************************/
+
+Event_StructuredPushConsumer::Event_StructuredPushConsumer (Events *test_client)
+ : test_client_ (test_client)
+{
+}
+
+void
+Event_StructuredPushConsumer::push_structured_event (
+ const CosNotification::StructuredEvent & notification
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ CosEventComm::Disconnected))
+{
+ int event_num;
+ notification.filterable_data[0].value >>= event_num;
+
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG,
+ "Received event# %d\n",
+ event_num));
+
+ this->test_client_->on_event_received ();
+}
+
+/***************************************************************************/
+
+Event_StructuredPushSupplier::Event_StructuredPushSupplier (
+ Events* test_client
+ )
+ : test_client_ (test_client)
+{
+}
+
+Event_StructuredPushSupplier::~Event_StructuredPushSupplier (void)
+{
+}
+
+/***************************************************************************/
+Events::Events (void)
+ : use_default_admin_ (0), event_count_ (5)
+{
+}
+
+Events::~Events (void)
+{
+}
+
+int
+Events::init (int argc,
+ char* argv []
+ ACE_ENV_ARG_DECL)
+{
+ // Initialize the base class.
+ Notify_Test_Client::init (argc,
+ argv
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ // Create all participents.
+ this->create_EC (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ CosNotifyChannelAdmin::AdminID adminid;
+
+ if (use_default_admin_ == 1)
+ {
+ this->supplier_admin_ =
+ this->ec_->default_supplier_admin (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+ }
+ else
+ {
+ this->supplier_admin_ =
+ this->ec_->new_for_suppliers (this->ifgop_,
+ adminid
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+ }
+
+ ACE_ASSERT (!CORBA::is_nil (supplier_admin_.in ()));
+
+ if (use_default_admin_ == 1)
+ {
+ this->consumer_admin_ =
+ this->ec_->default_consumer_admin (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+ }
+ else
+ {
+ this->consumer_admin_ =
+ this->ec_->new_for_consumers (this->ifgop_,
+ adminid
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+ }
+
+ ACE_ASSERT (!CORBA::is_nil (consumer_admin_.in ()));
+
+ ACE_NEW_RETURN (this->consumer_,
+ Event_StructuredPushConsumer (this),
+ -1);
+ this->consumer_->init (root_poa_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+ this->consumer_->connect (this->consumer_admin_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ Event_StructuredPushConsumer* consumer2 = 0;
+ ACE_NEW_RETURN (consumer2,
+ Event_StructuredPushConsumer (this),
+ -1);
+ consumer2->init (root_poa_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+ consumer2->connect (this->consumer_admin_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ ACE_NEW_RETURN (this->supplier_,
+ Event_StructuredPushSupplier (this),
+ -1);
+ this->supplier_->init (root_poa_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ this->supplier_->connect (this->supplier_admin_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ consumer_start( 0 );
+
+ return 0;
+}
+
+int
+Events::parse_args (int argc,
+ char *argv[])
+{
+ ACE_Arg_Shifter arg_shifter (argc,
+ argv);
+ const char *current_arg = 0;
+
+ while (arg_shifter.is_anything_left ())
+ {
+ if (arg_shifter.cur_arg_strncasecmp ("-use_default_admin") == 0)
+ {
+ this->use_default_admin_ = 1;
+ arg_shifter.consume_arg ();
+
+ }
+ else if ((current_arg = arg_shifter.get_the_parameter ("-events")))
+ {
+ this->event_count_ = ACE_OS::atoi (current_arg);
+ // The number of events to send/receive.
+ arg_shifter.consume_arg ();
+ }
+ else if (arg_shifter.cur_arg_strncasecmp ("-?") == 0)
+ {
+ ACE_DEBUG((LM_DEBUG,
+ "usage: %s "
+ "-use_default_admin "
+ "-events event_count \n",
+ argv[0], argv[0]));
+
+ arg_shifter.consume_arg ();
+
+ return -1;
+ }
+ else
+ {
+ arg_shifter.ignore_arg ();
+ }
+ }
+
+ return 0;
+}
+
+void
+Events::create_EC (ACE_ENV_SINGLE_ARG_DECL)
+{
+ CosNotifyChannelAdmin::ChannelID id;
+
+ this->ec_ = notify_factory_->create_channel (this->initial_qos_,
+ this->initial_admin_,
+ id
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ /****************************************************************/
+ /*
+ CosNotification::AdminProperties admin(2);
+ admin.length (2);
+
+ admin[0].name =
+ CORBA::string_dup(CosNotification::MaxQueueLength);
+
+ admin[0].value <<= (CORBA::Long)5;
+
+ admin[1].name =
+ CORBA::string_dup(CosNotification::MaxConsumers);
+
+ admin[1].value <<= (CORBA::Long)2;
+
+ ec_->set_admin (admin ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;*/
+
+ /****************************************************************/
+ ACE_ASSERT (!CORBA::is_nil (this->ec_.in ()));
+}
+
+void
+Events::on_event_received (void)
+{
+ ++this->result_count_;
+
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG,
+ "event count = #%d\n",
+ this->result_count_.value ()));
+
+ if (this->result_count_ == 2 * this->event_count_)
+ {
+ ACE_DECLARE_NEW_CORBA_ENV;
+ this->end_test (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+}
+
+void
+Events::run_test (ACE_ENV_SINGLE_ARG_DECL)
+{
+ // operations:
+ CosNotification::StructuredEvent event;
+
+ // EventHeader.
+
+ // FixedEventHeader.
+ // EventType.
+ // string.
+ event.header.fixed_header.event_type.domain_name = CORBA::string_dup("*");
+ // string
+ event.header.fixed_header.event_type.type_name = CORBA::string_dup("*");
+ // string
+ event.header.fixed_header.event_name = CORBA::string_dup("myevent");
+
+ // OptionalHeaderFields.
+ // PropertySeq.
+ // sequence<Property>: string name, any value
+ CosNotification::PropertySeq& qos = event.header.variable_header;
+ qos.length (1); // put nothing here
+
+ // FilterableEventBody
+ // PropertySeq
+ // sequence<Property>: string name, any value
+ event.filterable_data.length (3);
+ event.filterable_data[0].name = CORBA::string_dup("threshold");
+
+ event.filterable_data[1].name = CORBA::string_dup("temperature");
+ event.filterable_data[1].value <<= (CORBA::Long)70;
+
+ event.filterable_data[2].name = CORBA::string_dup("pressure");
+ event.filterable_data[2].value <<= (CORBA::Long)80;
+
+ CORBA::Short prio = CosNotification::LowestPriority;
+
+ for (int i = 0; i < this->event_count_; ++i)
+ {
+ event.filterable_data[0].value <<= (CORBA::Long)i;
+
+ // any
+ event.remainder_of_body <<= (CORBA::Long)i;
+
+ qos[0].name = CORBA::string_dup (CosNotification::Priority);
+ qos[0].value <<= (CORBA::Short)prio++;
+
+ this->supplier_->send_event (event
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+}
+
+void
+Events::end_test (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+{
+ consumer_done( 0 );
+}
+
+int
+Events::check_results (void)
+{
+ // Destroy the channel.
+ ACE_DECLARE_NEW_CORBA_ENV;
+ this->ec_->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ if (this->result_count_ == 2 * this->event_count_)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "Events test success\n"));
+ return 0;
+ }
+ else
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "Events test failed!\n"));
+ return 1;
+ }
+}
+
+/***************************************************************************/
+
+int
+main (int argc, char* argv[])
+{
+ Events events;
+
+ if (events.parse_args (argc, argv) == -1)
+ {
+ return 1;
+ }
+
+ ACE_TRY_NEW_ENV
+ {
+ events.init (argc,
+ argv
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ events.run_test (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ events.ORB_run( ACE_ENV_SINGLE_ARG_PARAMETER );
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCH (CORBA::Exception, se)
+ {
+ ACE_PRINT_EXCEPTION (se, "Error: ");
+ return 1;
+ }
+ ACE_ENDTRY;
+
+ return events.check_results ();
+}
diff --git a/TAO/orbsvcs/tests/Notify/Basic/Events.h b/TAO/orbsvcs/tests/Notify/Basic/Events.h
new file mode 100644
index 00000000000..e7493489b67
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/Basic/Events.h
@@ -0,0 +1,132 @@
+/* -*- C++ -*- */
+// $Id$
+// ==========================================================================
+//
+// = FILENAME
+// Events.h
+//
+// = DESCRIPTION
+// Test to check if events are received by all 3 types of consumers.
+// This is intended to be a simple test without any filters with default subscription (all events).
+//
+// = AUTHOR
+// Pradeep Gore <pradeep@cs.wustl.edu>
+//
+// ==========================================================================
+
+#ifndef NOTIFY_TESTS_EventS_H
+#define NOTIFY_TESTS_EventS_H
+
+#include "Notify_Test_Client.h"
+#include "Notify_StructuredPushConsumer.h"
+#include "Notify_StructuredPushSupplier.h"
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+class Events;
+
+class Event_StructuredPushConsumer : public TAO_Notify_Tests_StructuredPushConsumer
+{
+public:
+ Event_StructuredPushConsumer (Events *test_client);
+ // Contructor.
+
+ // = StructuredPushSupplier methods.
+ virtual void push_structured_event (
+ const CosNotification::StructuredEvent & notification
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ CosEventComm::Disconnected));
+
+protected:
+ Events * test_client_;
+};
+
+/***************************************************************************/
+
+class Event_StructuredPushSupplier : public TAO_Notify_Tests_StructuredPushSupplier
+{
+public:
+ Event_StructuredPushSupplier (Events * test_client);
+ // Constructor.
+
+ virtual ~Event_StructuredPushSupplier (void);
+ // Destructor.
+
+protected:
+ Events* test_client_;
+};
+
+/***************************************************************************/
+
+class Events : public Notify_Test_Client
+{
+public:
+ // Initialization and termination code.
+ Events (void);
+ virtual ~Events (void);
+
+ int parse_args (int argc,
+ char *argv[]) ;
+
+ int init (int argc,
+ char *argv []
+ ACE_ENV_ARG_DECL);
+ // Initialization.
+
+ void on_event_received (void);
+ // Called when an event is received.
+
+ void run_test (ACE_ENV_SINGLE_ARG_DECL);
+ // Run the test.
+
+ void end_test (ACE_ENV_SINGLE_ARG_DECL);
+ // End the test.
+
+ int check_results (void);
+ // check if we got the expected results.
+
+protected:
+ void create_EC (ACE_ENV_SINGLE_ARG_DECL);
+ // Create EC
+
+ ACE_Atomic_Op <TAO_SYNCH_MUTEX, int> result_count_;
+ // Number of events received so far.
+
+ /// Use the default admins.
+ int use_default_admin_;
+
+ int event_count_;
+ // Number of events to send
+
+ CosNotifyChannelAdmin::EventChannel_var ec_;
+ // The one channel that we create using the factory.
+
+ CosNotifyChannelAdmin::ConsumerAdmin_var consumer_admin_;
+ // The consumer admin used by consumers.
+
+ CosNotifyChannelAdmin::SupplierAdmin_var supplier_admin_;
+ // The supplier admin used by suppliers.
+
+ TAO_Notify_Tests_StructuredPushConsumer* consumer_;
+ // Consumer
+
+ TAO_Notify_Tests_StructuredPushSupplier* supplier_;
+ // Supplier
+
+private:
+ friend class Event_StructuredPushSupplier;
+ friend class Event_StructuredPushConsumer;
+};
+
+/***************************************************************************/
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#endif /* NOTIFY_TESTS_EventS_H */
diff --git a/TAO/orbsvcs/tests/Notify/Basic/Filter.cpp b/TAO/orbsvcs/tests/Notify/Basic/Filter.cpp
new file mode 100644
index 00000000000..3d54679c307
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/Basic/Filter.cpp
@@ -0,0 +1,249 @@
+//$Id$
+
+#include "ace/Arg_Shifter.h"
+#include "ace/Get_Opt.h"
+#include "tao/debug.h"
+#include "Filter.h"
+
+ACE_RCSID (Notify_Tests, Filter, "$Id$")
+
+Filter::Filter (void)
+ : event_count_ (5)
+{
+}
+
+Filter::~Filter (void)
+{
+}
+
+int
+Filter::init (int argc, char* argv []
+ ACE_ENV_ARG_DECL)
+{
+ // Initialized the base class.
+ Notify_Test_Client::init (argc,
+ argv
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ // Create all participents.
+ this->create_EC (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ CosNotifyChannelAdmin::AdminID adminid;
+
+ this->supplier_admin_ =
+ this->ec_->new_for_suppliers (this->ifgop_,
+ adminid
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ ACE_ASSERT (!CORBA::is_nil (supplier_admin_.in ()));
+
+ this->consumer_admin_ =
+ this->ec_->new_for_consumers (this->ifgop_,
+ adminid
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ ACE_ASSERT (!CORBA::is_nil (consumer_admin_.in ()));
+
+ this->ffact_ =
+ ec_->default_filter_factory (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ return 0;
+}
+
+void
+Filter::run_test (ACE_ENV_SINGLE_ARG_DECL)
+{
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG, " Obtaining FilterAdmin interface from ConsumerAdmin\n"));
+
+ CosNotifyFilter::FilterAdmin_var ca_filter_admin =
+ CosNotifyFilter::FilterAdmin::_narrow (consumer_admin_.in () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->run_filter_test (consumer_admin_.in () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->ec_->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void
+Filter::run_filter_test (CosNotifyFilter::FilterAdmin_ptr filter_admin ACE_ENV_ARG_DECL)
+{
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG, " Calling remove_all_filters\n"));
+
+ // Clear all filters.
+ filter_admin->remove_all_filters (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->verify_filter_count (filter_admin, 0 ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG, "Adding a filter \n"));
+
+ CosNotifyFilter::FilterID id_1 = this->add_filter (filter_admin ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->verify_filter_count (filter_admin, 1 ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG, "Adding another filter \n"));
+
+ this->add_filter (filter_admin ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->verify_filter_count (filter_admin, 2 ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (TAO_debug_level)
+ {
+ ACE_DEBUG ((LM_DEBUG, "Calling print_filters \n"));
+ this->print_filters (filter_admin ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG, "Calling remove_filter\n"));
+
+ // remove the filter.
+ filter_admin->remove_filter (id_1 ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->verify_filter_count (filter_admin, 1 ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (TAO_debug_level)
+ {
+ ACE_DEBUG ((LM_DEBUG, "Calling print_filters \n"));
+ this->print_filters (filter_admin ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG, "Calling remove_all_filters \n"));
+
+ filter_admin->remove_all_filters (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (TAO_debug_level)
+ {
+ ACE_DEBUG ((LM_DEBUG, "Calling print_filters \n"));
+ this->print_filters (filter_admin ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ // Make sure all filters are removed -
+ this->verify_filter_count (filter_admin, 0 ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ ACE_DEBUG ((LM_DEBUG, "Filters test has run successfully\n"));
+}
+
+void
+Filter::verify_filter_count (CosNotifyFilter::FilterAdmin_ptr filter_admin, CORBA::ULong expected_count ACE_ENV_ARG_DECL)
+{
+ expected_count = expected_count; // if we don;t do this, we get a warning on linux about arg not used.
+ CosNotifyFilter::FilterIDSeq_var filter_seq = filter_admin->get_all_filters (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ ACE_ASSERT (filter_seq->length () == expected_count);
+}
+
+CosNotifyFilter::FilterID
+Filter::add_filter (CosNotifyFilter::FilterAdmin_ptr filter_admin ACE_ENV_ARG_DECL)
+{
+ // setup a filter at the filter admin
+ CosNotifyFilter::Filter_var filter =
+ this->ffact_->create_filter ("ETCL" ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ ACE_ASSERT (!CORBA::is_nil (filter.in ()));
+
+ const char* test_filter_string = "A > B";
+
+ CosNotifyFilter::ConstraintExpSeq constraint_list (1);
+ constraint_list.length (1);
+
+ constraint_list[0].event_types.length (0);
+ constraint_list[0].constraint_expr = CORBA::string_dup (test_filter_string);
+
+ filter->add_constraints (constraint_list ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ CosNotifyFilter::FilterID id = filter_admin->add_filter (filter.in () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ // Print the ID
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG, "Added Filter %d\n", id));
+
+ return id;
+}
+
+void
+Filter::print_filters (CosNotifyFilter::FilterAdmin_ptr filter_admin ACE_ENV_ARG_DECL)
+{
+ CosNotifyFilter::FilterIDSeq_var filter_seq = filter_admin->get_all_filters (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ ACE_DEBUG ((LM_DEBUG, "Getting all %d filters...\n ", filter_seq->length ()));
+
+ for (CORBA::ULong i = 0; i < filter_seq->length (); ++i)
+ {
+ ACE_DEBUG ((LM_DEBUG, " Filter %d\n", filter_seq[i]));
+ }
+}
+
+
+void
+Filter::create_EC (ACE_ENV_SINGLE_ARG_DECL)
+{
+ CosNotifyChannelAdmin::ChannelID id;
+
+ this->ec_ = notify_factory_->create_channel (this->initial_qos_,
+ this->initial_admin_,
+ id
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ ACE_ASSERT (!CORBA::is_nil (ec_.in ()));
+}
+
+//***************************************************************************
+
+int
+main (int argc, char* argv[])
+{
+ Filter events;
+
+ if (events.parse_args (argc, argv) == -1)
+ {
+ return 1;
+ }
+
+ ACE_TRY_NEW_ENV
+ {
+ events.init (argc,
+ argv
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ events.run_test (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCH (CORBA::Exception, se)
+ {
+ ACE_PRINT_EXCEPTION (se, "Error: ");
+ return 1;
+ }
+ ACE_ENDTRY;
+
+ return 0;
+}
diff --git a/TAO/orbsvcs/tests/Notify/Basic/Filter.h b/TAO/orbsvcs/tests/Notify/Basic/Filter.h
new file mode 100644
index 00000000000..9bd93156d6d
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/Basic/Filter.h
@@ -0,0 +1,92 @@
+/* -*- C++ -*- */
+// $Id$
+// ==========================================================================
+//
+// = FILENAME
+// Filter.h
+//
+// = DESCRIPTION
+// Filter test any supplier to any consumer.
+//
+// = AUTHOR
+// Pradeep Gore <pradeep@cs.wustl.edu>
+//
+// ==========================================================================
+
+#ifndef NOTIFY_TESTS_FILTER_H
+#define NOTIFY_TESTS_FILTER_H
+
+#include "Notify_Test_Client.h"
+#include "Notify_PushConsumer.h"
+#include "Notify_PushSupplier.h"
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+class Filter;
+
+class Filter : public Notify_Test_Client
+{
+public:
+ // Initialization and termination code
+ Filter (void);
+ virtual ~Filter (void);
+
+ int init (int argc,
+ char *argv []
+ ACE_ENV_ARG_DECL);
+ // initialization.
+
+ void run_test (ACE_ENV_SINGLE_ARG_DECL);
+ // Run the test.
+
+protected:
+ void create_EC (ACE_ENV_SINGLE_ARG_DECL);
+ // Create EC
+
+ /// Run some tests to check the filters.
+ void run_filter_test (CosNotifyFilter::FilterAdmin_ptr ACE_ENV_ARG_DECL);
+
+ /// Print the filter ids.
+ void print_filters (CosNotifyFilter::FilterAdmin_ptr filter_seq ACE_ENV_ARG_DECL);
+
+ /// Verify filter count.
+ void verify_filter_count (CosNotifyFilter::FilterAdmin_ptr filter_admin, CORBA::ULong expected_count ACE_ENV_ARG_DECL);
+
+ /// Add a filter.
+ CosNotifyFilter::FilterID add_filter (CosNotifyFilter::FilterAdmin_ptr filter_admin ACE_ENV_ARG_DECL);
+
+ /// The default filter factory.
+ CosNotifyFilter::FilterFactory_var ffact_;
+
+ ACE_Atomic_Op <TAO_SYNCH_MUTEX, int> result_count_;
+ // Number of events received so far.
+
+ int event_count_;
+ // Number of events to send
+
+ CosNotifyChannelAdmin::EventChannel_var ec_;
+ // The one channel that we create using the factory.
+
+ CosNotifyChannelAdmin::ConsumerAdmin_var consumer_admin_;
+ // The consumer admin used by consumers.
+
+ CosNotifyChannelAdmin::SupplierAdmin_var supplier_admin_;
+ // The supplier admin used by suppliers.
+
+ TAO_Notify_Tests_PushConsumer* consumer_;
+ // Consumer.
+
+ TAO_Notify_Tests_PushSupplier* supplier_;
+ // Supplier.
+};
+
+/***************************************************************************/
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#endif /* NOTIFY_TESTS_FILTER_H */
diff --git a/TAO/orbsvcs/tests/Notify/Basic/IdAssignment.cpp b/TAO/orbsvcs/tests/Notify/Basic/IdAssignment.cpp
new file mode 100644
index 00000000000..ebfd98f3df1
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/Basic/IdAssignment.cpp
@@ -0,0 +1,489 @@
+// $Id$
+
+#include "ace/Arg_Shifter.h"
+#include "ace/Get_Opt.h"
+#include "tao/debug.h"
+#include "orbsvcs/CosNamingC.h"
+#include "orbsvcs/CosNotifyCommC.h"
+#include "IdAssignment.h"
+
+ACE_RCSID (Notify_Tests,
+ IdAssignment,
+ "$Id$")
+
+IdAssignment::IdAssignment (void)
+ : iter_ (3),
+ ec_count_ (3),
+ consumer_admin_count_ (3),
+ supplier_admin_count_ (3)
+{
+}
+
+IdAssignment::~IdAssignment (void)
+{
+}
+
+int
+IdAssignment::parse_args (int argc,
+ char *argv[])
+{
+ ACE_Arg_Shifter arg_shifter (argc, argv);
+
+ const char *current_arg = 0;
+
+ while (arg_shifter.is_anything_left ())
+ {
+ if ((current_arg = arg_shifter.get_the_parameter ("-iter")))
+ {
+ this->iter_ = ACE_OS::atoi (current_arg);
+ // The number of times to repeat the test.
+ arg_shifter.consume_arg ();
+ }
+ if ((current_arg = arg_shifter.get_the_parameter ("-ec_count")))
+ {
+ this->ec_count_ = ACE_OS::atoi (current_arg);
+ arg_shifter.consume_arg ();
+ }
+ if ((current_arg = arg_shifter.get_the_parameter ("-ca_count")))
+ {
+ this->consumer_admin_count_ = ACE_OS::atoi (current_arg);
+ arg_shifter.consume_arg ();
+ }
+ if ((current_arg = arg_shifter.get_the_parameter ("-sa_count")))
+ {
+ this->supplier_admin_count_ = ACE_OS::atoi (current_arg);
+ arg_shifter.consume_arg ();
+ }
+ else if (arg_shifter.cur_arg_strncasecmp ("-?") == 0)
+ {
+ ACE_DEBUG((LM_DEBUG,
+ "usage: %s "
+ "-iter <count>",
+ "-ec_count <count>",
+ "-ca_count <count>",
+ "-sa_count <count>\n",
+ argv[0],
+ argv[0]));
+
+ arg_shifter.consume_arg ();
+
+ return -1;
+ }
+ else
+ {
+ arg_shifter.ignore_arg ();
+ }
+ }
+
+ return 0;
+}
+
+void
+IdAssignment::init (int argc,
+ char *argv[]
+ ACE_ENV_ARG_DECL)
+{
+ CORBA::ORB_var orb = CORBA::ORB_init (argc,
+ argv,
+ ""
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ CORBA::Object_var rootObj =
+ orb->resolve_initial_references ("NameService"
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (CORBA::is_nil (rootObj.in ()))
+ {
+ ACE_ERROR ((LM_ERROR,
+ " (%P|%t) Unable to resolve naming service !\n"));
+ return;
+
+ }
+ CosNaming::NamingContext_var rootNC =
+ CosNaming::NamingContext::_narrow (rootObj.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ CosNaming::Name name (1);
+ name.length (1);
+ name[0].id = CORBA::string_dup ("NotifyEventChannelFactory");
+
+ CORBA::Object_var obj = rootNC->resolve (name
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (CORBA::is_nil (obj.in ()))
+ {
+ ACE_ERROR ((LM_ERROR,
+ " (%P|%t) Unable to locate Notify_Service \n"));
+ return;
+ }
+
+ this->notify_factory_ =
+ CosNotifyChannelAdmin::EventChannelFactory::_narrow (
+ obj.in()
+ ACE_ENV_ARG_PARAMETER
+ );
+ ACE_CHECK;
+
+}
+
+CosNotifyChannelAdmin::ChannelID
+IdAssignment::create_ec (ACE_ENV_SINGLE_ARG_DECL)
+{
+ CosNotifyChannelAdmin::ChannelID id;
+ CosNotification::QoSProperties initial_qos;
+ CosNotification::AdminProperties initial_admin;
+ CosNotifyChannelAdmin::EventChannel_var ec =
+ this->notify_factory_->create_channel (initial_qos,
+ initial_admin,
+ id
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ return id;
+}
+
+
+void
+IdAssignment::destroy_ec(CosNotifyChannelAdmin::ChannelID id
+ ACE_ENV_ARG_DECL)
+{
+ CosNotifyChannelAdmin::EventChannel_var ec =
+ this->notify_factory_->get_event_channel (id
+ ACE_ENV_ARG_PARAMETER);
+
+ ACE_CHECK;
+
+ if (CORBA::is_nil (ec.in()))
+ {
+ ACE_ERROR((LM_ERROR,
+ " (%P|%t) Unable to find event channel\n"));
+ return;
+ }
+
+ ec->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+CosNotifyChannelAdmin::AdminID
+IdAssignment::create_supplier_admin (CosNotifyChannelAdmin::ChannelID channel_id
+ ACE_ENV_ARG_DECL)
+{
+ CosNotifyChannelAdmin::AdminID adminid;
+ CosNotifyChannelAdmin::InterFilterGroupOperator ifgop =
+ CosNotifyChannelAdmin::OR_OP;
+
+ CosNotifyChannelAdmin::EventChannel_var ec =
+ this->notify_factory_->get_event_channel (channel_id
+ ACE_ENV_ARG_PARAMETER);
+
+ ACE_CHECK_RETURN (0);
+
+ if (CORBA::is_nil (ec.in ()))
+ {
+ ACE_ERROR((LM_ERROR,
+ " (%P|%t) Unable to find event channel\n"));
+ return 0;
+ }
+
+ CosNotifyChannelAdmin::SupplierAdmin_var supplier_admin =
+ ec->new_for_suppliers (ifgop,
+ adminid
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ if (CORBA::is_nil (supplier_admin.in ()))
+ ACE_ERROR_RETURN ((LM_ERROR,
+ " (%P|%t) Unable to create supplier admin\n"),0);
+
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG,
+ "created supplier admin\n"));
+
+ return adminid;
+}
+
+CosNotifyChannelAdmin::AdminID
+IdAssignment::create_consumer_admin (CosNotifyChannelAdmin::ChannelID channel_id
+ ACE_ENV_ARG_DECL)
+{
+ CosNotifyChannelAdmin::AdminID adminid;
+ CosNotifyChannelAdmin::InterFilterGroupOperator ifgop =
+ CosNotifyChannelAdmin::OR_OP;
+
+ CosNotifyChannelAdmin::EventChannel_var ec =
+ this->notify_factory_->get_event_channel (channel_id
+ ACE_ENV_ARG_PARAMETER);
+
+ ACE_CHECK_RETURN (0);
+
+ if (CORBA::is_nil (ec.in ()))
+ {
+ ACE_ERROR((LM_ERROR,
+ " (%P|%t) Unable to find event channel\n"));
+ return 0;
+ }
+
+ CosNotifyChannelAdmin::ConsumerAdmin_var consumer_admin =
+ ec->new_for_consumers (ifgop,
+ adminid
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ if (CORBA::is_nil (consumer_admin.in ()))
+ ACE_ERROR_RETURN ((LM_ERROR,
+ " (%P|%t) Unable to create consumer admin\n"),0);
+
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG,
+ "created consumer admin\n"));
+
+ return adminid;
+}
+
+
+void
+IdAssignment::destroy_consumer_admin (
+ CosNotifyChannelAdmin::ChannelID channel_id,
+ CosNotifyChannelAdmin::AdminID admin_id
+ ACE_ENV_ARG_DECL
+ )
+{
+ CosNotifyChannelAdmin::EventChannel_var ec =
+ this->notify_factory_->get_event_channel (channel_id
+ ACE_ENV_ARG_PARAMETER);
+
+ ACE_CHECK;
+
+ if (CORBA::is_nil (ec.in ()))
+ {
+ ACE_ERROR((LM_ERROR,
+ " (%P|%t) Unable to find event channel\n"));
+ return;
+ }
+
+ CosNotifyChannelAdmin::ConsumerAdmin_var consumer_admin =
+ ec->get_consumeradmin (admin_id
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (CORBA::is_nil (consumer_admin.in()))
+ {
+ ACE_ERROR ((LM_ERROR,
+ " (%P|%t) Unable to get consumer admin\n"));
+ }
+
+ consumer_admin->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG,
+ "destroyed consumer admin\n"));
+}
+
+
+void
+IdAssignment::destroy_supplier_admin (
+ CosNotifyChannelAdmin::ChannelID channel_id,
+ CosNotifyChannelAdmin::AdminID admin_id
+ ACE_ENV_ARG_DECL
+ )
+{
+ CosNotifyChannelAdmin::EventChannel_var ec =
+ this->notify_factory_->get_event_channel (channel_id
+ ACE_ENV_ARG_PARAMETER);
+
+ ACE_CHECK;
+
+ if (CORBA::is_nil (ec.in ()))
+ {
+ ACE_ERROR ((LM_ERROR,
+ " (%P|%t) Unable to find event channel\n"));
+ }
+
+ CosNotifyChannelAdmin::SupplierAdmin_var supplier_admin =
+ ec->get_supplieradmin (admin_id
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (CORBA::is_nil (supplier_admin.in ()))
+ ACE_ERROR ((LM_ERROR,
+ " (%P|%t) Unable to get supplier admin\n"));
+
+ supplier_admin->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG,
+ "destroyed supplier admin\n"));
+}
+
+void
+IdAssignment::run_test(ACE_ENV_SINGLE_ARG_DECL)
+{
+ CosNotifyChannelAdmin::ChannelID* ec_id = 0;
+ ACE_NEW (ec_id,
+ CosNotifyChannelAdmin::ChannelID [this->ec_count_]);
+
+ CosNotifyChannelAdmin::AdminID* consumer_admin_id = 0;
+ ACE_NEW (consumer_admin_id,
+ CosNotifyChannelAdmin::AdminID [this->consumer_admin_count_]);
+
+ CosNotifyChannelAdmin::AdminID* supplier_admin_id = 0;
+ ACE_NEW (supplier_admin_id,
+ CosNotifyChannelAdmin::AdminID [this->supplier_admin_count_]);
+
+ // *******************************************************************
+
+ int i;
+
+ for (i = 0; i < this->iter_; ++i)
+ {
+ int ec_count;
+
+ for (ec_count = 0; ec_count < this->ec_count_; ++ec_count)
+ {
+ ec_id[ec_count] = this->create_ec (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Connect <consumer_admin_count_> number of consumers
+ // to the current ec.
+ for (int cons_count = 0;
+ cons_count < this->consumer_admin_count_;
+ ++cons_count)
+ {
+ consumer_admin_id [cons_count] =
+ this->create_consumer_admin (ec_id [ec_count]
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ // Connect <supplier_admin_count_> number of suppliers
+ // to the current ec.
+ for (int supp_count = 0;
+ supp_count < this->supplier_admin_count_;
+ ++supp_count)
+ {
+ supplier_admin_id [supp_count] =
+ this->create_supplier_admin (ec_id [ec_count]
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ }
+
+ // Destroy the ec, the admins should destroy too.
+ for (ec_count = 0; ec_count < this->ec_count_; ++ec_count)
+ {
+ this->destroy_ec (ec_id[ec_count]
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ } // for
+
+
+ //******************************************************************************
+ // Repeat, but this time destroy the admins explicity.
+ for (i = 0; i < this->iter_; ++i)
+ {
+ int ec_count;
+
+ for (ec_count = 0; ec_count < this->ec_count_; ++ec_count)
+ {
+ ec_id[ec_count] = this->create_ec (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ int cons_count, supp_count;
+ // Connect <consumer_admin_count_> number of consumers
+ // to the current ec.
+ for (cons_count = 0;
+ cons_count < this->consumer_admin_count_;
+ ++cons_count)
+ {
+ consumer_admin_id[cons_count] =
+ this->create_consumer_admin (ec_id[ec_count]
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ // Connect <supplier_admin_count_> number of suppliers
+ // to the current ec.
+ for (supp_count = 0; supp_count < this->supplier_admin_count_; ++supp_count)
+ {
+ supplier_admin_id[supp_count] =
+ this->create_supplier_admin (ec_id[ec_count]
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ // Destroy the admins.
+
+ // Destroy consumer admins.
+ for (cons_count = 0;
+ cons_count < this->consumer_admin_count_;
+ ++cons_count)
+ {
+ this->destroy_consumer_admin (ec_id[ec_count],
+ consumer_admin_id[cons_count]
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ // Destroy supplier admins
+ for (supp_count = 0;
+ supp_count < this->supplier_admin_count_;
+ ++supp_count)
+ {
+ this->destroy_supplier_admin (ec_id[ec_count],
+ supplier_admin_id[supp_count]
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ }
+
+ // Destroy the ec,
+ for (ec_count = 0; ec_count < this->ec_count_; ++ec_count)
+ {
+ this->destroy_ec (ec_id[ec_count]
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+ } // for
+
+ //********************************************************************************
+}
+
+int main (int argc, char* argv[])
+{
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ IdAssignment test;
+
+ test.parse_args (argc,
+ argv);
+
+ test.init (argc,
+ argv
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ test.run_test (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Error: ");
+ return 1;
+ }
+ ACE_ENDTRY;
+
+ ACE_DEBUG ((LM_DEBUG,
+ "IdAssignment test suceeded\n"));
+ return 0;
+}
diff --git a/TAO/orbsvcs/tests/Notify/Basic/IdAssignment.h b/TAO/orbsvcs/tests/Notify/Basic/IdAssignment.h
new file mode 100644
index 00000000000..7b4a7e3920f
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/Basic/IdAssignment.h
@@ -0,0 +1,71 @@
+/* -*- C++ -*- */
+// $Id$
+// ==========================================================================
+//
+// = FILENAME
+// IdAssignment.h
+//
+// = DESCRIPTION
+// Test to check if ec, admin are assigned id's correctly.
+//
+// = AUTHORS
+// Chanaka Liyanaarachchi <chanaka@ociweb.com> and Pradeep Gore <pradeep@cs.wustl.edu>
+//
+// ==========================================================================
+
+#ifndef IDASSIGNMENT_H
+#define IDASSIGNMENT_H
+
+#include "orbsvcs/CosNotifyChannelAdminC.h"
+
+class IdAssignment
+{
+public:
+ IdAssignment (void);
+ ~IdAssignment (void);
+
+ int parse_args (int argc,
+ char *argv[]);
+ void init (int argc,
+ char *argv[]
+ ACE_ENV_ARG_DECL);
+ void run_test (ACE_ENV_SINGLE_ARG_DECL);
+
+private:
+ CosNotifyChannelAdmin::ChannelID create_ec (ACE_ENV_SINGLE_ARG_DECL);
+ void destroy_ec (CosNotifyChannelAdmin::ChannelID id
+ ACE_ENV_ARG_DECL);
+
+ CosNotifyChannelAdmin::AdminID create_supplier_admin (
+ CosNotifyChannelAdmin::ChannelID channel_id
+ ACE_ENV_ARG_DECL
+ );
+ CosNotifyChannelAdmin::AdminID create_consumer_admin (
+ CosNotifyChannelAdmin::ChannelID channel_id
+ ACE_ENV_ARG_DECL
+ );
+
+ void destroy_consumer_admin (CosNotifyChannelAdmin::ChannelID channel_id,
+ CosNotifyChannelAdmin::AdminID admin_id
+ ACE_ENV_ARG_DECL);
+ void destroy_supplier_admin (CosNotifyChannelAdmin::ChannelID channel_id,
+ CosNotifyChannelAdmin::AdminID admin_id
+ ACE_ENV_ARG_DECL);
+
+ // = Data members.
+ CosNotifyChannelAdmin::EventChannelFactory_var notify_factory_;
+
+ int iter_;
+ // Number of iterations for the test.
+
+ int ec_count_;
+ // Numbers of EC's to create.
+
+ int consumer_admin_count_;
+ // Number of consumer admins to create per ec.
+
+ int supplier_admin_count_;
+ // Number of consumer admins to create per ec.
+};
+
+#endif /* IDASSIGNMENT_H */
diff --git a/TAO/orbsvcs/tests/Notify/Basic/LifeCycle.cpp b/TAO/orbsvcs/tests/Notify/Basic/LifeCycle.cpp
new file mode 100644
index 00000000000..0bb420600c7
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/Basic/LifeCycle.cpp
@@ -0,0 +1,271 @@
+//$Id$
+
+#include "ace/Arg_Shifter.h"
+#include "ace/Get_Opt.h"
+#include "tao/debug.h"
+#include <orbsvcs/CosNamingC.h>
+#include <orbsvcs/CosNotifyCommC.h>
+#include <orbsvcs/CosNotifyChannelAdminC.h>
+
+#include "LifeCycle.h"
+
+ACE_RCSID (Notify_Tests,
+ LifeCycle,
+ "$Id$")
+
+LifeCycle::LifeCycle (void)
+ : count_ (10)
+{
+}
+
+LifeCycle::~LifeCycle (void)
+{
+}
+
+int
+LifeCycle::parse_args (int argc,
+ char *argv[])
+{
+ ACE_Arg_Shifter arg_shifter (argc,
+ argv);
+
+ const char *current_arg = 0;
+
+ while (arg_shifter.is_anything_left ())
+ {
+ if ((current_arg = arg_shifter.get_the_parameter ("-count")))
+ {
+ this->count_ = ACE_OS::atoi (current_arg);
+ // The number of times to create and destroy.
+ arg_shifter.consume_arg ();
+ }
+ else if (arg_shifter.cur_arg_strncasecmp ("-?") == 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "usage: %s "
+ "-count testcount \n",
+ argv[0],
+ argv[0]));
+
+ arg_shifter.consume_arg ();
+
+ return -1;
+ }
+ else
+ {
+ arg_shifter.ignore_arg ();
+ }
+ }
+
+ return 0;
+}
+
+void
+LifeCycle::init (int argc,
+ char* argv[]
+ ACE_ENV_ARG_DECL)
+{
+ CORBA::ORB_var orb = CORBA::ORB_init (argc,
+ argv,
+ ""
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ CORBA::Object_var rootObj =
+ orb->resolve_initial_references ("NameService"
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (CORBA::is_nil (rootObj.in ()))
+ {
+ ACE_ERROR ((LM_ERROR,
+ " (%P|%t) Unable to resolve naming service !\n"));
+ return;
+ }
+
+ CosNaming::NamingContext_var rootNC =
+ CosNaming::NamingContext::_narrow (rootObj.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ CosNaming::Name name (1);
+ name.length (1);
+ name[0].id = CORBA::string_dup ("NotifyEventChannelFactory");
+
+ CORBA::Object_var obj = rootNC->resolve (name
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ notify_factory_ =
+ CosNotifyChannelAdmin::EventChannelFactory::_narrow (
+ obj.in()
+ ACE_ENV_ARG_PARAMETER
+ );
+ ACE_CHECK;
+
+ if (CORBA::is_nil (notify_factory_.in ()))
+ {
+ ACE_ERROR ((LM_ERROR,
+ " (%P|%t) Unable to locate Notify_Service \n"));
+
+ return;
+ }
+}
+
+void
+LifeCycle::run_test(ACE_ENV_SINGLE_ARG_DECL)
+{
+ for (int i = 0; i < this->count_; ++i)
+ {
+ this->create_ec (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->create_supplier_admin (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->create_consumer_admin (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->destroy_consumer_admin (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->destroy_supplier_admin (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->destroy_ec (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+}
+
+void
+LifeCycle::create_ec (ACE_ENV_SINGLE_ARG_DECL)
+{
+ CosNotifyChannelAdmin::ChannelID id;
+ CosNotification::QoSProperties initial_qos;
+ CosNotification::AdminProperties initial_admin;
+
+ this->ec_ = notify_factory_->create_channel (initial_qos,
+ initial_admin,
+ id
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (CORBA::is_nil (ec_.in ())) {
+ ACE_ERROR ((LM_ERROR,
+ " (%P|%t) Unable to create event channel\n"));
+ return;
+ }
+
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG,
+ "created event channel\n"));
+}
+
+void
+LifeCycle::create_supplier_admin (ACE_ENV_SINGLE_ARG_DECL)
+{
+ CosNotifyChannelAdmin::AdminID adminid;
+ CosNotifyChannelAdmin::InterFilterGroupOperator ifgop =
+ CosNotifyChannelAdmin::OR_OP;
+
+ supplier_admin_ = this->ec_->new_for_suppliers (ifgop,
+ adminid
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (CORBA::is_nil (supplier_admin_.in ()))
+ {
+ ACE_ERROR ((LM_ERROR,
+ " (%P|%t) Unable to create supplier admin\n"));
+ return;
+ }
+
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG,
+ "created supplier admin\n"));
+}
+
+void
+LifeCycle::create_consumer_admin (ACE_ENV_SINGLE_ARG_DECL)
+{
+ CosNotifyChannelAdmin::AdminID adminid;
+ CosNotifyChannelAdmin::InterFilterGroupOperator ifgop =
+ CosNotifyChannelAdmin::OR_OP;
+
+ consumer_admin_ = ec_->new_for_consumers (ifgop, adminid ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (CORBA::is_nil (consumer_admin_.in()))
+ {
+ ACE_ERROR ((LM_ERROR,
+ " (%P|%t) Unable to find supplier admin\n"));
+ return;
+ }
+
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG,
+ "created consumer admin\n"));
+}
+
+void
+LifeCycle::destroy_supplier_admin (ACE_ENV_SINGLE_ARG_DECL)
+{
+ this->supplier_admin_->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG,
+ "destroyed supplier admin\n"));
+}
+
+void
+LifeCycle::destroy_consumer_admin (ACE_ENV_SINGLE_ARG_DECL)
+{
+ this->consumer_admin_->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG,
+ "destroyed consumer admin\n"));
+}
+
+void
+LifeCycle::destroy_ec (ACE_ENV_SINGLE_ARG_DECL)
+{
+ this->ec_->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG,
+ "destroyed event channel\n"));
+}
+
+
+int
+main (int argc, char *argv[])
+{
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ LifeCycle test;
+
+ test.parse_args (argc,
+ argv);
+
+ test.init (argc,
+ argv
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ test.run_test (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Error: ");
+ return 1;
+ }
+ ACE_ENDTRY;
+
+ return 0;
+}
diff --git a/TAO/orbsvcs/tests/Notify/Basic/LifeCycle.h b/TAO/orbsvcs/tests/Notify/Basic/LifeCycle.h
new file mode 100644
index 00000000000..94a2869641b
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/Basic/LifeCycle.h
@@ -0,0 +1,49 @@
+/* -*- C++ -*- */
+// $Id$
+// ==========================================================================
+//
+// = FILENAME
+// LifeCycle.h
+//
+// = DESCRIPTION
+// Test to check it ec and admin objects are destroyed.
+//
+// = AUTHOR
+// Chanaka Liyanaarachchi <chanaka@ociweb.com>
+//
+// ==========================================================================
+
+#ifndef NOTIFY_LIFECYCLETST_H
+#define NOTIFY_LIFECYCLETST_H
+
+class LifeCycle
+{
+public:
+ LifeCycle (void);
+ ~LifeCycle (void);
+
+ void init (int argc,
+ char *argv[]
+ ACE_ENV_ARG_DECL);
+ void run_test (ACE_ENV_SINGLE_ARG_DECL);
+ int parse_args (int argc,
+ char *argv[]);
+
+private:
+ void create_ec (ACE_ENV_SINGLE_ARG_DECL);
+ void create_supplier_admin (ACE_ENV_SINGLE_ARG_DECL);
+ void create_consumer_admin (ACE_ENV_SINGLE_ARG_DECL);
+ void destroy_ec (ACE_ENV_SINGLE_ARG_DECL);
+ void destroy_supplier_admin (ACE_ENV_SINGLE_ARG_DECL);
+ void destroy_consumer_admin (ACE_ENV_SINGLE_ARG_DECL);
+
+ CosNotifyChannelAdmin::EventChannelFactory_var notify_factory_;
+ CosNotifyChannelAdmin::EventChannel_var ec_;
+ CosNotifyChannelAdmin::SupplierAdmin_var supplier_admin_;
+ CosNotifyChannelAdmin::ConsumerAdmin_var consumer_admin_;
+
+ int count_;
+ // Number of times to create destroy.
+};
+
+#endif /* NOTIFY_LIFECYCLETST_H */
diff --git a/TAO/orbsvcs/tests/Notify/Basic/Makefile.am b/TAO/orbsvcs/tests/Notify/Basic/Makefile.am
new file mode 100644
index 00000000000..3a4a36013ce
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/Basic/Makefile.am
@@ -0,0 +1,494 @@
+## Process this file with automake to create Makefile.in
+##
+## $Id$
+##
+## This file was generated by MPC. Any changes made directly to
+## this file will be lost the next time it is generated.
+##
+## MPC Command:
+## ../bin/mwc.pl -type automake -noreldefs TAO.mwc
+
+ACE_BUILDDIR = $(top_builddir)/..
+ACE_ROOT = $(top_srcdir)/..
+TAO_BUILDDIR = $(top_builddir)
+TAO_ROOT = $(top_srcdir)
+
+noinst_PROGRAMS =
+
+## Makefile.Basic_Notify_AdminProperties.am
+
+if BUILD_CORBA_MESSAGING
+if !BUILD_MINIMUM_CORBA
+
+noinst_PROGRAMS += AdminProperties
+
+AdminProperties_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR) \
+ -I$(TAO_ROOT) \
+ -I$(TAO_BUILDDIR) \
+ -I$(TAO_ROOT)/orbsvcs \
+ -I$(TAO_BUILDDIR)/orbsvcs \
+ -I$(TAO_ROOT)/orbsvcs/tests/Notify/lib \
+ -DTAO_HAS_TYPED_EVENT_CHANNEL
+
+AdminProperties_SOURCES = \
+ AdminProperties.cpp \
+ AdminProperties.h
+
+AdminProperties_LDADD = \
+ $(TAO_BUILDDIR)/orbsvcs/tests/Notify/lib/libTAO_NotifyTests.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosEvent_Serv.la \
+ $(TAO_BUILDDIR)/tao/libTAO_IFR_Client.la \
+ $(TAO_BUILDDIR)/tao/libTAO_DynamicInterface.la \
+ $(TAO_BUILDDIR)/tao/libTAO_Messaging.la \
+ $(TAO_BUILDDIR)/tao/libTAO_PI.la \
+ $(TAO_BUILDDIR)/tao/libTAO_CodecFactory.la \
+ $(TAO_BUILDDIR)/tao/libTAO_Valuetype.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosNaming.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosNotification_Serv.la \
+ $(TAO_BUILDDIR)/tao/libTAO_DynamicAny.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_ETCL.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_Svc_Utils.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosNotification_Skel.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosEvent_Skel.la \
+ $(TAO_BUILDDIR)/tao/libTAO_PortableServer.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosNotification.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosEvent.la \
+ $(TAO_BUILDDIR)/tao/libTAO_AnyTypeCode.la \
+ $(TAO_BUILDDIR)/tao/libTAO.la \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+endif !BUILD_MINIMUM_CORBA
+endif BUILD_CORBA_MESSAGING
+
+## Makefile.Basic_Notify_ConnectDisconnect.am
+
+if BUILD_CORBA_MESSAGING
+if !BUILD_MINIMUM_CORBA
+
+noinst_PROGRAMS += ConnectDisconnect
+
+ConnectDisconnect_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR) \
+ -I$(TAO_ROOT) \
+ -I$(TAO_BUILDDIR) \
+ -I$(TAO_ROOT)/orbsvcs \
+ -I$(TAO_BUILDDIR)/orbsvcs \
+ -I$(TAO_ROOT)/orbsvcs/tests/Notify/lib \
+ -DTAO_HAS_TYPED_EVENT_CHANNEL
+
+ConnectDisconnect_SOURCES = \
+ ConnectDisconnect.cpp \
+ ConnectDisconnect.h
+
+ConnectDisconnect_LDADD = \
+ $(TAO_BUILDDIR)/orbsvcs/tests/Notify/lib/libTAO_NotifyTests.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosEvent_Serv.la \
+ $(TAO_BUILDDIR)/tao/libTAO_IFR_Client.la \
+ $(TAO_BUILDDIR)/tao/libTAO_DynamicInterface.la \
+ $(TAO_BUILDDIR)/tao/libTAO_Messaging.la \
+ $(TAO_BUILDDIR)/tao/libTAO_PI.la \
+ $(TAO_BUILDDIR)/tao/libTAO_CodecFactory.la \
+ $(TAO_BUILDDIR)/tao/libTAO_Valuetype.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosNaming.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosNotification_Serv.la \
+ $(TAO_BUILDDIR)/tao/libTAO_DynamicAny.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_ETCL.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_Svc_Utils.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosNotification_Skel.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosEvent_Skel.la \
+ $(TAO_BUILDDIR)/tao/libTAO_PortableServer.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosNotification.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosEvent.la \
+ $(TAO_BUILDDIR)/tao/libTAO_AnyTypeCode.la \
+ $(TAO_BUILDDIR)/tao/libTAO.la \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+endif !BUILD_MINIMUM_CORBA
+endif BUILD_CORBA_MESSAGING
+
+## Makefile.Basic_Notify_Events.am
+
+if BUILD_CORBA_MESSAGING
+if !BUILD_MINIMUM_CORBA
+
+noinst_PROGRAMS += Events
+
+Events_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR) \
+ -I$(TAO_ROOT) \
+ -I$(TAO_BUILDDIR) \
+ -I$(TAO_ROOT)/orbsvcs \
+ -I$(TAO_BUILDDIR)/orbsvcs \
+ -I$(TAO_ROOT)/orbsvcs/tests/Notify/lib \
+ -DTAO_HAS_TYPED_EVENT_CHANNEL
+
+Events_SOURCES = \
+ Events.cpp \
+ Events.h
+
+Events_LDADD = \
+ $(TAO_BUILDDIR)/orbsvcs/tests/Notify/lib/libTAO_NotifyTests.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosEvent_Serv.la \
+ $(TAO_BUILDDIR)/tao/libTAO_IFR_Client.la \
+ $(TAO_BUILDDIR)/tao/libTAO_DynamicInterface.la \
+ $(TAO_BUILDDIR)/tao/libTAO_Messaging.la \
+ $(TAO_BUILDDIR)/tao/libTAO_PI.la \
+ $(TAO_BUILDDIR)/tao/libTAO_CodecFactory.la \
+ $(TAO_BUILDDIR)/tao/libTAO_Valuetype.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosNaming.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosNotification_Serv.la \
+ $(TAO_BUILDDIR)/tao/libTAO_DynamicAny.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_ETCL.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_Svc_Utils.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosNotification_Skel.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosEvent_Skel.la \
+ $(TAO_BUILDDIR)/tao/libTAO_PortableServer.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosNotification.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosEvent.la \
+ $(TAO_BUILDDIR)/tao/libTAO_AnyTypeCode.la \
+ $(TAO_BUILDDIR)/tao/libTAO.la \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+endif !BUILD_MINIMUM_CORBA
+endif BUILD_CORBA_MESSAGING
+
+## Makefile.Basic_Notify_Filter.am
+
+if BUILD_CORBA_MESSAGING
+if !BUILD_MINIMUM_CORBA
+
+noinst_PROGRAMS += Filter
+
+Filter_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR) \
+ -I$(TAO_ROOT) \
+ -I$(TAO_BUILDDIR) \
+ -I$(TAO_ROOT)/orbsvcs \
+ -I$(TAO_BUILDDIR)/orbsvcs \
+ -I$(TAO_ROOT)/orbsvcs/tests/Notify/lib \
+ -DTAO_HAS_TYPED_EVENT_CHANNEL
+
+Filter_SOURCES = \
+ Filter.cpp \
+ Filter.h
+
+Filter_LDADD = \
+ $(TAO_BUILDDIR)/orbsvcs/tests/Notify/lib/libTAO_NotifyTests.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosEvent_Serv.la \
+ $(TAO_BUILDDIR)/tao/libTAO_IFR_Client.la \
+ $(TAO_BUILDDIR)/tao/libTAO_DynamicInterface.la \
+ $(TAO_BUILDDIR)/tao/libTAO_Messaging.la \
+ $(TAO_BUILDDIR)/tao/libTAO_PI.la \
+ $(TAO_BUILDDIR)/tao/libTAO_CodecFactory.la \
+ $(TAO_BUILDDIR)/tao/libTAO_Valuetype.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosNaming.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosNotification_Serv.la \
+ $(TAO_BUILDDIR)/tao/libTAO_DynamicAny.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_ETCL.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_Svc_Utils.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosNotification_Skel.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosEvent_Skel.la \
+ $(TAO_BUILDDIR)/tao/libTAO_PortableServer.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosNotification.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosEvent.la \
+ $(TAO_BUILDDIR)/tao/libTAO_AnyTypeCode.la \
+ $(TAO_BUILDDIR)/tao/libTAO.la \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+endif !BUILD_MINIMUM_CORBA
+endif BUILD_CORBA_MESSAGING
+
+## Makefile.Basic_Notify_IdAssignment.am
+
+if BUILD_CORBA_MESSAGING
+if !BUILD_MINIMUM_CORBA
+
+noinst_PROGRAMS += IdAssignment
+
+IdAssignment_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR) \
+ -I$(TAO_ROOT) \
+ -I$(TAO_BUILDDIR) \
+ -I$(TAO_ROOT)/orbsvcs \
+ -I$(TAO_BUILDDIR)/orbsvcs \
+ -I$(TAO_ROOT)/orbsvcs/tests/Notify/lib \
+ -DTAO_HAS_TYPED_EVENT_CHANNEL
+
+IdAssignment_SOURCES = \
+ IdAssignment.cpp \
+ IdAssignment.h
+
+IdAssignment_LDADD = \
+ $(TAO_BUILDDIR)/orbsvcs/tests/Notify/lib/libTAO_NotifyTests.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosEvent_Serv.la \
+ $(TAO_BUILDDIR)/tao/libTAO_IFR_Client.la \
+ $(TAO_BUILDDIR)/tao/libTAO_DynamicInterface.la \
+ $(TAO_BUILDDIR)/tao/libTAO_Messaging.la \
+ $(TAO_BUILDDIR)/tao/libTAO_PI.la \
+ $(TAO_BUILDDIR)/tao/libTAO_CodecFactory.la \
+ $(TAO_BUILDDIR)/tao/libTAO_Valuetype.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosNaming.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosNotification_Serv.la \
+ $(TAO_BUILDDIR)/tao/libTAO_DynamicAny.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_ETCL.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_Svc_Utils.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosNotification_Skel.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosEvent_Skel.la \
+ $(TAO_BUILDDIR)/tao/libTAO_PortableServer.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosNotification.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosEvent.la \
+ $(TAO_BUILDDIR)/tao/libTAO_AnyTypeCode.la \
+ $(TAO_BUILDDIR)/tao/libTAO.la \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+endif !BUILD_MINIMUM_CORBA
+endif BUILD_CORBA_MESSAGING
+
+## Makefile.Basic_Notify_LifeCycle.am
+
+if BUILD_CORBA_MESSAGING
+if !BUILD_MINIMUM_CORBA
+
+noinst_PROGRAMS += LifeCycle
+
+LifeCycle_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR) \
+ -I$(TAO_ROOT) \
+ -I$(TAO_BUILDDIR) \
+ -I$(TAO_ROOT)/orbsvcs \
+ -I$(TAO_BUILDDIR)/orbsvcs \
+ -I$(TAO_ROOT)/orbsvcs/tests/Notify/lib \
+ -DTAO_HAS_TYPED_EVENT_CHANNEL
+
+LifeCycle_SOURCES = \
+ LifeCycle.cpp \
+ LifeCycle.h
+
+LifeCycle_LDADD = \
+ $(TAO_BUILDDIR)/orbsvcs/tests/Notify/lib/libTAO_NotifyTests.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosEvent_Serv.la \
+ $(TAO_BUILDDIR)/tao/libTAO_IFR_Client.la \
+ $(TAO_BUILDDIR)/tao/libTAO_DynamicInterface.la \
+ $(TAO_BUILDDIR)/tao/libTAO_Messaging.la \
+ $(TAO_BUILDDIR)/tao/libTAO_PI.la \
+ $(TAO_BUILDDIR)/tao/libTAO_CodecFactory.la \
+ $(TAO_BUILDDIR)/tao/libTAO_Valuetype.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosNaming.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosNotification_Serv.la \
+ $(TAO_BUILDDIR)/tao/libTAO_DynamicAny.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_ETCL.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_Svc_Utils.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosNotification_Skel.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosEvent_Skel.la \
+ $(TAO_BUILDDIR)/tao/libTAO_PortableServer.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosNotification.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosEvent.la \
+ $(TAO_BUILDDIR)/tao/libTAO_AnyTypeCode.la \
+ $(TAO_BUILDDIR)/tao/libTAO.la \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+endif !BUILD_MINIMUM_CORBA
+endif BUILD_CORBA_MESSAGING
+
+## Makefile.Basic_Notify_MultiTypes.am
+
+if BUILD_CORBA_MESSAGING
+if !BUILD_MINIMUM_CORBA
+
+noinst_PROGRAMS += MultiTypes
+
+MultiTypes_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR) \
+ -I$(TAO_ROOT) \
+ -I$(TAO_BUILDDIR) \
+ -I$(TAO_ROOT)/orbsvcs \
+ -I$(TAO_BUILDDIR)/orbsvcs \
+ -I$(TAO_ROOT)/orbsvcs/tests/Notify/lib \
+ -DTAO_HAS_TYPED_EVENT_CHANNEL
+
+MultiTypes_SOURCES = \
+ MultiTypes.cpp \
+ MultiTypes.h
+
+MultiTypes_LDADD = \
+ $(TAO_BUILDDIR)/orbsvcs/tests/Notify/lib/libTAO_NotifyTests.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosEvent_Serv.la \
+ $(TAO_BUILDDIR)/tao/libTAO_IFR_Client.la \
+ $(TAO_BUILDDIR)/tao/libTAO_DynamicInterface.la \
+ $(TAO_BUILDDIR)/tao/libTAO_Messaging.la \
+ $(TAO_BUILDDIR)/tao/libTAO_PI.la \
+ $(TAO_BUILDDIR)/tao/libTAO_CodecFactory.la \
+ $(TAO_BUILDDIR)/tao/libTAO_Valuetype.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosNaming.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosNotification_Serv.la \
+ $(TAO_BUILDDIR)/tao/libTAO_DynamicAny.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_ETCL.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_Svc_Utils.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosNotification_Skel.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosEvent_Skel.la \
+ $(TAO_BUILDDIR)/tao/libTAO_PortableServer.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosNotification.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosEvent.la \
+ $(TAO_BUILDDIR)/tao/libTAO_AnyTypeCode.la \
+ $(TAO_BUILDDIR)/tao/libTAO.la \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+endif !BUILD_MINIMUM_CORBA
+endif BUILD_CORBA_MESSAGING
+
+## Makefile.Basic_Notify_Sequence.am
+
+if BUILD_CORBA_MESSAGING
+if !BUILD_MINIMUM_CORBA
+
+noinst_PROGRAMS += Sequence
+
+Sequence_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR) \
+ -I$(TAO_ROOT) \
+ -I$(TAO_BUILDDIR) \
+ -I$(TAO_ROOT)/orbsvcs \
+ -I$(TAO_BUILDDIR)/orbsvcs \
+ -I$(TAO_ROOT)/orbsvcs/tests/Notify/lib \
+ -DTAO_HAS_TYPED_EVENT_CHANNEL
+
+Sequence_SOURCES = \
+ Sequence.cpp \
+ Sequence.h
+
+Sequence_LDADD = \
+ $(TAO_BUILDDIR)/orbsvcs/tests/Notify/lib/libTAO_NotifyTests.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosEvent_Serv.la \
+ $(TAO_BUILDDIR)/tao/libTAO_IFR_Client.la \
+ $(TAO_BUILDDIR)/tao/libTAO_DynamicInterface.la \
+ $(TAO_BUILDDIR)/tao/libTAO_Messaging.la \
+ $(TAO_BUILDDIR)/tao/libTAO_PI.la \
+ $(TAO_BUILDDIR)/tao/libTAO_CodecFactory.la \
+ $(TAO_BUILDDIR)/tao/libTAO_Valuetype.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosNaming.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosNotification_Serv.la \
+ $(TAO_BUILDDIR)/tao/libTAO_DynamicAny.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_ETCL.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_Svc_Utils.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosNotification_Skel.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosEvent_Skel.la \
+ $(TAO_BUILDDIR)/tao/libTAO_PortableServer.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosNotification.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosEvent.la \
+ $(TAO_BUILDDIR)/tao/libTAO_AnyTypeCode.la \
+ $(TAO_BUILDDIR)/tao/libTAO.la \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+endif !BUILD_MINIMUM_CORBA
+endif BUILD_CORBA_MESSAGING
+
+## Makefile.Basic_Notify_Simple.am
+
+if BUILD_CORBA_MESSAGING
+if !BUILD_MINIMUM_CORBA
+
+noinst_PROGRAMS += Simple
+
+Simple_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR) \
+ -I$(TAO_ROOT) \
+ -I$(TAO_BUILDDIR) \
+ -I$(TAO_ROOT)/orbsvcs \
+ -I$(TAO_BUILDDIR)/orbsvcs \
+ -I$(TAO_ROOT)/orbsvcs/tests/Notify/lib \
+ -DTAO_HAS_TYPED_EVENT_CHANNEL
+
+Simple_SOURCES = \
+ Simple.cpp \
+ Simple.h
+
+Simple_LDADD = \
+ $(TAO_BUILDDIR)/orbsvcs/tests/Notify/lib/libTAO_NotifyTests.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosEvent_Serv.la \
+ $(TAO_BUILDDIR)/tao/libTAO_IFR_Client.la \
+ $(TAO_BUILDDIR)/tao/libTAO_DynamicInterface.la \
+ $(TAO_BUILDDIR)/tao/libTAO_Messaging.la \
+ $(TAO_BUILDDIR)/tao/libTAO_PI.la \
+ $(TAO_BUILDDIR)/tao/libTAO_CodecFactory.la \
+ $(TAO_BUILDDIR)/tao/libTAO_Valuetype.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosNaming.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosNotification_Serv.la \
+ $(TAO_BUILDDIR)/tao/libTAO_DynamicAny.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_ETCL.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_Svc_Utils.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosNotification_Skel.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosEvent_Skel.la \
+ $(TAO_BUILDDIR)/tao/libTAO_PortableServer.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosNotification.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosEvent.la \
+ $(TAO_BUILDDIR)/tao/libTAO_AnyTypeCode.la \
+ $(TAO_BUILDDIR)/tao/libTAO.la \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+endif !BUILD_MINIMUM_CORBA
+endif BUILD_CORBA_MESSAGING
+
+## Makefile.Basic_Notify_Updates.am
+
+if BUILD_CORBA_MESSAGING
+if !BUILD_MINIMUM_CORBA
+
+noinst_PROGRAMS += Updates
+
+Updates_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR) \
+ -I$(TAO_ROOT) \
+ -I$(TAO_BUILDDIR) \
+ -I$(TAO_ROOT)/orbsvcs \
+ -I$(TAO_BUILDDIR)/orbsvcs \
+ -I$(TAO_ROOT)/orbsvcs/tests/Notify/lib \
+ -DTAO_HAS_TYPED_EVENT_CHANNEL
+
+Updates_SOURCES = \
+ Updates.cpp \
+ Updates.h
+
+Updates_LDADD = \
+ $(TAO_BUILDDIR)/orbsvcs/tests/Notify/lib/libTAO_NotifyTests.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosEvent_Serv.la \
+ $(TAO_BUILDDIR)/tao/libTAO_IFR_Client.la \
+ $(TAO_BUILDDIR)/tao/libTAO_DynamicInterface.la \
+ $(TAO_BUILDDIR)/tao/libTAO_Messaging.la \
+ $(TAO_BUILDDIR)/tao/libTAO_PI.la \
+ $(TAO_BUILDDIR)/tao/libTAO_CodecFactory.la \
+ $(TAO_BUILDDIR)/tao/libTAO_Valuetype.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosNaming.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosNotification_Serv.la \
+ $(TAO_BUILDDIR)/tao/libTAO_DynamicAny.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_ETCL.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_Svc_Utils.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosNotification_Skel.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosEvent_Skel.la \
+ $(TAO_BUILDDIR)/tao/libTAO_PortableServer.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosNotification.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosEvent.la \
+ $(TAO_BUILDDIR)/tao/libTAO_AnyTypeCode.la \
+ $(TAO_BUILDDIR)/tao/libTAO.la \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+endif !BUILD_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/Basic/MultiTypes.cpp b/TAO/orbsvcs/tests/Notify/Basic/MultiTypes.cpp
new file mode 100644
index 00000000000..f8bb9dd472a
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/Basic/MultiTypes.cpp
@@ -0,0 +1,412 @@
+//$Id$
+
+#include "ace/Arg_Shifter.h"
+#include "ace/Get_Opt.h"
+#include "tao/debug.h"
+#include "MultiTypes.h"
+
+ACE_RCSID (Notify_Tests, MultiTypes, "$Id$")
+
+//*****************************************************************************************************
+
+MultiTypes_PushConsumer::MultiTypes_PushConsumer (MultiTypes* client)
+ :client_ (client)
+{
+}
+
+void
+MultiTypes_PushConsumer::push (const CORBA::Any & /*data*/
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ CosEventComm::Disconnected
+ ))
+{
+ client_->on_received_event (this);
+}
+
+/***************************************************************************/
+
+MultiTypes_StructuredPushConsumer::MultiTypes_StructuredPushConsumer (MultiTypes* client)
+ :client_ (client)
+{
+}
+
+void
+MultiTypes_StructuredPushConsumer::push_structured_event (const CosNotification::StructuredEvent & /*notification*/
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ CosEventComm::Disconnected
+ ))
+{
+ client_->on_received_event (this);
+}
+
+/***************************************************************************/
+
+MultiTypes_SequencePushConsumer::MultiTypes_SequencePushConsumer (MultiTypes* client)
+ :client_ (client)
+{
+}
+
+// TODO: if the batch contains more than one event this counts only one received event
+// Since this should *never* happen, I'm not fixing it now.
+void
+MultiTypes_SequencePushConsumer::push_structured_events (const CosNotification::EventBatch & /*notifications*/
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ CosEventComm::Disconnected
+ ))
+{
+ client_->on_received_event (this);
+}
+
+/***************************************************************************/
+
+MultiTypes::MultiTypes (void)
+ :any_consumer_ (0),
+ structured_consumer_ (0),
+ sequence_consumer_ (0),
+ any_supplier_ (0),
+ structured_supplier_ (0),
+ sequence_supplier_ (0),
+ any_event_count_ (0),
+ struct_event_count_ (0),
+ seq_event_count_ (0),
+ disconnect_on_last_event_ (0)
+{
+
+}
+
+MultiTypes::~MultiTypes ()
+{
+}
+
+void
+MultiTypes::on_received_event (MultiTypes_PushConsumer* consumer)
+{
+ ++any_event_count_;
+
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG, "PushConsumer received event #%d\n", any_event_count_.value ()));
+
+ ACE_DECLARE_NEW_CORBA_ENV;
+
+ if (disconnect_on_last_event_ == 1)
+ {
+ consumer->disconnect (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG, "PushConsumer has been disconnected.\n"));
+ consumer = 0;
+ }
+}
+
+void
+MultiTypes::on_received_event (MultiTypes_StructuredPushConsumer* consumer)
+{
+ ++struct_event_count_;
+
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG, "StructuredPushConsumer received event #%d\n", struct_event_count_.value ()));
+
+ ACE_DECLARE_NEW_CORBA_ENV;
+
+ if (disconnect_on_last_event_ == 1)
+ {
+ consumer->disconnect (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG, "StructuredPushConsumer has been disconnected.\n"));
+ consumer = 0;
+ }
+}
+
+void
+MultiTypes::on_received_event (MultiTypes_SequencePushConsumer* consumer)
+{
+ ++seq_event_count_;
+
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG, "SequencePushConsumer received event #%d\n", seq_event_count_.value ()));
+
+ ACE_DECLARE_NEW_CORBA_ENV;
+
+ if (disconnect_on_last_event_ == 1)
+ {
+ consumer->disconnect (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG, "SequencePushConsumer has been disconnected.\n"));
+ consumer = 0;
+ }
+}
+
+int
+MultiTypes::init (int argc,
+ char* argv []
+ ACE_ENV_ARG_DECL)
+{
+ // Initialize the base class.
+ Notify_Test_Client::init (argc,
+ argv
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);;
+
+ // Create all participants.
+ this->create_EC (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ CosNotifyChannelAdmin::AdminID adminid;
+
+ this->supplier_admin_ =
+ ec_->new_for_suppliers (this->ifgop_,
+ adminid
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);;
+
+ ACE_ASSERT (!CORBA::is_nil (supplier_admin_.in ()));
+
+ this->consumer_admin_ =
+ ec_->new_for_consumers (this->ifgop_,
+ adminid
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ ACE_ASSERT (!CORBA::is_nil (consumer_admin_.in ()));
+
+ // Create the consumers and suppliers.
+ any_consumer_ = new MultiTypes_PushConsumer (this);
+ structured_consumer_ = new MultiTypes_StructuredPushConsumer (this);
+ sequence_consumer_ = new MultiTypes_SequencePushConsumer (this);
+
+ any_supplier_ = new TAO_Notify_Tests_PushSupplier;
+ structured_supplier_ = new TAO_Notify_Tests_StructuredPushSupplier ();
+ sequence_supplier_ = new TAO_Notify_Tests_SequencePushSupplier ();
+
+ // Init and connect all consumers.
+ structured_consumer_->init (root_poa_.in () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ structured_consumer_->connect (this->consumer_admin_.in () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ any_consumer_->init (root_poa_.in () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ any_consumer_->connect (this->consumer_admin_.in () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+
+ sequence_consumer_->init (root_poa_.in () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ sequence_consumer_->connect (this->consumer_admin_.in () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ // Init and connect all suppliers.
+ any_supplier_->init (root_poa_.in () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ any_supplier_->connect (this->supplier_admin_.in () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ structured_supplier_->init (root_poa_.in () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ structured_supplier_->connect (this->supplier_admin_.in () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ sequence_supplier_->init (root_poa_.in () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ sequence_supplier_->connect (this->supplier_admin_.in () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ consumer_start( 0 );
+
+ return 0;
+}
+
+int
+MultiTypes::parse_args(int, char **)
+{
+ // Doesn't accept any arguments
+ return 0;
+}
+
+void
+MultiTypes::create_EC (ACE_ENV_SINGLE_ARG_DECL)
+{
+ CosNotifyChannelAdmin::ChannelID id;
+
+ this->ec_ = notify_factory_->create_channel (this->initial_qos_,
+ this->initial_admin_,
+ id
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ ACE_ASSERT (!CORBA::is_nil (ec_.in ()));
+}
+
+void
+MultiTypes::run_test (ACE_ENV_SINGLE_ARG_DECL)
+{
+ // Send an Any, all consumers should receive it.
+ CORBA::Any any;
+ any <<= (CORBA::Long)0;
+
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG, "Sending Any Event..\n"));
+ any_supplier_->send_event (any ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG, "Waiting for consumers to receive the 1 event..\n"));
+ this->wait_for_all_consumers (1);
+
+ /*****************************************************************************/
+
+ // Reset Count
+ any_event_count_ = 0;
+ struct_event_count_ = 0;
+ seq_event_count_ = 0;
+
+ // Send Structured Event, all consumers should receive it.
+ CosNotification::StructuredEvent event;
+ event.header.fixed_header.event_type.domain_name = CORBA::string_dup("*");
+ event.header.fixed_header.event_type.type_name = CORBA::string_dup("*");
+ event.header.fixed_header.event_name = CORBA::string_dup("myevent");
+
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG, "Sending Structured Event..\n"));
+ structured_supplier_->send_event (event ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG, "Waiting for consumers to receive the 1 event..\n"));
+ this->wait_for_all_consumers (1);
+
+ /*****************************************************************************/
+
+ // Reset Count
+ any_event_count_ = 0;
+ struct_event_count_ = 0;
+ seq_event_count_ = 0;
+
+ // Send Structured Events, all consumers should receive it.
+ CosNotification::EventBatch events;
+ events.length (2);
+
+ event.header.fixed_header.event_name = CORBA::string_dup("myevent_1");
+
+ events[0] = event;
+
+ event.header.fixed_header.event_name = CORBA::string_dup("myevent_2");
+
+ events[1] = event;
+
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG, "Sending Sequence Event..\n"));
+ sequence_supplier_->send_events (events ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG, "Waiting for consumers to receive the 2 events..\n"));
+ this->wait_for_all_consumers (2);
+
+ /*****************************************************************************/
+ // Reset Count
+ any_event_count_ = 0;
+ struct_event_count_ = 0;
+ seq_event_count_ = 0;
+
+ // set flag to disconnect consumers when event received.
+ disconnect_on_last_event_ = 1;
+
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG, "Sending LAST Any Event, Consumers will attempt disconnect..\n"));
+ any_supplier_->send_event (any ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG, "Waiting for consumers to receive the 1 event..\n"));
+ this->wait_for_all_consumers (1);
+
+ ACE_DEBUG ((LM_DEBUG, "MultiTypes test has run successfully!\n"));
+}
+
+void
+MultiTypes::wait_for_all_consumers (int expected_count_per_consumer)
+{
+ while (true)
+ {
+ if (any_event_count_.value () >= expected_count_per_consumer &&
+ struct_event_count_.value () >= expected_count_per_consumer &&
+ seq_event_count_.value () >= expected_count_per_consumer)
+ {
+ break;
+ }
+
+ ACE_Time_Value tv (0, 100 * 1000);
+ this->orb_->run(tv);
+ }
+}
+
+void
+MultiTypes::end_test (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+{
+ consumer_done( 0 );
+}
+
+int
+MultiTypes::check_results (void)
+{
+ // Destroy the channel.
+ ACE_DECLARE_NEW_CORBA_ENV;
+ this->ec_->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ return 0;
+}
+
+/***************************************************************************/
+
+int
+main (int argc, char* argv[])
+{
+ MultiTypes client;
+
+ if (client.parse_args (argc, argv) == -1)
+ {
+ return 1;
+ }
+
+ ACE_TRY_NEW_ENV
+ {
+ client.init (argc,
+ argv
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ client.run_test (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ client.end_test (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCH (CORBA::Exception, se)
+ {
+ ACE_PRINT_EXCEPTION (se, "Error: ");
+ return 1;
+ }
+ ACE_ENDTRY;
+
+ return client.check_results ();
+}
diff --git a/TAO/orbsvcs/tests/Notify/Basic/MultiTypes.h b/TAO/orbsvcs/tests/Notify/Basic/MultiTypes.h
new file mode 100644
index 00000000000..ac2701e61b8
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/Basic/MultiTypes.h
@@ -0,0 +1,169 @@
+/* -*- C++ -*- */
+// $Id$
+// ==========================================================================
+//
+// = FILENAME
+// MultiTypes.h
+//
+// = DESCRIPTION
+// Test connect-disconnect methods of Notify.
+//
+// = AUTHOR
+// Pradeep Gore <pradeep@cs.wustl.edu>
+//
+// ==========================================================================
+
+#ifndef NOTIFY_MULTI_TYPES_H
+#define NOTIFY_MULTI_TYPES_H
+
+#include "Notify_Test_Client.h"
+#include "Notify_StructuredPushConsumer.h"
+#include "Notify_StructuredPushSupplier.h"
+#include "Notify_PushConsumer.h"
+#include "Notify_PushSupplier.h"
+#include "Notify_SequencePushConsumer.h"
+#include "Notify_SequencePushSupplier.h"
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+class MultiTypes;
+
+/***************************************************************************/
+
+class MultiTypes_PushConsumer : public TAO_Notify_Tests_PushConsumer
+{
+public:
+ MultiTypes_PushConsumer (MultiTypes* client);
+
+ void push (
+ const CORBA::Any & data
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ CosEventComm::Disconnected
+ ));
+
+protected:
+ MultiTypes* client_;
+};
+
+/***************************************************************************/
+
+class MultiTypes_StructuredPushConsumer : public TAO_Notify_Tests_StructuredPushConsumer
+{
+public:
+ MultiTypes_StructuredPushConsumer (MultiTypes* client);
+
+ // = StructuredPushSupplier methods
+ virtual void push_structured_event (const CosNotification::StructuredEvent & notification
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ CosEventComm::Disconnected
+ ));
+
+protected:
+ MultiTypes* client_;
+};
+
+class MultiTypes_SequencePushConsumer : public TAO_Notify_Tests_SequencePushConsumer
+{
+public:
+ MultiTypes_SequencePushConsumer (MultiTypes* client);
+
+ // = SequencePushConsumer methods
+ virtual void push_structured_events (
+ const CosNotification::EventBatch & notifications
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ CosEventComm::Disconnected
+ ));
+
+protected:
+ MultiTypes* client_;
+};
+
+
+/***************************************************************************/
+
+class MultiTypes : public Notify_Test_Client
+{
+public:
+ // Initialization and termination code.
+ MultiTypes (void);
+ virtual ~MultiTypes ();
+
+ void on_received_event (MultiTypes_PushConsumer* consumer);
+ void on_received_event (MultiTypes_StructuredPushConsumer* consumer);
+ void on_received_event (MultiTypes_SequencePushConsumer* consumer);
+
+ int parse_args (int argc,
+ char *argv[]);
+
+ int init (int argc,
+ char *argv []
+ ACE_ENV_ARG_DECL);
+ // initialization.
+
+ void run_test (ACE_ENV_SINGLE_ARG_DECL);
+ // Run the test.
+
+ void end_test (ACE_ENV_SINGLE_ARG_DECL);
+ // End the test.
+
+ int check_results (void);
+ // Check if we got the expected results.
+
+protected:
+ // Wait to receive events.
+ void wait_for_all_consumers (int expected_count_per_consumer);
+
+ void create_EC (ACE_ENV_SINGLE_ARG_DECL);
+ // Create EC.
+
+ CosNotifyChannelAdmin::EventChannel_var ec_;
+ // The one channel that we create using the factory.
+
+ CosNotifyChannelAdmin::ConsumerAdmin_var consumer_admin_;
+ // The consumer admin used by consumers.
+
+ CosNotifyChannelAdmin::SupplierAdmin_var supplier_admin_;
+ // The supplier admin used by suppliers.
+
+ TAO_Notify_Tests_PushConsumer* any_consumer_;
+ TAO_Notify_Tests_StructuredPushConsumer* structured_consumer_;
+ TAO_Notify_Tests_SequencePushConsumer* sequence_consumer_;
+ // Consumers.
+
+ TAO_Notify_Tests_PushSupplier* any_supplier_;
+ TAO_Notify_Tests_StructuredPushSupplier* structured_supplier_;
+ TAO_Notify_Tests_SequencePushSupplier* sequence_supplier_;
+ // Suppliers
+
+ // Count of Any events received;
+ ACE_Atomic_Op <TAO_SYNCH_MUTEX, int> any_event_count_;
+
+ // Count of Structured events received;
+ ACE_Atomic_Op <TAO_SYNCH_MUTEX, int> struct_event_count_;
+
+ // Count of Sequence events received;
+ ACE_Atomic_Op <TAO_SYNCH_MUTEX, int> seq_event_count_;
+
+ // disconnect_on_last_event_
+ int disconnect_on_last_event_;
+};
+
+/***************************************************************************/
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#endif /* NOTIFY_MULTI_TYPES_H */
diff --git a/TAO/orbsvcs/tests/Notify/Basic/README b/TAO/orbsvcs/tests/Notify/Basic/README
new file mode 100644
index 00000000000..ed9a0128716
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/Basic/README
@@ -0,0 +1,109 @@
+
+ Basic Tests
+ ===========
+
+Updates:
+-------
+This test will check if the subscription and publication update messages
+from the event channel are properly received from the Notify Service.
+
+Command line parameters:
+none.
+
+ConnectDisconnect:
+-----------------
+Connects/Disconnects consumers and suppliers in a loop to test connect
+and disconnect to admin objects.
+
+Command line parameters:
+
+"-count <testcount>",
+"-consumers <number_of_consumers>",
+"-suppliers <number_of_suppliers>",
+
+LifeCycle:
+-------------
+Creates and destroys EC and Admin objects.
+
+Command line parameters:
+"-count testcount"
+
+where <testcount> is how many times we want to create/destroy.
+
+IdAssignment:
+------------
+This test exercies Id generation by creating ec and admin objects and
+using the assigned ids to lookup these objects and destroy them.
+
+Command line parameters:
+"-iter <count>", count is how many times to repeat this test.
+"-ec_count <count>", count is number of ec objects to create
+"-ca_count <count>", count is number of consumer admin (ca) objects to create
+"-sa_count <count>\n", count is number of supplier admin (sa) objects to create
+
+
+AdminProperties
+--------------------
+Tests out the EC Admin QoSproperties:
+
+command line parameters:
+
+-max_queue_length [max_queue_length]
+-max_consumers [max_consumers]
+-max_suppliers [max_suppliers]
+-reject_new_events [reject_new_events]
+-consumers [consumers]
+-suppliers [suppliers]
+-event_count [event_count]
+-ConsumerDelay [delay in secs]
+// sleep period per push for the consumer created to test MaxQueueLength
+-InitialDelay [delay in secs]
+
+Events:
+----------
+This test creates 1 structured supplier and 2 structured consumers.
+Each consumer should receive all the events send by the supplier.
+The uses the default ConsumerAdmin and default Supplier Admin if the
+-use_default_admin option is specified.
+
+command line options:
+-use_default_admin
+-events [number of events to send]
+
+MultiTypes:
+-----------
+Creates a Supplier and Consumer each for the 3 Client types that send
+and receive Any, Structured and Sequence event types.
+Each type of the supplier then sends an event each to the Notification
+channel. All 3 types of consumers should receive 3 events each.
+
+command line options:
+none.
+
+Simple:
+-------
+Creates 1 Any Supplier and 1 Any Consumer. Events received by the
+supplier must be equal to the count send.
+
+command line options:
+-events [number of events to send]
+
+Filter:
+------
+Tests the FilterAdmin and Filter interface methods.
+
+command line options:
+none.
+
+Sequence:
+---------
+In the default run, this test sends 15 events in batches of 5 events
+via a sequence supplier. It sets the consumer's batch size to 3 and
+sets a pacing interval of 2 seconds. It checks to see if 15 events are indeed received.
+
+command line options:
+-events [count]
+-SupplierBatchSize [count]
+-ConsumerBatchSize [count]
+-ConsumerDelay [delay]
+-InitialDelay [delay] \ No newline at end of file
diff --git a/TAO/orbsvcs/tests/Notify/Basic/Sequence.cpp b/TAO/orbsvcs/tests/Notify/Basic/Sequence.cpp
new file mode 100644
index 00000000000..7842be55e57
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/Basic/Sequence.cpp
@@ -0,0 +1,387 @@
+// $Id$
+
+#include "ace/Arg_Shifter.h"
+#include "ace/Get_Opt.h"
+#include "ace/OS_NS_unistd.h"
+#include "tao/debug.h"
+#include "Sequence.h"
+
+ACE_RCSID (Notify_Tests, Sequence, "$Id$")
+
+/***************************************************************************/
+
+SequencePushConsumer::SequencePushConsumer (Sequence *test_client)
+ : test_client_ (test_client)
+{
+}
+
+void
+SequencePushConsumer::push_structured_events (
+ const CosNotification::EventBatch &batch
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ CosEventComm::Disconnected))
+{
+ this->test_client_->events_received_ += batch.length ();
+
+ if (batch.length () > this->test_client_->consumer_batch_size_)
+ ACE_DEBUG ((LM_ERROR,
+ "Error: Received more than max event batch %d\n",
+ batch.length ()));
+
+ this->test_client_->on_event_received ();
+
+ ACE_OS::sleep (this->test_client_->consumer_delay_);
+}
+
+/***************************************************************************/
+
+SequencePushSupplier::SequencePushSupplier (
+ Sequence* test_client
+ )
+ : test_client_ (test_client)
+{
+}
+
+SequencePushSupplier::~SequencePushSupplier (void)
+{
+}
+
+/***************************************************************************/
+Sequence::Sequence (void)
+ : event_count_ (15), supplier_batch_size_ (5), consumer_batch_size_ (3),
+ pacing_ (2), order_policy_ (CosNotification::PriorityOrder), events_received_ (0),
+ consumer_delay_ (1)
+{
+}
+
+Sequence::~Sequence (void)
+{
+}
+
+int
+Sequence::init (int argc,
+ char* argv []
+ ACE_ENV_ARG_DECL)
+{
+ if (TAO_debug_level)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "Options: event count = %d \n"
+ "supplier batch size = %d \n"
+ "consumer batch size = %d \n"
+ "pacing = %d secs \n"
+ , event_count_
+ , supplier_batch_size_
+ , consumer_batch_size_
+ , pacing_));
+
+ ACE_DEBUG ((LM_DEBUG, "consumer delay = %d\n", consumer_delay_.sec ()));
+ }
+
+ // Initialize the base class.
+ Notify_Test_Client::init (argc,
+ argv
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ // Create all participents.
+ this->create_EC (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ CosNotifyChannelAdmin::AdminID adminid;
+
+ this->supplier_admin_ =
+ this->ec_->new_for_suppliers (this->ifgop_,
+ adminid
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ ACE_ASSERT (!CORBA::is_nil (supplier_admin_.in ()));
+
+ this->consumer_admin_ =
+ this->ec_->new_for_consumers (this->ifgop_,
+ adminid
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ ACE_ASSERT (!CORBA::is_nil (consumer_admin_.in ()));
+
+ ACE_NEW_RETURN (this->consumer_,
+ SequencePushConsumer (this),
+ -1);
+ this->consumer_->init (root_poa_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+ this->consumer_->connect (this->consumer_admin_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ CosNotification::QoSProperties properties (3);
+ properties.length (3);
+
+ properties[0].name = CORBA::string_dup (CosNotification::MaximumBatchSize);
+ properties[0].value <<= (CORBA::Long) this->consumer_batch_size_;
+ properties[1].name = CORBA::string_dup (CosNotification::PacingInterval);
+ properties[1].value <<= (TimeBase::TimeT) (this->pacing_ * 1000 * 10000);
+ properties[2].name = CORBA::string_dup (CosNotification::OrderPolicy);
+ properties[2].value <<= this->order_policy_;
+
+ this->consumer_->get_proxy_supplier ()->set_qos (properties);
+
+ ACE_NEW_RETURN (this->supplier_,
+ SequencePushSupplier (this),
+ -1);
+ this->supplier_->init (root_poa_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ this->supplier_->connect (this->supplier_admin_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ consumer_start( 0 );
+
+ return 0;
+}
+
+int
+Sequence::parse_args (int argc,
+ char *argv[])
+{
+ ACE_Arg_Shifter arg_shifter (argc,
+ argv);
+ const char *current_arg = 0;
+
+ while (arg_shifter.is_anything_left ())
+ {
+ if ((current_arg = arg_shifter.get_the_parameter ("-events")))
+ {
+ this->event_count_ = ACE_OS::atoi (current_arg); // The number of events to send/receive.
+
+ arg_shifter.consume_arg ();
+ }
+ else if ((current_arg = arg_shifter.get_the_parameter ("-SupplierBatchSize")))
+ {
+ this->supplier_batch_size_ = ACE_OS::atoi (current_arg); // Supplier batch size
+
+ arg_shifter.consume_arg ();
+ }
+ else if ((current_arg = arg_shifter.get_the_parameter ("-ConsumerBatchSize")))
+ {
+ this->consumer_batch_size_ = ACE_OS::atoi (current_arg); // Consumer batch size
+
+ arg_shifter.consume_arg ();
+ }
+ else if ((current_arg = arg_shifter.get_the_parameter ("-ConsumerDelay")))
+ {
+ this->consumer_delay_ = ACE_Time_Value (ACE_OS::atoi (current_arg), 0); // Consumer delay in secs.
+
+ arg_shifter.consume_arg ();
+ }
+ else if ((current_arg = arg_shifter.get_the_parameter ("-Pacing"))) // in seconds
+ {
+ this->pacing_ = (TimeBase::TimeT) ACE_OS::atoi (current_arg);
+
+ arg_shifter.consume_arg ();
+ }
+
+ else if (arg_shifter.cur_arg_strncasecmp ("-?") == 0)
+ {
+ ACE_DEBUG((LM_DEBUG,
+ "usage: %s "
+ "-events event_count "
+ "-SupplierBatchSize size "
+ "-ConsumerBatchSize size "
+ "-ConsumerDelay delay "
+ "-Pacing pacing \n",
+ argv[0], argv[0]));
+
+ arg_shifter.consume_arg ();
+
+ return -1;
+ }
+ else
+ {
+ arg_shifter.ignore_arg ();
+ }
+ }
+
+ return 0;
+}
+
+void
+Sequence::create_EC (ACE_ENV_SINGLE_ARG_DECL)
+{
+ CosNotifyChannelAdmin::ChannelID id;
+
+ this->ec_ = notify_factory_->create_channel (this->initial_qos_,
+ this->initial_admin_,
+ id
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ ACE_ASSERT (!CORBA::is_nil (this->ec_.in ()));
+}
+
+void
+Sequence::on_event_received (void)
+{
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG,
+ "Events received = %d\n",
+ this->events_received_.value ()));
+
+ if (this->events_received_.value () == this->event_count_)
+ {
+ ACE_DECLARE_NEW_CORBA_ENV;
+ this->end_test (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+}
+
+void
+Sequence::run_test (ACE_ENV_SINGLE_ARG_DECL)
+{
+ // operations:
+ CosNotification::StructuredEvent event;
+
+ // EventHeader.
+
+ // FixedEventHeader.
+ // EventType.
+ // string.
+ event.header.fixed_header.event_type.domain_name = CORBA::string_dup("*");
+ // string
+ event.header.fixed_header.event_type.type_name = CORBA::string_dup("*");
+ // string
+ event.header.fixed_header.event_name = CORBA::string_dup("myevent");
+
+ // OptionalHeaderFields.
+ // PropertySeq.
+ // sequence<Property>: string name, any value
+ CosNotification::PropertySeq& qos = event.header.variable_header;
+ qos.length (1); // put nothing here
+
+ // FilterableEventBody
+ // PropertySeq
+ // sequence<Property>: string name, any value
+ event.filterable_data.length (3);
+ event.filterable_data[0].name = CORBA::string_dup("threshold");
+
+ event.filterable_data[1].name = CORBA::string_dup("temperature");
+ event.filterable_data[1].value <<= (CORBA::Long)70;
+
+ event.filterable_data[2].name = CORBA::string_dup("pressure");
+ event.filterable_data[2].value <<= (CORBA::Long)80;
+
+ CORBA::Short prio = CosNotification::LowestPriority;
+
+ CosNotification::EventBatch batch;
+ batch.length (this->supplier_batch_size_);
+ CORBA::ULong batch_index = 0;
+
+ for (int i = 0; i < this->event_count_; ++i)
+ {
+ event.filterable_data[0].value <<= (CORBA::Long)i;
+
+ // any
+ event.remainder_of_body <<= (CORBA::Long)i;
+
+ qos[0].name = CORBA::string_dup (CosNotification::Priority);
+ qos[0].value <<= (CORBA::Short)prio++;
+
+ batch[batch_index] = event;
+ batch_index++;
+
+ if (batch_index == this->supplier_batch_size_)
+ {
+ batch.length (batch_index); // set the correct length
+
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG, "Sending batch with %d events\n", batch.length ()));
+
+ this->supplier_->send_events (batch
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // reset
+ batch.length (this->supplier_batch_size_);
+ batch_index = 0;
+ }
+ } // for
+
+ // send the last batch.
+ if (batch_index > 0)
+ {
+ batch.length (batch_index); // set the correct length
+
+ this->supplier_->send_events (batch
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+
+}
+
+void
+Sequence::end_test (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+{
+ consumer_done( 0 );
+}
+
+int
+Sequence::check_results (void)
+{
+ // Destroy the channel.
+ ACE_DECLARE_NEW_CORBA_ENV;
+ this->ec_->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ if (this->events_received_.value () == this->event_count_)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "Sequence test success\n"));
+ return 0;
+ }
+ else
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "Sequence test failed!\n"));
+ return 1;
+ }
+}
+
+/***************************************************************************/
+
+int
+main (int argc, char* argv[])
+{
+ Sequence events;
+
+ if (events.parse_args (argc, argv) == -1)
+ {
+ return 1;
+ }
+
+ ACE_TRY_NEW_ENV
+ {
+ events.init (argc,
+ argv
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ events.run_test (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ events.ORB_run( ACE_ENV_SINGLE_ARG_PARAMETER );
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCH (CORBA::Exception, se)
+ {
+ ACE_PRINT_EXCEPTION (se, "Error: ");
+ return 1;
+ }
+ ACE_ENDTRY;
+
+ return events.check_results ();
+}
diff --git a/TAO/orbsvcs/tests/Notify/Basic/Sequence.h b/TAO/orbsvcs/tests/Notify/Basic/Sequence.h
new file mode 100644
index 00000000000..5a8e1138f3b
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/Basic/Sequence.h
@@ -0,0 +1,142 @@
+/* -*- C++ -*- */
+// $Id$
+// ==========================================================================
+//
+// = FILENAME
+// Events.h
+//
+// = DESCRIPTION
+// Test Sequence support in Notification.
+//
+// = AUTHOR
+// Pradeep Gore <pradeep@cs.wustl.edu>
+//
+// ==========================================================================
+
+#ifndef NOTIFY_TESTS_SEQUENCE_H
+#define NOTIFY_TESTS_SEQUENCE_H
+
+#include "Notify_Test_Client.h"
+#include "Notify_SequencePushConsumer.h"
+#include "Notify_SequencePushSupplier.h"
+#include "orbsvcs/TimeBaseC.h"
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+class Sequence;
+
+class SequencePushConsumer : public TAO_Notify_Tests_SequencePushConsumer
+{
+public:
+ SequencePushConsumer (Sequence* client);
+
+ // = SequencePushConsumer methods
+ virtual void push_structured_events (
+ const CosNotification::EventBatch & notifications
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ CosEventComm::Disconnected
+ ));
+
+protected:
+ Sequence* test_client_;
+};
+
+/***************************************************************************/
+
+class SequencePushSupplier : public TAO_Notify_Tests_SequencePushSupplier
+{
+public:
+ SequencePushSupplier (Sequence * test_client);
+ // Constructor.
+
+ virtual ~SequencePushSupplier (void);
+ // Destructor.
+
+protected:
+ Sequence* test_client_;
+};
+
+/***************************************************************************/
+
+class Sequence : public Notify_Test_Client
+{
+public:
+ // Initialization and termination code.
+ Sequence (void);
+ virtual ~Sequence (void);
+
+ int parse_args (int argc,
+ char *argv[]) ;
+
+ int init (int argc,
+ char *argv []
+ ACE_ENV_ARG_DECL);
+ // Initialization.
+
+ void on_event_received (void);
+ // Called when an event is received.
+
+ void run_test (ACE_ENV_SINGLE_ARG_DECL);
+ // Run the test.
+
+ void end_test (ACE_ENV_SINGLE_ARG_DECL);
+ // End the test.
+
+ int check_results (void);
+ // check if we got the expected results.
+
+protected:
+ void create_EC (ACE_ENV_SINGLE_ARG_DECL);
+ // Create EC
+
+ int event_count_;
+ // Number of events to send
+
+ /// Batch size send by supplier.
+ CORBA::ULong supplier_batch_size_;
+
+ /// Max Batch size expected by consumer.
+ CORBA::ULong consumer_batch_size_;
+
+ TimeBase::TimeT pacing_;
+
+ CORBA::Short order_policy_;
+
+ /// Count the number of events received by the consumer.
+ ACE_Atomic_Op <TAO_SYNCH_MUTEX, int> events_received_;
+
+ ACE_Time_Value consumer_delay_;
+
+ CosNotifyChannelAdmin::EventChannel_var ec_;
+ // The one channel that we create using the factory.
+
+ CosNotifyChannelAdmin::ConsumerAdmin_var consumer_admin_;
+ // The consumer admin used by consumers.
+
+ CosNotifyChannelAdmin::SupplierAdmin_var supplier_admin_;
+ // The supplier admin used by suppliers.
+
+ TAO_Notify_Tests_SequencePushConsumer* consumer_;
+ // Consumer
+
+ TAO_Notify_Tests_SequencePushSupplier* supplier_;
+ // Supplier
+
+private:
+ friend class SequencePushSupplier;
+ friend class SequencePushConsumer;
+};
+
+/***************************************************************************/
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#endif /* NOTIFY_TESTS_SEQUENCE_H */
diff --git a/TAO/orbsvcs/tests/Notify/Basic/Simple.cpp b/TAO/orbsvcs/tests/Notify/Basic/Simple.cpp
new file mode 100644
index 00000000000..fd0dffb4620
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/Basic/Simple.cpp
@@ -0,0 +1,271 @@
+//$Id$
+
+#include "ace/Arg_Shifter.h"
+#include "ace/Get_Opt.h"
+#include "tao/debug.h"
+#include "Simple.h"
+
+ACE_RCSID (Notify_Tests, Simple, "$Id$")
+
+//***************************************************************************
+
+Event_AnyPushConsumer::Event_AnyPushConsumer (Simple_Test *test_client)
+ : test_client_ (test_client)
+{
+}
+
+void
+Event_AnyPushConsumer::push (const CORBA::Any & data
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ CosEventComm::Disconnected))
+{
+ int event_num;
+ data >>= event_num;
+
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG,
+ "Received event# %d\n",
+ event_num));
+
+ this->test_client_->on_event_received ();
+}
+
+//***************************************************************************
+
+Event_AnyPushSupplier::Event_AnyPushSupplier (Simple_Test* test_client)
+ : test_client_ (test_client)
+{
+}
+
+Event_AnyPushSupplier::~Event_AnyPushSupplier (void)
+{
+}
+
+//***************************************************************************
+
+Simple_Test::Simple_Test (void)
+ : event_count_ (5)
+{
+}
+
+Simple_Test::~Simple_Test (void)
+{
+}
+
+int
+Simple_Test::init (int argc,
+ char* argv []
+ ACE_ENV_ARG_DECL)
+{
+ // Initialized the base class.
+ Notify_Test_Client::init (argc,
+ argv
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ // Create all participents.
+ this->create_EC (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ CosNotifyChannelAdmin::AdminID adminid;
+
+ supplier_admin_ =
+ this->ec_->new_for_suppliers (this->ifgop_,
+ adminid
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ ACE_ASSERT (!CORBA::is_nil (supplier_admin_.in ()));
+
+ consumer_admin_ =
+ this->ec_->new_for_consumers (this->ifgop_,
+ adminid
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ ACE_ASSERT (!CORBA::is_nil (consumer_admin_.in ()));
+
+ ACE_NEW_RETURN (this->consumer_,
+ Event_AnyPushConsumer (this),
+ -1);
+ this->consumer_->init (root_poa_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+ this->consumer_->connect (this->consumer_admin_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ Event_AnyPushConsumer* consumer2;
+ ACE_NEW_RETURN (consumer2,
+ Event_AnyPushConsumer (this),
+ -1);
+ consumer2->init (root_poa_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+ consumer2->connect (this->consumer_admin_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ ACE_NEW_RETURN (this->supplier_,
+ Event_AnyPushSupplier (this),
+ -1);
+ this->supplier_->init (root_poa_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ this->supplier_->connect (this->supplier_admin_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ consumer_start( 0 );
+
+ return 0;
+}
+
+int
+Simple_Test::parse_args (int argc,
+ char *argv[])
+{
+ ACE_Arg_Shifter arg_shifter (argc,
+ argv);
+
+ const char *current_arg = 0;
+
+ while (arg_shifter.is_anything_left ())
+ {
+ if ((current_arg = arg_shifter.get_the_parameter ("-events")))
+ {
+ this->event_count_ = ACE_OS::atoi (current_arg);
+ // The number of events to send/receive.
+ arg_shifter.consume_arg ();
+ }
+ else if (arg_shifter.cur_arg_strncasecmp ("-?") == 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "usage: %s "
+ "-events event_count \n",
+ argv[0],
+ argv[0]));
+
+ arg_shifter.consume_arg ();
+
+ return -1;
+ }
+ else
+ {
+ arg_shifter.ignore_arg ();
+ }
+ }
+ return 0;
+}
+
+void
+Simple_Test::create_EC (ACE_ENV_SINGLE_ARG_DECL)
+{
+ CosNotifyChannelAdmin::ChannelID id;
+
+ this->ec_ = notify_factory_->create_channel (this->initial_qos_,
+ this->initial_admin_,
+ id
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ ACE_ASSERT (!CORBA::is_nil (ec_.in ()));
+}
+
+void
+Simple_Test::on_event_received (void)
+{
+ ++this->result_count_;
+
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG,
+ "event count = #%d\n",
+ this->result_count_.value ()));
+
+ if (this->result_count_ == 2 * this->event_count_)
+ {
+ ACE_DECLARE_NEW_CORBA_ENV;
+ this->end_test (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+}
+
+void
+Simple_Test::run_test (ACE_ENV_SINGLE_ARG_DECL)
+{
+ CORBA::Any data;
+
+ for (int i = 0; i < this->event_count_; ++i)
+ {
+ data <<= (CORBA::Long)i;
+
+ this->supplier_->send_event (data
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+}
+
+void
+Simple_Test::end_test (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+{
+ consumer_done( 0 );
+}
+
+int
+Simple_Test::check_results (void)
+{
+ // Destroy the channel
+ ACE_DECLARE_NEW_CORBA_ENV;
+ this->ec_->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ if (this->result_count_ == 2 * this->event_count_)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "Events test success\n"));
+ return 0;
+ }
+ else
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "Events test failed!\n"));
+ return 1;
+ }
+}
+
+//***************************************************************************
+
+int
+main (int argc, char* argv[])
+{
+ Simple_Test events;
+
+ if (events.parse_args (argc, argv) == -1)
+ {
+ return 1;
+ }
+
+ ACE_TRY_NEW_ENV
+ {
+ events.init (argc,
+ argv
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ events.run_test (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ events.ORB_run( ACE_ENV_SINGLE_ARG_PARAMETER );
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCH (CORBA::Exception, se)
+ {
+ ACE_PRINT_EXCEPTION (se, "Error: ");
+ return 1;
+ }
+ ACE_ENDTRY;
+
+ return events.check_results ();
+}
diff --git a/TAO/orbsvcs/tests/Notify/Basic/Simple.h b/TAO/orbsvcs/tests/Notify/Basic/Simple.h
new file mode 100644
index 00000000000..a941fcfb027
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/Basic/Simple.h
@@ -0,0 +1,130 @@
+/* -*- C++ -*- */
+// $Id$
+// ==========================================================================
+//
+// = FILENAME
+// Simple_Test.h
+//
+// = DESCRIPTION
+// Simple test any supplier to any consumer.
+//
+// = AUTHOR
+// Pradeep Gore <pradeep@cs.wustl.edu>
+//
+// ==========================================================================
+
+#ifndef NOTIFY_TESTS_SIMPLE_H
+#define NOTIFY_TESTS_SIMPLE_H
+
+#include "Notify_Test_Client.h"
+#include "Notify_PushConsumer.h"
+#include "Notify_PushSupplier.h"
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+class Simple_Test;
+
+/***************************************************************************/
+
+class Event_AnyPushConsumer : public TAO_Notify_Tests_PushConsumer
+{
+public:
+ Event_AnyPushConsumer (Simple_Test *test_client);
+ // Contructor.
+
+ // = PushSupplier methods
+ virtual void push (
+ const CORBA::Any & data
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ CosEventComm::Disconnected));
+
+protected:
+ Simple_Test * test_client_;
+};
+
+/***************************************************************************/
+
+class Event_AnyPushSupplier : public TAO_Notify_Tests_PushSupplier
+{
+public:
+ Event_AnyPushSupplier (Simple_Test * test_client);
+ // Constructor.
+
+ virtual ~Event_AnyPushSupplier (void);
+ // Destructor.
+
+protected:
+ Simple_Test* test_client_;
+};
+
+/***************************************************************************/
+
+class Simple_Test : public Notify_Test_Client
+{
+public:
+ // Initialization and termination code
+ Simple_Test (void);
+ virtual ~Simple_Test (void);
+
+ int parse_args (int argc,
+ char *argv[]) ;
+
+ int init (int argc,
+ char *argv []
+ ACE_ENV_ARG_DECL);
+ // initialization.
+
+ void on_event_received (void);
+ // Called when an event is received.
+
+ void run_test (ACE_ENV_SINGLE_ARG_DECL);
+ // Run the test.
+
+ void end_test (ACE_ENV_SINGLE_ARG_DECL);
+ // End the test.
+
+ int check_results (void);
+ // check if we got the expected results.
+
+protected:
+ void create_EC (ACE_ENV_SINGLE_ARG_DECL);
+ // Create EC
+
+ ACE_Atomic_Op <TAO_SYNCH_MUTEX, int> result_count_;
+ // Number of events received so far.
+
+ int event_count_;
+ // Number of events to send
+
+ CosNotifyChannelAdmin::EventChannel_var ec_;
+ // The one channel that we create using the factory.
+
+ CosNotifyChannelAdmin::ConsumerAdmin_var consumer_admin_;
+ // The consumer admin used by consumers.
+
+ CosNotifyChannelAdmin::SupplierAdmin_var supplier_admin_;
+ // The supplier admin used by suppliers.
+
+ TAO_Notify_Tests_PushConsumer* consumer_;
+ // Consumer.
+
+ TAO_Notify_Tests_PushSupplier* supplier_;
+ // Supplier.
+
+private:
+ friend class Event_AnyPushSupplier;
+ friend class Event_AnyPushConsumer;
+};
+
+/***************************************************************************/
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#endif /* NOTIFY_TESTS_SIMPLE_H */
diff --git a/TAO/orbsvcs/tests/Notify/Basic/Updates.cpp b/TAO/orbsvcs/tests/Notify/Basic/Updates.cpp
new file mode 100644
index 00000000000..3933aaa37a1
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/Basic/Updates.cpp
@@ -0,0 +1,488 @@
+//$Id$
+
+#include "ace/Arg_Shifter.h"
+#include "ace/Get_Opt.h"
+#include "tao/debug.h"
+#include "Updates.h"
+
+ACE_RCSID (Notify_Tests, Updates, "$Id$")
+
+Updates_StructuredPushConsumer::Updates_StructuredPushConsumer (Updates *test_client)
+ : test_client_ (test_client)
+{
+}
+
+void
+Updates_StructuredPushConsumer::offer_change (
+ const CosNotification::EventTypeSeq & added,
+ const CosNotification::EventTypeSeq & removed
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ CosNotifyComm::InvalidEventType
+ ))
+{
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG, "StructuredPushConsumer::offer_change invoked:\n"));
+ this->test_client_->types_changed (added, removed);
+}
+
+/***************************************************************************/
+
+Updates_StructuredPushSupplier::Updates_StructuredPushSupplier (Updates* test_client)
+ :test_client_ (test_client)
+{
+}
+
+Updates_StructuredPushSupplier::~Updates_StructuredPushSupplier ()
+{
+}
+
+void
+Updates_StructuredPushSupplier::subscription_change (
+ const CosNotification::EventTypeSeq & added,
+ const CosNotification::EventTypeSeq & removed
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ CosNotifyComm::InvalidEventType))
+{
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG, "StructuredPushSupplier::subscription_change invoked:\n"));
+ this->test_client_->types_changed (added, removed);
+}
+
+/***************************************************************************/
+
+Updates::Updates (void)
+ : added_count_ (0), removed_count_ (0)
+{
+}
+
+Updates::~Updates ()
+{
+}
+
+int
+Updates::init (int argc,
+ char* argv []
+ ACE_ENV_ARG_DECL)
+{
+ // Initialize base class.
+ Notify_Test_Client::init (argc,
+ argv
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ // Create all participents.
+ this->create_EC (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ CosNotifyChannelAdmin::AdminID adminid;
+
+ supplier_admin_ =
+ ec_->new_for_suppliers (this->ifgop_,
+ adminid
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ ACE_ASSERT (!CORBA::is_nil (supplier_admin_.in ()));
+
+ consumer_admin_ =
+ ec_->new_for_consumers (this->ifgop_,
+ adminid
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ ACE_ASSERT (!CORBA::is_nil (consumer_admin_.in ()));
+
+ ACE_NEW_RETURN (consumer_,
+ Updates_StructuredPushConsumer (this),
+ -1);
+ consumer_->init (root_poa_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ consumer_->connect (this->consumer_admin_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ ACE_NEW_RETURN (supplier_,
+ Updates_StructuredPushSupplier (this),
+ -1);
+ supplier_->init (root_poa_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ supplier_->connect (this->supplier_admin_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ return 0;
+}
+
+void
+Updates::create_EC (ACE_ENV_SINGLE_ARG_DECL)
+{
+ CosNotifyChannelAdmin::ChannelID id;
+
+ ec_ = notify_factory_->create_channel (initial_qos_,
+ initial_admin_,
+ id
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ ACE_ASSERT (!CORBA::is_nil (ec_.in ()));
+}
+
+void
+Updates::types_changed (const CosNotification::EventTypeSeq & added,
+ const CosNotification::EventTypeSeq & removed)
+{
+ if (TAO_debug_level)
+ {
+ ACE_DEBUG ((LM_DEBUG, "Added Types.. \n"));
+ this->print_event_types (added);
+
+ ACE_DEBUG ((LM_DEBUG, "Removed Types.. \n"));
+ this->print_event_types (removed);
+ }
+
+ ACE_GUARD (TAO_SYNCH_MUTEX, mon, this->lock_);
+
+ this->added_count_ += added.length ();
+ this->removed_count_ += removed.length ();
+}
+
+void
+Updates::print_event_types (const CosNotification::EventTypeSeq &types)
+{
+ for (CORBA::ULong i = 0; i < types.length (); ++i)
+ {
+ ACE_DEBUG ((LM_DEBUG, "(%s, %s)\n", types[i].domain_name.in (), types[i].type_name. in()));
+ }
+}
+
+void
+Updates::add_type (CosNotification::EventTypeSeq& type_seq, const char* type)
+{
+ // Make space.
+ int index = type_seq.length ();
+ type_seq.length (index + 1);
+
+ type_seq[index].domain_name = CORBA::string_dup (type);
+ type_seq[index].type_name = CORBA::string_dup (type);
+}
+
+void
+Updates::wait_for_updates (int expected_added, int expected_removed)
+{
+ while (1)
+ {
+ if (added_count_ == expected_added &&
+ removed_count_ == expected_removed)
+ break;
+
+ ACE_Time_Value tv(0, 100 * 1000);
+ orb_->run(tv);
+ }
+}
+
+void
+Updates::reset_counts (void)
+{
+ ACE_GUARD (TAO_SYNCH_MUTEX, mon, this->lock_);
+ this->added_count_ = 0;
+ this->removed_count_ = 0;
+}
+
+void
+Updates::run_test (ACE_ENV_SINGLE_ARG_DECL)
+{
+ this->test_subscription_change (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG, "Finished testing subscription_change!\n"));
+
+ this->test_offer_change (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ ACE_DEBUG ((LM_DEBUG, "Updates test has run successfully!\n"));
+}
+
+void
+Updates::test_subscription_change (ACE_ENV_SINGLE_ARG_DECL)
+{
+ {
+ // reset counts.
+ this->reset_counts ();
+
+ /// Currently we're subscribed for "*"
+ /// Add RED, GREEN and BLUE
+ /// Remove ORANGE and PINK
+
+ CosNotification::EventTypeSeq added, removed;
+
+ this->add_type (added, "RED");
+ this->add_type (added, "GREEN");
+ this->add_type (added, "BLUE");
+
+ this->add_type (removed, "ORANGE");
+ this->add_type (removed, "PINK");
+
+ if (TAO_debug_level)
+ {
+ ACE_DEBUG ((LM_DEBUG, "Calling subscription_change with added types:\n"));
+ this->print_event_types (added);
+ ACE_DEBUG ((LM_DEBUG, "Calling subscription_change with removed types:\n"));
+ this->print_event_types (removed);
+ }
+
+ this->consumer_->get_proxy_supplier ()->subscription_change (added,
+ removed
+ ACE_ENV_ARG_PARAMETER
+ );
+ ACE_CHECK;
+
+ this->wait_for_updates (3, 0); // The supplier should receive Added (RED, GREEN, BLUE)
+
+ // Get the subscriptions visible to the supplier.
+ CosNotification::EventTypeSeq_var obtained =
+ this->supplier_->get_proxy_consumer ()->obtain_subscription_types (CosNotifyChannelAdmin::ALL_NOW_UPDATES_ON);
+
+ if (TAO_debug_level)
+ {
+ ACE_DEBUG ((LM_DEBUG, "obtain_subscription_types \n"));
+ this->print_event_types (obtained.in ());
+ }
+ }
+
+ {
+ // reset counts.
+ this->reset_counts ();
+
+ // Now, add PURPLE, RED and GREEN
+ CosNotification::EventTypeSeq added, removed;
+
+ this->add_type (added, "PURPLE");
+ this->add_type (added, "GREEN");
+ this->add_type (added, "BLUE");
+
+ if (TAO_debug_level)
+ {
+ ACE_DEBUG ((LM_DEBUG, "Calling subscription_change with added types:\n"));
+ this->print_event_types (added);
+ ACE_DEBUG ((LM_DEBUG, "Calling subscription_change with removed types:\n"));
+ this->print_event_types (removed);
+ }
+
+ this->consumer_->get_proxy_supplier ()->subscription_change (added,
+ removed
+ ACE_ENV_ARG_PARAMETER
+ );
+ ACE_CHECK;
+
+ this->wait_for_updates (1, 0); // The supplier should receive Added (PURPLE).
+
+ // Get the subscriptions visible to the supplier.
+ CosNotification::EventTypeSeq_var obtained =
+ this->supplier_->get_proxy_consumer ()->obtain_subscription_types (CosNotifyChannelAdmin::ALL_NOW_UPDATES_ON);
+
+ if (TAO_debug_level)
+ {
+ ACE_DEBUG ((LM_DEBUG, "obtain_subscription_types \n"));
+ this->print_event_types (obtained.in ());
+ }
+ }
+
+ {
+ // reset counts.
+ this->reset_counts ();
+
+ // Next, Remove everything by subcribing to "*"
+ CosNotification::EventTypeSeq added, removed;
+
+ this->add_type (added, "*");
+
+ if (TAO_debug_level)
+ {
+ ACE_DEBUG ((LM_DEBUG, "Calling subscription_change with added types:\n"));
+ this->print_event_types (added);
+ ACE_DEBUG ((LM_DEBUG, "Calling subscription_change with removed types:\n"));
+ this->print_event_types (removed);
+ }
+
+ this->consumer_->get_proxy_supplier ()->subscription_change (added,
+ removed
+ ACE_ENV_ARG_PARAMETER
+ );
+ ACE_CHECK;
+
+ this->wait_for_updates (0, 4);
+ // The supplier should receive Remove {RED, GREEN} out of the 4 actally removed (RED, GREEN, BLUE, PURPLE) becaue that whats it offered for.
+
+ // Get the subscriptions visible to the supplier.
+ CosNotification::EventTypeSeq_var obtained =
+ this->supplier_->get_proxy_consumer ()->obtain_subscription_types (CosNotifyChannelAdmin::ALL_NOW_UPDATES_ON);
+
+ if (TAO_debug_level)
+ {
+ ACE_DEBUG ((LM_DEBUG, "obtain_subscription_types \n"));
+ this->print_event_types (obtained.in ());
+ }
+ }
+
+}
+
+void
+Updates::test_offer_change (ACE_ENV_SINGLE_ARG_DECL)
+{
+ {
+ // reset counts.
+ this->reset_counts ();
+
+ /// Currently we're subscribed for "*"
+ /// Add RED, GREEN and BLUE
+ /// Remove ORANGE and PINK
+
+ CosNotification::EventTypeSeq added, removed;
+
+ this->add_type (added, "RED");
+ this->add_type (added, "GREEN");
+ this->add_type (added, "BLUE");
+
+ this->add_type (removed, "ORANGE");
+ this->add_type (removed, "PINK");
+
+ if (TAO_debug_level)
+ {
+ ACE_DEBUG ((LM_DEBUG, "Calling offer_change with added types:\n"));
+ this->print_event_types (added);
+ ACE_DEBUG ((LM_DEBUG, "Calling offer_change with removed types:\n"));
+ this->print_event_types (removed);
+ }
+
+ this->supplier_->get_proxy_consumer ()->offer_change (added,
+ removed
+ ACE_ENV_ARG_PARAMETER
+ );
+ ACE_CHECK;
+
+ this->wait_for_updates (3, 0); // The consumer should receive Added (RED, GREEN, BLUE)
+
+ // Get the offers visible to the supplier.
+ CosNotification::EventTypeSeq_var obtained =
+ this->consumer_->get_proxy_supplier ()->obtain_offered_types (CosNotifyChannelAdmin::ALL_NOW_UPDATES_ON);
+
+ if (TAO_debug_level)
+ {
+ ACE_DEBUG ((LM_DEBUG, "obtain_offer_types \n"));
+ this->print_event_types (obtained.in ());
+ }
+ }
+
+ {
+ // reset counts.
+ this->reset_counts ();
+
+ // Now, add PURPLE, RED and GREEN
+ CosNotification::EventTypeSeq added, removed;
+
+ this->add_type (added, "PURPLE");
+ this->add_type (added, "GREEN");
+ this->add_type (added, "BLUE");
+
+ if (TAO_debug_level)
+ {
+ ACE_DEBUG ((LM_DEBUG, "Calling offer_change with added types:\n"));
+ this->print_event_types (added);
+ ACE_DEBUG ((LM_DEBUG, "Calling offer_change with removed types:\n"));
+ this->print_event_types (removed);
+ }
+
+ this->supplier_->get_proxy_consumer ()->offer_change (added,
+ removed
+ ACE_ENV_ARG_PARAMETER
+ );
+ ACE_CHECK;
+
+ this->wait_for_updates (1, 0); // The consumer should receive Added (PURPLE).
+
+ // Get the offers visible to the consumer.
+ CosNotification::EventTypeSeq_var obtained =
+ this->consumer_->get_proxy_supplier ()->obtain_offered_types (CosNotifyChannelAdmin::ALL_NOW_UPDATES_ON);
+
+ if (TAO_debug_level)
+ {
+ ACE_DEBUG ((LM_DEBUG, "obtain_offer_types \n"));
+ this->print_event_types (obtained.in ());
+ }
+ }
+
+ {
+ // reset counts.
+ this->reset_counts ();
+
+ // Next, Remove everything by subcribing to "*"
+ CosNotification::EventTypeSeq added, removed;
+
+ this->add_type (added, "*");
+
+ if (TAO_debug_level)
+ {
+ ACE_DEBUG ((LM_DEBUG, "Calling offer_change with added types:\n"));
+ this->print_event_types (added);
+ ACE_DEBUG ((LM_DEBUG, "Calling offer_change with removed types:\n"));
+ this->print_event_types (removed);
+ }
+
+ this->supplier_->get_proxy_consumer ()->offer_change (added,
+ removed
+ ACE_ENV_ARG_PARAMETER
+ );
+ ACE_CHECK;
+
+ this->wait_for_updates (0, 4);
+ // The consumer should receive Remove {RED, GREEN} out of the 4 actally removed (RED, GREEN, BLUE, PURPLE) becaue that whats it offered for.
+
+ // Get the offers visible to the consumer.
+ CosNotification::EventTypeSeq_var obtained =
+ this->consumer_->get_proxy_supplier ()->obtain_offered_types (CosNotifyChannelAdmin::ALL_NOW_UPDATES_ON);
+
+ if (TAO_debug_level)
+ {
+ ACE_DEBUG ((LM_DEBUG, "obtain_offer_types \n"));
+ this->print_event_types (obtained.in ());
+ }
+ }
+
+}
+
+/***************************************************************************/
+
+int
+main (int argc, char* argv[])
+{
+ Updates updates;
+
+ ACE_TRY_NEW_ENV
+ {
+ updates.init (argc,
+ argv
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ updates.run_test (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCH (CORBA::SystemException, se)
+ {
+ ACE_PRINT_EXCEPTION (se, "Error: ");
+ return 1;
+ }
+ ACE_ENDTRY;
+
+ return 0;
+}
diff --git a/TAO/orbsvcs/tests/Notify/Basic/Updates.h b/TAO/orbsvcs/tests/Notify/Basic/Updates.h
new file mode 100644
index 00000000000..e4c7104f9bf
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/Basic/Updates.h
@@ -0,0 +1,148 @@
+/* -*- C++ -*- */
+// $Id$
+// ==========================================================================
+//
+// = FILENAME
+// Updates.h
+//
+// = DESCRIPTION
+// Test to check if <offer_change> and <subscription_change> messages are
+// received correctly.
+//
+// = AUTHOR
+// Pradeep Gore <pradeep@cs.wustl.edu>
+//
+// ==========================================================================
+
+#ifndef NOTIFY_TESTS_UPDATES_H
+#define NOTIFY_TESTS_UPDATES_H
+
+#include "Notify_Test_Client.h"
+#include "Notify_StructuredPushConsumer.h"
+#include "Notify_StructuredPushSupplier.h"
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+class Updates;
+
+class Updates_StructuredPushConsumer : public TAO_Notify_Tests_StructuredPushConsumer
+{
+public:
+ Updates_StructuredPushConsumer (Updates *test_client);
+ // Contructor.
+
+ virtual void offer_change (const CosNotification::EventTypeSeq & added,
+ const CosNotification::EventTypeSeq & removed
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ CosNotifyComm::InvalidEventType));
+ // Offer change is conveyed here.
+
+protected:
+ Updates * test_client_;
+};
+
+/***************************************************************************/
+
+class Updates_StructuredPushSupplier : public TAO_Notify_Tests_StructuredPushSupplier
+{
+public:
+ Updates_StructuredPushSupplier (Updates * test_client);
+ // Constructor.
+
+ virtual ~Updates_StructuredPushSupplier ();
+ // Destructor.
+
+ virtual void subscription_change (
+ const CosNotification::EventTypeSeq & added,
+ const CosNotification::EventTypeSeq & removed
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ CosNotifyComm::InvalidEventType));
+ // Subscription change is conveyed here.
+
+protected:
+ Updates* test_client_;
+};
+
+/***************************************************************************/
+
+class Updates : public Notify_Test_Client
+{
+public:
+ // Initialization and termination code
+ Updates (void);
+ virtual ~Updates ();
+
+ int init (int argc, char *argv [] ACE_ENV_ARG_DECL);
+ // initialization.
+
+ void run_test (ACE_ENV_SINGLE_ARG_DECL);
+ // Run the test.
+
+ /// print_event_types
+ void print_event_types (const CosNotification::EventTypeSeq &types);
+
+ /// Invoked by Supplier and Consumer when they receive updates
+ void types_changed (const CosNotification::EventTypeSeq & added, const CosNotification::EventTypeSeq & removed);
+
+ /// Wait for expected count of updates.
+ void wait_for_updates (int expected_added, int expected_removed);
+
+protected:
+ void create_EC (ACE_ENV_SINGLE_ARG_DECL);
+ // Create EC
+
+ /// Helper to add types.
+ void add_type (CosNotification::EventTypeSeq& type_seq, const char* type);
+
+ // test subscription_change
+ void test_subscription_change (ACE_ENV_SINGLE_ARG_DECL);
+
+ // test offer_change
+ void test_offer_change (ACE_ENV_SINGLE_ARG_DECL);
+
+ /// Reset the counts.
+ void reset_counts (void);
+
+ /// Lock to serialize internal state.
+ TAO_SYNCH_MUTEX lock_;
+
+ /// Count of added updates received
+ int added_count_;
+
+ /// Count of removed updates received
+ int removed_count_;
+ // Check if these are equal to <update_count_> at the end of the test.
+
+ CosNotifyChannelAdmin::EventChannel_var ec_;
+ // The one channel that we create using the factory.
+
+ CosNotifyChannelAdmin::ConsumerAdmin_var consumer_admin_;
+ // The consumer admin used by consumers.
+
+ CosNotifyChannelAdmin::SupplierAdmin_var supplier_admin_;
+ // The supplier admin used by suppliers.
+
+ TAO_Notify_Tests_StructuredPushConsumer* consumer_;
+ // Consumer
+
+ TAO_Notify_Tests_StructuredPushSupplier* supplier_;
+ // Supplier
+
+private:
+ friend class Updates_StructuredPushSupplier;
+ friend class Updates_StructuredPushConsumer;
+};
+
+/***************************************************************************/
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#endif /* NOTIFY_TESTS_UPDATES_H */
diff --git a/TAO/orbsvcs/tests/Notify/Basic/adminproperties.conf b/TAO/orbsvcs/tests/Notify/Basic/adminproperties.conf
new file mode 100644
index 00000000000..7ed22785ab7
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/Basic/adminproperties.conf
@@ -0,0 +1,6 @@
+## $Id$
+
+## Load the static Cos Notification Service
+## We must use the following settings, because the supplier and consumer are co-located, and
+## the test needs to prevent the threads from mixing during upcalls.
+static Client_Strategy_Factory "-ORBWaitStrategy RW -ORBTransportMuxStrategy exclusive"
diff --git a/TAO/orbsvcs/tests/Notify/Basic/notify.mt.conf b/TAO/orbsvcs/tests/Notify/Basic/notify.mt.conf
new file mode 100644
index 00000000000..1ed64ed8d98
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/Basic/notify.mt.conf
@@ -0,0 +1,2 @@
+##$Id$
+static Notify_Default_Event_Manager_Objects_Factory "-DispatchingThreads 2"
diff --git a/TAO/orbsvcs/tests/Notify/Basic/notify.reactive.conf b/TAO/orbsvcs/tests/Notify/Basic/notify.reactive.conf
new file mode 100644
index 00000000000..ca5144bd072
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/Basic/notify.reactive.conf
@@ -0,0 +1,2 @@
+##$Id$
+static Notify_Default_Event_Manager_Objects_Factory ""
diff --git a/TAO/orbsvcs/tests/Notify/Basic/notify.rt.conf b/TAO/orbsvcs/tests/Notify/Basic/notify.rt.conf
new file mode 100644
index 00000000000..50faf80e5ee
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/Basic/notify.rt.conf
@@ -0,0 +1,5 @@
+dynamic TAO_RT_ORB_Loader Service_Object *TAO_RTCORBA:_make_TAO_RT_ORB_Loader () "-ORBPriorityMapping continuous"
+#
+# Uncomment this line to use SCHED_FIFO
+#dynamic TAO_RT_ORB_Loader Service_Object *TAO_RTCORBA:_make_TAO_RT_ORB_Loader () "-ORBSchedPolicy SCHED_FIFO -ORBScopePolicy SYSTEM -ORBPriorityMapping continuous"
+dynamic TAO_Notify_Service Service_Object * TAO_RT_Notification:_make_TAO_RT_Notify_Service () "" \ No newline at end of file
diff --git a/TAO/orbsvcs/tests/Notify/Basic/run_test.pl b/TAO/orbsvcs/tests/Notify/Basic/run_test.pl
new file mode 100755
index 00000000000..4139898c4ce
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/Basic/run_test.pl
@@ -0,0 +1,152 @@
+eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
+ & eval 'exec perl -S $0 $argv:q'
+ if 0;
+
+# $Id$
+# -*- perl -*-
+
+use lib "../../../../../bin";
+use PerlACE::Run_Test;
+
+$experiment_timeout = 60;
+$startup_timeout = 60;
+$notifyior = PerlACE::LocalFile ("notify.ior");
+$namingior = PerlACE::LocalFile ("naming.ior");
+$status = 0;
+
+@tests =
+ (
+ {
+ name => "AdminProperties",
+ args => "-ORBSvcConf adminproperties.conf",
+ },
+ {
+ name => "ConnectDisconnect",
+ args => "",
+ extra => 300,
+ },
+ {
+ name => "Events",
+ args => "",
+ },
+ {
+ name => "IdAssignment",
+ args => "",
+ },
+ {
+ name => "LifeCycle",
+ args => "",
+ },
+ {
+ name => "Simple",
+ args => "",
+ },
+ {
+ name => "MultiTypes",
+ args => "",
+ },
+ {
+ name => "Filter",
+ args => "",
+ },
+ {
+ name => "Updates",
+ args => "",
+ },
+ {
+ name => "Sequence",
+ args => "",
+ },
+ );
+
+@default_test_configs =
+ (
+ "notify.rt.conf",
+ "notify.reactive.conf",
+ "notify.mt.conf",
+ );
+
+if ($#ARGV == -1)
+ {
+ @test_configs = @default_test_configs;
+ }
+else
+ {
+ @test_configs = @ARGV;
+ }
+
+$Naming = new PerlACE::Process ("../../../Naming_Service/Naming_Service",
+ "-o $namingior");
+unlink $namingior;
+
+$naming_spawn = $Naming->Spawn ();
+if ($naming_spawn != 0)
+ {
+ exit 1;
+ }
+
+if (PerlACE::waitforfile_timed ($namingior, $startup_timeout) == -1) {
+ print STDERR "ERROR: waiting for the naming service to start\n";
+ $Naming->Kill ();
+ exit 1;
+}
+
+for $config (@test_configs)
+ {
+ print STDERR "\nTesting Notification Service with config file = $config ....\n\n";
+
+ $Notification = new PerlACE::Process ("../../../Notify_Service/Notify_Service",
+ "-ORBInitRef NameService=file://$namingior " .
+ "-IORoutput $notifyior " .
+ "-ORBSvcConf $config");
+ unlink $notifyior;
+ $Notification->Spawn ();
+
+ if (PerlACE::waitforfile_timed ($notifyior, $startup_timeout) == -1) {
+ print STDERR "ERROR: waiting for the notify service to start\n";
+ $Notification->Kill ();
+ $Naming->Kill ();
+ exit 1;
+ }
+
+ for $name (@tests)
+ {
+ ## The MaxQueueLength and MaxEventsPerConsumer are not supported in the Reactive
+ ## configuration, so we skip this test for now.
+ ## The Notification should actually throw an exception for the property not supported.
+ if ($name->{name} eq "AdminProperties"
+ && ($config eq "notify.reactive.conf" || $config eq "notify.rt.conf"))
+ {
+ next;
+ }
+
+ print STDERR "\nTesting $name->{name}....\n\n";
+ $test = new PerlACE::Process ("./$name->{name}",
+ "-ORBInitRef NameService=file://$namingior " .
+ "$name->{args} ");
+ $test_spawn = $test->Spawn ();
+ if ($test_spawn != 0)
+ {
+ break;
+ }
+
+ $status = $test->WaitKill ($experiment_timeout +
+ (defined $name->{extra} ?
+ $name->{extra} : 0));
+
+ if ($status != 0)
+ {
+ print STDERR "ERROR: $name->{name} returned $status\n";
+ break;
+ }
+ }
+
+ $Notification->Kill ();
+ }
+
+$Naming->Kill ();
+
+unlink $namingior;
+unlink $notifyior;
+
+exit $status;
diff --git a/TAO/orbsvcs/tests/Notify/Basic/run_test_ipv6.pl b/TAO/orbsvcs/tests/Notify/Basic/run_test_ipv6.pl
new file mode 100755
index 00000000000..a118126af0b
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/Basic/run_test_ipv6.pl
@@ -0,0 +1,145 @@
+eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
+ & eval 'exec perl -S $0 $argv:q'
+ if 0;
+
+# $Id$
+# -*- perl -*-
+
+use lib "../../../../../bin";
+use PerlACE::Run_Test;
+
+$experiment_timeout = 60;
+$startup_timeout = 60;
+$notifyior = PerlACE::LocalFile ("notify.ior");
+$namingior = PerlACE::LocalFile ("naming.ior");
+$status = 0;
+
+@tests =
+ (
+ {
+ name => "AdminProperties",
+ args => "-ORBSvcConf adminproperties.conf -ORBConnectIPV6Only 1",
+ },
+ {
+ name => "ConnectDisconnect",
+ args => "-ORBConnectIPV6Only 1",
+ extra => 300,
+ },
+ {
+ name => "Events",
+ args => "-ORBConnectIPV6Only 1",
+ },
+ {
+ name => "IdAssignment",
+ args => "-ORBConnectIPV6Only 1",
+ },
+ {
+ name => "LifeCycle",
+ args => "-ORBConnectIPV6Only 1",
+ },
+ {
+ name => "Simple",
+ args => "-ORBConnectIPV6Only 1",
+ },
+ {
+ name => "MultiTypes",
+ args => "-ORBConnectIPV6Only 1",
+ },
+ {
+ name => "Filter",
+ args => "-ORBConnectIPV6Only 1",
+ },
+ {
+ name => "Updates",
+ args => "-ORBConnectIPV6Only 1",
+ },
+ {
+ name => "Sequence",
+ args => "-ORBConnectIPV6Only 1",
+ },
+ );
+
+@default_test_configs =
+ (
+ "notify.rt.conf",
+ "notify.reactive.conf",
+ "notify.mt.conf",
+ );
+
+if ($#ARGV == -1)
+ {
+ @test_configs = @default_test_configs;
+ }
+else
+ {
+ @test_configs = @ARGV;
+ }
+
+$Naming = new PerlACE::Process ("../../../Naming_Service/Naming_Service",
+ "-o $namingior");
+unlink $namingior;
+
+$Naming->Spawn ();
+
+if (PerlACE::waitforfile_timed ($namingior, $startup_timeout) == -1) {
+ print STDERR "ERROR: waiting for the naming service to start\n";
+ $Naming->Kill ();
+ exit 1;
+}
+
+for $config (@test_configs)
+ {
+ print STDERR "\nTesting Notification Service with config file = $config ....\n\n";
+
+ $Notification = new PerlACE::Process ("../../../Notify_Service/Notify_Service",
+ "-ORBInitRef NameService=file://$namingior " .
+ "-IORoutput $notifyior " .
+ "-ORBSvcConf $config " .
+ "-ORBListenEndpoints iiop://1.2@[::1]");
+ unlink $notifyior;
+ $Notification->Spawn ();
+
+ if (PerlACE::waitforfile_timed ($notifyior, $startup_timeout) == -1) {
+ print STDERR "ERROR: waiting for the notify service to start\n";
+ $Notification->Kill ();
+ $Naming->Kill ();
+ exit 1;
+ }
+
+ for $name (@tests)
+ {
+ ## The MaxQueueLength and MaxEventsPerConsumer are not supported in the Reactive
+ ## configuration, so we skip this test for now.
+ ## The Notification should actually throw an exception for the property not supported.
+ if ($name->{name} eq "AdminProperties"
+ && ($config eq "notify.reactive.conf" || $config eq "notify.rt.conf"))
+ {
+ next;
+ }
+
+ print STDERR "\nTesting $name->{name}....\n\n";
+ $test = new PerlACE::Process ("./$name->{name}",
+ "-ORBInitRef NameService=file://$namingior " .
+ "$name->{args} ");
+ $test->Spawn ();
+
+ $status = $test->WaitKill ($experiment_timeout +
+ (defined $name->{extra} ?
+ $name->{extra} : 0));
+
+ if ($status != 0)
+ {
+ print STDERR "ERROR: $name->{name} returned $status\n";
+ break;
+ }
+ }
+
+ $Notification->Kill ();
+ }
+
+$Naming->Kill ();
+
+unlink $namingior;
+unlink $notifyior;
+
+exit $status;