More tests update
[ACE_TAO.git] / TAO / tests / TransportCurrent / Framework / simple.cpp
blob5c9f92d54b972aa9a4f3efbaeb6b3e67cb6671e6
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 *[])
33 ACE_Service_Object *factory = 0;
35 factory = ACE_Dynamic_Service<ACE_Service_Object>::instance
36 (ACE_TEXT ("TAO_Transport_Current_Loader"));
38 int done =
39 #if defined (TAO_AS_STATIC_LIBS)
40 true;
41 #else
42 (factory != 0);
43 #endif /* TAO_AS_STATIC_LIBS */
45 if (factory == 0)
47 if (done)
48 ACE_ERROR_RETURN ((LM_ERROR,
49 ACE_TEXT ("Unable to instantiate TAO::Transport::Current_Factory\n")),
50 -1);
51 else
54 #if !defined (TAO_AS_STATIC_LIBS)
55 int ret = ACE_Service_Config::process_directive
56 (ACE_DYNAMIC_VERSIONED_SERVICE_DIRECTIVE("TAO_Transport_Current_Loader",
57 "TAO_Transport_Current",
58 TAO_VERSION
59 "_make_TAO_Transport_Current_Loader",
60 ""));
61 ACE_ASSERT (ret == 0);
63 factory = ACE_Dynamic_Service<ACE_Service_Object>::instance
64 (ACE_TEXT ("TAO_Transport_Current_Loader"));
66 #endif /* !TAO_AS_STATIC_LIBS */
70 // ACE_ASSERT (factory != 0);
71 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("testCurrentLoader: OK\n")));
72 return 0;
77 int
78 ACE_TMAIN(int argc, ACE_TCHAR *argv[])
80 return testCurrentLoader (argc, argv)
81 || testCurrentORBInitializer (argc, argv);