1 #include "ace/Service_Config.h"
2 #include "orbsvcs/Notify_Service/Notify_Service.h"
3 #include "orbsvcs/CosNotifyChannelAdminC.h"
4 #include "orbsvcs/CosNamingC.h"
7 #include "TestListener.h"
8 #include "TestBroadcaster.h"
10 ACE_TCHAR
const * const scpc_loadOrb
= ACE_DYNAMIC_VERSIONED_SERVICE_DIRECTIVE(
15 "testDllOrb -ORBDebugLevel 0 -ORBId testDllOrb -ORBDottedDecimalAddresses 1 -ORBInitRef NameService=file://naming.ior"
18 ACE_TCHAR
const * const scpc_unloadOrb
= ACE_REMOVE_SERVICE_DIRECTIVE("testDllOrb");
20 ACE_TCHAR
const * const scpc_loadNameService
= ACE_DYNAMIC_VERSIONED_SERVICE_DIRECTIVE(
24 "_make_TAO_Naming_Loader",
25 "testNameService testNameService -ORBId testDllOrb -m 0 -o naming.ior"
28 ACE_TCHAR
const * const scpc_unloadNameService
= ACE_REMOVE_SERVICE_DIRECTIVE("testNamingService");
31 ACE_TCHAR
const * const scpc_loadNotifyService
= ACE_DYNAMIC_VERSIONED_SERVICE_DIRECTIVE(
35 "_make_TAO_Notify_Service_Driver",
36 "-Channel -ChannelName Channel1 -ChannelName Channel2 -RunThreads 1 -ORBInitRef NameService=file://naming.ior -IORoutput notify.ior"
39 ACE_TCHAR
const * const scpc_unloadNotifyService
= ACE_REMOVE_SERVICE_DIRECTIVE("testNotifyService");
48 ACE_TEXT ("(%P|%t) publish ...\n")
51 DllORB
* p_orb
= ACE_Dynamic_Service
<DllORB
>::instance ("testDllOrb");
52 CORBA::ORB_var v_orb
= p_orb
->orb();
54 TestBroadcaster testBroadcaster
;
56 testBroadcaster
.connect(
58 "corbaname:rir:#Channel1");
60 TestListener
testListener(
62 "corbaname:rir:#Channel1",
68 testBroadcaster
.sendData();
73 ACE_TEXT ("(%P|%t) testListener.m_receivedData.size()=%d\n"),
74 testListener
.m_receivedData
.size()
77 result
= testListener
.m_receivedData
.size() == 3 ? 0 : testListener
.m_receivedData
.size();
81 ACE_TEXT ("(%P|%t) publish done\n")
89 int publish_result
= 0;
93 ACE_TEXT ("(%P|%t) loadunloadcycle - loading\n")
96 int result
= ACE_Service_Config::process_directive(scpc_loadOrb
);
99 ACE_TEXT ("(%P|%t) loadunloadcycle - loading ORB done. Result: <%d>\n"),
104 ACE_Dynamic_Service
<DllORB
>::instance("testDllOrb");
106 CORBA::ORB_var v_orb
= p_orb
->orb();
109 ACE_TEXT ("(%P|%t) loadunloadcycle - v_orb OK\n")
112 CORBA::Object_var v_poa
=
113 v_orb
->resolve_initial_references("RootPOA");
116 ACE_TEXT ("(%P|%t) loadunloadcycle - v_poa OK\n")
119 PortableServer::POA_var v_rootPOA
=
120 PortableServer::POA::_narrow(v_poa
.in ());
123 ACE_TEXT ("(%P|%t) loadunloadcycle - v_rootPOA OK\n")
126 result
= ACE_Service_Config::process_directive(scpc_loadNameService
);
129 ACE_TEXT ("(%P|%t) loadunloadcycle - loading NamingService done. Result: <%d>\n"),
133 result
= ACE_Service_Config::process_directive(scpc_loadNotifyService
);
136 ACE_TEXT ("(%P|%t) loadunloadcycle - loading NotifyService done. Result: <%d>\n"),
140 publish_result
= publish();
144 ACE_TEXT ("(%P|%t) loadunloadcycle - unloading\n")
149 ACE_TEXT ("(%P|%t) loadunloadcycle - unloading NotifyService ...\n")
151 result
= ACE_Service_Config::process_directive(scpc_unloadNotifyService
);
154 ACE_TEXT ("(%P|%t) loadunloadcycle - unloading NotifyService done. Result: <%d>\n"),
160 ACE_TEXT ("(%P|%t) loadunloadcycle - unloading NameService ...\n")
162 result
= ACE_Service_Config::process_directive(scpc_unloadNameService
);
165 ACE_TEXT ("(%P|%t) loadunloadcycle - unloading NameService done. Result: <%d>\n"),
171 ACE_TEXT ("(%P|%t) loadunloadcycle - unloading ORB ...\n")
173 result
= ACE_Service_Config::process_directive(scpc_unloadOrb
);
176 ACE_TEXT ("(%P|%t) loadunloadcycle - unloading ORB done. Result: <%d>\n"),
180 return publish_result
;
183 int ACE_TMAIN (int , ACE_TCHAR
**)
187 ACE_TEXT ("(%P|%t) main - entered\n")
192 ACE_TEXT ("(%P|%t) main - cycle ...\n")
195 int result
= loadunloadcycle();
199 ACE_TEXT ("(%P|%t) main - cycle done\n")
204 ACE_TEXT ("(%P|%t) main - leaving\n")