Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / TAO / tests / Bug_2735_Regression / server.cpp
blobd0b5d1c4b2601c8d3d8e0025db48d48e15a677f0
1 #include "tao/ORB.h"
2 #include "ace/Get_Opt.h"
3 #include "ace/Service_Config.h"
4 #include "ace/Log_Msg.h"
6 static const ACE_TCHAR* server_strat =
7 ACE_STATIC_SERVICE_DIRECTIVE ("Server_Strategy_Factory",
8 "-ORBConcurrency thread-per-connection");
9 static const ACE_TCHAR* foo_strat =
10 ACE_STATIC_SERVICE_DIRECTIVE ("Foo_Strategy_Factory", "");
12 enum Factory_Strategy { SERVER_STRATEGY, FOO_STRATEGY };
14 static Factory_Strategy factory_strategy = SERVER_STRATEGY;
16 static int
17 parse_args (int argc, ACE_TCHAR *argv[])
19 ACE_Get_Opt get_opts (argc, argv, ACE_TEXT ("fs"));
20 int c;
22 while ((c = get_opts ()) != -1)
23 switch (c)
25 case 'f':
26 factory_strategy = FOO_STRATEGY;
27 break;
28 case 's':
29 factory_strategy = SERVER_STRATEGY;
30 break;
31 case '?':
32 default:
33 ACE_ERROR_RETURN ((LM_ERROR,
34 "usage: %s "
35 "-f "
36 "-s "
37 "\n",
38 argv [0]),
39 -1);
41 return 0;
45 int
46 ACE_TMAIN (int argc, ACE_TCHAR *argv[])
48 try
50 if (parse_args (argc, argv) == -1)
51 return -1;
53 int targc = 3;
54 const ACE_TCHAR *targv[] =
55 { ACE_TEXT ("server"), ACE_TEXT ("-ORBSvcConfDirective"), 0, 0 }; // null-terminated!
56 switch (factory_strategy)
58 case FOO_STRATEGY:
59 targv[2] = foo_strat;
60 break;
61 case SERVER_STRATEGY:
62 targv[2] = server_strat;
63 break;
65 CORBA::ORB_var orb = CORBA::ORB_init (targc, const_cast<ACE_TCHAR**> (targv));
66 orb->destroy ();
68 catch (const CORBA::Exception& ex)
70 ex._tao_print_exception ("Exception caught:");
71 return 1;
74 return 0;