Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / orbsvcs / tests / Bug_3486_Regression / server.cpp
blobb35654f41c2923a2d7c131f0d23cc55bc5a91aef
1 #include "ace/Service_Config.h"
2 #include "orbsvcs/Naming/Naming_Loader.h"
4 #include "DllORB.h"
6 char const * const scpc_orbId = "testDllOrb";
8 ACE_TCHAR const * const scpc_loadOrb = ACE_DYNAMIC_VERSIONED_SERVICE_DIRECTIVE(
9 "testDllOrb",
10 "bug3486",
11 TAO_VERSION,
12 "_make_DllORB",
13 "testDllOrb -ORBDebugLevel 0 -ORBId testDllOrb -ORBDottedDecimalAddresses 1"
16 ACE_TCHAR const * const scpc_unloadOrb = ACE_REMOVE_SERVICE_DIRECTIVE("testDllOrb");
18 ACE_TCHAR const * const scpc_loadNamingService = ACE_DYNAMIC_VERSIONED_SERVICE_DIRECTIVE(
19 "testNamingService",
20 "TAO_CosNaming_Serv",
21 TAO_VERSION,
22 "_make_TAO_Naming_Loader",
26 ACE_TCHAR const * const scpc_unloadNamingService = ACE_REMOVE_SERVICE_DIRECTIVE("testNamingService");
28 void loadunloadcycle()
30 ACE_DEBUG((
31 LM_DEBUG,
32 ACE_TEXT ("(%P|%t) loadunloadcycle - loading\n")
33 ));
35 int result = ACE_Service_Config::process_directive(scpc_loadOrb);
36 ACE_DEBUG((
37 LM_DEBUG,
38 ACE_TEXT ("(%P|%t) loadunloadcycle - loading ORB done. Result: <%d>\n"),
39 result
40 ));
42 DllORB * p_orb =
43 ACE_Dynamic_Service<DllORB>::instance("testDllOrb");
45 CORBA::ORB_var v_orb;
46 v_orb = p_orb->orb();
47 ACE_DEBUG((
48 LM_DEBUG,
49 ACE_TEXT ("(%P|%t) loadunloadcycle - v_orb OK\n")
50 ));
52 CORBA::Object_var v_poa =
53 v_orb->resolve_initial_references("RootPOA");
54 ACE_DEBUG((
55 LM_DEBUG,
56 ACE_TEXT ("(%P|%t) loadunloadcycle - v_poa OK\n")
57 ));
59 PortableServer::POA_var v_rootPOA =
60 PortableServer::POA::_narrow(v_poa.in ());
61 ACE_DEBUG((
62 LM_DEBUG,
63 ACE_TEXT ("(%P|%t) loadunloadcycle - v_rootPOA OK\n")
64 ));
66 result = ACE_Service_Config::process_directive(scpc_loadNamingService);
67 ACE_DEBUG((
68 LM_DEBUG,
69 ACE_TEXT ("(%P|%t) loadunloadcycle - loading NamingService done. Result: <%d>\n"),
70 result
71 ));
73 TAO_Naming_Loader * p_NamingService =
74 ACE_Dynamic_Service<TAO_Naming_Loader>::instance("testNamingService");
76 ACE_UNUSED_ARG (p_NamingService);
78 ACE_DEBUG((
79 LM_DEBUG,
80 ACE_TEXT ("(%P|%t) loadunloadcycle - unloading\n")
81 ));
83 ACE_DEBUG((
84 LM_DEBUG,
85 ACE_TEXT ("(%P|%t) loadunloadcycle - unloading NamingService ...\n")
86 ));
87 result = ACE_Service_Config::process_directive(scpc_unloadNamingService);
88 ACE_DEBUG((
89 LM_DEBUG,
90 ACE_TEXT ("(%P|%t) loadunloadcycle - unloading NamingService done. Result: <%d>\n"),
91 result
92 ));
94 ACE_DEBUG((
95 LM_DEBUG,
96 ACE_TEXT ("(%P|%t) loadunloadcycle - unloading ORB ...\n")
97 ));
98 result = ACE_Service_Config::process_directive(scpc_unloadOrb);
99 ACE_DEBUG((
100 LM_DEBUG,
101 ACE_TEXT ("(%P|%t) loadunloadcycle - unloading ORB done. Result: <%d>\n"),
102 result
106 int ACE_TMAIN (int , ACE_TCHAR **)
108 ACE_DEBUG((
109 LM_DEBUG,
110 ACE_TEXT ("(%P|%t) main - entered\n")
113 ACE_DEBUG((
114 LM_DEBUG,
115 ACE_TEXT ("(%P|%t) main - cycle 1 ...\n")
117 loadunloadcycle();
118 ACE_DEBUG((
119 LM_DEBUG,
120 ACE_TEXT ("(%P|%t) main - cycle 1 done\n")
123 ACE_DEBUG((
124 LM_DEBUG,
125 ACE_TEXT ("(%P|%t) main - cycle 2 ...\n")
127 loadunloadcycle();
128 ACE_DEBUG((
129 LM_DEBUG,
130 ACE_TEXT ("(%P|%t) main - cycle 2 done\n")
133 ACE_DEBUG((
134 LM_DEBUG,
135 ACE_TEXT ("(%P|%t) main - leaving\n")
138 return 0;