diff options
Diffstat (limited to 'CIAO/tests/Bug_2130_Regression/SEC_CheckPoint')
10 files changed, 1367 insertions, 0 deletions
diff --git a/CIAO/tests/Bug_2130_Regression/SEC_CheckPoint/TSEC_CheckPoint.cidl b/CIAO/tests/Bug_2130_Regression/SEC_CheckPoint/TSEC_CheckPoint.cidl new file mode 100644 index 00000000000..07748288e51 --- /dev/null +++ b/CIAO/tests/Bug_2130_Regression/SEC_CheckPoint/TSEC_CheckPoint.cidl @@ -0,0 +1,17 @@ +//$Id$ + +#ifndef TSEC_CHECKPOINT_CIDL +#define TSEC_CHECKPOINT_CIDL + +#include "TSEC_CheckPoint.idl" + +composition session TSEC_CheckPoint_Impl +{ + home executor TSEC_CheckPointHome_Exec + { + implements ENW::TSEC_CheckPointHome; + manages TSEC_CheckPoint_Exec; + }; +}; + +#endif // TSEC_CHECKPOINT_CIDL diff --git a/CIAO/tests/Bug_2130_Regression/SEC_CheckPoint/TSEC_CheckPoint.idl b/CIAO/tests/Bug_2130_Regression/SEC_CheckPoint/TSEC_CheckPoint.idl new file mode 100644 index 00000000000..83d68fc4353 --- /dev/null +++ b/CIAO/tests/Bug_2130_Regression/SEC_CheckPoint/TSEC_CheckPoint.idl @@ -0,0 +1,27 @@ +//$Id$ + +#ifndef TSEC_CHECKPOINT_IDL +#define TSEC_CHECKPOINT_IDL + +#include "../interfaces/ENW.idl" + + +module ENW +{ + component TSEC_CheckPoint supports ISessionService + { + provides ISessionService sessionService; + + consumes ET_LifeToken lifeTokenIn; + publishes ET_LifeToken lifeTokenOut; + + }; + + home TSEC_CheckPointHome manages TSEC_CheckPoint + { + factory new_TSEC_CheckPoint( in string Version ); + }; +}; + + +#endif // TSEC_CHECKPOINT_IDL diff --git a/CIAO/tests/Bug_2130_Regression/SEC_CheckPoint/TSEC_CheckPoint.mpc b/CIAO/tests/Bug_2130_Regression/SEC_CheckPoint/TSEC_CheckPoint.mpc new file mode 100644 index 00000000000..8de487816bb --- /dev/null +++ b/CIAO/tests/Bug_2130_Regression/SEC_CheckPoint/TSEC_CheckPoint.mpc @@ -0,0 +1,102 @@ +//$Id$ + +project(TSEC_CheckPoint_stub): ciao_client_dnc, event { + avoids += ace_for_tao + after += ENW_stub + libpaths += ../interfaces + libs += ENW_stub + sharedname = TSEC_CheckPoint_stub + idlflags -= -GT + idlflags += -St \ + -Wb,stub_export_macro=TSEC_CHECKPOINT_STUB_Export \ + -Wb,stub_export_include=TSEC_CheckPoint_stub_export.h \ + -Wb,skel_export_macro=TSEC_CHECKPOINT_SVNT_Export \ + -Wb,skel_export_include=TSEC_CheckPoint_svnt_export.h + dynamicflags = TSEC_CHECKPOINT_STUB_BUILD_DLL + + IDL_Files { + TSEC_CheckPoint.idl + } + + Source_Files { + TSEC_CheckPointC.cpp + } +} + +project(TSEC_CheckPoint_svnt) : ciao_servant_dnc, event { + avoids += ace_for_tao + after += TSEC_CheckPoint_stub + after += ENW_skel ENW_stub + sharedname = TSEC_CheckPoint_svnt + libpaths += ../interfaces + libs += TSEC_CheckPoint_stub + libs += ENW_stub ENW_skel + + idlflags -= -GT + idlflags += -SS -St \ + -Wb,export_macro=TSEC_CHECKPOINT_SVNT_Export \ + -Wb,export_include=TSEC_CheckPoint_svnt_export.h + dynamicflags = TSEC_CHECKPOINT_SVNT_BUILD_DLL + + CIDL_Files { + TSEC_CheckPoint.cidl + } + + IDL_Files { + TSEC_CheckPointE.idl + } + + Source_Files { + TSEC_CheckPointEC.cpp + TSEC_CheckPointS.cpp + TSEC_CheckPoint_svnt.cpp + } +} + + +project(TSEC_CheckPoint_exec) : ciao_component_dnc, event, ciao_server_dnc { + avoids += ace_for_tao + after += TSEC_CheckPoint_svnt + after += ENW_skel ENW_stub + + includes += ../interfaces + + sharedname = TSEC_CheckPoint_exec + libpaths += ../interfaces + libs += TSEC_CheckPoint_stub TSEC_CheckPoint_svnt + libs += ENW_stub ENW_skel + + idlflags -= -GT + idlflags += -SS -St \ + -Wb,export_macro=TSEC_CHECKPOINT_EXEC_Export \ + -Wb,export_include=TSEC_CheckPoint_exec_export.h + dynamicflags = TSEC_CHECKPOINT_EXEC_BUILD_DLL + + IDL_Files { + TSEC_CheckPointEI.idl + } + + Source_Files { + TSEC_CheckPointEIC.cpp + TSEC_CheckPoint_exec.cpp + } +} + + +project(TSEC_CheckPoint_controller) : ciao_client_dnc, valuetype, event { + avoids += ace_for_tao + exename = controller + after += TSEC_CheckPoint_stub + libs += TSEC_CheckPoint_stub ENW_stub + libpaths += ../interfaces + + IDL_Files { + } + + Source_Files { + controller.cpp + } +} + + + diff --git a/CIAO/tests/Bug_2130_Regression/SEC_CheckPoint/TSEC_CheckPointEI.idl b/CIAO/tests/Bug_2130_Regression/SEC_CheckPoint/TSEC_CheckPointEI.idl new file mode 100644 index 00000000000..9cd47181299 --- /dev/null +++ b/CIAO/tests/Bug_2130_Regression/SEC_CheckPoint/TSEC_CheckPointEI.idl @@ -0,0 +1,19 @@ +// $Id$ + +#ifndef TSEC_CHECKPOINTEI_IDL +#define TSEC_CHECKPOINTEI_IDL + +#include "TSEC_CheckPointE.idl" + +module ENW +{ + local interface TSEC_CheckPoint_Exec : + CCM_TSEC_CheckPoint, + CCM_ISessionService, + Components::SessionComponent + { + }; + +}; + +#endif /* TSEC_CHECKPOINTEI_IDL */ diff --git a/CIAO/tests/Bug_2130_Regression/SEC_CheckPoint/TSEC_CheckPoint_exec.cpp b/CIAO/tests/Bug_2130_Regression/SEC_CheckPoint/TSEC_CheckPoint_exec.cpp new file mode 100644 index 00000000000..11f1fc27962 --- /dev/null +++ b/CIAO/tests/Bug_2130_Regression/SEC_CheckPoint/TSEC_CheckPoint_exec.cpp @@ -0,0 +1,604 @@ +//$Id$ + +//------------------------------------------------------------------- +// Includes +//------------------------------------------------------------------- + +#include "ace/Timer_Queue.h" +#include "ace/Reactor.h" + +#include "tao/LocalObject.h" +#include <orbsvcs/CosNamingC.h> + +#include "ciao/CIAO_common.h" +#include "ciao/Version.h" + +#include "TSEC_CheckPoint_exec.h" +#include "TSEC_CheckPoint_svnt.h" + + +//------------------------------------------------------------------- +// Defines +//------------------------------------------------------------------- + +#define SEPARATION_LINE "----------------------------------------" \ + "----------------------------------------\n" + + +//------------------------------------------------------------------- +// Statics +//------------------------------------------------------------------- + +static const char* argv[] = +{ + "TSEC_CheckPoint" +}; + + +//------------------------------------------------------------------- +// Operation +//------------------------------------------------------------------- + +Impl::TSEC_SessionEntry::TSEC_SessionEntry() +: _p_sessionImpl( 0 ) +{ +} + + +//------------------------------------------------------------------- +// Operation +//------------------------------------------------------------------- + +Impl::TSEC_SessionEntry::TSEC_SessionEntry +( + TSEC_Session_impl* pSessionImpl, + ENW::TSession_ptr Session +) +: _p_sessionImpl( pSessionImpl ) +{ + if( !CORBA::is_nil( Session ) ) + { + _session = ENW::TSession::_duplicate( Session ); + } +} + + +//------------------------------------------------------------------- +// Operation +//------------------------------------------------------------------- + +Impl::TSEC_Session_impl::TSEC_Session_impl +( + TSEC_CheckPoint_exec_i& Parent, + CORBA::Long Ident +) + : _isInUse(0),_ident( Ident ),_parent( Parent ) +{ +} + + +//------------------------------------------------------------------- +// Operation +//------------------------------------------------------------------- + +Impl::TSEC_Session_impl::~TSEC_Session_impl() +{ +} + + +//------------------------------------------------------------------- +// Operation +//------------------------------------------------------------------- + +CORBA::ULong +Impl::TSEC_Session_impl::hash +( + CORBA::ULong Maximum +) +{ + CORBA::ULong hash = + static_cast <CORBA::ULong> (reinterpret_cast <ptrdiff_t> (this)); + + return hash % Maximum; +} + + +//------------------------------------------------------------------- +// Operation +//------------------------------------------------------------------- + +CORBA::Long +Impl::TSEC_Session_impl::getIdent +( +) +{ + //ACE_GUARD_RETURN( TMutex, guard, _parent.getMutex(), -1 ); + + return _ident; +} + + +//------------------------------------------------------------------- +// Operation +//------------------------------------------------------------------- + +CORBA::Boolean +Impl::TSEC_Session_impl::isInUse +( +) +{ + //ACE_GUARD_RETURN( TMutex, guard, _parent.getMutex(), FALSE ); + return _isInUse; +} + + +//------------------------------------------------------------------- +// Operation +//------------------------------------------------------------------- + +Impl::TSEC_CheckPoint_exec_i::TSEC_CheckPoint_exec_i() +: _p_sessionContainer( 0 ), + _isActivated( false ) +{ + ACE_DEBUG( ( LM_DEBUG, "Impl::TSEC_CheckPoint_exec_i::" + "TSEC_CheckPoint_exec_i\n" ) ); + + this->init(); +} + + +//------------------------------------------------------------------- +// Operation +//------------------------------------------------------------------- + +Impl::TSEC_CheckPoint_exec_i::TSEC_CheckPoint_exec_i +( + const char* /*Version*/ +) +: _p_sessionContainer( 0 ), + _isActivated( false ) +{ + ACE_DEBUG( ( LM_DEBUG, "Impl::TSEC_CheckPoint_exec_i::" + "TSEC_CheckPoint_exec_i\n" ) ); + this->init(); +} + + +//------------------------------------------------------------------- +// Operation +//------------------------------------------------------------------- + +Impl::TSEC_CheckPoint_exec_i::~TSEC_CheckPoint_exec_i() +{ + ACE_DEBUG( ( LM_DEBUG, "Impl::TSEC_CheckPoint_exec_i::" + "~TSEC_CheckPoint_exec_i\n" ) ); +} + + +//------------------------------------------------------------------- +// Operation +//------------------------------------------------------------------- + +CORBA::Object_ptr +Impl::TSEC_CheckPoint_exec_i::getObjRef +( + PortableServer::Servant Servant +) +{ + return this->_p_sessionContainer->get_objref( Servant ); +} + + +//------------------------------------------------------------------- +// Operation +//------------------------------------------------------------------- + +int +Impl::TSEC_CheckPoint_exec_i::init +( +) +{ + ACE_DEBUG ((LM_DEBUG, "Impl::TSEC_CheckPoint_exec_i::init\n")); + + int argc = sizeof( argv ) / sizeof( argv[0] ); + + CORBA::ORB_var orb = CORBA::ORB_init( argc, + const_cast<char **> (argv) + ); + _orb = CORBA::ORB::_duplicate( orb.in () ); + + return 0; +} + + +//------------------------------------------------------------------- +// Operation +//------------------------------------------------------------------- + +CORBA::Object_ptr +Impl::TSEC_CheckPoint_exec_i::installServant +( + PortableServer::Servant Servant +) +{ + assert( this->_p_sessionContainer ); + + return this->_p_sessionContainer->install_servant( Servant, + CIAO::Container::Component ); +} + + +//------------------------------------------------------------------- +// Operation +//------------------------------------------------------------------- + +void +Impl::TSEC_CheckPoint_exec_i::uninstallServant +( + CORBA::Object_ptr ObjRef +) +{ + assert( this->_p_sessionContainer ); + + this->_p_sessionContainer->uninstall( ObjRef, CIAO::Container::Component ); +} + + +//------------------------------------------------------------------- +// Operation +//------------------------------------------------------------------- + +ENW::TSession_ptr +Impl::TSEC_CheckPoint_exec_i::createSession +( +) +{ + static long cnt = 0L; + + ENW::TSession_var session = ENW::TSession::_nil(); + + ACE_DEBUG( ( LM_DEBUG, "(%P|%t@%T) TSEC_CheckPoint_exec_i::createSession...\n" ) ); + + TSEC_Session_impl* p_sessionImpl = new TSEC_Session_impl( *this, ++cnt ); + PortableServer::ServantBase_var safe_servant( p_sessionImpl ); + CORBA::Object_var obj = this->installServant( p_sessionImpl + ); + session = ENW::TSession::_narrow ( obj.in () ); + + ACE_DEBUG( ( LM_DEBUG, "(%P|%t@%T) TSEC_CheckPoint_exec_i::createSession...[DONE]\n" ) ); + + return session._retn(); +} + + +//------------------------------------------------------------------- +// Operation +//------------------------------------------------------------------- + +::CORBA::Boolean +Impl::TSEC_CheckPoint_exec_i::destroySession +( + ENW::TSession_ptr Session +) +{ + ACE_DEBUG( ( LM_DEBUG, "(%P|%t@%T) TSEC_CheckPoint_exec_i::destroySession...\n" ) ); + + if( CORBA::is_nil( Session ) ) + { + ACE_DEBUG( ( LM_DEBUG, "(%P|%t@%T) TSEC_CheckPoint_exec_i::destroySession...[ERROR]\n" ) ); + return 0; + } + + this->uninstallServant( Session ); + + return 1; +} + + +//------------------------------------------------------------------- +// Operation +//------------------------------------------------------------------- + +ENW::TSession_ptr +Impl::TSEC_CheckPoint_exec_i::acquireSession +( + CORBA::Long Ident +) +{ + ACE_DEBUG( ( LM_DEBUG, "(%P|%t@%T) TSEC_CheckPoint_exec_i::acquireSession...\n" ) ); + + if( Ident <= 0 || Ident > TSEC_SESSION_MAX_IDENT ) + { + if( Ident != -1 ) + { + ACE_DEBUG( ( LM_DEBUG, "(%P|%t@%T) TSEC_CheckPoint_exec_i::releaseSession...[ERROR]\n" ) ); + throw ENW::EUnknownIdent(); + } + } + + ENW::TSession_var session = ENW::TSession::_nil(); + TSEC_Session_impl* p_sessionImpl = 0; + + try + { + { + //ACE_GUARD_RETURN( TMutex, guard, _mutex, ENW::TSession::_nil() ); + p_sessionImpl = sessionVector[Ident-1]._p_sessionImpl; + } + + p_sessionImpl->isInUse( 1 ); + CORBA::Object_var obj = this->getObjRef( p_sessionImpl) ; + session = ENW::TSession::_narrow ( obj.in () ); + //session = sessionVector[Ident-1]._session; + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Reason\n"); + ACE_DEBUG( ( LM_DEBUG, "(%P|%t@%T) TSEC_CheckPoint_exec_i::releaseSession...[ERROR]\n" ) ); + + return session._retn(); + } + + ACE_DEBUG( ( LM_DEBUG, "(%P|%t@%T) TSEC_CheckPoint_exec_i::releaseSession...[DONE]\n" ) ); + + return session._retn(); +} + + +//------------------------------------------------------------------- +// Operation +//------------------------------------------------------------------- + +::CORBA::Boolean +Impl::TSEC_CheckPoint_exec_i::releaseSession +( + CORBA::Long Ident, + ENW::TSession_ptr Session +) +{ + ACE_DEBUG( ( LM_DEBUG, "(%P|%t@%T) TSEC_CheckPoint_exec_i::releaseSession...\n" ) ); + + if( CORBA::is_nil( Session ) ) + { + ACE_DEBUG( ( LM_DEBUG, "(%P|%t@%T) TSEC_CheckPoint_exec_i::releaseSession...[ERROR]\n" ) ); + throw ENW::EUnknownSession(); + } + + //CORBA::Long ident = Session->getIdent(); + CORBA::Long ident = Ident; + + if( ident <= 0 || ident > TSEC_SESSION_MAX_IDENT ) + { + ACE_DEBUG( ( LM_DEBUG, "(%P|%t@%T) TSEC_CheckPoint_exec_i::releaseSession...[ERROR]\n" ) ); + return 0;; + } + + TSEC_Session_impl* p_sessionImpl = 0; + + { + //ACE_GUARD_RETURN( TMutex, guard, _mutex, FALSE ); + + p_sessionImpl = sessionVector[ident-1]._p_sessionImpl; + } + + assert( p_sessionImpl ); + + + if( !p_sessionImpl->isInUse() ) + { + ACE_DEBUG( ( LM_DEBUG, "(%P|%t@%T) TSEC_CheckPoint_exec_i::releaseSession...[ERROR]\n" ) ); + return 0; + } + + p_sessionImpl->isInUse( 0); + + ACE_DEBUG( ( LM_DEBUG, "(%P|%t@%T) TSEC_CheckPoint_exec_i::releaseSession...[DONE]\n" ) ); + + return 1; +} + + +//------------------------------------------------------------------- +// Operation +//------------------------------------------------------------------- + +ENW::CCM_ISessionService_ptr +Impl::TSEC_CheckPoint_exec_i::get_sessionService +( +) +{ + return ENW::CCM_ISessionService::_duplicate( this ); +} + + +//------------------------------------------------------------------- +// Operation +//------------------------------------------------------------------- + +void +Impl::TSEC_CheckPoint_exec_i::set_session_context +( + Components::SessionContext_ptr Ctx +) +{ + ACE_DEBUG( ( LM_DEBUG, + "Impl::TSEC_CheckPoint_exec_i::set_session_context\n" ) ); + + this->_context = + ENW::CCM_TSEC_CheckPoint_Context::_narrow( Ctx + ); + + if( CORBA::is_nil( this->_context.in() ) ) + { + throw CORBA::INTERNAL(); + } + + CIDL_TSEC_CheckPoint_Impl::TSEC_CheckPoint_Context* p_checkPoint_Context = + CIDL_TSEC_CheckPoint_Impl::TSEC_CheckPoint_Context::_narrow( Ctx ); + + if( !p_checkPoint_Context ) + { + throw CORBA::INTERNAL(); + } + + this->_p_sessionContainer = p_checkPoint_Context->_ciao_the_Container(); + + if( !_p_sessionContainer ) + { + throw CORBA::INTERNAL(); + } +} + + +//------------------------------------------------------------------- +// Operation +//------------------------------------------------------------------- + +void +Impl::TSEC_CheckPoint_exec_i::push_lifeTokenIn +( + ENW::ET_LifeToken* /* Event */ +) +{ + _awaitingLifeToken = false; +} + + +//------------------------------------------------------------------- +// Operation +//------------------------------------------------------------------- + +void +Impl::TSEC_CheckPoint_exec_i::ciao_preactivate +( +) +{ + ACE_DEBUG( ( LM_DEBUG, "Impl::TSEC_CheckPoint_exec_i::ciao_preactivate\n" ) ); +} + + +//------------------------------------------------------------------- +// Operation +//------------------------------------------------------------------- + +void +Impl::TSEC_CheckPoint_exec_i::ccm_activate +( +) +{ + ACE_DEBUG( ( LM_DEBUG, "Impl::TSEC_CheckPoint_exec_i::ccm_activate\n" ) ); + + TSEC_Session_impl* p_sessionImpl = 0; + + for( CORBA::Long i = 0; i < TSEC_SESSION_MAX_IDENT; ++i ) + { + p_sessionImpl = new TSEC_Session_impl( *this, i + 1 ); + PortableServer::ServantBase_var safe_servant( p_sessionImpl ); + CORBA::Object_var obj = this->installServant( p_sessionImpl + ); + ENW::TSession_var session = + ENW::TSession::_narrow ( obj.in () ); + sessionVector[i] = TSEC_SessionEntry( p_sessionImpl, session.in () ); + } + + _isActivated = true; +} + + +//------------------------------------------------------------------- +// Operation +//------------------------------------------------------------------- + +void +Impl::TSEC_CheckPoint_exec_i::ciao_postactivate +( +) +{ + ACE_DEBUG( ( LM_DEBUG, "Impl::TSEC_CheckPoint_exec_i::ciao_postactivate\n" ) ); +} + + +//------------------------------------------------------------------- +// Operation +//------------------------------------------------------------------- + +void +Impl::TSEC_CheckPoint_exec_i::ccm_passivate +( +) +{ + ACE_DEBUG( ( LM_DEBUG, "Impl::TSEC_CheckPoint_exec_i::ccm_passivate\n" ) ); + _isActivated = false; +} + + +//------------------------------------------------------------------- +// Operation +//------------------------------------------------------------------- + +void +Impl::TSEC_CheckPoint_exec_i::ccm_remove +( +) +{ + ACE_DEBUG( ( LM_DEBUG, "Impl::TSEC_CheckPoint_exec_i::ccm_remove\n" ) ); + _isActivated = false; +} + + +//------------------------------------------------------------------- +// Operation +//------------------------------------------------------------------- + +Impl::TSEC_CheckPointHome_exec_i::TSEC_CheckPointHome_exec_i() +{ +} + + +//------------------------------------------------------------------- +// Operation +//------------------------------------------------------------------- + +Impl::TSEC_CheckPointHome_exec_i::~TSEC_CheckPointHome_exec_i() +{ +} + + +//------------------------------------------------------------------- +// Operation +//------------------------------------------------------------------- + +::Components::EnterpriseComponent_ptr +Impl::TSEC_CheckPointHome_exec_i::new_TSEC_CheckPoint +( + const char* Version + ) +{ + return new Impl::TSEC_CheckPoint_exec_i( Version ); +} + + +//------------------------------------------------------------------- +// Operation +//------------------------------------------------------------------- + +::Components::EnterpriseComponent_ptr +Impl::TSEC_CheckPointHome_exec_i::create +( +) +{ + + return new Impl::TSEC_CheckPoint_exec_i(); +} + + +//------------------------------------------------------------------- +// Operation +//------------------------------------------------------------------- + +extern "C" TSEC_CHECKPOINT_EXEC_Export ::Components::HomeExecutorBase_ptr +createTSEC_CheckPointHome_Impl() +{ + return new Impl::TSEC_CheckPointHome_exec_i(); +} + diff --git a/CIAO/tests/Bug_2130_Regression/SEC_CheckPoint/TSEC_CheckPoint_exec.h b/CIAO/tests/Bug_2130_Regression/SEC_CheckPoint/TSEC_CheckPoint_exec.h new file mode 100644 index 00000000000..bdafdd2ed94 --- /dev/null +++ b/CIAO/tests/Bug_2130_Regression/SEC_CheckPoint/TSEC_CheckPoint_exec.h @@ -0,0 +1,251 @@ +//$Id$ + +//=================================================================== +/** + * @file TSEC_CheckPoint_exec.h + * + * Header file for the Executor implementation. + */ +//=================================================================== + +#ifndef TSEC_CheckPoint_EXEC_H +#define TSEC_CheckPoint_EXEC_H + +//------------------------------------------------------------------- +// Includes +//------------------------------------------------------------------- + +#include "ace/Thread_Manager.h" +#include "ace/Task.h" + +#include "tao/LocalObject.h" + +#include "ciao/Session_Container.h" + +#include "ENWS.h" +#include "TSEC_CheckPointEIC.h" +#include "TSEC_CheckPoint_exec_export.h" + + +//------------------------------------------------------------------- +// Defines +//------------------------------------------------------------------- + +#define TSEC_SESSION_ID_MAX 0xffffffff +#define TSEC_SESSION_MAX_IDENT 2 + + +//------------------------------------------------------------------- +// Type definitions +//------------------------------------------------------------------- + + +//------------------------------------------------------------------- +// Forward declarations +//------------------------------------------------------------------- + + +//------------------------------------------------------------------- +// Classes +//------------------------------------------------------------------- + +namespace Impl +{ + typedef ACE_SYNCH_MUTEX TMutex; + + class TSEC_CheckPoint_exec_i; + + class TSEC_Session_impl : + public virtual POA_ENW::TSession, + public virtual TAO_Local_RefCounted_Object + { + public: + + TSEC_Session_impl + ( + TSEC_CheckPoint_exec_i& Parent, + CORBA::Long Ident + ); + + virtual ~TSEC_Session_impl(); + + CORBA::Long getIdent(); + CORBA::Boolean isInUse(); + void isInUse( CORBA::Boolean Flag ) { _isInUse = Flag; } + + protected: + CORBA::Boolean _isInUse; + CORBA::Long _ident; + + TSEC_CheckPoint_exec_i& _parent; + + CORBA::ULong hash + ( + CORBA::ULong Maximum + ); + + TSEC_CheckPoint_exec_i& getParent() { return _parent; } + + }; + + struct TSEC_SessionEntry + { + TSEC_SessionEntry(); + + TSEC_SessionEntry + ( + TSEC_Session_impl* pSessionImpl, + ENW::TSession_ptr Session + ); + + TSEC_Session_impl* _p_sessionImpl; + ENW::TSession_var _session; + }; + + class TSEC_CHECKPOINT_EXEC_Export TSEC_CheckPoint_exec_i : + public virtual ENW::TSEC_CheckPoint_Exec, + public virtual TAO_Local_RefCounted_Object + { + public: + TSEC_CheckPoint_exec_i(); + TSEC_CheckPoint_exec_i( const char* Version ); + + virtual ~TSEC_CheckPoint_exec_i(); + + // Attribute Operationen: + // + + + // Interface ISessionService + // + + virtual ENW::CCM_ISessionService_ptr get_sessionService + ( + ); + + + virtual ENW::TSession_ptr createSession + ( + ); + + virtual CORBA::Boolean destroySession + ( + ENW::TSession_ptr Session + ); + + virtual ENW::TSession_ptr acquireSession + ( + CORBA::Long Ident + ); + + virtual CORBA::Boolean releaseSession + ( + CORBA::Long Ident, + ENW::TSession_ptr Session + ); + + + // Events + // + + virtual void push_lifeTokenIn + ( + ENW::ET_LifeToken* Event + ); + + + // Operations from Components::SessionComponent + // + + virtual void set_session_context + ( + Components::SessionContext_ptr ctx + ); + + virtual void ciao_preactivate + ( + ); + + virtual void ccm_activate + ( + ); + + virtual void ciao_postactivate + ( + ); + + + virtual void ccm_passivate + ( + ); + + virtual void ccm_remove + ( + ); + + CORBA::Object_ptr getObjRef + ( + PortableServer::Servant Servant + ); + + int init( + ); + + CORBA::Object_ptr installServant + ( + PortableServer::Servant Servant + ); + + void uninstallServant + ( + CORBA::Object_ptr ObjRef + ); + + TMutex& getMutex() { return _mutex; } + + protected: + // Copmponent specific context + + ENW::CCM_TSEC_CheckPoint_Context_var _context; + ::CIAO::Session_Container* _p_sessionContainer; + TMutex _mutex; + CORBA::ORB_var _orb; + + private: + bool _awaitingLifeToken; + bool _isActivated; + + //TSEC_Session_impl* sessionVector[TSEC_SESSION_MAX_IDENT]; + TSEC_SessionEntry sessionVector[TSEC_SESSION_MAX_IDENT]; + }; + + /** + * home executor implementation class. + */ + class TSEC_CHECKPOINT_EXEC_Export TSEC_CheckPointHome_exec_i : + public virtual ENW::CCM_TSEC_CheckPointHome, + public virtual TAO_Local_RefCounted_Object + { + public: + + TSEC_CheckPointHome_exec_i(); + + virtual ~TSEC_CheckPointHome_exec_i(); + + // Explicit home operations. + virtual ::Components::EnterpriseComponent_ptr new_TSEC_CheckPoint + ( + const char* Version + ); + + // Implicit home operations. + virtual ::Components::EnterpriseComponent_ptr create + ( + ); + }; +} // Impl + +extern "C" TSEC_CHECKPOINT_EXEC_Export ::Components::HomeExecutorBase_ptr +createTSEC_CheckPointHome_Impl(); + +#endif // TSEC_CheckPoint_EXEC_H diff --git a/CIAO/tests/Bug_2130_Regression/SEC_CheckPoint/TSEC_CheckPoint_exec_export.h b/CIAO/tests/Bug_2130_Regression/SEC_CheckPoint/TSEC_CheckPoint_exec_export.h new file mode 100644 index 00000000000..4b0bf7770ef --- /dev/null +++ b/CIAO/tests/Bug_2130_Regression/SEC_CheckPoint/TSEC_CheckPoint_exec_export.h @@ -0,0 +1,50 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl TSEC_CHECKPOINT_EXEC +// ------------------------------ +#ifndef TSEC_CHECKPOINT_EXEC_EXPORT_H +#define TSEC_CHECKPOINT_EXEC_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (TSEC_CHECKPOINT_EXEC_HAS_DLL) +# define TSEC_CHECKPOINT_EXEC_HAS_DLL 1 +#endif /* ! TSEC_CHECKPOINT_EXEC_HAS_DLL */ + +#if defined (TSEC_CHECKPOINT_EXEC_HAS_DLL) && (TSEC_CHECKPOINT_EXEC_HAS_DLL == 1) +# if defined (TSEC_CHECKPOINT_EXEC_BUILD_DLL) +# define TSEC_CHECKPOINT_EXEC_Export ACE_Proper_Export_Flag +# define TSEC_CHECKPOINT_EXEC_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define TSEC_CHECKPOINT_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* TSEC_CHECKPOINT_EXEC_BUILD_DLL */ +# define TSEC_CHECKPOINT_EXEC_Export ACE_Proper_Import_Flag +# define TSEC_CHECKPOINT_EXEC_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define TSEC_CHECKPOINT_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* TSEC_CHECKPOINT_EXEC_BUILD_DLL */ +#else /* TSEC_CHECKPOINT_EXEC_HAS_DLL == 1 */ +# define TSEC_CHECKPOINT_EXEC_Export +# define TSEC_CHECKPOINT_EXEC_SINGLETON_DECLARATION(T) +# define TSEC_CHECKPOINT_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* TSEC_CHECKPOINT_EXEC_HAS_DLL == 1 */ + +// Set TSEC_CHECKPOINT_EXEC_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (TSEC_CHECKPOINT_EXEC_NTRACE) +# if (ACE_NTRACE == 1) +# define TSEC_CHECKPOINT_EXEC_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define TSEC_CHECKPOINT_EXEC_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !TSEC_CHECKPOINT_EXEC_NTRACE */ + +#if (TSEC_CHECKPOINT_EXEC_NTRACE == 1) +# define TSEC_CHECKPOINT_EXEC_TRACE(X) +#else /* (TSEC_CHECKPOINT_EXEC_NTRACE == 1) */ +# define TSEC_CHECKPOINT_EXEC_TRACE(X) ACE_TRACE_IMPL(X) +#endif /* (TSEC_CHECKPOINT_EXEC_NTRACE == 1) */ + +#endif /* TSEC_CHECKPOINT_EXEC_EXPORT_H */ + +// End of auto generated file. diff --git a/CIAO/tests/Bug_2130_Regression/SEC_CheckPoint/TSEC_CheckPoint_stub_export.h b/CIAO/tests/Bug_2130_Regression/SEC_CheckPoint/TSEC_CheckPoint_stub_export.h new file mode 100644 index 00000000000..5619f37d45d --- /dev/null +++ b/CIAO/tests/Bug_2130_Regression/SEC_CheckPoint/TSEC_CheckPoint_stub_export.h @@ -0,0 +1,50 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl TSEC_CHECKPOINT_STUB +// ------------------------------ +#ifndef TSEC_CHECKPOINT_STUB_EXPORT_H +#define TSEC_CHECKPOINT_STUB_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (TSEC_CHECKPOINT_STUB_HAS_DLL) +# define TSEC_CHECKPOINT_STUB_HAS_DLL 1 +#endif /* ! TSEC_CHECKPOINT_STUB_HAS_DLL */ + +#if defined (TSEC_CHECKPOINT_STUB_HAS_DLL) && (TSEC_CHECKPOINT_STUB_HAS_DLL == 1) +# if defined (TSEC_CHECKPOINT_STUB_BUILD_DLL) +# define TSEC_CHECKPOINT_STUB_Export ACE_Proper_Export_Flag +# define TSEC_CHECKPOINT_STUB_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define TSEC_CHECKPOINT_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* TSEC_CHECKPOINT_STUB_BUILD_DLL */ +# define TSEC_CHECKPOINT_STUB_Export ACE_Proper_Import_Flag +# define TSEC_CHECKPOINT_STUB_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define TSEC_CHECKPOINT_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* TSEC_CHECKPOINT_STUB_BUILD_DLL */ +#else /* TSEC_CHECKPOINT_STUB_HAS_DLL == 1 */ +# define TSEC_CHECKPOINT_STUB_Export +# define TSEC_CHECKPOINT_STUB_SINGLETON_DECLARATION(T) +# define TSEC_CHECKPOINT_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* TSEC_CHECKPOINT_STUB_HAS_DLL == 1 */ + +// Set TSEC_CHECKPOINT_STUB_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (TSEC_CHECKPOINT_STUB_NTRACE) +# if (ACE_NTRACE == 1) +# define TSEC_CHECKPOINT_STUB_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define TSEC_CHECKPOINT_STUB_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !TSEC_CHECKPOINT_STUB_NTRACE */ + +#if (TSEC_CHECKPOINT_STUB_NTRACE == 1) +# define TSEC_CHECKPOINT_STUB_TRACE(X) +#else /* (TSEC_CHECKPOINT_STUB_NTRACE == 1) */ +# define TSEC_CHECKPOINT_STUB_TRACE(X) ACE_TRACE_IMPL(X) +#endif /* (TSEC_CHECKPOINT_STUB_NTRACE == 1) */ + +#endif /* TSEC_CHECKPOINT_STUB_EXPORT_H */ + +// End of auto generated file. diff --git a/CIAO/tests/Bug_2130_Regression/SEC_CheckPoint/TSEC_CheckPoint_svnt_export.h b/CIAO/tests/Bug_2130_Regression/SEC_CheckPoint/TSEC_CheckPoint_svnt_export.h new file mode 100644 index 00000000000..99666df89e6 --- /dev/null +++ b/CIAO/tests/Bug_2130_Regression/SEC_CheckPoint/TSEC_CheckPoint_svnt_export.h @@ -0,0 +1,50 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl TSEC_CHECKPOINT_SVNT +// ------------------------------ +#ifndef TSEC_CHECKPOINT_SVNT_EXPORT_H +#define TSEC_CHECKPOINT_SVNT_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (TSEC_CHECKPOINT_SVNT_HAS_DLL) +# define TSEC_CHECKPOINT_SVNT_HAS_DLL 1 +#endif /* ! TSEC_CHECKPOINT_SVNT_HAS_DLL */ + +#if defined (TSEC_CHECKPOINT_SVNT_HAS_DLL) && (TSEC_CHECKPOINT_SVNT_HAS_DLL == 1) +# if defined (TSEC_CHECKPOINT_SVNT_BUILD_DLL) +# define TSEC_CHECKPOINT_SVNT_Export ACE_Proper_Export_Flag +# define TSEC_CHECKPOINT_SVNT_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define TSEC_CHECKPOINT_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* TSEC_CHECKPOINT_SVNT_BUILD_DLL */ +# define TSEC_CHECKPOINT_SVNT_Export ACE_Proper_Import_Flag +# define TSEC_CHECKPOINT_SVNT_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define TSEC_CHECKPOINT_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* TSEC_CHECKPOINT_SVNT_BUILD_DLL */ +#else /* TSEC_CHECKPOINT_SVNT_HAS_DLL == 1 */ +# define TSEC_CHECKPOINT_SVNT_Export +# define TSEC_CHECKPOINT_SVNT_SINGLETON_DECLARATION(T) +# define TSEC_CHECKPOINT_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* TSEC_CHECKPOINT_SVNT_HAS_DLL == 1 */ + +// Set TSEC_CHECKPOINT_SVNT_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (TSEC_CHECKPOINT_SVNT_NTRACE) +# if (ACE_NTRACE == 1) +# define TSEC_CHECKPOINT_SVNT_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define TSEC_CHECKPOINT_SVNT_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !TSEC_CHECKPOINT_SVNT_NTRACE */ + +#if (TSEC_CHECKPOINT_SVNT_NTRACE == 1) +# define TSEC_CHECKPOINT_SVNT_TRACE(X) +#else /* (TSEC_CHECKPOINT_SVNT_NTRACE == 1) */ +# define TSEC_CHECKPOINT_SVNT_TRACE(X) ACE_TRACE_IMPL(X) +#endif /* (TSEC_CHECKPOINT_SVNT_NTRACE == 1) */ + +#endif /* TSEC_CHECKPOINT_SVNT_EXPORT_H */ + +// End of auto generated file. diff --git a/CIAO/tests/Bug_2130_Regression/SEC_CheckPoint/controller.cpp b/CIAO/tests/Bug_2130_Regression/SEC_CheckPoint/controller.cpp new file mode 100644 index 00000000000..6e7d40bcea5 --- /dev/null +++ b/CIAO/tests/Bug_2130_Regression/SEC_CheckPoint/controller.cpp @@ -0,0 +1,197 @@ +//$Id$ + + +/** + * @file controller.cpp + * + * This program interact with a TSEC_CheckPoint component, using its supported + * interface "ISessionService" + */ + + +//------------------------------------------------------------------- +// Includes +//------------------------------------------------------------------- + +#include <ace/streams.h> +#include <ace/Get_Opt.h> + +#include "TSEC_CheckPointC.h" + + +//------------------------------------------------------------------- +// Defines +//------------------------------------------------------------------- + +#define SEPARATION_LINE "----------------------------------------" \ + "----------------------------------------\n" + +#define TESTCASE_NOT_DEFINED 0 +#define TESTCASE_ACQUIRE_RELEASE_SESSION 1 +#define TESTCASE_CREATE_DESTROY_SESSION 2 + + +//------------------------------------------------------------------- +// Statics +//------------------------------------------------------------------- + +static int _testcase = TESTCASE_NOT_DEFINED; +static int _loop = 0; +static int _ident = 1; +static const char* _sessionService_ior = 0; + + +//------------------------------------------------------------------- +// Function +//------------------------------------------------------------------- + +int +parse_args +( + int argc, + char* argv[] +) +{ + ACE_Get_Opt get_opts( argc, argv, "i:k:l:t:" ); + int c; + + while( ( c = get_opts() ) != -1 ) + { + switch( c ) + { + case 'i': + _ident = ACE_OS::atoi( get_opts.opt_arg() ); + break; + + case 'k': + _sessionService_ior = get_opts.opt_arg(); + break; + + case 'l': + _loop = ACE_OS::atoi( get_opts.opt_arg() ); + break; + + case 't': + _testcase = ACE_OS::atoi( get_opts.opt_arg() ); + break; + + case '?': // display help for use of the server. + default: + ACE_ERROR_RETURN( ( LM_ERROR, + "usage: %s\n" + "-i <Ident> (default is 1)\n" + "-k <TSEC_CheckPoint IOR> (default is file://TSEC_CheckPoint.ior)\n" + "-t <testcase number> (default is 1)\n" + "\n", + argv[0] ), + -1 ); + break; + } + } + + if ( _sessionService_ior == 0 ) + { + _sessionService_ior = "file://TSEC_CheckPoint.ior"; + } + + if( _testcase == 0 ) + { + _testcase = TESTCASE_ACQUIRE_RELEASE_SESSION; + } + + return 0; +} + + +//------------------------------------------------------------------- +// Function +//------------------------------------------------------------------- + +int +main +( + int argc, + char* argv[] +) +{ + try + { + // Initialize orb + CORBA::ORB_var orb = + CORBA::ORB_init( argc, argv, "" ); + + if( parse_args( argc, argv ) != 0 ) + { + return -1; + } + + CORBA::Object_var obj = orb->string_to_object( _sessionService_ior + ); + + ENW::ISessionService_var sessionService = + ENW::ISessionService::_narrow (obj.in () ); + + if( CORBA::is_nil( sessionService.in() ) ) + { + ACE_ERROR_RETURN( ( LM_ERROR, + "Unable to acquire 'SessionService' objref\n" ), + -1 ); + } + + ACE_DEBUG( ( LM_DEBUG, SEPARATION_LINE ) ); + + for( int i = 0; i < _loop; ++i ) + { + switch( _testcase ) + { + case TESTCASE_ACQUIRE_RELEASE_SESSION: + { + ACE_DEBUG( ( LM_DEBUG, "(%P|%t@%T) Executing testcase acquire release session...[running]\n" ) ); + + ENW::TSession_var session = sessionService->acquireSession( _ident ); + //CORBA::Long ident = session->getIdent(); + sessionService->releaseSession( _ident, session.in () ); + + ACE_DEBUG( ( LM_DEBUG, "(%P|%t@%T) Executing testcase acquire release session...[ready]\n" ) ); + } + + break; + + case TESTCASE_CREATE_DESTROY_SESSION: + { + ACE_DEBUG( ( LM_DEBUG, "(%P|%t@%T) Executing testcase create destroy session...[running]\n" ) ); + + ENW::TSession_var session = sessionService->createSession(); + CORBA::Long ident = session->getIdent(); + ACE_DEBUG(( LM_DEBUG, "(%P|%t@%T) Ident: %d\n", ident ) ); + + if( !sessionService->destroySession( session.in () ) ) + { + ACE_DEBUG( ( LM_DEBUG, "(%P|%t@%T) Executing testcase create destroy session...[ERROR]\n" ) ); + } + + ACE_DEBUG( ( LM_DEBUG, "(%P|%t@%T) Executing testcase create destroy session...[ready]\n" ) ); + } + + break; + + default: + ACE_DEBUG( ( LM_DEBUG, "(%P|%t@%T) Testcase is undefined!\n" ) ); + break; + + } + } + + orb->destroy( ); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Who is the culprit \n"); + cerr << "Uncaught CORBA exception" << endl; + + return 1; + } + + return 0; +} + |