summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/orbsvcs')
-rwxr-xr-xTAO/orbsvcs/tests/Naming/Makefile2
-rw-r--r--TAO/orbsvcs/tests/Naming/ns_tree.cpp56
2 files changed, 18 insertions, 40 deletions
diff --git a/TAO/orbsvcs/tests/Naming/Makefile b/TAO/orbsvcs/tests/Naming/Makefile
index b8b66a203cf..1392aebabdf 100755
--- a/TAO/orbsvcs/tests/Naming/Makefile
+++ b/TAO/orbsvcs/tests/Naming/Makefile
@@ -6,7 +6,7 @@
CXX = CC -g
IDL = $(TAO_ROOT)/TAO_IDL/tao_idl
-CPPFLAGS = -c -I$(ACE_ROOT) -I$(TAO_ROOT) -I$(TAO_ROOT)/orbsvcs -I. -DHIERARCHICAL_BIND -DRECURSIVE_BIND
+CPPFLAGS = -c -I$(ACE_ROOT) -I$(TAO_ROOT) -I$(TAO_ROOT)/orbsvcs -I.
IDLFLAGS =
# All ACE/TAO related libraries have links in the $ACE_ROOT/ace
diff --git a/TAO/orbsvcs/tests/Naming/ns_tree.cpp b/TAO/orbsvcs/tests/Naming/ns_tree.cpp
index 0cf7c426ca3..6bf979212f7 100644
--- a/TAO/orbsvcs/tests/Naming/ns_tree.cpp
+++ b/TAO/orbsvcs/tests/Naming/ns_tree.cpp
@@ -11,6 +11,7 @@
// Ross Lillie <lillie@rsch.comm.mot.com>
// LMPS Systems Research Lab
//
+//
// ============================================================================
#include "tao/TAO.h"
@@ -32,6 +33,7 @@ main (int argc, char **argv)
TAO_TRY
{
+ // Initialize and obtain reference to the Naming Context
if (orbmgr.init (argc, argv, TAO_TRY_ENV) == -1)
ACE_ERROR_RETURN ((LM_ERROR,
"failed to init ORB\n"),
@@ -57,66 +59,40 @@ main (int argc, char **argv)
myObject._this (TAO_TRY_ENV);
TAO_CHECK_ENV;
-#if !defined (HIERARCHICAL_BIND)
+
+ // Create a child context.
CosNaming::Name test_context (1);
test_context.length (1);
test_context[0].id =
CORBA::string_dup ("MyContext");
- CORBA::Object_var myobj =
+ CORBA::Object_var mycontext =
ns_ctx->bind_new_context (test_context,
TAO_TRY_ENV);
TAO_CHECK_ENV;
- if (CORBA::is_nil (myobj))
+ if (CORBA::is_nil (mycontext))
ACE_ERROR_RETURN ((LM_ERROR,
- "unabled to resolve naming context \"MyContext\"\n"),
+ "unabled to create new naming context \"MyContext\"\n"),
-1);
CosNaming::NamingContext_var my_context =
- CosNaming::NamingContext::_narrow (myobj.in (),
+ CosNaming::NamingContext::_narrow (mycontext.in (),
TAO_TRY_ENV);
TAO_CHECK_ENV;
-#endif /* !HIERARCHICAL_BIND */
-#if defined (RECURSIVE_BIND)
+ cerr << "Created new context OK" << endl;
+
+ // bind an object to a child context
CosNaming::Name test_name (2);
- test_name.length (1);
+ test_name.length (2);
test_name[0].id = CORBA::string_dup ("MyContext");
test_name[1].id = CORBA::string_dup ("MyName");
ns_ctx->bind (test_name,
myObject_var.in (),
TAO_TRY_ENV);
- TAO_CHECK_ENV;
-
-#else
-#if defined (HIERARCHICAL_BIND)
- CosNaming::Name test_context (1);
- test_context.length (1);
- test_context[0].id = CORBA::string_dup ("MyContext");
-
- CORBA::Object_var myobj = ns_ctx->resolve (test_context,
- TAO_TRY_ENV);
- TAO_CHECK_ENV;
-
- if (CORBA::is_nil (myobj))
- ACE_ERROR_RETURN ((LM_ERROR,
- "unabled to resolve naming context \"MyContext\"\n"),
- -1);
- CosNaming::NamingContext_var my_context =
- CosNaming::NamingContext::_narrow (myobj.in (),
- TAO_TRY_ENV);
- TAO_CHECK_ENV;
-#endif /* HIERARCHICAL_BIND */
- CosNaming::Name test_name (1);
- test_name.length (1);
- test_name[0].id = CORBA::string_dup ("MyName");
-
- my_context->bind (test_name,
- myObject_var.in (),
- TAO_TRY_ENV);
- TAO_CHECK_ENV;
-#endif /* RECURSIVE_BIND */
+ TAO_CHECK_ENV;
+ cerr << "Bound compound name OK" << endl;
// Finally, try now to resolve the compound name.
CosNaming::Name result_name (2);
@@ -130,7 +106,9 @@ main (int argc, char **argv)
Test_Object_var resultObject =
Test_Object::_narrow (resolvedobj.in (),
- TAO_TRY_ENV);
+ TAO_TRY_ENV);
+
+ cerr << "Resolved compound name OK" << endl;
}
TAO_CATCHANY
{