summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam R. Otte <wotte@dre.vanderbilt.edu>2009-12-07 17:51:49 +0000
committerWilliam R. Otte <wotte@dre.vanderbilt.edu>2009-12-07 17:51:49 +0000
commit96654e80044ce886731aa4d3bc6f5a036dc36c36 (patch)
tree431d8232107201042ebb36a6c2870140544f741e
parente2416419afba220946e341b785d11700478b4d7c (diff)
downloadATCD-96654e80044ce886731aa4d3bc6f5a036dc36c36.tar.gz
Mon Dec 7 17:51:30 UTC 2009 William R. Otte <wotte@dre.vanderbilt.edu>
-rw-r--r--CIAO/ChangeLog17
-rw-r--r--CIAO/tests/CIAO_ComponentServer/Local_Facet/Local_Facet.idl8
-rw-r--r--CIAO/tests/CIAO_ComponentServer/Local_Facet/Local_Facet.mpc10
-rw-r--r--CIAO/tests/CIAO_ComponentServer/Local_Facet/Local_Facet_exec.cpp26
-rw-r--r--CIAO/tests/CIAO_ComponentServer/Local_Facet/Local_Facet_exec.h2
-rw-r--r--CIAO/tests/CIAO_ComponentServer/Local_Facet/client.cpp188
-rwxr-xr-xCIAO/tests/CIAO_ComponentServer/Local_Facet/run_test.pl33
7 files changed, 277 insertions, 7 deletions
diff --git a/CIAO/ChangeLog b/CIAO/ChangeLog
index 93987022111..038b0f990ce 100644
--- a/CIAO/ChangeLog
+++ b/CIAO/ChangeLog
@@ -1,9 +1,20 @@
+Mon Dec 7 17:51:30 UTC 2009 William R. Otte <wotte@dre.vanderbilt.edu>
+
+ * tests/CIAO_ComponentServer/Local_Facet/Local_Facet.idl:
+ * tests/CIAO_ComponentServer/Local_Facet/Local_Facet.mpc:
+ * tests/CIAO_ComponentServer/Local_Facet/Local_Facet_exec.h:
+ * tests/CIAO_ComponentServer/Local_Facet/Local_Facet_exec.cpp:
+ * tests/CIAO_ComponentServer/Local_Facet/client.cpp:
+ * tests/CIAO_ComponentServer/Local_Facet/run_test.pl:
+
+ Added simple test for local facet connection logic.
+
Mon Dec 7 17:04:43 UTC 2009 William R. Otte <wotte@dre.vanderbilt.edu>
* tests/CIAO_ComponentServer/Local_Facet:
-
- Moved local facet test under ComponentServer.
-
+
+ Moved local facet test under ComponentServer.
+
* tests/IDL_Test/Local_Facet:
Removed these files.
diff --git a/CIAO/tests/CIAO_ComponentServer/Local_Facet/Local_Facet.idl b/CIAO/tests/CIAO_ComponentServer/Local_Facet/Local_Facet.idl
index 457e3db2578..82b82b5e6a2 100644
--- a/CIAO/tests/CIAO_ComponentServer/Local_Facet/Local_Facet.idl
+++ b/CIAO/tests/CIAO_ComponentServer/Local_Facet/Local_Facet.idl
@@ -1,11 +1,17 @@
// $Id$
#include <Components.idl>
+interface trigger
+{
+ oneway void run_test ();
+};
+
local interface Foo
{
+ void simple ();
};
-component Bar
+component Bar supports trigger
{
uses Foo foo_in;
provides Foo foo_out;
diff --git a/CIAO/tests/CIAO_ComponentServer/Local_Facet/Local_Facet.mpc b/CIAO/tests/CIAO_ComponentServer/Local_Facet/Local_Facet.mpc
index 8c97929b875..022c15a5cad 100644
--- a/CIAO/tests/CIAO_ComponentServer/Local_Facet/Local_Facet.mpc
+++ b/CIAO/tests/CIAO_ComponentServer/Local_Facet/Local_Facet.mpc
@@ -135,4 +135,12 @@ project(Local_Facet_svnt) : ciao_servant {
}
}
-
+project (Lf_CIAOComponentServer_Tst) : ciao_componentserver_stub, ccm_configvalue, ciao_cs_client, ciao_logger {
+ after += Local_Facet_stub Local_Facet_svnt
+ libs += Local_Facet_stub
+ IDL_Files {
+ }
+ Source_Files {
+ client.cpp
+ }
+} \ No newline at end of file
diff --git a/CIAO/tests/CIAO_ComponentServer/Local_Facet/Local_Facet_exec.cpp b/CIAO/tests/CIAO_ComponentServer/Local_Facet/Local_Facet_exec.cpp
index 3f76738685f..c03ac24c666 100644
--- a/CIAO/tests/CIAO_ComponentServer/Local_Facet/Local_Facet_exec.cpp
+++ b/CIAO/tests/CIAO_ComponentServer/Local_Facet/Local_Facet_exec.cpp
@@ -30,6 +30,7 @@
// be/be_codegen.cpp:1278
#include "Local_Facet_exec.h"
+#include "ciao/Logger/Log_Macros.h"
namespace CIAO_Bar_Impl
{
@@ -45,6 +46,11 @@ namespace CIAO_Bar_Impl
{
}
+ void Foo_exec_i::simple (void)
+ {
+ CIAO_DEBUG ((LM_INFO, "Got simple invocation\n"));
+ }
+
// Operations from ::Foo
//============================================================
@@ -66,8 +72,7 @@ namespace CIAO_Bar_Impl
::CCM_Foo_ptr
Bar_exec_i::get_foo_out (void)
{
- /* Your code here. */
- return ::CCM_Foo::_nil ();
+ return new Foo_exec_i ();
}
// Operations from Components::SessionComponent.
@@ -86,6 +91,23 @@ namespace CIAO_Bar_Impl
}
void
+ Bar_exec_i::run_test (void)
+ {
+ ::Foo_var foo_intf = this->context_->get_connection_foo_in ();
+
+ if (CORBA::is_nil (foo_intf))
+ {
+ CIAO_ERROR ((LM_ERROR, "ERROR: Local_Facet_Test: got a nil object reference for my connection\n"));
+ return;
+ }
+
+ CIAO_DEBUG ((LM_DEBUG, "Invoking simple\n"));
+ foo_intf->simple ();
+
+ CIAO_DEBUG ((LM_INFO, "Test successful!\n"));
+ }
+
+ void
Bar_exec_i::configuration_complete (void)
{
/* Your code here. */
diff --git a/CIAO/tests/CIAO_ComponentServer/Local_Facet/Local_Facet_exec.h b/CIAO/tests/CIAO_ComponentServer/Local_Facet/Local_Facet_exec.h
index d91b1e991b1..e168608e197 100644
--- a/CIAO/tests/CIAO_ComponentServer/Local_Facet/Local_Facet_exec.h
+++ b/CIAO/tests/CIAO_ComponentServer/Local_Facet/Local_Facet_exec.h
@@ -55,6 +55,7 @@ namespace CIAO_Bar_Impl
virtual ~Foo_exec_i (void);
// Operations and attributes from ::Foo
+ virtual void simple (void);
};
class LOCAL_FACET_EXEC_Export Bar_exec_i
@@ -67,6 +68,7 @@ namespace CIAO_Bar_Impl
//@{
/** Supported operations and attributes. */
+ virtual void run_test (void);
//@}
diff --git a/CIAO/tests/CIAO_ComponentServer/Local_Facet/client.cpp b/CIAO/tests/CIAO_ComponentServer/Local_Facet/client.cpp
new file mode 100644
index 00000000000..2f74d5d3b0f
--- /dev/null
+++ b/CIAO/tests/CIAO_ComponentServer/Local_Facet/client.cpp
@@ -0,0 +1,188 @@
+// $Id$
+
+#include "ace/Get_Opt.h"
+#include "ciao/ComponentServer/CIAO_CS_ClientS.h"
+#include "ciao/ComponentServer/CIAO_ComponentServerC.h"
+#include "ciao/ComponentServer/CIAO_ServerActivator_Impl.h"
+#include "ciao/ComponentServer/CIAO_ComponentInstallation_Impl.h"
+#include "ciao/ComponentServer/CIAO_PropertiesC.h"
+#include "ciao/Valuetype_Factories/ConfigValue.h"
+#include "ciao/Logger/Logger_Service.h"
+
+#include "Local_FacetC.h"
+
+const char *cs_path = "ciao_componentserver";
+CORBA::ULong spawn_delay = 30;
+
+int
+parse_args (int argc, ACE_TCHAR *argv[])
+{
+ ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("s:d:"));
+ int c;
+
+ while ((c = get_opts ()) != -1)
+ switch (c)
+ {
+ case 's':
+ cs_path = ACE_TEXT_ALWAYS_CHAR (get_opts.opt_arg ());
+ break;
+
+ case 'd':
+ spawn_delay = ACE_OS::atoi (get_opts.opt_arg ());
+ break;
+
+ case '?':
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "usage: %s "
+ "-s <path> "
+ "-d <uint> "
+ "\n",
+ argv [0]),
+ -1);
+ }
+ // Indicates sucessful parsing of the command line
+ return 0;
+}
+
+int
+ACE_TMAIN (int argc, ACE_TCHAR **argv)
+{
+ using namespace CIAO::Deployment;
+
+ CIAO::Logger_Service logger;
+
+ logger.init (argc, argv);
+ try
+ {
+ CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);
+ if (parse_args (argc, argv) != 0)
+ return 1;
+
+ CORBA::Object_var object =
+ orb->resolve_initial_references ("RootPOA");
+
+ PortableServer::POA_var root_poa =
+ PortableServer::POA::_narrow (object.in ());
+
+ PortableServer::POAManager_var poa_manager =
+ root_poa->the_POAManager ();
+
+ poa_manager->activate ();
+ ACE_DEBUG ((LM_DEBUG, "foo\n"));
+
+ CIAO::Deployment::ComponentInstallation_Impl *tmp_ci = 0;
+
+ ACE_NEW_THROW_EX (tmp_ci,
+ CIAO::Deployment::ComponentInstallation_Impl (),
+ CORBA::NO_MEMORY ());
+
+ PortableServer::ServantBase_var safe_servant = tmp_ci;
+
+ root_poa->activate_object (tmp_ci);
+
+ CIAO_ServerActivator_i *sa_tmp = new CIAO_ServerActivator_i (spawn_delay,
+ cs_path,
+ 0,
+ false,
+ tmp_ci->_this (),
+ orb.in (),
+ root_poa.in ());
+
+ PortableServer::ServantBase_var safe = sa_tmp;
+
+ ServerActivator_var sa = sa_tmp->_this ();
+
+ //ACE_DEBUG ((LM_DEBUG, "Attempting to create componentserver with no configvalues\n"));
+ // Make a componentserver with no configvalues
+ ComponentServer_var server1 (ComponentServer::_narrow (sa->create_component_server (0)));
+
+ if (CORBA::is_nil (server1.in ()))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Nil componentserver references"), -1);
+ }
+
+ Components::Deployment::Container_var tmp = server1->create_container (0);
+ Container_var cont1a = Container::_narrow (tmp.in ());
+
+ if (CORBA::is_nil (cont1a.in ()))
+ {
+ ACE_ERROR ((LM_ERROR, "Error: Got nil object reference from first create op on server 1 %u %u\n",
+ tmp.in (), cont1a.in ()));
+ return -1;
+ }
+
+ // Make our configvalues
+ // ::Components::ConfigValues_var configs = new
+ CORBA::Any val;
+ ::Components::ConfigValues configs(3);
+ configs.length (3);
+
+ val <<= "create_Bar_Servant";
+ configs[0] = new CIAO::ConfigValue_impl (CIAO::Deployment::SVNT_ENTRYPT,
+ val);
+ val <<= "Local_Facet_svnt";
+ configs[1] = new CIAO::ConfigValue_impl (CIAO::Deployment::SVNT_ARTIFACT,
+ val);
+ tmp_ci->install ("Local_Facet_svnt", "Local_Facet_svnt");
+ val <<= "Local_Facet_exec";
+ configs[2] = new CIAO::ConfigValue_impl (CIAO::Deployment::EXEC_ARTIFACT,
+ val);
+ tmp_ci->install ("Local_Facet_exec", "Local_Facet_exec");
+
+ // Install Components
+ Components::CCMObject_var comp1 = cont1a->install_component ("User",
+ "create_Bar_Impl",
+ configs);
+ Components::CCMObject_var comp2 = cont1a->install_component ("Provider",
+ "create_Bar_Impl",
+ configs);
+
+ if (CORBA::is_nil (comp1) || CORBA::is_nil (comp2))
+ {
+ ACE_ERROR ((LM_ERROR, "Got back a nil component ref from install_component\n"));
+ return -1;
+ }
+
+ ::Bar_var user = ::Bar::_narrow (comp1.in ());
+
+
+ if (CORBA::is_nil (user))
+ {
+ ACE_ERROR ((LM_ERROR, "Narrow failed from CCMObject to Bar\n"));
+ return -1;
+ }
+
+
+ cont1a->connect_local_facet (comp2, "foo_out", comp1, "foo_in");
+
+
+ user->run_test ();
+
+
+ cont1a->remove_component (comp1.in ());
+ cont1a->remove_component (comp2.in ());
+
+ server1->remove_container (cont1a.in ());
+
+ //ACE_DEBUG ((LM_DEBUG, "Removing component server\n"));
+ sa->remove_component_server (server1.in ());
+ //ACE_DEBUG ((LM_DEBUG, "Componentserver removed\n"));
+
+ orb->destroy ();
+ }
+ catch (::Components::CreateFailure &)
+ {
+ ACE_ERROR ((LM_ERROR, "Error: Caught CreateFailure exception.\n"));
+ }
+ catch (::Components::RemoveFailure &)
+ {
+ ACE_ERROR ((LM_ERROR, "Error: Caught RemoveFailure exception.\n"));
+ }
+ catch (...)
+ {
+ ACE_ERROR ((LM_ERROR, "Error: Caught unknown exception\n"));
+ }
+ return 0;
+}
diff --git a/CIAO/tests/CIAO_ComponentServer/Local_Facet/run_test.pl b/CIAO/tests/CIAO_ComponentServer/Local_Facet/run_test.pl
new file mode 100755
index 00000000000..5d8a72f7694
--- /dev/null
+++ b/CIAO/tests/CIAO_ComponentServer/Local_Facet/run_test.pl
@@ -0,0 +1,33 @@
+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;
+
+$status = 0;
+$ciao_root = "$ENV{CIAO_ROOT}";
+
+foreach $i (@ARGV) {
+ if ($i eq '-debug') {
+ $ENV{"DANCE_TRACE_ENABLE"} = 1;
+ $ENV{"CIAO_TRACE_ENABLE"} = 1;
+ }
+}
+
+my $target = PerlACE::TestTarget::create_target ($PerlACE::TestConfig);
+
+$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";
+ exit 1;
+}
+
+$target->GetStderrLog();
+
+exit $status;