summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/tests/Naming
diff options
context:
space:
mode:
authorschmidt <douglascraigschmidt@users.noreply.github.com>1998-07-18 14:43:03 +0000
committerschmidt <douglascraigschmidt@users.noreply.github.com>1998-07-18 14:43:03 +0000
commit53179d40d4419e6d8cfd6c20f8e09fc72c3e33bf (patch)
tree13ed654237c82ebd6df7e307f94f628f6b670496 /TAO/orbsvcs/tests/Naming
parent1a05dd9d58f6ed1bbef9bcc6a0b7b3c0767b266d (diff)
downloadATCD-53179d40d4419e6d8cfd6c20f8e09fc72c3e33bf.tar.gz
*** empty log message ***
Diffstat (limited to 'TAO/orbsvcs/tests/Naming')
-rw-r--r--TAO/orbsvcs/tests/Naming/ns_tree.cpp66
1 files changed, 41 insertions, 25 deletions
diff --git a/TAO/orbsvcs/tests/Naming/ns_tree.cpp b/TAO/orbsvcs/tests/Naming/ns_tree.cpp
index 303bebb9df6..8fcb52bf33d 100644
--- a/TAO/orbsvcs/tests/Naming/ns_tree.cpp
+++ b/TAO/orbsvcs/tests/Naming/ns_tree.cpp
@@ -6,6 +6,8 @@
// ns_tree.cpp
//
// = DESCRIPTION
+// Tests various features of TAO's Naming Service. Note that this
+// uses a co-located Naming Service, rather than a remote one.
//
// = AUTHOR
// Ross Lillie <lillie@rsch.comm.mot.com>
@@ -15,28 +17,30 @@
#include "tao/TAO.h"
#include "orbsvcs/CosNamingC.h"
-#include "test_objectS.h"
#include "orbsvcs/Naming/Naming_Utils.h"
+#include "test_objectS.h"
-class Test_Object_impl : public POA_Test_Object
+class My_Test_Object : public POA_Test_Object
{
public:
- Test_Object_impl (void) {};
- ~Test_Object_impl (void) {};
+ My_Test_Object (void) {};
+ ~My_Test_Object (void) {};
};
int
main (int argc, char **argv)
{
TAO_ORB_Manager orbmgr;
- Test_Object_impl myObject;
+ My_Test_Object myObject;
TAO_Naming_Server my_name_server;
- int result;
TAO_TRY
{
- // Initialize and obtain reference to the Naming Context
- if (orbmgr.init_child_poa (argc, argv,"Rob", TAO_TRY_ENV) == -1)
+ // Initialize and obtain reference to the Naming Context.
+ if (orbmgr.init_child_poa (argc,
+ argv,
+ "child",
+ TAO_TRY_ENV) == -1)
ACE_ERROR_RETURN ((LM_ERROR,
"failed to init ORB\n"),
-1);
@@ -46,16 +50,19 @@ main (int argc, char **argv)
CORBA::ORB_var orb = orbmgr.orb ();
child_poa = orbmgr.child_poa ();
- result = my_name_server.init (orb, child_poa);
+ int result = my_name_server.init (orb,
+ child_poa);
- if (result < 0)
+ if (result == -1)
return result;
CosNaming::Name context_name;
- CosNaming::NamingContext_var ns_ctx;
context_name.length (1);
- context_name[0].id = CORBA::string_dup ("NameService");
- ns_ctx = my_name_server->bind_new_context (context_name, TAO_TRY_ENV);
+ context_name[0].id =
+ CORBA::string_dup ("NameService");
+ CosNaming::NamingContext_var ns_ctx =
+ my_name_server->bind_new_context (context_name,
+ TAO_TRY_ENV);
TAO_CHECK_ENV_RETURN (TAO_TRY_ENV, -1);
@@ -66,43 +73,52 @@ main (int argc, char **argv)
// Create a child context.
CosNaming::Name test_context (1);
- CosNaming::NamingContext_var my_context;
test_context.length (1);
test_context[0].id =
CORBA::string_dup ("MyContext");
- my_context = my_name_server->bind_new_context (test_context, TAO_TRY_ENV);
+ CosNaming::NamingContext_var my_context =
+ my_name_server->bind_new_context (test_context,
+ TAO_TRY_ENV);
TAO_CHECK_ENV_RETURN (TAO_TRY_ENV, -1);
- cerr << "Created new context OK" << endl;
+ ACE_DEBUG ((LM_DEBUG,
+ "Created new context OK"));
// Bind an object to a child context.
CosNaming::Name test_name (2);
test_name.length (2);
- test_name[0].id = CORBA::string_dup ("MyContext");
- test_name[1].id = CORBA::string_dup ("MyName");
+ test_name[0].id =
+ CORBA::string_dup ("MyContext");
+ test_name[1].id =
+ CORBA::string_dup ("MyName");
my_name_server->bind (test_name,
myObject_var.in (),
TAO_TRY_ENV);
TAO_CHECK_ENV;
- cerr << "Bound compound name OK" << endl;
+ ACE_DEBUG ((LM_DEBUG,
+ "Bound compound name OK"));
// Finally, try now to resolve the compound name.
CosNaming::Name result_name (2);
result_name.length (2);
- result_name[0].id = CORBA::string_dup ("MyContext");
- result_name[1].id = CORBA::string_dup ("MyName");
+ result_name[0].id =
+ CORBA::string_dup ("MyContext");
+ result_name[1].id =
+ CORBA::string_dup ("MyName");
- CORBA::Object_var resolvedobj = my_name_server->resolve (result_name,
- TAO_TRY_ENV);
+ CORBA::Object_var resolvedobj =
+ my_name_server->resolve (result_name,
+ TAO_TRY_ENV);
TAO_CHECK_ENV;
Test_Object_var resultObject =
Test_Object::_narrow (resolvedobj.in (),
TAO_TRY_ENV);
-
- cerr << "Resolved compound name OK" << endl;
+ TAO_CHECK_ENV;
+ ACE_DEBUG ((LM_DEBUG,
+ "Resolved compound name OK"));
}
TAO_CATCHANY
{