summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/tests/Notify/Bug_1884_Regression
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/orbsvcs/tests/Notify/Bug_1884_Regression')
-rw-r--r--TAO/orbsvcs/tests/Notify/Bug_1884_Regression/Bug_1884_Regression.mpc26
-rw-r--r--TAO/orbsvcs/tests/Notify/Bug_1884_Regression/common.h83
-rw-r--r--TAO/orbsvcs/tests/Notify/Bug_1884_Regression/consumer.cpp205
-rw-r--r--TAO/orbsvcs/tests/Notify/Bug_1884_Regression/ecf.conf2
-rw-r--r--TAO/orbsvcs/tests/Notify/Bug_1884_Regression/filter.cpp246
-rwxr-xr-xTAO/orbsvcs/tests/Notify/Bug_1884_Regression/run_test.pl118
-rw-r--r--TAO/orbsvcs/tests/Notify/Bug_1884_Regression/supplier.cpp148
7 files changed, 828 insertions, 0 deletions
diff --git a/TAO/orbsvcs/tests/Notify/Bug_1884_Regression/Bug_1884_Regression.mpc b/TAO/orbsvcs/tests/Notify/Bug_1884_Regression/Bug_1884_Regression.mpc
new file mode 100644
index 00000000000..d900bd56fd6
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/Bug_1884_Regression/Bug_1884_Regression.mpc
@@ -0,0 +1,26 @@
+// -*- MPC -*-
+// $Id$
+
+project(*Consumer) : orbsvcsexe, notification, notification_skel, naming {
+ exename = consumer
+ Source_Files {
+ consumer.cpp
+ }
+}
+
+
+project(*Supplier) : orbsvcsexe, notification, notification_skel, naming {
+ exename = supplier
+
+ Source_Files {
+ supplier.cpp
+ }
+}
+
+project(*Filter) : orbsvcsexe, notification, notification_skel, naming {
+ exename = filter
+
+ Source_Files {
+ filter.cpp
+ }
+}
diff --git a/TAO/orbsvcs/tests/Notify/Bug_1884_Regression/common.h b/TAO/orbsvcs/tests/Notify/Bug_1884_Regression/common.h
new file mode 100644
index 00000000000..18df456f8d4
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/Bug_1884_Regression/common.h
@@ -0,0 +1,83 @@
+// $Id$
+
+#include "orbsvcs/orbsvcs/CosNotifyChannelAdminC.h"
+#include "orbsvcs/orbsvcs/CosNotifyChannelAdminS.h"
+#include <iostream>
+const char *ior = "file://ecf.ior";
+
+CosNotifyChannelAdmin::EventChannel_var
+get_event_channel(CORBA::ORB_ptr orb)
+
+{
+ CosNotifyChannelAdmin::EventChannel_var ec;
+ CosNotifyChannelAdmin::ChannelID id;
+ CosNotification::QoSProperties init_qos(0);
+ CosNotification::AdminProperties init_admin(0);
+
+ std::cout << "Get CosNotifyChannelAdmin::EventChannelFactory" << std::endl;
+ std::cout << "IorEventChannelFactory=" << ior << std::endl;
+ CORBA::Object_var obj = orb->string_to_object(ior);
+
+ if (CORBA::is_nil(obj.in ()))
+ {
+ std::cerr << "Bad ec_fact.ior " << std::endl;
+ ACE_OS::exit (1);
+ }
+
+ CosNotifyChannelAdmin::EventChannelFactory_var factory =
+ CosNotifyChannelAdmin::EventChannelFactory::_narrow(obj.in ());
+ if (CORBA::is_nil(factory.in()))
+ {
+ std::cerr << "Could not _narrow object to type CosNotifyChannelAdmin::EventChannelFactory" << std::endl;
+ ACE_OS::exit(1);
+ }
+
+ //Get the first ec
+ CosNotifyChannelAdmin::ChannelIDSeq_var channelIdSeq;
+ try
+ {
+ channelIdSeq = factory->get_all_channels();
+ }
+ catch (CORBA::SystemException& se )
+ {
+ std::cerr << "System exception occurred during get_all_channels: "
+ << se << std::endl;
+ throw;
+ }
+
+ if( channelIdSeq->length() == 0 )
+ {
+ try
+ {
+ ec = factory->create_channel( init_qos, init_admin, id);
+ }
+ catch (CORBA::SystemException& se )
+ {
+ std::cerr << "System exception occurred during find_channel: "
+ << se << std::endl;
+ throw;
+ }
+ }
+ else {
+ try
+ {
+ ec = factory->get_event_channel(channelIdSeq[0]);
+ }
+ catch (CosNotifyChannelAdmin::ChannelNotFound& )
+ {
+ std::cerr << "ChannelNotFound: "
+ << channelIdSeq[0] << std::endl;
+ throw;
+ }
+
+ catch (CORBA::SystemException& se )
+ {
+ std::cerr << "System exception occurred during get_event_channel: "
+ << se << std::endl;
+ throw;
+ }
+ }
+
+ return ec._retn();
+}
+
diff --git a/TAO/orbsvcs/tests/Notify/Bug_1884_Regression/consumer.cpp b/TAO/orbsvcs/tests/Notify/Bug_1884_Regression/consumer.cpp
new file mode 100644
index 00000000000..e95740fec0d
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/Bug_1884_Regression/consumer.cpp
@@ -0,0 +1,205 @@
+// $Id$
+
+#include "common.h"
+
+#include "ace/Get_Opt.h"
+#include "ace/OS_NS_stdlib.h"
+
+int runtime = 5; //sec
+
+
+namespace CosNotifyCommImpl{
+ class StructuredPushConsumer: public virtual POA_CosNotifyComm:: StructuredPushConsumer
+ {
+ public:
+ StructuredPushConsumer () : received_ (false) {};
+ virtual ~ StructuredPushConsumer () {};
+
+ void push_structured_event(
+ const CosNotification::StructuredEvent &event)
+ {
+ std::cout << "Received an event...," << std::endl;
+ std::cout << "event.header.fixed_header.event_type.domain_name = "
+ << event.header.fixed_header.event_type.domain_name
+ << std::endl;
+ std::cout << "event.header.fixed_header.event_type.type_name = "
+ << event.header.fixed_header.event_type.type_name
+ << std::endl;
+
+ };
+
+ void disconnect_structured_push_consumer()
+ {};
+
+ void offer_change (
+ const CosNotification::EventTypeSeq &,
+ const CosNotification::EventTypeSeq &)
+ {};
+
+ bool received_events ()
+ {
+ return this->received_;
+ };
+
+ private:
+ bool received_;
+ };
+}
+
+int parse_args (int argc, ACE_TCHAR *argv[])
+{
+ ACE_Get_Opt get_opts (argc, argv, "t:");
+ int x;
+
+ while ((x = get_opts ()) != -1)
+ switch (x)
+ {
+ case 't':
+ runtime = ACE_OS::atoi (get_opts.optarg);
+ break;
+
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("usage: %s -t <runtime>\n"),
+ argv [0]),
+ -1);
+ }
+
+ return 0; // successful parse
+}
+
+int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
+{
+ try
+ {
+ PortableServer::POAManager_var poa_manager;
+
+ CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
+
+ CORBA::Object_var poa_obj = orb->resolve_initial_references("RootPOA");
+ PortableServer::POA_var root_poa = PortableServer::POA::_narrow(poa_obj.in());
+
+ poa_manager = root_poa->the_POAManager();
+
+ if (parse_args (argc, argv) != 0)
+ return 1;
+
+ poa_manager->activate();
+
+ /*Get event_channel*/
+ std::cout << "Get event_channel now" << std::endl;
+ CosNotifyChannelAdmin::EventChannel_var ec = get_event_channel(orb.in());
+
+ //Instanciating the Consumer
+ CosNotifyComm::StructuredPushConsumer_var spc =
+ CosNotifyComm::StructuredPushConsumer::_nil();
+
+ CosNotifyCommImpl::StructuredPushConsumer *pImpl_spc = new CosNotifyCommImpl::StructuredPushConsumer;
+ spc = pImpl_spc->_this();
+
+ //Obtain a Consumer Admin
+ CosNotifyChannelAdmin::AdminID adminid = 0;
+ CosNotifyChannelAdmin::ConsumerAdmin_var ca =
+ ec->new_for_consumers (CosNotifyChannelAdmin::AND_OP, adminid);
+
+ if( ca.in() == CosNotifyChannelAdmin::ConsumerAdmin::_nil() ){
+ std::cerr << "ca is nil!" << std::endl;
+ return 1;
+ }
+
+ //Obtain a Proxy Consumer
+ CosNotifyChannelAdmin::ProxyID proxy_id;
+ CosNotifyChannelAdmin::ClientType ctype = CosNotifyChannelAdmin::STRUCTURED_EVENT;
+
+ CosNotifyChannelAdmin::ProxySupplier_var proxySupplier_obj;
+ try
+ {
+ proxySupplier_obj = ca->obtain_notification_push_supplier(ctype, proxy_id);
+ }
+ catch(CosNotifyChannelAdmin::AdminLimitExceeded err)
+ {
+ std::cerr << "CosNotifyChannelAdmin::AdminLimitExceeded Exception!" << std::endl;
+ throw;
+ }
+
+ CosNotifyChannelAdmin::StructuredProxyPushSupplier_var pps =
+ CosNotifyChannelAdmin::StructuredProxyPushSupplier::_narrow(proxySupplier_obj.in());
+
+
+ //Attaching a filter to pps
+ CosNotifyFilter::FilterFactory_var dff =
+ ec->default_filter_factory();
+
+ ACE_ASSERT(!CORBA::is_nil(dff.in()));
+
+ CosNotifyFilter::Filter_var filter = dff->create_filter("EXTENDED_TCL");
+
+ CosNotification::EventTypeSeq event_types(1);
+ event_types.length(2);
+
+ event_types[0].domain_name = CORBA::string_dup("DomainA");
+ event_types[0].type_name = CORBA::string_dup("TypeA");
+ event_types[1].domain_name = CORBA::string_dup("DomainB");
+ event_types[1].type_name = CORBA::string_dup("TypeB");
+
+ CosNotifyFilter::ConstraintExpSeq constraints(1);
+ constraints.length(1);
+
+ constraints[0].event_types = event_types;
+ constraints[0].constraint_expr = CORBA::string_dup(
+ "");
+
+ filter->add_constraints(constraints);
+
+ pps->add_filter(filter.in());
+
+ std::cout << "Attached a filter to ProxyPushSupplier" << std::endl;
+ std::cout << "The filter's event_types[0].domain_name=" << event_types[0].domain_name << std::endl;
+ std::cout << "The filter's event_types[0].type_name=" << event_types[0].type_name << std::endl;
+ std::cout << "The filter's event_types[1].domain_name=" << event_types[1].domain_name << std::endl;
+ std::cout << "The filter's event_types[1].type_name=" << event_types[1].type_name << std::endl;
+
+
+ //Connecting a Supplier to a Proxy Consumer
+ try
+ {
+ pps->connect_structured_push_consumer(spc.in());
+ }
+ catch (CosEventChannelAdmin::AlreadyConnected ac)
+ {
+ std::cerr << "CosEventChannelAdmin::AlreadyConnected" << std::endl;
+ throw;
+ }
+ catch (CORBA::SystemException& se)
+ {
+ std::cerr << "System exception occurred during connect: " <<
+ se << std::endl;
+ throw;
+ }
+
+
+ ACE_Time_Value tv (runtime);
+ orb->run (tv);
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Consumer done.\n")));
+
+ if (pImpl_spc->received_events ())
+ {
+ //Consumer should not receive any events as it's filtered with event type.
+ std::cerr << "Test failed - received test events." << std::endl;
+ return 1;
+ }
+ else
+ {
+ std::cerr << "Test passed - did not receive test events as expected." << std::endl;
+ }
+ }
+ catch(...)
+ {
+ std::cerr << "Consumer: Some exceptions was caught!" << std::endl;
+ return 1;
+ }
+
+
+ return 0;
+}
+
diff --git a/TAO/orbsvcs/tests/Notify/Bug_1884_Regression/ecf.conf b/TAO/orbsvcs/tests/Notify/Bug_1884_Regression/ecf.conf
new file mode 100644
index 00000000000..8c29f3485b8
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/Bug_1884_Regression/ecf.conf
@@ -0,0 +1,2 @@
+dynamic Topology_Factory Service_Object* TAO_CosNotification_Persist:_make_TAO_Notify_XML_Topology_Factory() "-save_base_path ./persistency.notif -load_base_path ./persistency.notif -backup_count 1 -v"
+
diff --git a/TAO/orbsvcs/tests/Notify/Bug_1884_Regression/filter.cpp b/TAO/orbsvcs/tests/Notify/Bug_1884_Regression/filter.cpp
new file mode 100644
index 00000000000..6be470f7276
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/Bug_1884_Regression/filter.cpp
@@ -0,0 +1,246 @@
+// $Id$
+
+#include "orbsvcs/orbsvcs/CosNotifyChannelAdminC.h"
+#include "orbsvcs/orbsvcs/CosNotifyChannelAdminS.h"
+
+#include <iostream>
+
+
+const char *ior = "file://ecf.ior";
+
+CosNotifyChannelAdmin::EventChannel_var
+get_event_channel(CORBA::ORB_ptr orb)
+
+{
+ CosNotifyChannelAdmin::EventChannel_var ec;
+ CosNotifyChannelAdmin::ChannelID id;
+ CosNotification::QoSProperties init_qos(0);
+ CosNotification::AdminProperties init_admin(0);
+
+
+
+ std::cout << "Get CosNotifyChannelAdmin::EventChannelFactory" << std::endl;
+ std::cout << "IorEventChannelFactory=" << ior << std::endl;
+ CORBA::Object_var obj = orb->string_to_object(ior);
+
+ if (CORBA::is_nil(obj.in ()))
+ {
+ std::cerr << "Bad ec_fact.ior " << std::endl;
+ exit(1);
+ }
+
+
+ CosNotifyChannelAdmin::EventChannelFactory_var factory =
+ CosNotifyChannelAdmin::EventChannelFactory::_narrow(obj.in ());
+ if (CORBA::is_nil(factory.in()))
+ {
+ std::cerr << "Could not _narrow object to type CosNotifyChannelAdmin::EventChannelFactory" << std::endl;
+ exit(1);
+ }
+
+ //Get the first ec
+ CosNotifyChannelAdmin::ChannelIDSeq_var channelIdSeq;
+ try
+ {
+ channelIdSeq = factory->get_all_channels();
+ }
+ catch (CORBA::SystemException& se )
+ {
+ std::cerr << "System exception occurred during get_all_channels: "
+ << se << std::endl;
+ exit(1);
+ }
+
+ if( channelIdSeq->length() == 0 )
+ {
+
+ try
+ {
+ ec = factory->create_channel( init_qos, init_admin, id);
+ }
+ catch (CORBA::SystemException& se )
+ {
+ std::cerr << "System exception occurred during find_channel: "
+ << se << std::endl;
+ exit(1);
+ }
+ }
+ else {
+ try
+ {
+ ec = factory->get_event_channel(channelIdSeq[0]);
+ }
+ catch (CosNotifyChannelAdmin::ChannelNotFound&)
+ {
+ std::cerr << "ChannelNotFound: "
+ << channelIdSeq[0] << std::endl;
+ exit(1);
+ }
+
+ catch (CORBA::SystemException& se )
+ {
+ std::cerr << "System exception occurred during get_event_channel: "
+ << se << std::endl;
+ exit(1);
+ }
+
+ }
+
+ return ec._retn();
+}
+
+
+void match_structure_test (const CosNotifyFilter::Filter_var& filter,
+ const CosNotification::StructuredEvent& event,
+ bool & expected_result)
+{
+ bool bResult = false;
+ try{
+ bResult = filter->match_structured(event);
+ }
+ catch(CosNotifyFilter::UnsupportedFilterableData)
+ {
+ std::cerr << "UnsupportedFilterableData!" << std::endl;
+ }
+ catch (CORBA::SystemException& se )
+ {
+ std::cerr << "System exception occurred during match_structured: "
+ << se << std::endl;
+ exit(1);
+ }
+
+ std::cout << "The result is:" << (bResult?"Match":"Unmatch") << std::endl;
+
+ if (bResult != expected_result)
+ {
+ // The result should be unmatched as it's filtered with event type.
+ std::cerr << "filter test failed." << std::endl;
+ exit(1);
+ }
+}
+
+
+void update_constraints (const CosNotifyFilter::Filter_var& filter,
+ const char* domain1, const char* type1,
+ const char* domain2, const char* type2)
+{
+ filter->remove_all_constraints ();
+
+ CosNotification::EventTypeSeq event_types(2);
+ event_types.length(2);
+
+ event_types[0].domain_name = CORBA::string_dup(domain1);
+ event_types[0].type_name = CORBA::string_dup(type1);
+
+ event_types[1].domain_name = CORBA::string_dup(domain2);
+ event_types[1].type_name = CORBA::string_dup(type2);
+
+ CosNotifyFilter::ConstraintExpSeq constraints(1);
+ constraints.length(1);
+
+ constraints[0].event_types = event_types;
+ constraints[0].constraint_expr = CORBA::string_dup("");
+
+ CosNotifyFilter::ConstraintInfoSeq_var cons_info
+ = filter->add_constraints(constraints);
+
+ std::cout << "Constructing a filter..." << std::endl;
+
+ for (CORBA::ULong i = 0; i < event_types.length(); ++i)
+ {
+ std::cout << "\tevent_types[" << i << "].domain_name="
+ << event_types[i].domain_name
+ << std::endl;
+ std::cout << "\tevent_types[" << i << "].type_name="
+ << event_types[i].type_name
+ << std::endl;
+ }
+
+ std::cout << "\tIts constraint ="
+ << constraints[0].constraint_expr.in ()
+ << std::endl;
+}
+
+
+int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
+{
+ try
+ {
+ PortableServer::POAManager_var poa_manager;
+
+ CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
+
+ CORBA::Object_var poa_obj = orb->resolve_initial_references("RootPOA");
+ PortableServer::POA_var root_poa = PortableServer::POA::_narrow(poa_obj.in());
+
+ poa_manager = root_poa->the_POAManager();
+
+ poa_manager->activate();
+
+ /*Get event_channel*/
+ std::cout << "Get event_channel now" << std::endl;
+ CosNotifyChannelAdmin::EventChannel_var ec = get_event_channel(orb.in());
+
+ //Attaching a filter to pps
+ CosNotifyFilter::FilterFactory_var dff =
+ ec->default_filter_factory();
+
+ ACE_ASSERT(!CORBA::is_nil(dff.in()));
+
+ std::cout << "Test CosNotifyFilter::Filter::match_structured" << std::endl;
+
+ //Constructing a test event
+ CosNotification::StructuredEvent event;
+
+ event.header.fixed_header.event_type.domain_name =
+ CORBA::string_dup("Test_domain");
+ event.header.fixed_header.event_type.type_name =
+ CORBA::string_dup("Test_type_name");
+
+ event.header.variable_header.length(0);
+ event.remainder_of_body <<= "";
+
+ std::cout << "Constructing a test event" << std::endl;
+ std::cout << "\tIts header.fixed_header.event_type.domain_name="
+ << event.header.fixed_header.event_type.domain_name
+ << std::endl;
+ std::cout << "\tIts header.fixed_header.event_type.type_name="
+ << event.header.fixed_header.event_type.type_name
+ << std::endl;
+
+ CosNotifyFilter::Filter_var filter = dff->create_filter("EXTENDED_TCL");
+ update_constraints (filter, "DomainA", "TypeA", "DomainB", "TypeB");
+
+ bool expected_result = false;
+ match_structure_test (filter, event, expected_result);
+
+ update_constraints (filter, "*", "%ALL", "DomainB", "TypeB");
+ expected_result = true;
+ match_structure_test (filter, event, expected_result);
+
+ update_constraints (filter, "Test_domain", "%ALL", "DomainB", "TypeB");
+ expected_result = true;
+ match_structure_test (filter, event, expected_result);
+
+ update_constraints (filter, "*", "Test_type_name", "DomainB", "TypeB");
+ expected_result = true;
+ match_structure_test (filter, event, expected_result);
+
+ update_constraints (filter, "*", "*", "*", "*");
+ expected_result = true;
+ match_structure_test (filter, event, expected_result);
+
+ orb->shutdown();
+
+ }
+ catch(...)
+ {
+ std::cerr << "Filter: Some exceptions was caught!" << std::endl;
+ exit(1);
+ }
+
+
+ return 0;
+}
+
+
diff --git a/TAO/orbsvcs/tests/Notify/Bug_1884_Regression/run_test.pl b/TAO/orbsvcs/tests/Notify/Bug_1884_Regression/run_test.pl
new file mode 100755
index 00000000000..f40dd5eee68
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/Bug_1884_Regression/run_test.pl
@@ -0,0 +1,118 @@
+eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
+ & eval 'exec perl -S $0 $argv:q'
+ if 0;
+
+# $Id$
+# -*- perl -*-
+
+use lib "$ENV{ACE_ROOT}/bin";
+use PerlACE::Run_Test;
+use strict;
+
+my $persistent_test = 0;
+my $notifyior = PerlACE::LocalFile("ecf.ior");
+my $notify2ior = PerlACE::LocalFile("ecf2.ior");
+my $notify_conf = PerlACE::LocalFile("ecf$PerlACE::svcconf_ext");
+my $port = PerlACE::uniqueid () + 10005;
+my $nts_ref = "NotifyService=iioploc://localhost:$port/NotifyService";
+my $svcconf = "";
+my $consumer_runtime = 5;
+my $persistent_file = PerlACE::LocalFile ("persistency.notif.xml");
+my $persistent_file_backup = PerlACE::LocalFile ("persistency.notif.000");
+
+
+if ($#ARGV >= 0 && $ARGV[0] eq '-p') {
+ $persistent_test = 1;
+ $svcconf = " -ORBSvcConf $notify_conf";
+ $consumer_runtime = 20;
+}
+
+my $NTS = new PerlACE::Process("../../../Notify_Service/Notify_Service",
+ "-ORBDebugLevel 1 ".
+ "-NoNameSvc -IORoutput $notifyior $svcconf " .
+ "-ORBEndpoint iiop://localhost:$port");
+my $SUPPLIER = new PerlACE::Process("supplier", "$nts_ref");
+my $CONSUMER = new PerlACE::Process("consumer", "$nts_ref -t $consumer_runtime");
+my $FILTER = new PerlACE::Process("filter", "$nts_ref");
+
+unlink($notifyior, $persistent_file, $persistent_file_backup);
+
+
+print "\n*********** Starting the Notify_Service ***********\n\n";
+$NTS->Spawn();
+if (PerlACE::waitforfile_timed($notifyior, 20) == -1) {
+ print STDERR "ERROR: waiting for the notify service to start\n";
+ $NTS->Kill();
+ exit(1);
+}
+
+if ($persistent_test == 0)
+{
+ print "\n*********** Starting the filter test ***********\n\n";
+ my $filter = $FILTER->SpawnWaitKill (10);
+ if ($filter != 0) {
+ $NTS->Kill();
+ exit(1);
+ }
+
+ print "\n*********** Filter test passed ***********\n\n";
+}
+
+print "\n*********** Starting the notification Consumer ***********\n\n";
+print STDERR $CONSUMER->CommandLine (). "\n";
+
+my $client = $CONSUMER->Spawn();
+if ($client != 0) {
+ $NTS->Kill();
+ exit(1);
+}
+
+sleep(5);
+
+if ($persistent_test == 1)
+{
+ print "*********** Killing the first Notify_Service ***********\n";
+ $NTS->Kill();
+ sleep(1);
+
+ unlink ($notifyior);
+
+ print "*********** Starting the second Notify_Service ***********\n";
+print STDERR $NTS->CommandLine (). "\n";
+ $NTS->Spawn();
+ if (PerlACE::waitforfile_timed($notifyior, 20) == -1) {
+ print STDERR "ERROR: waiting for the notify service to start\n";
+ $SUPPLIER->Kill();
+ exit(1);
+ }
+
+ sleep(5);
+}
+
+print "\n*********** Starting the notification Supplier ***********\n\n";
+print STDERR $SUPPLIER->CommandLine (). "\n";
+
+my $server = $SUPPLIER->Spawn();
+if ($server != 0) {
+ $NTS->Kill();
+ $CONSUMER->Kill();
+ exit(1);
+}
+
+$server = $SUPPLIER->WaitKill(10);
+if ($server != 0) {
+ $NTS->Kill();
+ $CONSUMER->Kill();
+ exit(1);
+}
+
+$client = $CONSUMER->WaitKill($consumer_runtime + 10);
+if ($client != 0) {
+ $NTS->Kill();
+ exit(1);
+}
+
+$NTS->Kill();
+
+#unlink($notifyior, $persistent_file, $persistent_file_backup);
+exit(0);
diff --git a/TAO/orbsvcs/tests/Notify/Bug_1884_Regression/supplier.cpp b/TAO/orbsvcs/tests/Notify/Bug_1884_Regression/supplier.cpp
new file mode 100644
index 00000000000..5088b562343
--- /dev/null
+++ b/TAO/orbsvcs/tests/Notify/Bug_1884_Regression/supplier.cpp
@@ -0,0 +1,148 @@
+// $Id$
+
+#include "common.h"
+#include "ace/OS.h"
+
+
+namespace CosNotifyCommImpl{
+ class StructuredPushSupplier: public virtual POA_CosNotifyComm:: StructuredPushSupplier
+ {
+ public:
+ void disconnect_structured_push_supplier()
+ {};
+ void subscription_change( const CosNotification::EventTypeSeq&,
+ const CosNotification::EventTypeSeq&)
+ {};
+
+ };
+}
+
+
+int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
+{
+ try
+ {
+ PortableServer::POAManager_var poa_manager;
+
+ CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
+
+ CORBA::Object_var poa_obj = orb->resolve_initial_references("RootPOA");
+ PortableServer::POA_var root_poa = PortableServer::POA::_narrow(poa_obj.in());
+
+ poa_manager = root_poa->the_POAManager();
+
+ poa_manager->activate();
+
+ /*Get event_channel*/
+ std::cout << "Create event_channel now" << std::endl;
+ CosNotifyChannelAdmin::EventChannel_var ec = get_event_channel(orb.in());
+
+ //Instanciating the Supplier
+ CosNotifyComm::StructuredPushSupplier_var sps =
+ CosNotifyComm::StructuredPushSupplier::_nil();
+
+
+ CosNotifyCommImpl::StructuredPushSupplier *pImpl_sps = new CosNotifyCommImpl::StructuredPushSupplier;
+ sps = pImpl_sps->_this();
+
+ //Obtain a Supplier Admin
+ CosNotifyChannelAdmin::SupplierAdmin_var sa = ec->default_supplier_admin();
+ if( sa.in() == CosNotifyChannelAdmin::SupplierAdmin::_nil() ){
+ std::cerr << "sa is nil!" << std::endl;
+ return 1;
+ }
+
+ //Obtain a Proxy Consumer
+ CosNotifyChannelAdmin::ProxyID proxy_id;
+ CosNotifyChannelAdmin::ClientType ctype = CosNotifyChannelAdmin::STRUCTURED_EVENT;
+
+ CosNotifyChannelAdmin::ProxyConsumer_var proxyCon_obj;
+ try
+ {
+ proxyCon_obj = sa->obtain_notification_push_consumer(ctype, proxy_id);
+ }
+ catch(CosNotifyChannelAdmin::AdminLimitExceeded err)
+ {
+ std::cerr << "CosNotifyChannelAdmin::AdminLimitExceeded Exception!" << std::endl;
+ throw;
+ }
+
+ CosNotifyChannelAdmin::StructuredProxyPushConsumer_var ppc =
+ CosNotifyChannelAdmin::StructuredProxyPushConsumer::_narrow(proxyCon_obj.in());
+
+ //Connecting a Supplier to a Proxy Consumer
+ try
+ {
+ ppc->connect_structured_push_supplier(sps.in());
+ }
+ catch (CosEventChannelAdmin::AlreadyConnected ac)
+ {
+ std::cerr << "CosEventChannelAdmin::AlreadyConnected" << std::endl;
+ throw;
+ }
+ catch (CORBA::SystemException& se)
+ {
+ std::cerr << "System exception occurred during connect: " <<
+ se << std::endl;
+ throw;
+ }
+
+
+ //Demo::demo_send_heart_beat(ppc);
+ //Send a Demo Notification
+
+ CosNotification::StructuredEvent event;
+
+ event.header.fixed_header.event_type.domain_name =
+ CORBA::string_dup("Test_domain");
+ event.header.fixed_header.event_type.type_name =
+ CORBA::string_dup("Test_type_name");
+
+ event.header.variable_header.length(0);
+ event.remainder_of_body <<= "";
+
+ std::cout << "Sending a demo event...," << std::endl;
+ std::cout << "event.header.fixed_header.event_type.domain_name = "
+ << event.header.fixed_header.event_type.domain_name
+ << std::endl;
+ std::cout << "event.header.fixed_header.event_type.type_name = "
+ << event.header.fixed_header.event_type.type_name
+ << std::endl;
+
+
+ try{
+ ppc->push_structured_event(event);
+ }
+ catch (CORBA::SystemException& se)
+ {
+ std::cerr << "System exception occurred during push: "
+ << se << std::endl;
+ throw;
+ }
+ catch (CORBA::Exception&)
+ {
+ std::cerr << "Unknown exception occurred during push" << std::endl;
+ throw;
+ }
+
+ try{
+ ppc->disconnect_structured_push_consumer();
+ }
+ catch(CORBA::Exception&)
+ {
+ std::cerr << "Disconnect fail!" << std::endl;
+ }
+
+ orb->shutdown();
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Supplier done.\n")));
+ }
+ catch(...)
+ {
+ std::cerr << "Supplier: Some exceptions was caught!" << std::endl;
+ return 1;
+ }
+
+
+ return 0;
+}
+