summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-10-30 21:48:18 +0000
committernanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-10-30 21:48:18 +0000
commit9584ed87650a5e9031a11b56b63420e3ce8cde33 (patch)
treea48fe7ddfab44176bcd46a18d82142ec3e841ff1
parent1ffa3e3b2dc60a08df1650baaccdd972eed11dd1 (diff)
downloadATCD-9584ed87650a5e9031a11b56b63420e3ce8cde33.tar.gz
collocation test fix
-rw-r--r--TAO/performance-tests/Cubit/TAO/IDL_Cubit/Cubit_Client.cpp51
-rw-r--r--TAO/performance-tests/Cubit/TAO/IDL_Cubit/Cubit_Client.h17
-rw-r--r--TAO/performance-tests/Cubit/TAO/IDL_Cubit/collocation_test.cpp17
3 files changed, 66 insertions, 19 deletions
diff --git a/TAO/performance-tests/Cubit/TAO/IDL_Cubit/Cubit_Client.cpp b/TAO/performance-tests/Cubit/TAO/IDL_Cubit/Cubit_Client.cpp
index 1d9d65e0edc..67a9d674e0a 100644
--- a/TAO/performance-tests/Cubit/TAO/IDL_Cubit/Cubit_Client.cpp
+++ b/TAO/performance-tests/Cubit/TAO/IDL_Cubit/Cubit_Client.cpp
@@ -92,7 +92,7 @@ ACE_TIMEPROBE_EVENT_DESCRIPTIONS (Cubit_Client_Timeprobe_Description,
#endif /* ACE_ENABLE_TIMEPROBES */
// Constructor.
-Cubit_Client::Cubit_Client (void)
+Cubit_Client::Cubit_Client (int testing_collocation)
: cubit_factory_key_ (0),
loop_count_ (250),
shutdown_ (0),
@@ -102,7 +102,8 @@ Cubit_Client::Cubit_Client (void)
cubit_factory_ior_file_ (0),
f_handle_ (ACE_INVALID_HANDLE),
only_void_ (0),
- only_oneway_ (0)
+ only_oneway_ (0),
+ testing_collocation_ (testing_collocation)
{
}
@@ -819,7 +820,7 @@ Cubit_Client::print_stats (const char *call_name,
// Execute client example code.
int
-Cubit_Client::run (int testing_collocation)
+Cubit_Client::run ()
{
if (this->only_void_)
return this->run_void ();
@@ -995,15 +996,44 @@ Cubit_Client::run (int testing_collocation)
timer.elapsed_time (elapsed_time);
this->print_stats ("cube_oneway", elapsed_time);
- if (testing_collocation)
+ this->shutdown_server (this->shutdown_);
+
+ return this->error_count_ == 0 ? 0 : 1;
+}
+
+int
+Cubit_Client::shutdown_server (int do_shutdown)
+{
+ if (this->testing_collocation_)
{
- // @@ Nanbor, this code should be split into a separate method.
TAO_ORB_Core_instance ()->using_collocation (0);
// Make sure we call the following method "remotely" so
// the right ORB could be used.
TAO_TRY
{
+ if (this->cubit_factory_key_ == 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%s: no cubit factory key specified\n",
+ this->argv_[0]),
+ -1);
+
+ CORBA::Object_var factory_object =
+ this->orb_->string_to_object (this->cubit_factory_key_,
+ TAO_TRY_ENV);
+ TAO_CHECK_ENV;
+
+ this->factory_ =
+ Cubit_Factory::_narrow (factory_object.in(),
+ TAO_TRY_ENV);
+ TAO_CHECK_ENV;
+
+ if (CORBA::is_nil (this->factory_.in ()))
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "invalid factory key <%s>\n",
+ this->cubit_factory_key_),
+ -1);
+
this->cubit_ =
this->factory_->make_cubit (TAO_TRY_ENV);
TAO_CHECK_ENV;
@@ -1023,15 +1053,13 @@ Cubit_Client::run (int testing_collocation)
TAO_ENDTRY;
}
- else if (this->shutdown_)
+ else if (do_shutdown)
{
ACE_DEBUG ((LM_DEBUG, "shutdown on cubit object\n"));
this->cubit_->shutdown (this->env_);
dexc (this->env_, "server, please ACE_OS::exit");
}
-
-
- return this->error_count_ == 0 ? 0 : 1;
+ return 0;
}
int
@@ -1107,7 +1135,7 @@ Cubit_Client::~Cubit_Client (void)
}
int
-Cubit_Client::init (int argc, char **argv)
+Cubit_Client::init (int argc, char **argv, char *collocation_test_ior)
{
this->argc_ = argc;
this->argv_ = argv;
@@ -1125,6 +1153,9 @@ Cubit_Client::init (int argc, char **argv)
if (this->parse_args () == -1)
return -1;
+ if (collocation_test_ior != 0)
+ this->read_ior (collocation_test_ior);
+
if (this->cubit_factory_key_ == 0)
ACE_ERROR_RETURN ((LM_ERROR,
"%s: no cubit factory key specified\n",
diff --git a/TAO/performance-tests/Cubit/TAO/IDL_Cubit/Cubit_Client.h b/TAO/performance-tests/Cubit/TAO/IDL_Cubit/Cubit_Client.h
index 7229424b1ea..0b895711210 100644
--- a/TAO/performance-tests/Cubit/TAO/IDL_Cubit/Cubit_Client.h
+++ b/TAO/performance-tests/Cubit/TAO/IDL_Cubit/Cubit_Client.h
@@ -44,14 +44,17 @@ class Cubit_Client
// server is hidden in the class. Just the run() interface is needed.
public:
// = Constructor and destructor.
- Cubit_Client (void);
+ Cubit_Client (int testing_collocation = 0);
+ // Use <testing_collocation> to control some client's behaviors.
+
~Cubit_Client (void);
- int run (int testing_collocation = 0);
+ int run (void);
// Execute client example code.
- int init (int argc, char **argv);
+ int init (int argc, char **argv, char *collocation_test_ior = 0);
// Initialize the client communication endpoint with server.
+ // <collocation_test_ior> is used to pass in the ior file name.
private:
int func (u_int i);
@@ -107,6 +110,11 @@ private:
int run_oneway (void);
// This method runs only the cube_oneway() test.
+ int shutdown_server (int do_shutdown);
+ // Invoke the method with <do_shutdown> != 0 to shutdown the server.
+ // When testing collocation, <do_shutdown> has no effect (it always
+ // shuts the server down.
+
int argc_;
// # of arguments on the command line.
@@ -151,6 +159,9 @@ private:
int only_oneway_;
// Run only the cube_oneway() test.
+
+ int testing_collocation_;
+ // We are running the collocation test.
};
#endif /* _CUBIT_CLIENT_H */
diff --git a/TAO/performance-tests/Cubit/TAO/IDL_Cubit/collocation_test.cpp b/TAO/performance-tests/Cubit/TAO/IDL_Cubit/collocation_test.cpp
index 67fc63f8f52..a1d2268104c 100644
--- a/TAO/performance-tests/Cubit/TAO/IDL_Cubit/collocation_test.cpp
+++ b/TAO/performance-tests/Cubit/TAO/IDL_Cubit/collocation_test.cpp
@@ -4,6 +4,8 @@
#include "Cubit_Client.h"
#include "Cubit_Server.h"
+#define THE_IOR_FILE "theior"
+
ACE_RCSID(IDL_Cubit, collocation_test, "$Id$")
#define ACE_THREAD_MANAGER ACE_Thread_Manager::instance ()
@@ -13,11 +15,11 @@ svr_worker (void *arg)
{
Cubit_Server cubit_server;
ACE_Barrier *barrier = (ACE_Barrier *) arg;
- char *fake[] = {"server"};
+ char *fake[] = {"server", "-o", THE_IOR_FILE };
TAO_TRY
{
- if (cubit_server.init (1, fake, TAO_TRY_ENV) == -1)
+ if (cubit_server.init (3, fake, TAO_TRY_ENV) == -1)
return (void *) 1;
else
{
@@ -46,7 +48,10 @@ svr_worker (void *arg)
int
main (int argc, char **argv)
{
- Cubit_Client cubit_client;
+ Cubit_Client cubit_client (1);
+ // We want to test collocation, so create
+ // cubit_client with parameter 1 set.
+
CORBA::Environment env;
ACE_Barrier barrier (2);
@@ -60,10 +65,10 @@ main (int argc, char **argv)
barrier.wait ();
ACE_OS::sleep (1);
- if (cubit_client.init (argc, argv) == -1)
- return 1;
+ if (cubit_client.init (argc, argv, THE_IOR_FILE) == -1)
+ return 1;
else
- retv = cubit_client.run (1);
+ retv = cubit_client.run ();
ACE_THREAD_MANAGER->wait ();
return retv;