Revert "Use a variable on the stack to not have a temporary in the call"
[ACE_TAO.git] / TAO / tests / ORB_Local_Config / Two_DLL_ORB / Test.cpp
blob1c6d5526d6e9bd475ff2fca84dc5859b0257195b
1 #include "ace/ARGV.h"
2 #include "ace/Thread_Manager.h"
4 #include "Service_Configuration_Per_ORB.h"
6 // Uncomment this line to test the SSLIOP scenario, as described in
7 //the README.
8 // #define TEST_WITH_SSLIOP
10 const ACE_TCHAR*
11 config_file_name ()
13 // ASCII (UTF-8) encoded Service Configurator file.
14 static const ACE_TCHAR svc_conf[] =
15 #ifdef TEST_WITH_SSLIOP
16 ACE_TEXT ("primary-ssl")
17 #else
18 ACE_TEXT ("primary-csd")
19 #endif
20 ACE_TEXT (ACE_DEFAULT_SVC_CONF_EXT);
22 return svc_conf;
26 // @brief Loading a dynamic services in a local repository, which
27 // initializes its own ORB
29 int
30 testLoadingTwoOrbs (int , ACE_TCHAR *argv[])
32 ACE_ARGV new_argv;
34 ACE_DEBUG ((LM_DEBUG,
35 ACE_TEXT ("Looking for conf file %s\n"),
36 config_file_name ()));
38 // Process the Service Configurator directives in this test's
39 if (new_argv.add (argv) == -1
40 || new_argv.add (ACE_TEXT ("-f")) == -1
41 || new_argv.add (config_file_name ()) == -1)
43 ACE_ERROR ((LM_ERROR, ACE_TEXT("ARGV initialization failed\n")));
44 return -1;
47 if (ACE_Service_Config::instance() ->open (new_argv.argc (),
48 new_argv.argv ()) == -1)
50 if (errno == ENOENT)
51 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("No service config file found\n")));
52 else
53 ACE_ERROR ((LM_ERROR, ACE_TEXT ("Service Config open failed: %m\n")));
55 return -1;
58 // Since the loaded services start their own threads, wait until all of them
59 // are done to avoid pulling the rug under their feet.
60 ACE_Thread_Manager::instance ()->wait ();
61 return 0;
64 int
65 ACE_TMAIN (int argc, ACE_TCHAR *argv[])
67 return testLoadingTwoOrbs (argc, argv);