summaryrefslogtreecommitdiff
path: root/TAO/tests/Simple/time
diff options
context:
space:
mode:
authorschmidt <douglascraigschmidt@users.noreply.github.com>1998-08-22 04:16:55 +0000
committerschmidt <douglascraigschmidt@users.noreply.github.com>1998-08-22 04:16:55 +0000
commit81dc43fd54eff6d6c192485342bd3b2e7ac37b9e (patch)
tree3b4dd0172655ad805d780ace8aabec6ab2a82094 /TAO/tests/Simple/time
parenta5cea7e6ee908159a1fa4526e7a863ebc751a06d (diff)
downloadATCD-81dc43fd54eff6d6c192485342bd3b2e7ac37b9e.tar.gz
*** empty log message ***
Diffstat (limited to 'TAO/tests/Simple/time')
-rw-r--r--TAO/tests/Simple/time/README7
-rw-r--r--TAO/tests/Simple/time/Time.idl3
-rw-r--r--TAO/tests/Simple/time/Time_impl.cpp5
-rw-r--r--TAO/tests/Simple/time/Time_impl.h5
-rw-r--r--TAO/tests/Simple/time/client.cpp4
-rw-r--r--TAO/tests/Simple/time/client_impl.cpp22
-rw-r--r--TAO/tests/Simple/time/client_impl.h18
-rw-r--r--TAO/tests/Simple/time/server.cpp2
-rw-r--r--TAO/tests/Simple/time/server_impl.cpp6
-rw-r--r--TAO/tests/Simple/time/server_impl.h17
10 files changed, 49 insertions, 40 deletions
diff --git a/TAO/tests/Simple/time/README b/TAO/tests/Simple/time/README
index cfda19d802d..6b29732fb7d 100644
--- a/TAO/tests/Simple/time/README
+++ b/TAO/tests/Simple/time/README
@@ -28,7 +28,6 @@ Using -d turns on debugging messages. It is additive, i.e., the more
only 2 levels of debugging are implemented, and more than 2 -d options
are ignored.
-
client:
-------
@@ -41,9 +40,9 @@ Options:
-f Reads the server ior from the file
-n no. of iterations
-There is only one way of giving the server IOR to the client, and
-that is from a file using the -f option. (This file is produced using
-the -o option of the server.)
+There is only one way of giving the server IOR to the client, and that
+is from a file using the -f option. (This file is produced using the
+-o option of the server.)
run_test.pl:
------------
diff --git a/TAO/tests/Simple/time/Time.idl b/TAO/tests/Simple/time/Time.idl
index 235ed8c9f44..ffbdc5cc49c 100644
--- a/TAO/tests/Simple/time/Time.idl
+++ b/TAO/tests/Simple/time/Time.idl
@@ -2,10 +2,11 @@
// $Id$
interface Time
+{
// = TITLE
// Defines an interface that encapsulates operations that
// return the current time of day and shuts down the server.
-{
+
long time ();
// Returns the current time of day on another machine.
diff --git a/TAO/tests/Simple/time/Time_impl.cpp b/TAO/tests/Simple/time/Time_impl.cpp
index c05736f554f..a7028321fa3 100644
--- a/TAO/tests/Simple/time/Time_impl.cpp
+++ b/TAO/tests/Simple/time/Time_impl.cpp
@@ -24,7 +24,7 @@ Time_Impl::time (CORBA::Environment &env)
{
ACE_UNUSED_ARG (env);
- return long (ACE_OS::time (0));
+ return CORBA::Long (ACE_OS::time (0));
}
// Shutdown.
@@ -36,6 +36,9 @@ void Time_Impl::shutdown (CORBA::Environment &env)
ACE_DEBUG ((LM_DEBUG,
"%s\n",
"Time_Impl is shutting down"));
+
+ // @@ TAO_ORB_Core_instance() is non-standard and should eventually
+ // be replaced.
TAO_ORB_Core_instance ()->orb ()->shutdown ();
}
diff --git a/TAO/tests/Simple/time/Time_impl.h b/TAO/tests/Simple/time/Time_impl.h
index ec5d47de5dd..24f970215f1 100644
--- a/TAO/tests/Simple/time/Time_impl.h
+++ b/TAO/tests/Simple/time/Time_impl.h
@@ -10,7 +10,7 @@
// simple_object_impl.h
//
// = DESCRIPTION
-// This class implements the Simple Object object.
+// This class implements the Time interface.
//
// = AUTHOR
// Darrell Brunsch <brunsch@cs.wustl.edu>
@@ -39,6 +39,7 @@ class Time_Impl: public POA_Time
// return the current time/date on the server and the other that
// shuts down the server.
public:
+ // = Initialization and termination methods.
Time_Impl (const char *obj_name = 0);
// Constructor
@@ -49,7 +50,7 @@ public:
// Return the current time/date on the server.
virtual void shutdown (CORBA::Environment &env);
- // Shutdown routine.
+ // Shutdown the server.
};
#endif /* TIME_IMPL_H */
diff --git a/TAO/tests/Simple/time/client.cpp b/TAO/tests/Simple/time/client.cpp
index 2727dbef2e6..3a711195698 100644
--- a/TAO/tests/Simple/time/client.cpp
+++ b/TAO/tests/Simple/time/client.cpp
@@ -4,7 +4,7 @@
ACE_RCSID(Time, client, "$Id$")
-// This function runs the test.
+// This function runs the time and date test.
int
main (int argc, char **argv)
@@ -12,7 +12,7 @@ main (int argc, char **argv)
Client_Impl client;
ACE_DEBUG ((LM_DEBUG,
- "\n\tSimple_Client\n\n"));
+ "\n\ttime and date test\n\n"));
if (client.init (argc, argv) == -1)
return 1;
diff --git a/TAO/tests/Simple/time/client_impl.cpp b/TAO/tests/Simple/time/client_impl.cpp
index dd50619b072..b21f2eb79e9 100644
--- a/TAO/tests/Simple/time/client_impl.cpp
+++ b/TAO/tests/Simple/time/client_impl.cpp
@@ -28,6 +28,7 @@ Client_Impl::read_ior (char *filename)
"Unable to open %s for writing: %p\n",
filename),
-1);
+
ACE_Read_Buffer ior_buffer (f_handle_);
this->server_key_ = ior_buffer.read ();
@@ -91,15 +92,17 @@ Client_Impl::parse_args (void)
void
Client_Impl::time (void)
{
+ // Make the RMI.
CORBA::Long timedate = this->server_->time (this->env_);
if (this->env_.exception () != 0)
this->env_.print_exception ("from time");
else
{
- dmsg1 ("time: %d\n", timedate);
+ dmsg1 ("time: %d\n", timedate);
- char *ascii_timedate = ACE_OS::ctime (ACE_static_cast (time_t *, &timedate));
+ char *ascii_timedate =
+ ACE_OS::ctime (ACE_static_cast (time_t *, &timedate));
ACE_DEBUG ((LM_DEBUG,
"string time is %s\n",
@@ -128,15 +131,12 @@ Client_Impl::run (void)
Client_Impl::~Client_Impl (void)
{
- // Free resources
- // Close the ior files
+ // Free resources and close the IOR files.
CORBA::release (this->server_);
- if (this->server_key_ != 0)
- ACE_OS::free (this->server_key_);
+ ACE_OS::free (this->server_key_);
}
-
int
Client_Impl::init (int argc, char **argv)
{
@@ -148,7 +148,7 @@ Client_Impl::init (int argc, char **argv)
// Retrieve the ORB.
this->orb_ = CORBA::ORB_init (this->argc_,
this->argv_,
- "internet",
+ 0,
TAO_TRY_ENV);
TAO_CHECK_ENV;
@@ -164,10 +164,12 @@ Client_Impl::init (int argc, char **argv)
CORBA::Object_var server_object =
- this->orb_->string_to_object (this->server_key_, TAO_TRY_ENV);
+ this->orb_->string_to_object (this->server_key_,
+ TAO_TRY_ENV);
TAO_CHECK_ENV;
- this->server_ = Time::_narrow (server_object.in(), TAO_TRY_ENV);
+ this->server_ = Time::_narrow (server_object.in (),
+ TAO_TRY_ENV);
TAO_CHECK_ENV;
if (CORBA::is_nil (server_object.in ()))
diff --git a/TAO/tests/Simple/time/client_impl.h b/TAO/tests/Simple/time/client_impl.h
index de32d31f689..7c315b1aa19 100644
--- a/TAO/tests/Simple/time/client_impl.h
+++ b/TAO/tests/Simple/time/client_impl.h
@@ -10,7 +10,8 @@
// client_impl.h
//
// = DESCRIPTION
-// This class implements a simple CORBA client.
+// This class implements a simple CORBA client that access a Time
+// server.
//
// = AUTHORS
// Darrell Brunsch <brunsch@cs.wustl.edu>
@@ -23,26 +24,29 @@
class Client_Impl
{
// = TITLE
- // Simple Client Implementation.
+ // Simple Client implementation.
//
// = DESCRIPTION
- // Class wrapper for a client which gets the server IOR and then
+ // Class wrapper for a client that gets the server IOR and then
// makes several calls to the server before optionally shutting
// it down.
public:
- // = Constructor and destructor.
+ // = Initialization and termination methods.
Client_Impl (void);
+ // Constructor.
+
~Client_Impl (void);
+ // Destructor.
int run (void);
// Execute client example code.
- int init (int argc, char **argv);
+ int init (int argc, char *argv[]);
// Initialize the client communication endpoint with server.
private:
int read_ior (char *filename);
- // Function to read the server ior from a file.
+ // Function to read the server IOR from a file.
int parse_args (void);
// Parses the arguments passed on the command line.
@@ -60,7 +64,7 @@ private:
// Key of the obj ref of the server.
u_int loop_count_;
- // Number of times to do the time() operation.
+ // Number of times to invoke the <time> operation.
int shutdown_;
// Flag for server shutdown.
diff --git a/TAO/tests/Simple/time/server.cpp b/TAO/tests/Simple/time/server.cpp
index 391f128a474..d58135fc08c 100644
--- a/TAO/tests/Simple/time/server.cpp
+++ b/TAO/tests/Simple/time/server.cpp
@@ -9,7 +9,7 @@ main (int argc, char *argv[])
{
Server_Impl server;
- ACE_DEBUG ((LM_DEBUG, "\n\tSimple_Server\n\n"));
+ ACE_DEBUG ((LM_DEBUG, "\n\ttime and date server\n\n"));
TAO_TRY
{
if (server.init (argc, argv, TAO_TRY_ENV) == -1)
diff --git a/TAO/tests/Simple/time/server_impl.cpp b/TAO/tests/Simple/time/server_impl.cpp
index 59083270c64..8095a6c80de 100644
--- a/TAO/tests/Simple/time/server_impl.cpp
+++ b/TAO/tests/Simple/time/server_impl.cpp
@@ -39,7 +39,6 @@ Server_Impl::parse_args (void)
argv_ [0]),
1);
}
-
// Indicates successful parsing of command line.
return 0;
}
@@ -89,7 +88,10 @@ int
Server_Impl::run (CORBA::Environment& env)
{
if (this->orb_manager_.run (env) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "Server_Impl::run"), -1);
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Server_Impl::run"),
+ -1);
+
return 0;
}
diff --git a/TAO/tests/Simple/time/server_impl.h b/TAO/tests/Simple/time/server_impl.h
index 6cb2c3ee7dd..f6cccc30145 100644
--- a/TAO/tests/Simple/time/server_impl.h
+++ b/TAO/tests/Simple/time/server_impl.h
@@ -10,8 +10,8 @@
// server_impl.h
//
// = DESCRIPTION
-// Class which implements a CORBA server which sets up the simple object
-// implementation and the orb.
+// A CORBA server that initializes the time server implementation
+// and the ORB.
//
// = AUTHORS
// Darrell Brunsch <brunsch@cs.wustl.edu>
@@ -27,20 +27,17 @@
class Server_Impl
{
// = TITLE
- // CORBA Server Implementation
- //
- // = DESCRIPTION
- //
+ // CORBA Server implementation.
public:
// = Initialization and termination methods.
Server_Impl (void);
- // Default constructor
+ // Constructor.
~Server_Impl (void);
- // Destructor
+ // Destructor.
- int init (int argc, char **argv, CORBA::Environment& env);
- // Initialize the Server state - parsing arguments and waiting
+ int init (int argc, char *argv[], CORBA::Environment& env);
+ // Initialize the Server state - parsing arguments and waiting.
int run (CORBA::Environment& env);
// Run the orb