summaryrefslogtreecommitdiff
path: root/modules/CIAO/tests/CIF/Navigation
diff options
context:
space:
mode:
Diffstat (limited to 'modules/CIAO/tests/CIF/Navigation')
-rw-r--r--modules/CIAO/tests/CIF/Navigation/Navigation.idl18
-rw-r--r--modules/CIAO/tests/CIF/Navigation/Navigation.mpc156
-rw-r--r--modules/CIAO/tests/CIF/Navigation/Navigation_exec.cpp87
-rw-r--r--modules/CIAO/tests/CIF/Navigation/Navigation_exec.h62
-rw-r--r--modules/CIAO/tests/CIF/Navigation/client.cpp173
-rwxr-xr-xmodules/CIAO/tests/CIF/Navigation/run_test.pl30
6 files changed, 526 insertions, 0 deletions
diff --git a/modules/CIAO/tests/CIF/Navigation/Navigation.idl b/modules/CIAO/tests/CIF/Navigation/Navigation.idl
new file mode 100644
index 00000000000..afd92b3e403
--- /dev/null
+++ b/modules/CIAO/tests/CIF/Navigation/Navigation.idl
@@ -0,0 +1,18 @@
+// $Id$
+#include <Components.idl>
+
+interface foo
+{
+ void do_foo ();
+};
+
+interface foo_inherited : Components::Navigation
+{
+ void do_inherited_foo ();
+};
+
+component Navigation
+{
+ provides foo navigation_foo;
+ provides foo_inherited inherited_foo;
+};
diff --git a/modules/CIAO/tests/CIF/Navigation/Navigation.mpc b/modules/CIAO/tests/CIF/Navigation/Navigation.mpc
new file mode 100644
index 00000000000..62c9b9b13cf
--- /dev/null
+++ b/modules/CIAO/tests/CIF/Navigation/Navigation.mpc
@@ -0,0 +1,156 @@
+// $Id$
+
+project(Navigation_idl_gen) : componentidldefaults {
+
+ custom_only = 1
+ idlflags += -Wb,stub_export_macro=NAVIGATION_STUB_Export \
+ -Wb,stub_export_include=Navigation_stub_export.h \
+ -Wb,skel_export_macro=NAVIGATION_SVNT_Export \
+ -Wb,skel_export_include=Navigation_svnt_export.h \
+ -Wb,exec_export_macro=NAVIGATION_EXEC_Export \
+ -Wb,exec_export_include=Navigation_exec_export.h
+
+ IDL_Files {
+ Navigation.idl
+ }
+}
+
+project(Navigation_lem_gen) : ciaoidldefaults {
+
+ after += Navigation_idl_gen
+ custom_only = 1
+ idlflags += -Wb,stub_export_macro=NAVIGATION_LEM_STUB_Export \
+ -Wb,stub_export_include=Navigation_lem_stub_export.h \
+ -SS -Gxhst
+
+ IDL_Files {
+ NavigationE.idl
+ }
+}
+
+project(Navigation_lem_stub) : ccm_svnt {
+
+ after += Navigation_lem_gen Navigation_stub
+ libs += Navigation_stub
+ libpaths += ../lib
+ libout = ../lib
+
+ sharedname = Navigation_lem_stub
+ dynamicflags = NAVIGATION_LEM_STUB_BUILD_DLL
+
+ IDL_Files {
+ }
+
+ Source_Files {
+ NavigationEC.cpp
+ }
+
+ Header_Files {
+ NavigationEC.h
+ Navigation_lem_stub_export.h
+ }
+
+ Inline_Files {
+ NavigationEC.inl
+ }
+}
+
+project(Navigation_stub) : ccm_stub {
+
+ after += Navigation_idl_gen
+ libs +=
+ libpaths += ../lib
+ libout = ../lib
+
+
+ sharedname = Navigation_stub
+ dynamicflags = NAVIGATION_STUB_BUILD_DLL
+
+ IDL_Files {
+ }
+
+ Source_Files {
+ NavigationC.cpp
+ }
+
+ Header_Files {
+ NavigationC.h
+ Navigation_stub_export.h
+ }
+
+ Inline_Files {
+ NavigationC.inl
+ }
+}
+
+project(Navigation_exec) : ciao_executor {
+
+ after += Navigation_lem_stub Navigation_stub
+ sharedname = Navigation_exec
+ libs += Navigation_stub Navigation_lem_stub
+ libpaths += ../lib
+ libout = ../lib
+
+
+ dynamicflags = NAVIGATION_EXEC_BUILD_DLL
+
+ IDL_Files {
+ }
+
+ Source_Files {
+ Navigation_exec.cpp
+ }
+
+ Header_Files {
+ Navigation_exec.h
+ Navigation_exec_export.h
+ }
+
+ Inline_Files {
+ }
+}
+
+
+project(Navigation_svnt) : ciao_servant {
+
+ after += Navigation_lem_stub
+ sharedname = Navigation_svnt
+ libs += Navigation_stub Navigation_lem_stub
+ libpaths += ../lib
+ libout = ../lib
+
+
+ dynamicflags = NAVIGATION_SVNT_BUILD_DLL
+
+ IDL_Files {
+ }
+
+ Source_Files {
+ NavigationS.cpp
+ Navigation_svnt.cpp
+ }
+
+ Header_Files {
+ NavigationS.h
+ Navigation_svnt.h
+ Navigation_svnt_export.h
+ }
+
+ Inline_Files {
+ NavigationS.inl
+ }
+}
+
+project (Navigation_client_test) : ciao_componentserver_stub, ccm_configvalue, ciao_cs_client, ciao_logger {
+ after += Navigation_stub Navigation_svnt CIF_Common
+ libpaths += ../lib
+ libs += Navigation_stub CIF_Common
+ includes += ../
+
+ IDL_Files {
+ }
+
+ Source_Files {
+ client.cpp
+ }
+}
diff --git a/modules/CIAO/tests/CIF/Navigation/Navigation_exec.cpp b/modules/CIAO/tests/CIF/Navigation/Navigation_exec.cpp
new file mode 100644
index 00000000000..3250b4660b8
--- /dev/null
+++ b/modules/CIAO/tests/CIF/Navigation/Navigation_exec.cpp
@@ -0,0 +1,87 @@
+// -*- C++ -*-
+// $Id$
+
+#include "Navigation_exec.h"
+#include "ciao/Logger/Log_Macros.h"
+
+namespace CIAO_Navigation_Impl
+{
+ //============================================================
+ // Component Executor Implementation Class: Navigation_exec_i
+ //============================================================
+ Navigation_exec_i::Navigation_exec_i (void)
+ {
+ }
+
+ Navigation_exec_i::~Navigation_exec_i (void)
+ {
+ }
+
+ // Supported operations and attributes.
+
+ // Component attributes and port operations.
+ ::CCM_foo_ptr
+ Navigation_exec_i::get_navigation_foo (void)
+ {
+ return ::CCM_foo::_nil ();
+ }
+
+ ::CCM_foo_inherited_ptr
+ Navigation_exec_i::get_inherited_foo (void)
+ {
+ return ::CCM_foo_inherited::_nil ();
+ }
+
+ // Operations from Components::SessionComponent.
+
+ void
+ Navigation_exec_i::set_session_context (
+ ::Components::SessionContext_ptr ctx)
+ {
+ this->context_ =
+ ::CCM_Navigation_Context::_narrow (ctx);
+
+ if ( ::CORBA::is_nil (this->context_.in ()))
+ {
+ throw ::CORBA::INTERNAL ();
+ }
+ }
+
+ void
+ Navigation_exec_i::configuration_complete (void)
+ {
+ /* Your code here. */
+ }
+
+ void
+ Navigation_exec_i::ccm_activate (void)
+ {
+ /* Your code here. */
+ }
+
+ void
+ Navigation_exec_i::ccm_passivate (void)
+ {
+ /* Your code here. */
+ }
+
+ void
+ Navigation_exec_i::ccm_remove (void)
+ {
+ /* Your code here. */
+ }
+
+ extern "C" NAVIGATION_EXEC_Export ::Components::EnterpriseComponent_ptr
+ create_Navigation_Impl (void)
+ {
+ ::Components::EnterpriseComponent_ptr retval =
+ ::Components::EnterpriseComponent::_nil ();
+
+ ACE_NEW_NORETURN (
+ retval,
+ Navigation_exec_i);
+
+ return retval;
+ }
+}
+
diff --git a/modules/CIAO/tests/CIF/Navigation/Navigation_exec.h b/modules/CIAO/tests/CIF/Navigation/Navigation_exec.h
new file mode 100644
index 00000000000..82d557d586a
--- /dev/null
+++ b/modules/CIAO/tests/CIF/Navigation/Navigation_exec.h
@@ -0,0 +1,62 @@
+// -*- C++ -*-
+// $Id$
+
+#ifndef CIAO_NAVIGATION_EXEC_H_
+#define CIAO_NAVIGATION_EXEC_H_
+
+#include /**/ "ace/pre.h"
+
+#include "NavigationEC.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include /**/ "Navigation_exec_export.h"
+#include "tao/LocalObject.h"
+
+
+namespace CIAO_Navigation_Impl
+{
+
+ class NAVIGATION_EXEC_Export Navigation_exec_i
+ : public virtual Navigation_Exec,
+ public virtual ::CORBA::LocalObject
+ {
+ public:
+ Navigation_exec_i (void);
+ virtual ~Navigation_exec_i (void);
+
+ virtual ::CCM_foo_ptr
+ get_navigation_foo (void);
+
+ virtual ::CCM_foo_inherited_ptr
+ get_inherited_foo (void);
+
+ //@{
+ /** Operations from Components::SessionComponent. */
+
+ virtual void
+ set_session_context (
+ ::Components::SessionContext_ptr ctx);
+
+ virtual void configuration_complete (void);
+
+ virtual void ccm_activate (void);
+ virtual void ccm_passivate (void);
+ virtual void ccm_remove (void);
+ //@}
+
+
+ private:
+ ::CCM_Navigation_Context_var context_;
+ };
+
+ extern "C" NAVIGATION_EXEC_Export ::Components::EnterpriseComponent_ptr
+ create_Navigation_Impl (void);
+}
+
+#include /**/ "ace/post.h"
+
+#endif /* ifndef */
+
diff --git a/modules/CIAO/tests/CIF/Navigation/client.cpp b/modules/CIAO/tests/CIF/Navigation/client.cpp
new file mode 100644
index 00000000000..65dfbb18f36
--- /dev/null
+++ b/modules/CIAO/tests/CIF/Navigation/client.cpp
@@ -0,0 +1,173 @@
+// $Id$
+
+#include "Common/CIF_Common.h"
+#include "NavigationEC.h"
+
+const char * artifact_name = "Navigation";
+
+int
+run_test (::Navigation_ptr nav)
+{
+ try
+ {
+ try
+ {
+ nav->provide_facet ("navigation_foo");
+ nav->provide_facet ("inherited_foo");
+ }
+ catch (const ::Components::InvalidName &e)
+ {
+ ACE_ERROR ((LM_ERROR, "Error: Unexpected InvalidName exception caught "
+ "while testing provide_facet\n"));
+ }
+ ACE_DEBUG ((LM_DEBUG, "Provide facet test passed !\n"));
+
+ try
+ {
+ nav->provide_facet ("navigation_foo_1");
+ ACE_ERROR ((LM_ERROR, "Error: No InvalidName exception caught "
+ "while testing provide_facet\n"));
+ }
+ catch (const ::Components::InvalidName &e)
+ {
+ ACE_DEBUG ((LM_DEBUG, "Expected InvalidName exception caught.\n"));
+ }
+
+ try
+ {
+ nav->provide_facet ("inherited_foo_1");
+ ACE_ERROR ((LM_ERROR, "Error: No InvalidName exception caught "
+ "while testing provide_facet\n"));
+ }
+ catch (const ::Components::InvalidName &e)
+ {
+ ACE_DEBUG ((LM_DEBUG, "Expected InvalidName exception caught.\n"));
+ }
+
+ #if !defined (CCM_LW)
+ ::Components::FacetDescriptions_var all_facets = nav->get_all_facets ();
+ if (all_facets->length () != 2)
+ {
+ ACE_ERROR ((LM_ERROR, "Error: unexpected number of descriptions: "
+ "expected <%u> - received <%u>\n",
+ 2, all_facets->length ()));
+ }
+ else
+ {
+ ACE_DEBUG ((LM_DEBUG, "get_all_facets test passed !\n"));
+ }
+
+ try
+ {
+ ::Components::NameList names;
+ names.length (2);
+ names[0] = CORBA::string_dup ("navigation_foo");
+ names[1] = CORBA::string_dup ("inherited_foo");
+ ::Components::FacetDescriptions_var named_facets = nav->get_named_facets (names);
+ if (named_facets->length () != 2)
+ {
+ ACE_ERROR ((LM_ERROR, "Error: unexpected number of descriptions: "
+ "expected <%u> - received <%u>\n",
+ 2, named_facets->length ()));
+ }
+ else
+ {
+ ACE_DEBUG ((LM_DEBUG, "get_named_facets test passed !\n"));
+ }
+ }
+ catch (const ::Components::InvalidName &e)
+ {
+ ACE_ERROR ((LM_ERROR, "Error: Unexpected InvalidName exception caught "
+ "while testing get_named_facets\n"));
+ }
+
+ try
+ {
+ ::Components::NameList names;
+ names.length (2);
+ names[0] = CORBA::string_dup ("navigation_foo_1");
+ names[1] = CORBA::string_dup ("inherited_foo_1");
+ ::Components::FacetDescriptions_var named_facets = nav->get_named_facets (names);
+ ACE_ERROR ((LM_ERROR, "Error: No InvalidName exception caught "
+ "while testing get_named_facets\n"));
+ }
+ catch (const ::Components::InvalidName &e)
+ {
+ ACE_DEBUG ((LM_DEBUG, "Expected InvalidName exception caught "
+ "while testing get_named_facets\n"));
+ }
+
+// boolean same_component (in Object object_ref);
+ #endif
+ }
+ catch (...)
+ {
+ ACE_ERROR ((LM_ERROR, "Unexpected exception caught while running test.\n"));
+ return 1;
+ }
+ return 0;
+}
+
+int
+ACE_TMAIN (int argc, ACE_TCHAR **argv)
+{
+ using namespace ::CIAO::Deployment;
+
+ CIF_Common cmd;
+ try
+ {
+ if (cmd.init (argc, argv, artifact_name) != 0)
+ return 1;
+
+ ComponentServer_var server = cmd.create_componentserver ();
+ if (CORBA::is_nil (server.in ()))
+ {
+ ACE_ERROR ((LM_ERROR, "Error: Got nil object reference from create_component_server "
+ "operation\n"));
+ return 1;
+ }
+
+ Container_var cont = cmd.create_container (server.in ());
+ if (CORBA::is_nil (cont.in ()))
+ {
+ ACE_ERROR ((LM_ERROR, "Error: Got nil object reference from create_container "
+ "operation on server\n"));
+ return 1;
+ }
+
+ Components::CCMObject_var comp = cmd.install_component (cont.in (),
+ artifact_name);
+ if (CORBA::is_nil (comp.in ()))
+ {
+ ACE_ERROR ((LM_ERROR, "Error: Installing component failed.\n"));
+ return 1;
+ }
+ ::Navigation_var nav = ::Navigation::_narrow (comp.in ());
+
+ if (CORBA::is_nil (nav.in ()))
+ {
+ ACE_ERROR ((LM_ERROR, "Narrow failed from CCMObject to Navigation\n"));
+ return 1;
+ }
+
+ run_test (nav.in ());
+
+ cmd.shutdown (server.in (), cont.in (), comp.in ());
+ }
+ catch (const ::Components::CreateFailure &)
+ {
+ ACE_ERROR ((LM_ERROR, "Error: Caught CreateFailure exception.\n"));
+ return 1;
+ }
+ catch (const ::Components::RemoveFailure &)
+ {
+ ACE_ERROR ((LM_ERROR, "Error: Caught RemoveFailure exception.\n"));
+ return 1;
+ }
+ catch (...)
+ {
+ ACE_ERROR ((LM_ERROR, "Error: Caught unknown exception\n"));
+ return 1;
+ }
+ return 0;
+}
diff --git a/modules/CIAO/tests/CIF/Navigation/run_test.pl b/modules/CIAO/tests/CIF/Navigation/run_test.pl
new file mode 100755
index 00000000000..9d1a77634f6
--- /dev/null
+++ b/modules/CIAO/tests/CIF/Navigation/run_test.pl
@@ -0,0 +1,30 @@
+eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
+ & eval 'exec perl -S $0 $argv:q'
+ if 0;
+
+# $Id$
+# -*- perl -*-
+
+use lib "$ENV{ACE_ROOT}/bin";
+use PerlACE::TestTarget;
+
+$ENV {'CIAO_LOG_LEVEL'} = 9;
+
+$status = 0;
+$ciao_root = "$ENV{CIAO_ROOT}";
+
+my $target = PerlACE::TestTarget::create_target (1);
+$target->AddLibPath ('../lib');
+
+$TG = $target->CreateProcess ("client", "-s $ciao_root/bin/ciao_componentserver -d 120");
+$server_status = $TG->SpawnWaitKill ($target->ProcessStartWaitInterval ());
+
+if ($server_status != 0) {
+ print STDERR "ERROR: process returned $server_status\n";
+ $TG->Kill ();
+ exit 1;
+}
+
+$target->GetStderrLog();
+
+exit $status;