summaryrefslogtreecommitdiff
path: root/tests/CIAO_ComponentServer
diff options
context:
space:
mode:
authorWilliam R. Otte <wotte@dre.vanderbilt.edu>2010-06-18 14:37:55 +0000
committerWilliam R. Otte <wotte@dre.vanderbilt.edu>2010-06-18 14:37:55 +0000
commit1576f18f4563b78b9c534866f894217dbda4a116 (patch)
tree5b7e217f962e3e5cbc40eba208669e698af54495 /tests/CIAO_ComponentServer
parente736a66bb06b1cdfd851d0dc39b1ccd6737f118b (diff)
downloadATCD-1576f18f4563b78b9c534866f894217dbda4a116.tar.gz
branch for removing component server
Diffstat (limited to 'tests/CIAO_ComponentServer')
-rw-r--r--tests/CIAO_ComponentServer/Activator/Activator.mpc6
-rw-r--r--tests/CIAO_ComponentServer/Activator/client.cpp190
-rwxr-xr-xtests/CIAO_ComponentServer/Activator/run_test.pl35
-rw-r--r--tests/CIAO_ComponentServer/Basic/Basic.mpc6
-rw-r--r--tests/CIAO_ComponentServer/Basic/client.cpp143
-rwxr-xr-xtests/CIAO_ComponentServer/Basic/run_test.pl110
-rw-r--r--tests/CIAO_ComponentServer/Local_Facet/Local_Facet.idl18
-rw-r--r--tests/CIAO_ComponentServer/Local_Facet/Local_Facet.mpc146
-rw-r--r--tests/CIAO_ComponentServer/Local_Facet/Local_Facet_exec.cpp119
-rw-r--r--tests/CIAO_ComponentServer/Local_Facet/Local_Facet_exec.h81
-rw-r--r--tests/CIAO_ComponentServer/Local_Facet/client.cpp186
-rwxr-xr-xtests/CIAO_ComponentServer/Local_Facet/run_test.pl26
-rw-r--r--tests/CIAO_ComponentServer/SimpleComponent/SimpleComponent.idl21
-rw-r--r--tests/CIAO_ComponentServer/SimpleComponent/SimpleComponent.mpc112
-rw-r--r--tests/CIAO_ComponentServer/SimpleComponent/SimpleComponent_exec.cpp131
-rw-r--r--tests/CIAO_ComponentServer/SimpleComponent/SimpleComponent_exec.h90
-rw-r--r--tests/CIAO_ComponentServer/SimpleComponent/client.cpp187
-rwxr-xr-xtests/CIAO_ComponentServer/SimpleComponent/run_test.pl26
18 files changed, 1633 insertions, 0 deletions
diff --git a/tests/CIAO_ComponentServer/Activator/Activator.mpc b/tests/CIAO_ComponentServer/Activator/Activator.mpc
new file mode 100644
index 00000000000..df8ec43d6f2
--- /dev/null
+++ b/tests/CIAO_ComponentServer/Activator/Activator.mpc
@@ -0,0 +1,6 @@
+// $Id$
+project (Activator_CIAOComponentServer_Test) : ciao_componentserver_stub, ccm_configvalue, ciao_cs_client {
+ Source_Files {
+ client.cpp
+ }
+} \ No newline at end of file
diff --git a/tests/CIAO_ComponentServer/Activator/client.cpp b/tests/CIAO_ComponentServer/Activator/client.cpp
new file mode 100644
index 00000000000..7357e86679b
--- /dev/null
+++ b/tests/CIAO_ComponentServer/Activator/client.cpp
@@ -0,0 +1,190 @@
+// $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/Valuetype_Factories/ConfigValue.h"
+
+const ACE_TCHAR *cs_path = ACE_TEXT ("ciao_componentserver");
+CORBA::ULong spawn_delay = 30;
+
+int
+parse_args (int argc, ACE_TCHAR *argv[])
+{
+ ACE_Get_Opt get_opts (argc, argv, "s:d:");
+ int c;
+
+ while ((c = get_opts ()) != -1)
+ switch (c)
+ {
+ case 's':
+ cs_path = 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;
+
+ 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 ();
+
+ CIAO::Deployment::ComponentInstallation_Impl *tmp_ci;
+
+ ACE_NEW_THROW_EX (tmp_ci,
+ CIAO::Deployment::ComponentInstallation_Impl (),
+ CORBA::NO_MEMORY ());
+
+ PortableServer::ServantBase_var safe_servant = tmp_ci;
+
+ CIAO_ServerActivator_i *sa_tmp = new CIAO_ServerActivator_i (spawn_delay,
+ ACE_TEXT_ALWAYS_CHAR (cs_path),
+ 0,
+ false,
+ tmp_ci->_this (),
+ orb.in (),
+ root_poa.in ());
+ PortableServer::ServantBase_var safe = sa_tmp;
+
+ ServerActivator_var sa = sa_tmp->_this ();
+
+ // Make our configvalues
+ // ::Components::ConfigValues_var configs = new
+ ::Components::ConfigValues configs(2);
+ //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 (configs)));
+ //ACE_DEBUG ((LM_DEBUG, "Componentserver with no configvalues created!\n"));
+
+ //ACE_DEBUG ((LM_DEBUG, "Attempting to create componentserver with UUID configvalues\n"));
+ CORBA::Any val;
+ val <<= "MyNameIsEarl";
+ configs.length (1);
+ ::Components::ConfigValue_var cv_tmp = new CIAO::ConfigValue_impl ("edu.vanderbilt.dre.ServerUUID", val);
+ configs[0] = cv_tmp._retn ();
+
+ ComponentServer_var server2 (ComponentServer::_narrow (sa->create_component_server (configs)));
+
+ // Initialize servant
+
+ if (CORBA::is_nil (server1.in ()) ||
+ 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;
+ }
+ //ACE_DEBUG ((LM_DEBUG, "Got container from server 1a\n"));
+
+ Container_var cont1b = Container::_narrow (server1->create_container (0));
+ if (CORBA::is_nil (cont1b.in ()))
+ {
+ ACE_ERROR ((LM_ERROR, "Error: Got nil object reference from second create op on server 1\n"));
+ return -1;
+ }
+ //ACE_DEBUG ((LM_DEBUG, "Got container from server 1b\n"));
+
+ Container_var cont2a = Container::_narrow (server2->create_container (0));
+ if (CORBA::is_nil (cont2a.in ()))
+ {
+ ACE_ERROR ((LM_ERROR, "Error: Got nil object reference from first create op on server 2\n"));
+ return -1;
+ }
+ //ACE_DEBUG ((LM_DEBUG, "Got container from server 2a\n"));
+
+ try
+ {
+ server2->remove_container (cont1a);
+ ACE_ERROR ((LM_ERROR, "Error: remove_container removed a container not belonging to the component server\n"));
+ }
+ catch (::Components::RemoveFailure &)
+ {
+ //ACE_DEBUG ((LM_DEBUG, "Server 2 Refused to remove container it didn't own\n"));
+ // expected
+ }
+
+ ::Components::Deployment::Containers_var cses = server1->get_containers ();
+
+ if (cses->length () != 2)
+ ACE_ERROR ((LM_ERROR, "Error: get_containers returned the wrong number of containers, %u should be 2\n",
+ cses->length ()));
+ else //ACE_DEBUG ((LM_DEBUG, "Got %u containers\n", cses->length ()));
+
+ server1->remove_container (cont1a);
+ //ACE_DEBUG ((LM_DEBUG, "Successfully removed container 1a\n"));
+
+ cses = server1->get_containers ();
+
+ if (cses->length () != 1)
+ ACE_ERROR ((LM_ERROR, "Error: get_containers returned %u containers after removal, should be 1\n",
+ cses->length ()));
+
+ server2->remove_container (cont2a);
+ //ACE_DEBUG ((LM_DEBUG, "Successfully removed container 2a\n"));
+ server1->remove_container (cont1b);
+ //ACE_DEBUG ((LM_DEBUG, "Successfully removed container 1b\n"));
+
+ //ACE_DEBUG ((LM_DEBUG, "Removing component server\n"));
+ sa->remove_component_server (server1.in ());
+ sa->remove_component_server (server2.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/tests/CIAO_ComponentServer/Activator/run_test.pl b/tests/CIAO_ComponentServer/Activator/run_test.pl
new file mode 100755
index 00000000000..91d47475aa7
--- /dev/null
+++ b/tests/CIAO_ComponentServer/Activator/run_test.pl
@@ -0,0 +1,35 @@
+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;
+$debug_level = '0';
+$ciao_root = "$ENV{CIAO_ROOT}";
+
+foreach $i (@ARGV) {
+ if ($i eq '-debug') {
+ $debug_level = '10';
+ }
+}
+
+my $target = PerlACE::TestTarget::create_target (1);
+
+$SV1 = $target->CreateProcess ("./client", "-s " . $target->GetArchDir("$ciao_root/bin/") . "ciao_componentserver");
+
+$server_status = $SV1->SpawnWaitKill ($target->ProcessStartWaitInterval ());
+
+if ($server_status != 0) {
+ $target->GetStderrLog();
+ print STDERR "ERROR: server1 returned $server_status\n";
+ exit 1;
+}
+
+$target->GetStderrLog();
+
+exit $status;
diff --git a/tests/CIAO_ComponentServer/Basic/Basic.mpc b/tests/CIAO_ComponentServer/Basic/Basic.mpc
new file mode 100644
index 00000000000..1de96195bb9
--- /dev/null
+++ b/tests/CIAO_ComponentServer/Basic/Basic.mpc
@@ -0,0 +1,6 @@
+// $Id$
+project (Basic_CIAOComponentServer_Test) : ciao_componentserver_stub {
+ Source_Files {
+ client.cpp
+ }
+} \ No newline at end of file
diff --git a/tests/CIAO_ComponentServer/Basic/client.cpp b/tests/CIAO_ComponentServer/Basic/client.cpp
new file mode 100644
index 00000000000..8d36037c8f2
--- /dev/null
+++ b/tests/CIAO_ComponentServer/Basic/client.cpp
@@ -0,0 +1,143 @@
+// $Id$
+
+#include "ace/Get_Opt.h"
+#include "ciao/ComponentServer/CIAO_ComponentServerC.h"
+
+const ACE_TCHAR *server_1 = ACE_TEXT("file://test1.ior");
+const ACE_TCHAR *server_2 = ACE_TEXT("file://test2.ior");
+
+int
+parse_args (int argc, ACE_TCHAR *argv[])
+{
+ ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:j:"));
+ int c;
+
+ while ((c = get_opts ()) != -1)
+ switch (c)
+ {
+ case 'k':
+ server_1 = get_opts.opt_arg ();
+ break;
+
+ case 'j':
+ server_2 = get_opts.opt_arg ();
+ break;
+
+ case '?':
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "usage: %s "
+ "-k <ior> "
+ "-j <ior> "
+ "\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;
+
+ try
+ {
+ CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);
+
+ if (parse_args (argc, argv) != 0)
+ return 1;
+
+ CORBA::Object_var tmp1 = orb->string_to_object(server_1);
+ CORBA::Object_var tmp2 = orb->string_to_object(server_2);
+
+ ComponentServer_var server1 (ComponentServer::_narrow (tmp1)),
+ server2 (ComponentServer::_narrow (tmp2));
+
+ if (CORBA::is_nil (server1.in ()) ||
+ 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;
+ }
+ ACE_ERROR ((LM_DEBUG, "Got container from server 1a\n"));
+
+ Container_var cont1b = Container::_narrow (server1->create_container (0));
+ if (CORBA::is_nil (cont1b.in ()))
+ {
+ ACE_ERROR ((LM_ERROR, "Error: Got nil object reference from second create op on server 1\n"));
+ return -1;
+ }
+ ACE_ERROR ((LM_DEBUG, "Got container from server 1b\n"));
+
+ Container_var cont2a = Container::_narrow (server2->create_container (0));
+ if (CORBA::is_nil (cont2a.in ()))
+ {
+ ACE_ERROR ((LM_ERROR, "Error: Got nil object reference from first create op on server 2\n"));
+ return -1;
+ }
+ ACE_ERROR ((LM_DEBUG, "Got container from server 2a\n"));
+
+ try
+ {
+ server2->remove_container (cont1a);
+ ACE_ERROR ((LM_ERROR, "Error: remove_container removed a container not belonging to the component server\n"));
+ }
+ catch (const ::Components::RemoveFailure &)
+ {
+ ACE_DEBUG ((LM_DEBUG, "Server 2 Refused to remove container it didn't own\n"));
+ // expected
+ }
+
+ ::Components::Deployment::Containers_var cses = server1->get_containers ();
+
+ if (cses->length () != 2)
+ ACE_ERROR ((LM_ERROR, "Error: get_containers returned the wrong number of containers, %u should be 2\n",
+ cses->length ()));
+ else ACE_DEBUG ((LM_DEBUG, "Got %u containers\n", cses->length ()));
+
+ server1->remove_container (cont1a);
+ ACE_DEBUG ((LM_DEBUG, "Successfully removed container 1a\n"));
+
+ cses = server1->get_containers ();
+
+ if (cses->length () != 1)
+ ACE_ERROR ((LM_ERROR, "Error: get_containers returned %u containers after removal, should be 1\n",
+ cses->length ()));
+
+ server2->remove_container (cont2a);
+ ACE_DEBUG ((LM_DEBUG, "Successfully removed container 2a\n"));
+ server1->remove_container (cont1b);
+ ACE_DEBUG ((LM_DEBUG, "Successfully removed container 1b\n"));
+
+ server1->remove ();
+ server1->shutdown ();
+ server2->remove ();
+ server2->shutdown ();
+
+ orb->destroy ();
+ }
+ catch (const ::Components::CreateFailure &)
+ {
+ ACE_ERROR ((LM_ERROR, "Error: Caught CreateFailure exception.\n"));
+ }
+ catch (const ::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/tests/CIAO_ComponentServer/Basic/run_test.pl b/tests/CIAO_ComponentServer/Basic/run_test.pl
new file mode 100755
index 00000000000..ed2f80825a6
--- /dev/null
+++ b/tests/CIAO_ComponentServer/Basic/run_test.pl
@@ -0,0 +1,110 @@
+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;
+$debug_level = '0';
+$ciao_root = "$ENV{CIAO_ROOT}";
+
+foreach $i (@ARGV) {
+ if ($i eq '-debug') {
+ $debug_level = '10';
+ }
+}
+
+my $target = PerlACE::TestTarget::create_target (1);
+my $host = new PerlACE::TestTarget;
+
+$iorbase1 = "server1.ior";
+$iorbase2 = "server2.ior";
+
+$server_iorfile1 = $target->LocalFile ($iorbase1);
+$server_iorfile2 = $target->LocalFile ($iorbase2);
+
+$target->DeleteFile($iorbase1);
+$target->DeleteFile($iorbase2);
+
+$client_iorfile1 = $host->LocalFile ($iorbase1);
+$client_iorfile2 = $host->LocalFile ($iorbase2);
+
+$host->DeleteFile($iorbase1);
+$host->DeleteFile($iorbase2);
+
+$SV1 = $target->CreateProcess ("$ciao_root/bin/ciao_componentserver", "-ORBDebuglevel $debug_level -u $server_iorfile1 -o $server_iorfile1");
+$SV2 = $target->CreateProcess ("$ciao_root/bin/ciao_componentserver", "-ORBDebuglevel $debug_level -u $server_iorfile2 -o $server_iorfile2");
+
+$CL = $host->CreateProcess ("client", "-k file://$client_iorfile1 -j file://$client_iorfile2");
+
+$server_status1 = $SV1->Spawn ();
+$server_status2 = $SV2->Spawn ();
+
+if ($server_status1 != 0) {
+ print STDERR "ERROR: server1 returned $server_status1\n";
+ exit 1;
+}
+if ($server_status2 != 0) {
+ print STDERR "ERROR: server2 returned $server_status2\n";
+ exit 1;
+}
+
+if ($target->WaitForFileTimed ($iorbase1,
+ $target->ProcessStartWaitInterval ()) == -1) {
+ print STDERR "ERROR: cannot find file <$server_iorfile1>\n";
+ $SV1->Kill (); $SV1->TimedWait (1);
+ exit 1;
+}
+
+if ($target->WaitForFileTimed ($iorbase2,
+ $target->ProcessStartWaitInterval ()) == -1) {
+ print STDERR "ERROR: cannot find file <$server_iorfile2>\n";
+ $SV2->Kill (); $SV2->TimedWait (1);
+ exit 1;
+}
+
+if ($target->GetFile ($server_iorfile1, $iorbase) == -1) {
+ print STDERR "ERROR: cannot retrieve file <$iorbase1>\n";
+ $SV1->Kill (); $SV1->TimedWait (1);
+ exit 1;
+}
+
+if ($target->GetFile ($server_iorfile2, $iorbase) == -1) {
+ print STDERR "ERROR: cannot retrieve file <$iorbase2>\n";
+ $SV2->Kill (); $SV2->TimedWait (1);
+ exit 1;
+}
+
+$client_status = $CL->SpawnWaitKill ($host->ProcessStartWaitInterval ());
+
+if ($client_status != 0) {
+ print STDERR "ERROR: client returned $client_status\n";
+ $status = 1;
+}
+
+$server_status1 = $SV1->WaitKill ($target->ProcessStopWaitInterval ());
+$server_status2 = $SV2->WaitKill ($target->ProcessStopWaitInterval ());
+
+if ($server_status1 != 0) {
+ print STDERR "ERROR: server1 returned $server_status1\n";
+ $status = 1;
+}
+
+if ($server_status2 != 0) {
+ print STDERR "ERROR: server2 returned $server_status2\n";
+ $status = 1;
+}
+
+$target->GetStderrLog();
+
+$target->DeleteFile($iorbase1);
+$target->DeleteFile($iorbase2);
+
+$host->DeleteFile($iorbase1);
+$host->DeleteFile($iorbase2);
+
+exit $status;
diff --git a/tests/CIAO_ComponentServer/Local_Facet/Local_Facet.idl b/tests/CIAO_ComponentServer/Local_Facet/Local_Facet.idl
new file mode 100644
index 00000000000..82b82b5e6a2
--- /dev/null
+++ b/tests/CIAO_ComponentServer/Local_Facet/Local_Facet.idl
@@ -0,0 +1,18 @@
+// $Id$
+#include <Components.idl>
+
+interface trigger
+{
+ oneway void run_test ();
+};
+
+local interface Foo
+{
+ void simple ();
+};
+
+component Bar supports trigger
+{
+ uses Foo foo_in;
+ provides Foo foo_out;
+};
diff --git a/tests/CIAO_ComponentServer/Local_Facet/Local_Facet.mpc b/tests/CIAO_ComponentServer/Local_Facet/Local_Facet.mpc
new file mode 100644
index 00000000000..f5d15f9dc85
--- /dev/null
+++ b/tests/CIAO_ComponentServer/Local_Facet/Local_Facet.mpc
@@ -0,0 +1,146 @@
+// $Id$
+// This file is generated with "generate_component_mpc.pl Local_Facet"
+
+project(Local_Facet_idl_gen) : componentidldefaults {
+
+ custom_only = 1
+ idlflags += -Wb,stub_export_macro=LOCAL_FACET_STUB_Export \
+ -Wb,stub_export_include=Local_Facet_stub_export.h \
+ -Wb,skel_export_macro=LOCAL_FACET_SVNT_Export \
+ -Wb,skel_export_include=Local_Facet_svnt_export.h \
+ -Wb,exec_export_macro=LOCAL_FACET_EXEC_Export \
+ -Wb,exec_export_include=Local_Facet_exec_export.h
+
+ IDL_Files {
+ Local_Facet.idl
+ }
+}
+
+project(Local_Facet_lem_gen) : ciaoidldefaults {
+
+ after += Local_Facet_idl_gen
+ custom_only = 1
+ idlflags += -Wb,stub_export_macro=LOCAL_FACET_LEM_STUB_Export \
+ -Wb,stub_export_include=Local_Facet_lem_stub_export.h \
+ -SS -Gxhst
+
+ IDL_Files {
+ Local_FacetE.idl
+ }
+}
+
+project(Local_Facet_lem_stub) : ccm_svnt {
+
+ after += Local_Facet_lem_gen Local_Facet_stub
+ libs += Local_Facet_stub
+
+
+ sharedname = Local_Facet_lem_stub
+ dynamicflags = LOCAL_FACET_LEM_STUB_BUILD_DLL
+
+ IDL_Files {
+ }
+
+ Source_Files {
+ Local_FacetEC.cpp
+ }
+
+ Header_Files {
+ Local_FacetEC.h
+ Local_Facet_lem_stub_export.h
+ }
+
+ Inline_Files {
+ Local_FacetEC.inl
+ }
+}
+
+project(Local_Facet_stub) : ccm_stub {
+
+ after += Local_Facet_idl_gen
+ libs +=
+
+
+ sharedname = Local_Facet_stub
+ dynamicflags = LOCAL_FACET_STUB_BUILD_DLL
+
+ IDL_Files {
+ }
+
+ Source_Files {
+ Local_FacetC.cpp
+ }
+
+ Header_Files {
+ Local_FacetC.h
+ Local_Facet_stub_export.h
+ }
+
+ Inline_Files {
+ Local_FacetC.inl
+ }
+}
+
+project(Local_Facet_exec) : ciao_executor {
+
+ after += Local_Facet_lem_stub Local_Facet_stub
+ sharedname = Local_Facet_exec
+ libs += Local_Facet_stub Local_Facet_lem_stub
+
+
+ dynamicflags = LOCAL_FACET_EXEC_BUILD_DLL
+
+ IDL_Files {
+ }
+
+ Source_Files {
+ Local_Facet_exec.cpp
+ }
+
+ Header_Files {
+ Local_Facet_exec.h
+ Local_Facet_exec_export.h
+ }
+
+ Inline_Files {
+ }
+}
+
+
+project(Local_Facet_svnt) : ciao_servant {
+
+ after += Local_Facet_lem_stub
+ sharedname = Local_Facet_svnt
+ libs += Local_Facet_stub Local_Facet_lem_stub
+
+
+ dynamicflags = LOCAL_FACET_SVNT_BUILD_DLL
+
+ IDL_Files {
+ }
+
+ Source_Files {
+ Local_FacetS.cpp
+ Local_Facet_svnt.cpp
+ }
+
+ Header_Files {
+ Local_FacetS.h
+ Local_Facet_svnt.h
+ Local_Facet_svnt_export.h
+ }
+
+ Inline_Files {
+ Local_FacetS.inl
+ }
+}
+
+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
+ }
+}
diff --git a/tests/CIAO_ComponentServer/Local_Facet/Local_Facet_exec.cpp b/tests/CIAO_ComponentServer/Local_Facet/Local_Facet_exec.cpp
new file mode 100644
index 00000000000..37a96ee10e3
--- /dev/null
+++ b/tests/CIAO_ComponentServer/Local_Facet/Local_Facet_exec.cpp
@@ -0,0 +1,119 @@
+// -*- C++ -*-
+// $Id$
+
+#include "Local_Facet_exec.h"
+#include "ciao/Logger/Log_Macros.h"
+
+namespace CIAO_Bar_Impl
+{
+ //============================================================
+ // Facet Executor Implementation Class: Foo_exec_i
+ //============================================================
+
+ Foo_exec_i::Foo_exec_i (void)
+ {
+ }
+
+ Foo_exec_i::~Foo_exec_i (void)
+ {
+ }
+
+ void Foo_exec_i::simple (void)
+ {
+ ACE_DEBUG ((LM_INFO, "Got simple invocation\n"));
+ }
+
+ // Operations from ::Foo
+
+ //============================================================
+ // Component Executor Implementation Class: Bar_exec_i
+ //============================================================
+
+ Bar_exec_i::Bar_exec_i (void)
+ {
+ }
+
+ Bar_exec_i::~Bar_exec_i (void)
+ {
+ }
+
+ // Supported operations and attributes.
+
+ // Component attributes and port operations.
+
+ ::CCM_Foo_ptr
+ Bar_exec_i::get_foo_out (void)
+ {
+ return new Foo_exec_i ();
+ }
+
+ // Operations from Components::SessionComponent.
+
+ void
+ Bar_exec_i::set_session_context (
+ ::Components::SessionContext_ptr ctx)
+ {
+ this->context_ =
+ ::CCM_Bar_Context::_narrow (ctx);
+
+ if ( ::CORBA::is_nil (this->context_.in ()))
+ {
+ throw ::CORBA::INTERNAL ();
+ }
+ }
+
+ void
+ Bar_exec_i::run_test (void)
+ {
+ ::Foo_var foo_intf = this->context_->get_connection_foo_in ();
+
+ if (CORBA::is_nil (foo_intf))
+ {
+ ACE_ERROR ((LM_ERROR, "ERROR: Local_Facet_Test: got a nil object reference for my connection\n"));
+ return;
+ }
+
+ ACE_DEBUG ((LM_DEBUG, "Invoking simple\n"));
+ foo_intf->simple ();
+
+ ACE_DEBUG ((LM_INFO, "Test successful!\n"));
+ }
+
+ void
+ Bar_exec_i::configuration_complete (void)
+ {
+ /* Your code here. */
+ }
+
+ void
+ Bar_exec_i::ccm_activate (void)
+ {
+ /* Your code here. */
+ }
+
+ void
+ Bar_exec_i::ccm_passivate (void)
+ {
+ /* Your code here. */
+ }
+
+ void
+ Bar_exec_i::ccm_remove (void)
+ {
+ /* Your code here. */
+ }
+
+ extern "C" LOCAL_FACET_EXEC_Export ::Components::EnterpriseComponent_ptr
+ create_Bar_Impl (void)
+ {
+ ::Components::EnterpriseComponent_ptr retval =
+ ::Components::EnterpriseComponent::_nil ();
+
+ ACE_NEW_NORETURN (
+ retval,
+ Bar_exec_i);
+
+ return retval;
+ }
+}
+
diff --git a/tests/CIAO_ComponentServer/Local_Facet/Local_Facet_exec.h b/tests/CIAO_ComponentServer/Local_Facet/Local_Facet_exec.h
new file mode 100644
index 00000000000..4113d147adc
--- /dev/null
+++ b/tests/CIAO_ComponentServer/Local_Facet/Local_Facet_exec.h
@@ -0,0 +1,81 @@
+// -*- C++ -*-
+// $Id$
+
+#ifndef CIAO_LOCAL_FACET_EXEC_H_
+#define CIAO_LOCAL_FACET_EXEC_H_
+
+#include /**/ "ace/pre.h"
+
+#include "Local_FacetEC.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include /**/ "Local_Facet_exec_export.h"
+#include "tao/LocalObject.h"
+
+
+namespace CIAO_Bar_Impl
+{
+ class LOCAL_FACET_EXEC_Export Foo_exec_i
+ : public virtual ::CCM_Foo,
+ public virtual ::CORBA::LocalObject
+ {
+ public:
+ Foo_exec_i (void);
+ virtual ~Foo_exec_i (void);
+
+ // Operations and attributes from ::Foo
+ virtual void simple (void);
+ };
+
+ class LOCAL_FACET_EXEC_Export Bar_exec_i
+ : public virtual Bar_Exec,
+ public virtual ::CORBA::LocalObject
+ {
+ public:
+ Bar_exec_i (void);
+ virtual ~Bar_exec_i (void);
+
+ //@{
+ /** Supported operations and attributes. */
+ virtual void run_test (void);
+
+ //@}
+
+ //@{
+ /** Component attributes and port operations. */
+
+
+ virtual ::CCM_Foo_ptr
+ get_foo_out (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_Bar_Context_var context_;
+ };
+
+ extern "C" LOCAL_FACET_EXEC_Export ::Components::EnterpriseComponent_ptr
+ create_Bar_Impl (void);
+}
+
+#include /**/ "ace/post.h"
+
+#endif /* ifndef */
+
diff --git a/tests/CIAO_ComponentServer/Local_Facet/client.cpp b/tests/CIAO_ComponentServer/Local_Facet/client.cpp
new file mode 100644
index 00000000000..10009051d88
--- /dev/null
+++ b/tests/CIAO_ComponentServer/Local_Facet/client.cpp
@@ -0,0 +1,186 @@
+// $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/tests/CIAO_ComponentServer/Local_Facet/run_test.pl b/tests/CIAO_ComponentServer/Local_Facet/run_test.pl
new file mode 100755
index 00000000000..d382c821cea
--- /dev/null
+++ b/tests/CIAO_ComponentServer/Local_Facet/run_test.pl
@@ -0,0 +1,26 @@
+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}";
+
+my $target = PerlACE::TestTarget::create_target (1);
+
+$TG = $target->CreateProcess ("client", "-s " . $target->GetArchDir("$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;
diff --git a/tests/CIAO_ComponentServer/SimpleComponent/SimpleComponent.idl b/tests/CIAO_ComponentServer/SimpleComponent/SimpleComponent.idl
new file mode 100644
index 00000000000..dcf676fb276
--- /dev/null
+++ b/tests/CIAO_ComponentServer/SimpleComponent/SimpleComponent.idl
@@ -0,0 +1,21 @@
+//$Id$
+
+#include <Components.idl>
+
+module Foo
+{
+ interface Simple
+ {
+ void trigger ();
+ };
+
+ component SimpleComponent supports Simple
+ {
+ readonly attribute string creationtype_;
+ };
+
+ home SimpleHome manages SimpleComponent
+ {
+ };
+};
+
diff --git a/tests/CIAO_ComponentServer/SimpleComponent/SimpleComponent.mpc b/tests/CIAO_ComponentServer/SimpleComponent/SimpleComponent.mpc
new file mode 100644
index 00000000000..cf6400373a5
--- /dev/null
+++ b/tests/CIAO_ComponentServer/SimpleComponent/SimpleComponent.mpc
@@ -0,0 +1,112 @@
+// $Id$
+// This file is generated with "generate_component_mpc.pl SimpleComponent"
+
+project(SimpleComponent_idl_gen) : componentidldefaults {
+ custom_only = 1
+ idlflags += -Wb,stub_export_macro=SIMPLECOMPONENT_STUB_Export \
+ -Wb,stub_export_include=SimpleComponent_stub_export.h \
+ -Wb,skel_export_macro=SIMPLECOMPONENT_SVNT_Export \
+ -Wb,skel_export_include=SimpleComponent_svnt_export.h \
+ -Wb,exec_export_macro=SIMPLECOMPONENT_EXEC_Export \
+ -Wb,exec_export_include=SimpleComponent_exec_export.h
+
+ IDL_Files {
+ SimpleComponent.idl
+ }
+}
+
+project(SimpleComponent_lem_gen) : ciaoidldefaults {
+ custom_only = 1
+ after += SimpleComponent_idl_gen
+ idlflags += -Wb,export_macro=SIMPLECOMPONENT_EXEC_Export \
+ -Wb,export_include=SimpleComponent_exec_export.h \
+ -SS
+
+ IDL_Files {
+ SimpleComponentE.idl
+ }
+}
+
+project(SimpleComponent_stub) : ccm_stub {
+ after += SimpleComponent_idl_gen
+
+ sharedname = SimpleComponent_stub
+ dynamicflags = SIMPLECOMPONENT_STUB_BUILD_DLL
+
+ IDL_Files {
+ }
+
+ Source_Files {
+ SimpleComponentC.cpp
+ }
+
+ Header_Files {
+ SimpleComponentC.h
+ SimpleComponent_stub_export.h
+ }
+
+ Inline_Files {
+ SimpleComponentC.inl
+ }
+}
+
+project(SimpleComponent_exec) : ciao_executor {
+ after += SimpleComponent_lem_gen SimpleComponent_stub
+ sharedname = SimpleComponent_exec
+ libs += SimpleComponent_stub
+
+ dynamicflags = SIMPLECOMPONENT_EXEC_BUILD_DLL
+
+ IDL_Files {
+ }
+
+ Source_Files {
+ SimpleComponentEC.cpp
+ SimpleComponent_exec.cpp
+ }
+
+ Header_Files {
+ SimpleComponentEC.h
+ SimpleComponent_exec.h
+ SimpleComponent_exec_export.h
+ }
+
+ Inline_Files {
+ SimpleComponentEC.inl
+ }
+}
+
+
+project(SimpleComponent_svnt) : ciao_servant {
+ sharedname = SimpleComponent_svnt
+ libs += SimpleComponent_stub SimpleComponent_exec
+ after += SimpleComponent_stub SimpleComponent_exec
+ dynamicflags = SIMPLECOMPONENT_SVNT_BUILD_DLL
+
+ IDL_Files {
+ }
+ Source_Files {
+ SimpleComponentS.cpp
+ SimpleComponent_svnt.cpp
+ }
+
+ Header_Files {
+ SimpleComponentS.h
+ SimpleComponent_svnt.h
+ SimpleComponent_svnt_export.h
+ }
+
+ Inline_Files {
+ SimpleComponentS.inl
+ }
+}
+
+project (SimpleComp_CIAOComponentServer_Tst) : ciao_componentserver_stub, ccm_configvalue, ciao_cs_client, ciao_logger {
+ after += SimpleComponent_stub SimpleComponent_svnt
+ libs += SimpleComponent_stub
+ IDL_Files {
+ }
+ Source_Files {
+ client.cpp
+ }
+}
diff --git a/tests/CIAO_ComponentServer/SimpleComponent/SimpleComponent_exec.cpp b/tests/CIAO_ComponentServer/SimpleComponent/SimpleComponent_exec.cpp
new file mode 100644
index 00000000000..60d0a6eebf7
--- /dev/null
+++ b/tests/CIAO_ComponentServer/SimpleComponent/SimpleComponent_exec.cpp
@@ -0,0 +1,131 @@
+// $Id$
+
+#include "SimpleComponent_exec.h"
+#include "ciao/Logger/Log_Macros.h"
+
+namespace CIAO_Foo_SimpleComponent_Impl
+{
+ //==================================================================
+ // Component Executor Implementation Class: SimpleComponent_exec_i
+ //==================================================================
+
+ SimpleComponent_exec_i::SimpleComponent_exec_i (const char *type)
+ : type_ (CORBA::string_dup (type))
+ {
+ }
+
+ SimpleComponent_exec_i::~SimpleComponent_exec_i (void)
+ {
+ }
+
+ // Supported or inherited operations.
+
+ void
+ SimpleComponent_exec_i::trigger ()
+ {
+ ACE_DEBUG ((LM_EMERGENCY, "Hello, world!!!!!!!!\n"));
+ }
+
+ // Attribute operations.
+
+ char *
+ SimpleComponent_exec_i::creationtype_ ()
+ {
+ return CORBA::string_dup (this->type_.in ());
+ }
+
+ // Port operations.
+
+ // Operations from Components::SessionComponent
+
+ void
+ SimpleComponent_exec_i::set_session_context (
+ ::Components::SessionContext_ptr ctx)
+ {
+ this->context_ =
+ ::Foo::CCM_SimpleComponent_Context::_narrow (ctx);
+
+ if (CORBA::is_nil (this->context_.in ()))
+ {
+ throw ::CORBA::INTERNAL ();
+ }
+ }
+
+ void
+ SimpleComponent_exec_i::configuration_complete ()
+ {
+ // Your code here.
+ }
+
+ void
+ SimpleComponent_exec_i::ccm_activate ()
+ {
+ // Your code here.
+ }
+
+ void
+ SimpleComponent_exec_i::ccm_passivate ()
+ {
+ // Your code here.
+ }
+
+ void
+ SimpleComponent_exec_i::ccm_remove ()
+ {
+ // Your code here.
+ }
+
+ //==================================================================
+ // Home Executor Implementation Class: SimpleHome_exec_i
+ //==================================================================
+
+ SimpleHome_exec_i::SimpleHome_exec_i (void)
+ {
+ CIAO_TRACE ("SimpleHome_exec_i::SimpleHome_exec_i");
+ ACE_DEBUG ((LM_NOTICE, CLINFO "SimpleHome_exec_i::SimpleHome_exec_i - "
+ "Home constructed\n"));
+ }
+
+ SimpleHome_exec_i::~SimpleHome_exec_i (void)
+ {
+ }
+
+ // Supported or inherited operations.
+
+ // Home operations.
+
+ // Factory and finder operations.
+
+ // Attribute operations.
+
+ // Implicit operations.
+
+ ::Components::EnterpriseComponent_ptr
+ SimpleHome_exec_i::create ()
+ {
+ ::Components::EnterpriseComponent_ptr retval =
+ ::Components::EnterpriseComponent::_nil ();
+
+ ACE_NEW_THROW_EX (
+ retval,
+ SimpleComponent_exec_i ("HomeCreated"),
+ ::CORBA::NO_MEMORY ());
+
+ return retval;
+ }
+
+ extern "C" SIMPLECOMPONENT_EXEC_Export ::Components::HomeExecutorBase_ptr
+ create_Foo_SimpleHome_Impl (void)
+ {
+ ::Components::HomeExecutorBase_ptr retval =
+ ::Components::HomeExecutorBase::_nil ();
+
+ ACE_NEW_RETURN (
+ retval,
+ SimpleHome_exec_i,
+ ::Components::HomeExecutorBase::_nil ());
+
+ return retval;
+ }
+}
+
diff --git a/tests/CIAO_ComponentServer/SimpleComponent/SimpleComponent_exec.h b/tests/CIAO_ComponentServer/SimpleComponent/SimpleComponent_exec.h
new file mode 100644
index 00000000000..04afe9ffc2c
--- /dev/null
+++ b/tests/CIAO_ComponentServer/SimpleComponent/SimpleComponent_exec.h
@@ -0,0 +1,90 @@
+// $Id$
+
+#ifndef CIAO_SIMPLECOMPONENT_EXEC_H
+#define CIAO_SIMPLECOMPONENT_EXEC_H
+
+#include /**/ "ace/pre.h"
+
+#include "SimpleComponentEC.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "SimpleComponent_exec_export.h"
+#include "tao/LocalObject.h"
+
+namespace CIAO_Foo_SimpleComponent_Impl
+{
+ class SIMPLECOMPONENT_EXEC_Export SimpleComponent_exec_i
+ : public virtual SimpleComponent_Exec,
+ public virtual ::CORBA::LocalObject
+ {
+ public:
+ SimpleComponent_exec_i (const char *CreateType);
+ virtual ~SimpleComponent_exec_i (void);
+
+ // Supported or inherited operations.
+
+ virtual void
+ trigger ();
+
+ // Attribute operations.
+
+ virtual char *
+ creationtype_ ()
+ ;
+
+ // Port operations.
+
+ // Operations from Components::SessionComponent
+
+ virtual void
+ set_session_context (
+ ::Components::SessionContext_ptr ctx);
+
+ virtual void configuration_complete ();
+
+ virtual void ccm_activate ();
+
+ virtual void ccm_passivate ();
+
+ virtual void ccm_remove ();
+
+ private:
+ ::Foo::CCM_SimpleComponent_Context_var context_;
+
+ CORBA::String_var type_;
+
+ };
+
+ class SIMPLECOMPONENT_EXEC_Export SimpleHome_exec_i
+ : public virtual SimpleHome_Exec,
+ public virtual ::CORBA::LocalObject
+ {
+ public:
+ SimpleHome_exec_i (void);
+ virtual ~SimpleHome_exec_i (void);
+
+ // Supported or inherited operations.
+
+ // Home operations.
+
+ // Factory and finder operations.
+
+ // Attribute operations.
+
+ // Implicit operations.
+
+ virtual ::Components::EnterpriseComponent_ptr
+ create ();
+ };
+
+ extern "C" SIMPLECOMPONENT_EXEC_Export ::Components::HomeExecutorBase_ptr
+ create_Foo_SimpleHome_Impl (void);
+}
+
+#include /**/ "ace/post.h"
+
+#endif /* CIAO_SIMPLECOMPONENT_EXEC_H */
+
diff --git a/tests/CIAO_ComponentServer/SimpleComponent/client.cpp b/tests/CIAO_ComponentServer/SimpleComponent/client.cpp
new file mode 100644
index 00000000000..bdcdf022d1a
--- /dev/null
+++ b/tests/CIAO_ComponentServer/SimpleComponent/client.cpp
@@ -0,0 +1,187 @@
+// $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 "SimpleComponentC.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_Foo_SimpleHome_Servant";
+ configs[0] = new CIAO::ConfigValue_impl (CIAO::Deployment::SVNT_ENTRYPT,
+ val);
+ val <<= "SimpleComponent_svnt";
+ configs[1] = new CIAO::ConfigValue_impl (CIAO::Deployment::SVNT_ARTIFACT,
+ val);
+ tmp_ci->install ("SimpleComponent_svnt", "SimpleComponent_svnt");
+ val <<= "SimpleComponent_exec";
+ configs[2] = new CIAO::ConfigValue_impl (CIAO::Deployment::EXEC_ARTIFACT,
+ val);
+ tmp_ci->install ("SimpleComponent_exec", "SimpleComponent_exec");
+
+ // Install Home
+ Components::CCMHome_var home = cont1a->install_home ("MyNameIsEarl",
+ "create_Foo_SimpleHome_Impl",
+ configs);
+
+ if (CORBA::is_nil (home))
+ {
+ ACE_ERROR ((LM_ERROR, "Got back a nil home ref from install_home\n"));
+ return -1;
+ }
+
+ Foo::SimpleHome_var shome = Foo::SimpleHome::_narrow (home.in ());
+
+ if (CORBA::is_nil (shome))
+ {
+ ACE_ERROR ((LM_ERROR, "Narrow failed from CCM_Home to SimpleHome\n"));
+ return -1;
+ }
+
+
+ Foo::SimpleComponent_var sc = shome->create ();
+
+ if (CORBA::is_nil (sc))
+ {
+ ACE_ERROR ((LM_ERROR, "Home failed to make a component\n"));
+ return -1;
+ }
+
+ sc->trigger ();
+
+ cont1a->remove_home (home.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/tests/CIAO_ComponentServer/SimpleComponent/run_test.pl b/tests/CIAO_ComponentServer/SimpleComponent/run_test.pl
new file mode 100755
index 00000000000..d382c821cea
--- /dev/null
+++ b/tests/CIAO_ComponentServer/SimpleComponent/run_test.pl
@@ -0,0 +1,26 @@
+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}";
+
+my $target = PerlACE::TestTarget::create_target (1);
+
+$TG = $target->CreateProcess ("client", "-s " . $target->GetArchDir("$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;