Revert "Minor modernization of DynamicAny code"
[ACE_TAO.git] / TAO / performance-tests / CSD_Strategy / TestServant / Foo_ClientEngine.cpp
blob7f71bed192199b14e0cc6a864408ac47302b0cef
1 #include "Foo_ClientEngine.h"
2 #include "Foo_Statistics.h"
3 #include "TestInf/TestAppExceptionC.h"
4 #include "TestInf/AppHelper.h"
5 #include "ace/Log_Msg.h"
8 Foo_ClientEngine::Foo_ClientEngine(Foo_ptr obj, unsigned client_id)
9 : obj_(Foo::_duplicate(obj)),
10 client_id_(client_id)
15 Foo_ClientEngine::~Foo_ClientEngine()
20 bool
21 Foo_ClientEngine::execute(unsigned num_loops)
23 // Make sure the connection is established before making
24 // remote invocations.
25 if (AppHelper::validate_connection(this->obj_.in()) == false)
27 ACE_ERROR((LM_ERROR,
28 "(%P|%t)Foo_ClientEngine::execute - "
29 "client %d connect failed.\n", this->client_id_));
30 return false;
33 // Verify the return values and return the results.
34 bool success = true;
36 for (unsigned loop = 0; loop < num_loops; loop++)
38 CORBA::Long i = this->client_id_;
40 this->obj_->op1();
41 this->obj_->op2(i);
43 CORBA::Long value = this->obj_->op3(i);
44 success = (value != i) ? false : success;
46 for (CORBA::Long j = 1; j <= 5; j++)
48 this->obj_->op4(495 + (i * 5) + j);
51 bool caught_exception = false;
53 try
55 this->obj_->op5();
57 catch (const FooException&)
59 // Expected
60 caught_exception = true;
63 success = (!caught_exception) ? false : success;
66 this->obj_->done();
67 return success;
71 void
72 Foo_ClientEngine::expected_results(Foo_Statistics& stats)
74 stats.expected(1, 1);
75 stats.expected(2, 1);
76 stats.expected(3, 1);
77 stats.expected(4, 0);
78 stats.expected(4, 5);
79 stats.expected(5, 1);