summaryrefslogtreecommitdiff
path: root/TAO/tests/RTCORBA/Server_Protocol/client.cpp
diff options
context:
space:
mode:
authormarina <marina@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2000-08-25 23:22:37 +0000
committermarina <marina@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2000-08-25 23:22:37 +0000
commit2ecfe972ecdaf8e8f5807f22d55c060efe837712 (patch)
tree3eef297b11c6fb780590ae519a5bd5b4c38487ae /TAO/tests/RTCORBA/Server_Protocol/client.cpp
parent8ce7ed7f2a8b38ad403f9f9dcfce6245663ad615 (diff)
downloadATCD-2ecfe972ecdaf8e8f5807f22d55c060efe837712.tar.gz
ChangeLogTag:Fri Aug 25 18:24:14 2000 Marina Spivak <marina@cs.wustl.edu>
Diffstat (limited to 'TAO/tests/RTCORBA/Server_Protocol/client.cpp')
-rw-r--r--TAO/tests/RTCORBA/Server_Protocol/client.cpp75
1 files changed, 75 insertions, 0 deletions
diff --git a/TAO/tests/RTCORBA/Server_Protocol/client.cpp b/TAO/tests/RTCORBA/Server_Protocol/client.cpp
new file mode 100644
index 00000000000..6926777cd31
--- /dev/null
+++ b/TAO/tests/RTCORBA/Server_Protocol/client.cpp
@@ -0,0 +1,75 @@
+// $Id$
+
+#include "testC.h"
+#include "ace/Get_Opt.h"
+
+const char *ior = "file://test.ior";
+
+int
+parse_args (int argc, char *argv[])
+{
+ ACE_Get_Opt get_opts (argc, argv, "k:");
+ int c;
+
+ while ((c = get_opts ()) != -1)
+ switch (c)
+ {
+ case 'k':
+ ior = get_opts.optarg;
+ break;
+ case '?':
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "usage: %s "
+ "-k <ior> "
+ "\n",
+ argv [0]),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+main (int argc, char *argv[])
+{
+ ACE_TRY_NEW_ENV
+ {
+ // Initialize and obtain reference to the Test object.
+ CORBA::ORB_var orb =
+ CORBA::ORB_init (argc, argv, "", ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ if (parse_args (argc, argv) != 0)
+ return 1;
+
+ CORBA::Object_var object =
+ orb->string_to_object (ior, ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ Test_var server =
+ Test::_narrow (object.in (), ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ if (CORBA::is_nil (server.in ()))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "ERROR: Object reference <%s> is nil\n",
+ ior),
+ 1);
+ }
+
+ // Make an invocation on the obtained Test object.
+ server->shutdown (ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "Catched exception:");
+ return 1;
+ }
+ ACE_ENDTRY;
+
+ return 0;
+}