Changes to attempt to silence bcc64x
[ACE_TAO.git] / TAO / orbsvcs / tests / Notify / Bug_3688_Regression / common.h
blob5ef26667930096303bb1955d732e09b6b59265d9
1 #include "orbsvcs/CosNotifyChannelAdminC.h"
2 #include "orbsvcs/CosNotifyChannelAdminS.h"
3 #include <iostream>
4 const char *ior = "file://ecf.ior";
6 CosNotifyChannelAdmin::EventChannel_var
7 get_event_channel(CORBA::ORB_ptr orb)
10 CosNotifyChannelAdmin::EventChannel_var ec;
11 CosNotifyChannelAdmin::ChannelID id;
12 CosNotification::QoSProperties init_qos(0);
13 CosNotification::AdminProperties init_admin(0);
15 std::cout << "Get CosNotifyChannelAdmin::EventChannelFactory" << std::endl;
16 std::cout << "IorEventChannelFactory=" << ior << std::endl;
17 CORBA::Object_var obj = orb->string_to_object(ior);
19 if (CORBA::is_nil(obj.in ()))
21 std::cerr << "Bad ec_fact.ior " << std::endl;
22 ACE_OS::exit (1);
25 CosNotifyChannelAdmin::EventChannelFactory_var factory =
26 CosNotifyChannelAdmin::EventChannelFactory::_narrow(obj.in ());
27 if (CORBA::is_nil(factory.in()))
29 std::cerr << "Could not _narrow object to type CosNotifyChannelAdmin::EventChannelFactory" << std::endl;
30 ACE_OS::exit(1);
33 //Get the first ec
34 CosNotifyChannelAdmin::ChannelIDSeq_var channelIdSeq;
35 try
37 channelIdSeq = factory->get_all_channels();
39 catch (const CORBA::SystemException& se )
41 std::cerr << "System exception occurred during get_all_channels: "
42 << se << std::endl;
43 throw;
46 if( channelIdSeq->length() == 0 )
48 try
50 ec = factory->create_channel( init_qos, init_admin, id);
52 catch (const CORBA::SystemException& se )
54 std::cerr << "System exception occurred during find_channel: "
55 << se << std::endl;
56 throw;
59 else {
60 try
62 ec = factory->get_event_channel(channelIdSeq.in()[0]);
64 catch (CosNotifyChannelAdmin::ChannelNotFound& )
66 std::cerr << "ChannelNotFound: "
67 << channelIdSeq.in()[0] << std::endl;
68 throw;
71 catch (const CORBA::SystemException& se )
73 std::cerr << "System exception occurred during get_event_channel: "
74 << se << std::endl;
75 throw;
79 return ec._retn();