From 3aff90f4a822fcf5d902bbfbcc9fa931d6191a8c Mon Sep 17 00:00:00 2001 From: "William R. Otte" Date: Mon, 24 Jul 2006 15:50:21 +0000 Subject: Repo restructuring --- TAO/tests/Object_Loader/.cvsignore | 1 + TAO/tests/Object_Loader/Loader.cpp | 64 ++++++++++++++++++++++ TAO/tests/Object_Loader/Loader.h | 44 +++++++++++++++ TAO/tests/Object_Loader/OLT_Export.h | 40 ++++++++++++++ TAO/tests/Object_Loader/Object_Loader.mpc | 21 ++++++++ TAO/tests/Object_Loader/README | 16 ++++++ TAO/tests/Object_Loader/Test.idl | 12 +++++ TAO/tests/Object_Loader/Test_i.cpp | 42 +++++++++++++++ TAO/tests/Object_Loader/Test_i.h | 49 +++++++++++++++++ TAO/tests/Object_Loader/driver.cpp | 90 +++++++++++++++++++++++++++++++ TAO/tests/Object_Loader/run_test.pl | 28 ++++++++++ TAO/tests/Object_Loader/svc.conf | 8 +++ TAO/tests/Object_Loader/svc.conf.xml | 13 +++++ 13 files changed, 428 insertions(+) create mode 100644 TAO/tests/Object_Loader/.cvsignore create mode 100644 TAO/tests/Object_Loader/Loader.cpp create mode 100644 TAO/tests/Object_Loader/Loader.h create mode 100644 TAO/tests/Object_Loader/OLT_Export.h create mode 100644 TAO/tests/Object_Loader/Object_Loader.mpc create mode 100644 TAO/tests/Object_Loader/README create mode 100644 TAO/tests/Object_Loader/Test.idl create mode 100644 TAO/tests/Object_Loader/Test_i.cpp create mode 100644 TAO/tests/Object_Loader/Test_i.h create mode 100644 TAO/tests/Object_Loader/driver.cpp create mode 100755 TAO/tests/Object_Loader/run_test.pl create mode 100644 TAO/tests/Object_Loader/svc.conf create mode 100644 TAO/tests/Object_Loader/svc.conf.xml (limited to 'TAO/tests/Object_Loader') diff --git a/TAO/tests/Object_Loader/.cvsignore b/TAO/tests/Object_Loader/.cvsignore new file mode 100644 index 00000000000..e54525b1ee9 --- /dev/null +++ b/TAO/tests/Object_Loader/.cvsignore @@ -0,0 +1 @@ +driver diff --git a/TAO/tests/Object_Loader/Loader.cpp b/TAO/tests/Object_Loader/Loader.cpp new file mode 100644 index 00000000000..73ae41e115f --- /dev/null +++ b/TAO/tests/Object_Loader/Loader.cpp @@ -0,0 +1,64 @@ +// $Id$ + +#include "Loader.h" +#include "Test_i.h" + +ACE_RCSID(Object_Loader, Loader, "$Id$") + +Loader::Loader (void) +{ +} + +CORBA::Object_ptr +Loader::create_object (CORBA::ORB_ptr orb, + int, + char * [] + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ACE_TRY + { + CORBA::Object_var obj = + orb->resolve_initial_references ("RootPOA" ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + PortableServer::POA_var poa = + PortableServer::POA::_narrow (obj.in () ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + PortableServer::POAManager_var mgr = + poa->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + mgr->activate (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + Test_i *test; + ACE_NEW_RETURN (test, Test_i (poa.in ()), + CORBA::Object::_nil ()); + + PortableServer::ServantBase_var tmp = test; + obj = test->_this (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + return obj._retn (); + } + ACE_CATCHANY + { + } + ACE_ENDTRY; + return CORBA::Object::_nil (); +} + +// **************************************************************** + +#if 0 +ACE_STATIC_SVC_DEFINE (Loader, + ACE_TEXT ("TAO_Object_Loader"), + ACE_SVC_OBJ_T, + &ACE_SVC_NAME (Loader), + ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ, + 0) +#endif /* 0 */ + +ACE_FACTORY_DEFINE (OLT, Loader) diff --git a/TAO/tests/Object_Loader/Loader.h b/TAO/tests/Object_Loader/Loader.h new file mode 100644 index 00000000000..73b4c5708f4 --- /dev/null +++ b/TAO/tests/Object_Loader/Loader.h @@ -0,0 +1,44 @@ +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// TAO/tests/Object_Loader +// +// = FILENAME +// Loader.h +// +// = AUTHOR +// Carlos O'Ryan +// +// ============================================================================ + +#ifndef TAO_OBJECT_LOADER_LOADER_H +#define TAO_OBJECT_LOADER_LOADER_H + +#include "tao/Object_Loader.h" +#include "OLT_Export.h" + +class OLT_Export Loader : public TAO_Object_Loader +{ + // = TITLE + // Implement the Test interface + // + // = DESCRIPTION + // +public: + Loader (void); + // ctor + + virtual CORBA::Object_ptr create_object (CORBA::ORB_ptr orb, + int argc, + char *argv [] + ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)); + // Create a new instance +}; + +// ACE_STATIC_SVC_DECLARE (Loader) +ACE_FACTORY_DECLARE (OLT, Loader) + +#endif /* TAO_OBJECT_LOADER_LOADER_H */ diff --git a/TAO/tests/Object_Loader/OLT_Export.h b/TAO/tests/Object_Loader/OLT_Export.h new file mode 100644 index 00000000000..f7d3ad034b9 --- /dev/null +++ b/TAO/tests/Object_Loader/OLT_Export.h @@ -0,0 +1,40 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl +// ------------------------------ +#ifndef OLT_EXPORT_H +#define OLT_EXPORT_H + +#include "ace/config-all.h" + +#if defined (TAO_AS_STATIC_LIBS) +# if !defined (OLT_HAS_DLL) +# define OLT_HAS_DLL 0 +# endif /* ! OLT_HAS_DLL */ +#else +# if !defined (OLT_HAS_DLL) +# define OLT_HAS_DLL 1 +# endif /* ! OLT_HAS_DLL */ +#endif + +#if defined (OLT_HAS_DLL) && (OLT_HAS_DLL == 1) +# if defined (OLT_BUILD_DLL) +# define OLT_Export ACE_Proper_Export_Flag +# define OLT_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define OLT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* OLT_BUILD_DLL */ +# define OLT_Export ACE_Proper_Import_Flag +# define OLT_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define OLT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* OLT_BUILD_DLL */ +#else /* OLT_HAS_DLL == 1 */ +# define OLT_Export +# define OLT_SINGLETON_DECLARATION(T) +# define OLT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* OLT_HAS_DLL == 1 */ + +#endif /* OLT_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/tests/Object_Loader/Object_Loader.mpc b/TAO/tests/Object_Loader/Object_Loader.mpc new file mode 100644 index 00000000000..a008ebf89a3 --- /dev/null +++ b/TAO/tests/Object_Loader/Object_Loader.mpc @@ -0,0 +1,21 @@ +// -*- MPC -*- +// $Id$ + +project(*Test): taolib_with_idl, portableserver { + sharedname = Test_DLL + dynamicflags = OLT_BUILD_DLL + + Source_Files { + Test_i.cpp + Loader.cpp + } +} + +project(*Driver): taoexe, portableserver { + after += *Test + Source_Files { + TestC.cpp + driver.cpp + } +} + diff --git a/TAO/tests/Object_Loader/README b/TAO/tests/Object_Loader/README new file mode 100644 index 00000000000..71faaabc8cf --- /dev/null +++ b/TAO/tests/Object_Loader/README @@ -0,0 +1,16 @@ +/** + +@page Object Loader Test README File + +$Id$ + + Test the DLL-style IORs. For more details on the DLL-style +IORs please read the documentation in $TAO_ROOT/tao/DLL_Parser.h. + + To execute the test simply run + +$ ./driver + + or run the run_test.pl script. The test returns 0 on success. + +*/ diff --git a/TAO/tests/Object_Loader/Test.idl b/TAO/tests/Object_Loader/Test.idl new file mode 100644 index 00000000000..609fe5f62c8 --- /dev/null +++ b/TAO/tests/Object_Loader/Test.idl @@ -0,0 +1,12 @@ +// $Id$ + +interface Test +{ + // = TITLE + // A simple interface to test the Object Loading features in the + // ORB. + + long instance_count (); + + void destroy (); +}; diff --git a/TAO/tests/Object_Loader/Test_i.cpp b/TAO/tests/Object_Loader/Test_i.cpp new file mode 100644 index 00000000000..6150714b0a5 --- /dev/null +++ b/TAO/tests/Object_Loader/Test_i.cpp @@ -0,0 +1,42 @@ +// $Id$ + +#include "Test_i.h" + +ACE_RCSID(Object_Loader, Test_i, "$Id$") + +CORBA::Long +Test_i::instance_count_ = 0; + +Test_i::Test_i (PortableServer::POA_ptr poa) + : poa_ (PortableServer::POA::_duplicate (poa)) +{ + Test_i::instance_count_++; +} + +CORBA::Long +Test_i::instance_count (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return Test_i::instance_count_; +} + +void +Test_i::destroy (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + PortableServer::POA_var poa = + this->_default_POA (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + PortableServer::ObjectId_var oid = + poa->servant_to_id (this ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + poa->deactivate_object (oid.in () ACE_ENV_ARG_PARAMETER); + ACE_CHECK; +} + +PortableServer::POA_ptr +Test_i::_default_POA (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return PortableServer::POA::_duplicate (this->poa_.in ()); +} diff --git a/TAO/tests/Object_Loader/Test_i.h b/TAO/tests/Object_Loader/Test_i.h new file mode 100644 index 00000000000..5fc58fc95cd --- /dev/null +++ b/TAO/tests/Object_Loader/Test_i.h @@ -0,0 +1,49 @@ +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// TAO/tests/Object_Loader +// +// = FILENAME +// Test_i.h +// +// = AUTHOR +// Carlos O'Ryan +// +// ============================================================================ + +#ifndef TAO_OBJECT_LOADER_TEST_I_H +#define TAO_OBJECT_LOADER_TEST_I_H + +#include "TestS.h" +#include "OLT_Export.h" + +class OLT_Export Test_i : public POA_Test +{ + // = TITLE + // Implement the Test interface + // + // = DESCRIPTION + // +public: + Test_i (PortableServer::POA_ptr poa); + // ctor + + CORBA::Long instance_count (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)); + + void destroy (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)); + + PortableServer::POA_ptr _default_POA (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)); + +private: + PortableServer::POA_var poa_; + // The default POA used for this object + + static CORBA::Long instance_count_; +}; + +#endif /* TAO_OBJECT_LOADER_TEST_I_H */ diff --git a/TAO/tests/Object_Loader/driver.cpp b/TAO/tests/Object_Loader/driver.cpp new file mode 100644 index 00000000000..e7e9b391e0d --- /dev/null +++ b/TAO/tests/Object_Loader/driver.cpp @@ -0,0 +1,90 @@ +// +// $Id$ +// + +#include "TestC.h" +#include "tao/PortableServer/PortableServer.h" + +#include "ace/Log_Msg.h" +#include "ace/OS_NS_stdio.h" + +int +main (int, char *[]) +{ + int niterations = 10; + int norbs = 10; + + ACE_TRY_NEW_ENV + { + for (int i = 0; i != niterations; ++i) + { + for (int j = 0; j != norbs; ++j) + { + char buf[16]; + ACE_OS::sprintf (buf, "ORB_%4.4d", j); + + int argc = 0; + CORBA::ORB_var orb = + CORBA::ORB_init (argc, 0, buf ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + CORBA::Object_var object = + orb->string_to_object ("DLL:Test_Object" + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + Test_var test = + Test::_narrow (object.in () ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + CORBA::Long count = + test->instance_count (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (count != norbs*i + j + 1) + { + ACE_DEBUG ((LM_DEBUG, + "Incorrect number of objects " + "(%d != %d)\n", + count, norbs * i + j + 1)); + } + test->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + } + } + + for (int j = 0; j != norbs; ++j) + { + char buf[16]; + ACE_OS::sprintf (buf, "ORB_%4.4d", j); + + int argc = 0; + CORBA::ORB_var orb = + CORBA::ORB_init (argc, 0, buf ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + CORBA::Object_var obj = + orb->resolve_initial_references ("RootPOA" + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + PortableServer::POA_var poa = + PortableServer::POA::_narrow (obj.in () ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + poa->destroy (1, 1 ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + orb->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + } + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "main()"); + return 1; + } + ACE_ENDTRY; + return 0; +} diff --git a/TAO/tests/Object_Loader/run_test.pl b/TAO/tests/Object_Loader/run_test.pl new file mode 100755 index 00000000000..5cc6f2cb6b1 --- /dev/null +++ b/TAO/tests/Object_Loader/run_test.pl @@ -0,0 +1,28 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use English; + +use lib '../../../bin'; +use PerlACE::Run_Test; + +if ($OSNAME eq "MSWin32") { + $ENV{'PATH'} .= ';'.$PerlACE::Process::ExeSubDir; +} else { + $ENV{'PATH'} .= ':'.$PerlACE::Process::ExeSubDir; +} + +$T = new PerlACE::Process ("driver"); + +$test = $T->SpawnWaitKill (60); + +if ($test != 0) { + print STDERR "ERROR: test returned $test\n"; + exit 1; +} + +exit 0; diff --git a/TAO/tests/Object_Loader/svc.conf b/TAO/tests/Object_Loader/svc.conf new file mode 100644 index 00000000000..94f31260de2 --- /dev/null +++ b/TAO/tests/Object_Loader/svc.conf @@ -0,0 +1,8 @@ +# +# $Id$ +# +dynamic TAO_POA Service_Object * TAO_PortableServer:_make_TAO_Object_Adapter_Factory() "" +dynamic Test_Object Service_Object * Test_DLL:_make_Loader() "" + + + diff --git a/TAO/tests/Object_Loader/svc.conf.xml b/TAO/tests/Object_Loader/svc.conf.xml new file mode 100644 index 00000000000..93b1f7c0c0e --- /dev/null +++ b/TAO/tests/Object_Loader/svc.conf.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + -- cgit v1.2.1