2 //=============================================================================
6 * This file contains the implementation of the client-side of the
7 * Alt_Mapping application.
11 //=============================================================================
23 Alt_Mapping_Client
<T
>::Alt_Mapping_Client (CORBA::ORB_ptr orb
,
24 Alt_Mapping_ptr objref
,
27 alt_mapping_test_ (objref
),
34 Alt_Mapping_Client
<T
>::~Alt_Mapping_Client ()
36 delete this->test_object_
;
39 // All the individual tests.
40 template <class T
> int
41 Alt_Mapping_Client
<T
>::run_sii_test ()
43 CORBA::ULong i
= 0; // loop index
44 Options
*opt
= OPTIONS::instance (); // get the options
45 const char *opname
= this->test_object_
->opname (); // operation
49 "********** %s SII *********\n",
52 // Initialize call count and error count.
53 this->results_
.call_count (0);
54 this->results_
.error_count (0);
55 this->results_
.iterations (opt
->loop_count ());
58 // Initialize parameters for the test.
59 int check
= this->test_object_
->init_parameters (this->alt_mapping_test_
);
63 ACE_ERROR_RETURN ((LM_ERROR
,
64 "(%N:%l) client.cpp - run_sii_test:"
65 "init_parameters failed for opname - %s",
71 // Make the calls in a loop.
72 for (i
= 0; i
< opt
->loop_count (); i
++)
76 this->results_
.call_count (this->results_
.call_count () + 1);
79 ACE_DEBUG ((LM_DEBUG
, "\n****** Before call values *****\n"));
80 this->test_object_
->print_values ();
84 this->results_
.start_timer ();
87 this->test_object_
->run_sii_test (this->alt_mapping_test_
);
90 this->results_
.stop_timer ();
92 // now check if the values returned are as expected
95 ACE_DEBUG ((LM_DEBUG
, "\n****** After call values *****\n"));
96 this->test_object_
->print_values ();
99 catch (const CORBA::Exception
& ex
)
101 this->results_
.error_count (this->results_
.error_count () + 1);
102 ex
._tao_print_exception (opname
);
103 ACE_ERROR ((LM_ERROR
,
104 "(%N:%l) client.cpp - run_sii_test:"
105 "run_sii_test exception in iteration %d",
110 if (!this->test_object_
->check_validity ())
112 this->results_
.error_count (this->results_
.error_count () + 1);
113 ACE_ERROR ((LM_ERROR
,
114 "(%N:%l) client.cpp - run_sii_test: "
115 "Invalid results in iteration %d\n",
119 // reset parameters for the test.
120 if (this->test_object_
->reset_parameters () == -1)
121 ACE_ERROR_RETURN ((LM_ERROR
,
122 "(%N:%l) client.cpp - run_sii_test:"
123 "init_parameters failed for opname - %s",
125 loop_around
: continue;
129 this->results_
.print_stats ();
131 if (this->results_
.error_count () != 0)
133 ACE_DEBUG ((LM_DEBUG
,
134 "********** Error running %s SII *********\n",
137 else if (opt
->debug ())
139 ACE_DEBUG ((LM_DEBUG
,
140 "********** Finished running %s SII *********\n",
144 return this->results_
.error_count ()? -1 : 0;
147 #endif /* CLIENT_CPP */