summaryrefslogtreecommitdiff
path: root/modules/CIAO/DAnCE/tests/ObjectLocatorTest/clt_main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/CIAO/DAnCE/tests/ObjectLocatorTest/clt_main.cpp')
-rw-r--r--modules/CIAO/DAnCE/tests/ObjectLocatorTest/clt_main.cpp56
1 files changed, 56 insertions, 0 deletions
diff --git a/modules/CIAO/DAnCE/tests/ObjectLocatorTest/clt_main.cpp b/modules/CIAO/DAnCE/tests/ObjectLocatorTest/clt_main.cpp
new file mode 100644
index 00000000000..d2cca36e843
--- /dev/null
+++ b/modules/CIAO/DAnCE/tests/ObjectLocatorTest/clt_main.cpp
@@ -0,0 +1,56 @@
+// $Id$
+#include "ace/String_Base.h"
+#include "DAnCE/Logger/Log_Macros.h"
+#include "RegistrationPath.h"
+#include "DummyC.h"
+
+using namespace ObjectLocatorTest;
+
+
+int ACE_TMAIN (int argc, ACE_TCHAR * argv[])
+{
+ try
+ {
+ CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);
+
+ ACE_CString url = "corbaloc:iiop:glasgow.headquarters.eclipsesp.com:12345/";
+ url += app_name;
+ url += "/";
+ url += inst_name;
+ url += "/";
+ url += port_name;
+ DANCE_DEBUG((LM_DEBUG, "[%M] URL : %s\n", url.c_str()));
+
+ CORBA::Object_var obj = orb->string_to_object (url.c_str());
+ if (CORBA::is_nil (obj))
+ {
+ DANCE_ERROR((LM_ERROR, "[%M] Failed to convert url to object. The test failed.\n"));
+ return 1;
+ }
+ DANCE_DEBUG((LM_DEBUG, "[%M] URL -> object : ok.\n"));
+
+ Dummy_var dummy_obj = Dummy::_narrow (obj);
+ if (CORBA::is_nil (dummy_obj))
+ {
+ DANCE_ERROR((LM_ERROR, "[%M] Failed to narrow the object to custom type. The test failed.\n"));
+ return 1;
+ }
+ DANCE_DEBUG((LM_DEBUG, "[%M] object -> dummy : ok.\n"));
+
+ DANCE_DEBUG((LM_DEBUG, "[%M] Dummy object returned : %s.", dummy_obj->sayHello()));
+ DANCE_DEBUG((LM_DEBUG, "[%M] The test succeeded."));
+ return 0;
+ }
+ catch (CORBA::Exception & e)
+ {
+ DANCE_ERROR((LM_ERROR, "[%M] A CORBA exception \"%s\" (%s) was thrown. The test failed."
+ , e._name(), e._info().c_str()));
+ return 1;
+ }
+ catch (...)
+ {
+ DANCE_ERROR((LM_ERROR, "[%M] An exception was thrown. The test failed."));
+ return 1;
+ }
+}
+