Merge pull request #1551 from DOCGroup/plm_jira_333
[ACE_TAO.git] / TAO / orbsvcs / tests / ImplRepo / oneway / client_ds.cpp
blob2d05c7b556deb9e3b0e55ff5669115b0682f77e1
1 #include "TestC.h"
2 #include <iostream>
3 #include "ace/Get_Opt.h"
4 #include "ace/OS_NS_unistd.h"
5 #include "tao/Stub.h"
7 char pause_poa = ' ';
8 char resume_poa = ' ';
10 int
11 parse_args (int argc, ACE_TCHAR *argv[])
13 ACE_Get_Opt get_opts (argc, argv, ACE_TEXT(""));
14 int c;
16 while ((c = get_opts ()) != -1)
17 switch (c)
19 case '?':
20 default:
21 ACE_ERROR_RETURN ((LM_ERROR,
22 "usage: %s "
23 "\n",
24 argv [0]),
25 -1);
27 // Indicates successful parsing of the command line
28 return 0;
31 int
32 ACE_TMAIN (int argc, ACE_TCHAR *argv[])
34 try {
35 // Initialize orb
36 CORBA::ORB_var orb = CORBA::ORB_init( argc, argv );
38 if (parse_args (argc, argv) != 0)
39 return 1;
41 CORBA::Object_var obj = orb->resolve_initial_references("Test");
42 if (CORBA::is_nil(obj.in()))
44 ACE_DEBUG ((LM_DEBUG, "Client could not RIR Test\n"));
45 return 1;
47 Test_var test = Test::_narrow( obj.in() );
48 if (CORBA::is_nil(test.in()))
50 ACE_DEBUG ((LM_DEBUG, "Client could not narrow Test\n"));
51 return 1;
54 test->_stubobj()->reset_profiles();
56 test->foo ();
58 CORBA::Short n = test->get_call_count();
59 ACE_DEBUG ((LM_DEBUG,
60 "DefSync client got call count of %d\n",
61 n));
63 return n != 1;
66 catch(const CORBA::Exception& ex) {
67 ex._tao_print_exception ("client:");
70 return -1;