Revert "Minor modernization of DynamicAny code"
[ACE_TAO.git] / TAO / tests / TransportCurrent / Framework / simple.cpp
blobe5d271f837e116819b2bc3c244e6766dce4251eb
1 // -*- C++ -*-
2 #include "tao/ORB.h"
3 #include "tao/Object.h"
5 #include "ace/Service_Config.h"
6 #include "ace/Dynamic_Service.h"
8 int
9 testCurrentORBInitializer (int argc, ACE_TCHAR *argv[])
11 CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);
13 if (orb.in () == 0)
14 ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Unable to create orb\n")), -1);
16 CORBA::Object_var obj =
17 orb->resolve_initial_references ("TAO::Transport::Current");
19 if (obj.in () == 0)
20 ACE_ERROR_RETURN ((LM_ERROR,
21 ACE_TEXT ("Unable to get the Transport Current\n")), -1);
24 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("testCurrentORBInitializer: OK\n")));
25 return 0;
29 int
30 testCurrentLoader (int, char *[])
32 ACE_Service_Object *factory = 0;
34 factory = ACE_Dynamic_Service<ACE_Service_Object>::instance
35 (ACE_TEXT ("TAO_Transport_Current_Loader"));
37 int done =
38 #if defined (TAO_AS_STATIC_LIBS)
39 true;
40 #else
41 (factory != 0);
42 #endif /* TAO_AS_STATIC_LIBS */
44 if (factory == 0)
46 if (done)
47 ACE_ERROR_RETURN ((LM_ERROR,
48 ACE_TEXT ("Unable to instantiate TAO::Transport::Current_Factory\n")),
49 -1);
50 else
52 #if !defined (TAO_AS_STATIC_LIBS)
53 int ret = ACE_Service_Config::process_directive
54 (ACE_DYNAMIC_VERSIONED_SERVICE_DIRECTIVE("TAO_Transport_Current_Loader",
55 "TAO_Transport_Current",
56 TAO_VERSION
57 "_make_TAO_Transport_Current_Loader",
58 ""));
59 ACE_ASSERT (ret == 0);
61 factory = ACE_Dynamic_Service<ACE_Service_Object>::instance
62 (ACE_TEXT ("TAO_Transport_Current_Loader"));
64 #endif /* !TAO_AS_STATIC_LIBS */
68 // ACE_ASSERT (factory != 0);
69 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("testCurrentLoader: OK\n")));
70 return 0;
74 int
75 ACE_TMAIN(int argc, ACE_TCHAR *argv[])
77 return testCurrentLoader (argc, argv)
78 || testCurrentORBInitializer (argc, argv);