summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/tests/Notify/Bug_1884_Regression/common.h
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/orbsvcs/tests/Notify/Bug_1884_Regression/common.h')
-rw-r--r--TAO/orbsvcs/tests/Notify/Bug_1884_Regression/common.h83
1 files changed, 83 insertions, 0 deletions
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();
+}
+