Changes to attempt to silence bcc64x
[ACE_TAO.git] / TAO / tests / Dynamic_TP / Config_Loader / Test.cpp
blobc0c04461ecceb9e04c9b3266ab1beb20ec6d8559
1 #include "tao/Dynamic_TP/DTP_Config.h"
2 #include "ace/OS_NS_stdio.h"
3 #include "ace/Service_Config.h"
4 #include "ace/Dynamic_Service.h"
6 void
7 show_tp_config (const ACE_CString &name, const TAO_DTP_Definition &entry)
9 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Config set for %C:\n"), name.c_str()));
10 ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" Initial threads: %d:\n"), entry.init_threads_));
11 ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" Min threads: %d:\n"), entry.min_threads_));
12 ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" Max threads: %d:\n"), entry.max_threads_));
13 if (entry.min_threads_ > -1)
14 ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" Idle Timeout: %d (sec)\n"), entry.timeout_.sec()));
15 ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" Stack Size: %d:\n"), entry.stack_size_));
16 ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" Request queue max depth: %d\n"), entry.queue_depth_));
19 int
20 ACE_TMAIN(int argc, ACE_TCHAR *argv[])
22 ACE_Service_Config::open (argc, argv);
24 ACE_Service_Gestalt *current = ACE_Service_Config::current();
25 TAO_DTP_Config_Registry* registry =
26 ACE_Dynamic_Service<TAO_DTP_Config_Registry>::instance
27 (current, "DTP_Config_Registry", true);
29 if (registry == 0)
31 ACE_DEBUG ((LM_DEBUG, ACE_TEXT("Unable to load configuration\n")));
32 return -1;
35 TAO_DTP_Definition entry;
37 const ACE_TCHAR *name_list [] =
38 { ACE_TEXT ("ORB"),
39 ACE_TEXT ("bogus"),
40 ACE_TEXT ("POA1"),
41 ACE_TEXT ("defaults"),
42 ACE_TEXT ("m1"),
43 ACE_TEXT ("m2"),
44 ACE_TEXT ("m3"),
45 ACE_TEXT ("m4"),
46 ACE_TEXT ("m5"),
47 ACE_TEXT ("m6"),
48 ACE_TEXT ("m7"),
52 for (int i = 0; name_list[i] != 0; i++)
54 bool found = registry->find (ACE_TEXT_ALWAYS_CHAR (name_list[i]), entry);
55 if (!found && (i != 1))
57 ACE_DEBUG ((LM_DEBUG, ACE_TEXT("Cannot find TP Config definition for %C\n"), name_list[i]));
58 return -1;
60 if (i == 1)
62 if (found)
64 ACE_DEBUG ((LM_DEBUG, ACE_TEXT("Found TP Config definition for %C which should have failed\n"), name_list[i]));
65 return -1;
67 else
69 ACE_DEBUG ((LM_DEBUG, ACE_TEXT("TP definition for %C not found as expected\n"), name_list[i]));
72 else
74 show_tp_config (ACE_TEXT_ALWAYS_CHAR (name_list[i]), entry);
77 return 0;