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
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
);
29 ACE_ERROR ((LM_ERROR
, ACE_TEXT ("Not expected to find %s locally\n"), svcname
));
33 svcname
= ACE_TEXT ("CORBANAME_Parser");
34 ACE_Service_Object
* p2
= ACE_Dynamic_Service
<ACE_Service_Object
>::instance (one
.get (), svcname
);
38 ACE_ERROR ((LM_ERROR
, ACE_TEXT ("Expected to find %s localy\n"), svcname
));
42 svcname
= ACE_TEXT ("CORBALOC_Parser");
43 ACE_Service_Object
* p3
= ACE_Dynamic_Service
<ACE_Service_Object
>::instance (one
.get (), svcname
);
47 ACE_ERROR ((LM_ERROR
, ACE_TEXT ("Expected to find %s locally\n"), svcname
));
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
);
61 ACE_ERROR ((LM_ERROR
, ACE_TEXT ("Not expected to find %s in the global repo\n"), svcname
));
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
));
78 ACE_TMAIN (int argc
, ACE_TCHAR
*argv
[])
80 return testReusingGlobals (argc
, argv
);