diff options
Diffstat (limited to 'TAO/tests/CSD_Strategy_Tests/Broken')
-rw-r--r-- | TAO/tests/CSD_Strategy_Tests/Broken/ClientApp.cpp | 71 | ||||
-rw-r--r-- | TAO/tests/CSD_Strategy_Tests/Broken/ClientApp.h | 12 | ||||
-rw-r--r-- | TAO/tests/CSD_Strategy_Tests/Broken/ServerApp.cpp | 100 | ||||
-rw-r--r-- | TAO/tests/CSD_Strategy_Tests/Broken/ServerApp.h | 14 |
4 files changed, 78 insertions, 119 deletions
diff --git a/TAO/tests/CSD_Strategy_Tests/Broken/ClientApp.cpp b/TAO/tests/CSD_Strategy_Tests/Broken/ClientApp.cpp index 0fbab91f139..4bbb75efe7f 100644 --- a/TAO/tests/CSD_Strategy_Tests/Broken/ClientApp.cpp +++ b/TAO/tests/CSD_Strategy_Tests/Broken/ClientApp.cpp @@ -33,24 +33,17 @@ int ClientApp::run_i(int argc, char* argv[] ACE_ENV_ARG_DECL) { int result = this->init(argc, argv ACE_ENV_ARG_PARAMETER); - if (result != 0) + if (result != 0) { return result; } - ACE_CHECK_RETURN (-1); - - this->poa_setup(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); - this->csd_setup(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); - this->client_setup(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); - this->poa_activate(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); - this->run_clients(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); - this->run_orb_event_loop(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); + + this->poa_setup(); + this->csd_setup(); + this->client_setup(); + this->poa_activate(); + this->run_clients(); + this->run_orb_event_loop(); // Calling wait on ACE_Thread_Manager singleton to avoid the problem // that the main thread might exit before all CSD Threads exit. @@ -68,7 +61,6 @@ int ClientApp::init(int argc, char* argv[] ACE_ENV_ARG_DECL) { this->orb_ = CORBA::ORB_init(argc, argv, "" ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); // Parse the command-line args for this application. // * Raises -1 if problems are encountered. @@ -81,24 +73,22 @@ ClientApp::init(int argc, char* argv[] ACE_ENV_ARG_DECL) } TheAppShutdown->init(this->orb_.in(), num_servants_ ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); return 0; } void -ClientApp::poa_setup(ACE_ENV_SINGLE_ARG_DECL) +ClientApp::poa_setup(void) { - this->poa_ = this->create_poa(this->orb_.in(), - "ChildPoa" + this->poa_ = this->create_poa(this->orb_.in(), + "ChildPoa" ACE_ENV_ARG_PARAMETER); - ACE_CHECK; } void -ClientApp::csd_setup(ACE_ENV_SINGLE_ARG_DECL) +ClientApp::csd_setup(void) { this->tp_strategy_ = new TAO::CSD::TP_Strategy(this->num_csd_threads_); @@ -108,46 +98,41 @@ ClientApp::csd_setup(ACE_ENV_SINGLE_ARG_DECL) "Failed to apply CSD strategy to poa.\n")); ACE_THROW(TestAppException()); } - ACE_CHECK; } void -ClientApp::client_setup(ACE_ENV_SINGLE_ARG_DECL) +ClientApp::client_setup(void) { // Turn the ior_ into a Foo_B obj ref. Foo_B_var foo = RefHelper<Foo_B>::string_to_ref(this->orb_.in(), this->ior_.c_str() ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - + this->servants_.create_and_activate(1, // number of callback servants this->poa_.in() ACE_ENV_ARG_PARAMETER); - ACE_CHECK; ServantListType::T_stub_var cb = this->servants_.objref(0); - // Create the ClientEngine object, and give it the Foo_B and Callback object + // Create the ClientEngine object, and give it the Foo_B and Callback object // references. - ClientEngine_Handle engine + ClientEngine_Handle engine = new Foo_B_ClientEngine(foo.in(), cb.in (), this->client_id_); this->client_task_.add_engine(engine.in()); } void -ClientApp::poa_activate(ACE_ENV_SINGLE_ARG_DECL) +ClientApp::poa_activate(void) { - PortableServer::POAManager_var poa_manager - = this->poa_->the_POAManager(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - poa_manager->activate(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; + PortableServer::POAManager_var poa_manager + = this->poa_->the_POAManager(); + poa_manager->activate(); } void -ClientApp::run_clients(ACE_ENV_SINGLE_ARG_DECL) +ClientApp::run_clients(void) { if (this->client_task_.open() != 0) { @@ -157,11 +142,10 @@ ClientApp::run_clients(ACE_ENV_SINGLE_ARG_DECL) void -ClientApp::run_orb_event_loop(ACE_ENV_SINGLE_ARG_DECL) +ClientApp::run_orb_event_loop(void) { OrbRunner orb_runner(this->orb_.in(), this->num_orb_threads_); - orb_runner.run(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; + orb_runner.run(); TheAppShutdown->wait (); } @@ -171,15 +155,13 @@ ClientApp::create_poa(CORBA::ORB_ptr orb, const char* poa_name ACE_ENV_ARG_DECL) { // Get the Root POA. PortableServer::POA_var root_poa - = RefHelper<PortableServer::POA>::resolve_initial_ref(orb, + = RefHelper<PortableServer::POA>::resolve_initial_ref(orb, "RootPOA" ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (PortableServer::POA::_nil ()); // Get the POAManager from the Root POA. - PortableServer::POAManager_var poa_manager - = root_poa->the_POAManager(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (PortableServer::POA::_nil ()); + PortableServer::POAManager_var poa_manager + = root_poa->the_POAManager(); // Create the child POA Policies. CORBA::PolicyList policies(0); @@ -191,7 +173,6 @@ ClientApp::create_poa(CORBA::ORB_ptr orb, const char* poa_name ACE_ENV_ARG_DECL) poa_manager.in(), policies ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (PortableServer::POA::_nil ()); // Give away the child POA_ptr from the POA_var variable. return poa._retn(); diff --git a/TAO/tests/CSD_Strategy_Tests/Broken/ClientApp.h b/TAO/tests/CSD_Strategy_Tests/Broken/ClientApp.h index 846384224f5..9447b7f619a 100644 --- a/TAO/tests/CSD_Strategy_Tests/Broken/ClientApp.h +++ b/TAO/tests/CSD_Strategy_Tests/Broken/ClientApp.h @@ -28,12 +28,12 @@ class ClientApp : public TestAppBase // These are all called, in order, by the run_i() method. int init(int argc, char* argv[] ACE_ENV_ARG_DECL); - void poa_setup(ACE_ENV_SINGLE_ARG_DECL); - void csd_setup(ACE_ENV_SINGLE_ARG_DECL); - void client_setup(ACE_ENV_SINGLE_ARG_DECL); - void poa_activate(ACE_ENV_SINGLE_ARG_DECL); - void run_clients(ACE_ENV_SINGLE_ARG_DECL); - void run_orb_event_loop(ACE_ENV_SINGLE_ARG_DECL); + void poa_setup(void); + void csd_setup(void); + void client_setup(void); + void poa_activate(void); + void run_clients(void); + void run_orb_event_loop(void); bool check_validity (); void cleanup(); diff --git a/TAO/tests/CSD_Strategy_Tests/Broken/ServerApp.cpp b/TAO/tests/CSD_Strategy_Tests/Broken/ServerApp.cpp index e48955f8c06..3a8ec92aad6 100644 --- a/TAO/tests/CSD_Strategy_Tests/Broken/ServerApp.cpp +++ b/TAO/tests/CSD_Strategy_Tests/Broken/ServerApp.cpp @@ -35,26 +35,18 @@ int ServerApp::run_i(int argc, char* argv[] ACE_ENV_ARG_DECL) { int result = this->init(argc, argv ACE_ENV_ARG_PARAMETER); - if (result != 0) + if (result != 0) { return result; } - ACE_CHECK_RETURN (-1); - - this->poa_setup(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); - this->csd_setup(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); - this->servant_setup(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); - this->collocated_setup(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); - this->poa_activate(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); - this->run_collocated_clients(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); - this->run_orb_event_loop(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); + + this->poa_setup(); + this->csd_setup(); + this->servant_setup(); + this->collocated_setup(); + this->poa_activate(); + this->run_collocated_clients(); + this->run_orb_event_loop(); // Calling wait on ACE_Thread_Manager singleton to avoid the problem // that the main thread might exit before all CSD Threads exit. @@ -71,7 +63,6 @@ int ServerApp::init(int argc, char* argv[] ACE_ENV_ARG_DECL) { this->orb_ = CORBA::ORB_init(argc, argv, "" ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); // Parse the command-line args for this application. // * Raises -1 if problems are encountered. @@ -87,31 +78,28 @@ ServerApp::init(int argc, char* argv[] ACE_ENV_ARG_DECL) this->num_collocated_clients_; TheAppShutdown->init(this->orb_.in(), num_clients ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); return 0; } void -ServerApp::poa_setup(ACE_ENV_SINGLE_ARG_DECL) +ServerApp::poa_setup(void) { - this->poa_ = this->create_poa(this->orb_.in(), - "ChildPoa" + this->poa_ = this->create_poa(this->orb_.in(), + "ChildPoa" ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - + if (this->num_collocated_clients_ > 0) { - this->cb_poa_ = this->create_poa(this->orb_.in(), - "CallbackPoa" + this->cb_poa_ = this->create_poa(this->orb_.in(), + "CallbackPoa" ACE_ENV_ARG_PARAMETER); - ACE_CHECK; } } void -ServerApp::csd_setup(ACE_ENV_SINGLE_ARG_DECL) +ServerApp::csd_setup(void) { this->tp_strategy_ = new TAO::CSD::TP_Strategy(this->num_csd_threads_); @@ -124,11 +112,10 @@ ServerApp::csd_setup(ACE_ENV_SINGLE_ARG_DECL) "Failed to apply CSD strategy to poa.\n")); ACE_THROW(TestAppException()); } - ACE_CHECK; #endif // Use another poa and strategy for callbacks. This would resolve - // the deadlock situation that happens when having number of csd + // the deadlock situation that happens when having number of csd // threads less than number of collocated clients. if (this->num_collocated_clients_ > 0) { @@ -141,27 +128,25 @@ ServerApp::csd_setup(ACE_ENV_SINGLE_ARG_DECL) ACE_ERROR((LM_ERROR, "Failed to apply CSD strategy to callback poa.\n")); ACE_THROW(TestAppException()); - } - ACE_CHECK; + } #endif } } void -ServerApp::servant_setup(ACE_ENV_SINGLE_ARG_DECL) +ServerApp::servant_setup(void) { this->foo_servants_.create_and_activate(this->num_servants_, this->orb_.in (), this->poa_.in (), this->ior_filename_prefix_.c_str() ACE_ENV_ARG_PARAMETER); - ACE_CHECK; } void -ServerApp::collocated_setup(ACE_ENV_SINGLE_ARG_DECL) +ServerApp::collocated_setup(void) { if (this->num_collocated_clients_ == 0) return; @@ -169,10 +154,9 @@ ServerApp::collocated_setup(ACE_ENV_SINGLE_ARG_DECL) this->cb_servants_.create_and_activate(1, // number of callback servants this->cb_poa_.in() ACE_ENV_ARG_PARAMETER); - ACE_CHECK; CallbackServantListType::T_stub_var cb = this->cb_servants_.objref(0); - + unsigned client_id = this->num_remote_clients_; for (unsigned i = 0; i < this->num_collocated_clients_; i++) @@ -181,9 +165,9 @@ ServerApp::collocated_setup(ACE_ENV_SINGLE_ARG_DECL) // Dole out the servant object references in a round-robin fashion. unsigned servant_index = i % this->num_servants_; - FooServantListType::T_stub_var foo + FooServantListType::T_stub_var foo = this->foo_servants_.objref(servant_index); - ClientEngine_Handle engine + ClientEngine_Handle engine = new Foo_B_SimpleClientEngine(foo.in(), cb.in (), client_id, true); this->collocated_client_task_.add_engine(engine.in()); } @@ -191,18 +175,16 @@ ServerApp::collocated_setup(ACE_ENV_SINGLE_ARG_DECL) void -ServerApp::poa_activate(ACE_ENV_SINGLE_ARG_DECL) +ServerApp::poa_activate(void) { - PortableServer::POAManager_var poa_manager - = this->poa_->the_POAManager(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - poa_manager->activate(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; + PortableServer::POAManager_var poa_manager + = this->poa_->the_POAManager(); + poa_manager->activate(); } void -ServerApp::run_collocated_clients(ACE_ENV_SINGLE_ARG_DECL) +ServerApp::run_collocated_clients(void) { if (this->num_collocated_clients_ > 0) { @@ -215,11 +197,10 @@ ServerApp::run_collocated_clients(ACE_ENV_SINGLE_ARG_DECL) void -ServerApp::run_orb_event_loop(ACE_ENV_SINGLE_ARG_DECL) +ServerApp::run_orb_event_loop(void) { OrbRunner orb_runner(this->orb_.in(), this->num_orb_threads_); - orb_runner.run(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; + orb_runner.run(); TheAppShutdown->wait (); } @@ -332,7 +313,7 @@ ServerApp::usage_statement() int ServerApp::arg_dependency_checks() { - return (this->num_remote_clients_ + return (this->num_remote_clients_ + this->num_collocated_clients_) > 0 ? 0 : -1; } @@ -361,21 +342,19 @@ ServerApp::set_arg(unsigned& value, PortableServer::POA_ptr -ServerApp::create_poa(CORBA::ORB_ptr orb, - const char* poa_name +ServerApp::create_poa(CORBA::ORB_ptr orb, + const char* poa_name ACE_ENV_ARG_DECL) { // Get the Root POA. PortableServer::POA_var root_poa - = RefHelper<PortableServer::POA>::resolve_initial_ref(orb, - "RootPOA" + = RefHelper<PortableServer::POA>::resolve_initial_ref(orb, + "RootPOA" ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (PortableServer::POA::_nil ()); // Get the POAManager from the Root POA. - PortableServer::POAManager_var poa_manager - = root_poa->the_POAManager(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (PortableServer::POA::_nil ()); + PortableServer::POAManager_var poa_manager + = root_poa->the_POAManager(); // Create the child POA Policies. CORBA::PolicyList policies(0); @@ -387,7 +366,6 @@ ServerApp::create_poa(CORBA::ORB_ptr orb, poa_manager.in(), policies ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (PortableServer::POA::_nil ()); // Give away the child POA_ptr from the POA_var variable. return poa._retn(); @@ -400,7 +378,7 @@ ServerApp::check_validity () return true; #if 0 // Check whether the clients return any errors. - if (this->num_collocated_clients_ > 0 + if (this->num_collocated_clients_ > 0 && this->collocated_client_task_.failure_count () > 0) { return false; @@ -408,7 +386,7 @@ ServerApp::check_validity () Foo_B_Statistics stats (this->num_remote_clients_, this->num_collocated_clients_); - + Foo_B_SimpleClientEngine::expected_results (stats); for (unsigned i = 0; i < this->num_servants_; i++) diff --git a/TAO/tests/CSD_Strategy_Tests/Broken/ServerApp.h b/TAO/tests/CSD_Strategy_Tests/Broken/ServerApp.h index c90b7671534..d976d13706e 100644 --- a/TAO/tests/CSD_Strategy_Tests/Broken/ServerApp.h +++ b/TAO/tests/CSD_Strategy_Tests/Broken/ServerApp.h @@ -28,13 +28,13 @@ class ServerApp : public TestAppBase // These are all called, in order, by the run_i() method. int init(int argc, char* argv[] ACE_ENV_ARG_DECL); - void poa_setup(ACE_ENV_SINGLE_ARG_DECL); - void csd_setup(ACE_ENV_SINGLE_ARG_DECL); - void servant_setup(ACE_ENV_SINGLE_ARG_DECL); - void collocated_setup(ACE_ENV_SINGLE_ARG_DECL); - void poa_activate(ACE_ENV_SINGLE_ARG_DECL); - void run_collocated_clients(ACE_ENV_SINGLE_ARG_DECL); - void run_orb_event_loop(ACE_ENV_SINGLE_ARG_DECL); + void poa_setup(void); + void csd_setup(void); + void servant_setup(void); + void collocated_setup(void); + void poa_activate(void); + void run_collocated_clients(void); + void run_orb_event_loop(void); bool check_validity (); void cleanup(); |