Revert "Minor modernization of DynamicAny code"
[ACE_TAO.git] / TAO / tests / ORB_Local_Config / Shared / Test.cpp
blobea5db3704c0a6637a82a9d62018273ad00c00b47
1 #include "tao/CORBANAME_Parser.h"
2 #include "tao/CORBALOC_Parser.h"
3 #include "tao/Protocol_Factory.h"
4 #include "ace/Dynamic_Service.h"
5 #include "ace/Intrusive_Auto_Ptr.h"
7 #include "Service_Configuration_Per_ORB.h"
9 // @brief All default-constructor-created Service Config instabces referr to the
10 // The One Global Configuration
12 int
13 testReusingGlobals (int , ACE_TCHAR *[])
15 ACE_TRACE ("testReusingGlobals");
18 ACE_Intrusive_Auto_Ptr<ACE_Service_Gestalt> one (new ACE_Service_Gestalt (10, false));
20 // The ACE_Service_Gestalt_Test will teardown all!
21 one->process_directive (ace_svc_desc_TAO_CORBANAME_Parser);
22 one->process_directive (ace_svc_desc_TAO_CORBALOC_Parser);
24 const ACE_TCHAR *svcname = ACE_TEXT ("IIOP_Factory");
25 TAO_Protocol_Factory* p1 = ACE_Dynamic_Service<TAO_Protocol_Factory>::instance (one.get (), svcname);
27 if (p1 != 0)
29 ACE_ERROR ((LM_ERROR, ACE_TEXT ("Not expected to find %s locally\n"), svcname));
30 return -1;
33 svcname = ACE_TEXT ("CORBANAME_Parser");
34 ACE_Service_Object* p2 = ACE_Dynamic_Service<ACE_Service_Object>::instance (one.get (), svcname);
36 if (p2 == 0)
38 ACE_ERROR ((LM_ERROR, ACE_TEXT ("Expected to find %s localy\n"), svcname));
39 return -1;
42 svcname = ACE_TEXT ("CORBALOC_Parser");
43 ACE_Service_Object* p3 = ACE_Dynamic_Service<ACE_Service_Object>::instance (one.get (), svcname);
45 if (p3 == 0)
47 ACE_ERROR ((LM_ERROR, ACE_TEXT ("Expected to find %s locally\n"), svcname));
48 return -1;
53 ACE_Intrusive_Auto_Ptr<ACE_Service_Gestalt> two (new ACE_Service_Gestalt_Test (10));
54 // ACE_Service_Gestalt_Test two; // Use the ACE_Service_Repository::instance ()
56 const ACE_TCHAR *svcname = ACE_TEXT ("IIOP_Factory");
57 TAO_Protocol_Factory* p1 = ACE_Dynamic_Service<TAO_Protocol_Factory>::instance (two.get (), svcname);
59 if (p1 != 0)
61 ACE_ERROR ((LM_ERROR, ACE_TEXT ("Not expected to find %s in the global repo\n"), svcname));
62 return -1;
65 svcname = ACE_TEXT ("CORBANAME_Parser");
66 ACE_Service_Object* p2 = ACE_Dynamic_Service<ACE_Service_Object>::instance (two.get (), svcname);
68 if (p2 == 0) // You should be able to find the same stuff here, too
70 ACE_ERROR ((LM_ERROR, ACE_TEXT ("Not expected to find %s in the global repo\n"), svcname));
71 return -1;
74 return 0;
77 int
78 ACE_TMAIN (int argc, ACE_TCHAR *argv[])
80 return testReusingGlobals (argc, argv);