diff options
Diffstat (limited to 'TAO/tests/Portable_Interceptors/IORInterceptor')
17 files changed, 0 insertions, 1254 deletions
diff --git a/TAO/tests/Portable_Interceptors/IORInterceptor/.cvsignore b/TAO/tests/Portable_Interceptors/IORInterceptor/.cvsignore deleted file mode 100644 index f2ad85300eb..00000000000 --- a/TAO/tests/Portable_Interceptors/IORInterceptor/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -client -server diff --git a/TAO/tests/Portable_Interceptors/IORInterceptor/FOO_ClientRequestInterceptor.cpp b/TAO/tests/Portable_Interceptors/IORInterceptor/FOO_ClientRequestInterceptor.cpp deleted file mode 100644 index 2bf02d1ef30..00000000000 --- a/TAO/tests/Portable_Interceptors/IORInterceptor/FOO_ClientRequestInterceptor.cpp +++ /dev/null @@ -1,126 +0,0 @@ -#include "FOO_ClientRequestInterceptor.h" -#include "testC.h" - -#include "ace/Log_Msg.h" - -#include "tao/AnyTypeCode/TypeCode_Constants.h" - -ACE_RCSID (IORInterceptor, - FOO_ClientRequestInterceptor, - "$Id$") - - -FOO_ClientRequestInterceptor::FOO_ClientRequestInterceptor ( - IOP::Codec_ptr codec) - : codec_ (IOP::Codec::_duplicate (codec)) -{ -} - -char * -FOO_ClientRequestInterceptor::name ( - ACE_ENV_SINGLE_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return CORBA::string_dup ("FOO_ClientRequestInterceptor"); -} - -void -FOO_ClientRequestInterceptor::destroy (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ -} - -void -FOO_ClientRequestInterceptor::send_request ( - PortableInterceptor::ClientRequestInfo_ptr ri - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)) -{ - // Verify that the tagged component that was supposed to be embedded - // into the IOR by the FOO_IORInterceptor is actually in the IOR - // profile. - IOP::TaggedComponent_var component = - ri->get_effective_component (FOO::COMPONENT_ID - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - // The correct tagged component appears to exist. Display the - // contents of the component data, which should be a NULL terminated - // string. In the case of this test, that string should be the name - // of the IORInterceptor that added the tagged component to the IOR. - - if (component->component_data.length () == 0) - { - // This should never happen because the IORInterceptor name is - // not an empty string. - ACE_ERROR ((LM_ERROR, - "Internal test error. Empty tagged component.\n")); - - ACE_THROW (CORBA::INTERNAL ()); - } - - CORBA::ULong maximum = component->component_data.maximum (); - CORBA::ULong length = component->component_data.length (); - CORBA::Octet * buffer = component->component_data.get_buffer (); - CORBA::Boolean release = 0; // TaggedComponent retains ownership. - - CORBA::OctetSeq data (maximum, length, buffer, release); - - // Extract the data from the octet sequence. - CORBA::Any_var decoded_data = - this->codec_->decode_value (data, - CORBA::_tc_string - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - const char * name = 0; - - if (!(decoded_data.in () >>= name)) - { - ACE_ERROR ((LM_ERROR, - "ERROR: Unable to extract tagged component " - "data from Any.\n")); - - ACE_THROW (CORBA::INTERNAL ()); - } - - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) String extracted from tagged component " - "data: %s\n", - name)); -} - -void -FOO_ClientRequestInterceptor::send_poll ( - PortableInterceptor::ClientRequestInfo_ptr - ACE_ENV_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ -} - -void -FOO_ClientRequestInterceptor::receive_reply ( - PortableInterceptor::ClientRequestInfo_ptr - ACE_ENV_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ -} - -void -FOO_ClientRequestInterceptor::receive_exception ( - PortableInterceptor::ClientRequestInfo_ptr - ACE_ENV_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)) -{ -} - -void -FOO_ClientRequestInterceptor::receive_other ( - PortableInterceptor::ClientRequestInfo_ptr - ACE_ENV_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)) -{ -} diff --git a/TAO/tests/Portable_Interceptors/IORInterceptor/FOO_ClientRequestInterceptor.h b/TAO/tests/Portable_Interceptors/IORInterceptor/FOO_ClientRequestInterceptor.h deleted file mode 100644 index abe9074a545..00000000000 --- a/TAO/tests/Portable_Interceptors/IORInterceptor/FOO_ClientRequestInterceptor.h +++ /dev/null @@ -1,110 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file FOO_ClientRequestInterceptor.h - * - * $Id$ - * - * Implementation header for the "FOO" client request test - * interceptor. - * - * @author Ossama Othman <ossama@uci.edu> - */ -//============================================================================= - -#ifndef FOO_CLIENT_REQUEST_INTERCEPTOR_H -#define FOO_CLIENT_REQUEST_INTERCEPTOR_H - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "tao/PI/PI.h" -#include "tao/PortableInterceptorC.h" -#include "tao/LocalObject.h" - -#if defined(_MSC_VER) -#pragma warning(push) -#pragma warning(disable:4250) -#endif /* _MSC_VER */ - -/** - * @class FOO_ClientRequestInterceptor - * - * @brief Simple concrete client request interceptor. - * - * This is a test client request interceptor that extracts a tagged - * component that should have been embedded in the server IOR by an - * IOR interceptor. It displays the contents of that tagged - * component. - */ -class FOO_ClientRequestInterceptor - : public virtual PortableInterceptor::ClientRequestInterceptor, - public virtual TAO_Local_RefCounted_Object -{ -public: - - /// Constructor - FOO_ClientRequestInterceptor (IOP::Codec_ptr codec); - - /** - * @name Methods Required by the Client Request Interceptor - * Interface - * - * These are methods that must be implemented since they are pure - * virtual in the abstract base class. They are the canonical - * methods required for all client request interceptors. - */ - //@{ - /// Return the name of this ClientRequestInterceptor. - virtual char * name (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual void destroy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual void send_request ( - PortableInterceptor::ClientRequestInfo_ptr ri - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)); - - virtual void send_poll ( - PortableInterceptor::ClientRequestInfo_ptr ri - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual void receive_reply ( - PortableInterceptor::ClientRequestInfo_ptr ri - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual void receive_exception ( - PortableInterceptor::ClientRequestInfo_ptr ri - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)); - - virtual void receive_other ( - PortableInterceptor::ClientRequestInfo_ptr ri - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)); - //@} - -private: - - /// The CDR encapsulation coder/decoder used to retrieve data - /// from the CDR encapsulation in the tagged component. - IOP::Codec_var codec_; - -}; - -#if defined(_MSC_VER) -#pragma warning(pop) -#endif /* _MSC_VER */ - -#endif /* FOO_CLIENT_REQUEST_INTERCEPTOR_H */ diff --git a/TAO/tests/Portable_Interceptors/IORInterceptor/FOO_Client_ORBInitializer.cpp b/TAO/tests/Portable_Interceptors/IORInterceptor/FOO_Client_ORBInitializer.cpp deleted file mode 100644 index f999b2f22bb..00000000000 --- a/TAO/tests/Portable_Interceptors/IORInterceptor/FOO_Client_ORBInitializer.cpp +++ /dev/null @@ -1,59 +0,0 @@ -#include "FOO_Client_ORBInitializer.h" -#include "FOO_ClientRequestInterceptor.h" - -#include "tao/ORB_Constants.h" -#include "tao/CodecFactory/CodecFactory.h" - -ACE_RCSID (IORInterceptor, - FOO_Client_ORBInitializer, - "$Id$") - - -void -FOO_Client_ORBInitializer::pre_init ( - PortableInterceptor::ORBInitInfo_ptr /* info */ - ACE_ENV_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ -} - -void -FOO_Client_ORBInitializer::post_init ( - PortableInterceptor::ORBInitInfo_ptr info - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - IOP::CodecFactory_var codec_factory = - info->codec_factory (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - // Set up a structure that contains information necessary to - // create a GIOP 1.2 CDR encapsulation Codec. - IOP::Encoding encoding; - encoding.format = IOP::ENCODING_CDR_ENCAPS; - encoding.major_version = 1; - encoding.minor_version = 2; - - // Obtain the CDR encapsulation Codec. - IOP::Codec_var codec = - codec_factory->create_codec (encoding - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - PortableInterceptor::ClientRequestInterceptor_ptr foo; - ACE_NEW_THROW_EX (foo, - FOO_ClientRequestInterceptor (codec.in ()), - CORBA::NO_MEMORY ( - CORBA::SystemException::_tao_minor_code ( - TAO::VMCID, - ENOMEM), - CORBA::COMPLETED_NO)); - ACE_CHECK; - - PortableInterceptor::ClientRequestInterceptor_var interceptor = - foo; - - info->add_client_request_interceptor (interceptor.in () - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; -} diff --git a/TAO/tests/Portable_Interceptors/IORInterceptor/FOO_Client_ORBInitializer.h b/TAO/tests/Portable_Interceptors/IORInterceptor/FOO_Client_ORBInitializer.h deleted file mode 100644 index a047658b5a8..00000000000 --- a/TAO/tests/Portable_Interceptors/IORInterceptor/FOO_Client_ORBInitializer.h +++ /dev/null @@ -1,74 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file FOO_Client_ORBInitializer.h - * - * $Id$ - * - * Implementation header for the "FOO" IOR test interceptor ORB - * initializer. - * - * @author Ossama Othman <ossama@uci.edu> - */ -//============================================================================= - -#ifndef FOO_CLIENT_ORB_INITIALIZER_H -#define FOO_CLIENT_ORB_INITIALIZER_H - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "tao/PI/PI.h" -#include "tao/LocalObject.h" - -#if defined(_MSC_VER) -#pragma warning(push) -#pragma warning(disable:4250) -#endif /* _MSC_VER */ - -/** - * @class FOO_Client_ORBInitializer - * - * @brief Simple concrete ORB initializer. - * - * This is a test ORB initializer that registers an Client for - * this test. - */ -class FOO_Client_ORBInitializer : - public virtual PortableInterceptor::ORBInitializer, - public virtual TAO_Local_RefCounted_Object -{ -public: - - /** - * @name Methods Required by the ORBInitializer Interface - * - * These are methods that must be implemented since they are pure - * virtual in the abstract base class. They are the canonical - * methods required for all ORB initializers. - */ - //@{ - /// The pre-initialization hook. - virtual void pre_init ( - PortableInterceptor::ORBInitInfo_ptr info - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - /// The post-initialization hook. - virtual void post_init ( - PortableInterceptor::ORBInitInfo_ptr info - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - //@} - -}; - -#if defined(_MSC_VER) -#pragma warning(pop) -#endif /* _MSC_VER */ - -#endif /* FOO_CLIENT_ORB_INITIALIZER_H */ diff --git a/TAO/tests/Portable_Interceptors/IORInterceptor/FOO_IORInterceptor.cpp b/TAO/tests/Portable_Interceptors/IORInterceptor/FOO_IORInterceptor.cpp deleted file mode 100644 index c29013285ff..00000000000 --- a/TAO/tests/Portable_Interceptors/IORInterceptor/FOO_IORInterceptor.cpp +++ /dev/null @@ -1,198 +0,0 @@ -#include "FOO_IORInterceptor.h" -#include "testS.h" - -#include "tao/ORB_Constants.h" - -ACE_RCSID (IORInterceptor, - FOO_IORInterceptor, - "$Id$") - - -FOO_IORInterceptor::FOO_IORInterceptor (IOP::Codec_ptr codec) - : codec_ (IOP::Codec::_duplicate (codec)) -{ -} - -char * -FOO_IORInterceptor::name (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return CORBA::string_dup ("FOO_IORInterceptor"); -} - -void -FOO_IORInterceptor::destroy (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ -} - -void -FOO_IORInterceptor::establish_components ( - PortableInterceptor::IORInfo_ptr info - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - // According to the Portable Interceptors specification, - // IORInterceptor::establish_components() must not throw an - // exception. We check for exceptions despite this fact. The ORB - // does the right thing, and ignores any IOR interceptors that throw - // an exception. - - CORBA::String_var name = this->name (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - CORBA::Any data; - data <<= name.in (); - - CORBA::OctetSeq_var encoded_data = - this->codec_->encode_value (data - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - // Construct a tagged component. - IOP::TaggedComponent component; - - component.tag = FOO::COMPONENT_ID; - - const CORBA::ULong maximum = encoded_data->maximum (); - const CORBA::ULong length = encoded_data->length (); - CORBA::Octet * buffer = encoded_data->get_buffer (); - const CORBA::Boolean release = 0; // OctetSeq retains ownership. - - ACE_ASSERT (maximum > 1); // Sanity check. - ACE_ASSERT (length > 1); // Sanity check. - - component.component_data.replace (maximum, length, buffer, release); - - ACE_ASSERT (component.component_data.length () == length); - - // Add the tagged component to all profiles. - info->add_ior_component (component - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) Added tagged component containing the\n" - "(%P|%t) string \"%s\" to all profiles.\n", - name.in ())); - - - // Add the tagged component to all IIOP profiles. - info->add_ior_component_to_profile (component, - IOP::TAG_INTERNET_IOP - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) Added tagged component containing the\n" - "(%P|%t) string \"%s\" to all IIOP profiles.\n", - name.in ())); - - - ACE_TRY - { - // Verify that policy retrieval internals work, and do not cause - // memory access violations. - CORBA::Policy_var policy = - info->get_effective_policy (PortableServer::THREAD_POLICY_ID - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) Successfully retrieved effective policy.\n")); - } - ACE_CATCH (CORBA::INV_POLICY, ex) - { - if (ex.minor () != (CORBA::OMGVMCID | 3)) - ACE_RE_THROW; - } - ACE_ENDTRY; - ACE_CHECK; -} - -void -FOO_IORInterceptor::components_established ( - PortableInterceptor::IORInfo_ptr info - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - // Construct a dummy tagged component. - IOP::TaggedComponent component; - - component.tag = 0; - component.component_data.length (1); - - - ACE_TRY_EX (ALL) - { - // Add the tagged component to all profiles. - // - // This call should fail since it shouldn't be possible to add - // an IOR component after establish_components() has been - // called. - info->add_ior_component (component - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK_EX (ALL); - - // The above call should NOT have succeeded. - ACE_TRY_THROW_EX (CORBA::INTERNAL (), ALL); - } - ACE_CATCH (CORBA::BAD_INV_ORDER, ex) - { - if (ex.minor () != (CORBA::OMGVMCID | 14)) - { - ACE_PRINT_EXCEPTION (ex, - "Unexpected exception"); - - ACE_RE_THROW_EX (ALL); - } - } - ACE_ENDTRY; - ACE_CHECK; - - ACE_TRY_EX (PROFILE) - { - // Add the tagged component to all profiles. - // - // This call should fail since it shouldn't be possible to add - // an IOR component after establish_components() has been - // called. - info->add_ior_component_to_profile (component, - IOP::TAG_INTERNET_IOP - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK_EX (PROFILE); - - // The above call should NOT have succeeded. - ACE_TRY_THROW_EX (CORBA::INTERNAL (), PROFILE); - } - ACE_CATCH (CORBA::BAD_INV_ORDER, ex) - { - if (ex.minor () != (CORBA::OMGVMCID | 14)) - { - ACE_PRINT_EXCEPTION (ex, - "Unexpected exception"); - - ACE_RE_THROW_EX (PROFILE); - } - } - ACE_ENDTRY; - ACE_CHECK; -} - -void -FOO_IORInterceptor::adapter_manager_state_changed ( - const char *, - PortableInterceptor::AdapterState - ACE_ENV_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ -} - -void -FOO_IORInterceptor:: adapter_state_changed ( - const PortableInterceptor::ObjectReferenceTemplateSeq &, - PortableInterceptor::AdapterState - ACE_ENV_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ -} diff --git a/TAO/tests/Portable_Interceptors/IORInterceptor/FOO_IORInterceptor.h b/TAO/tests/Portable_Interceptors/IORInterceptor/FOO_IORInterceptor.h deleted file mode 100644 index 4fc980070d1..00000000000 --- a/TAO/tests/Portable_Interceptors/IORInterceptor/FOO_IORInterceptor.h +++ /dev/null @@ -1,110 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file FOO_IORInterceptor.h - * - * $Id$ - * - * Implementation header for the "FOO" IOR test interceptor. - * - * @author Ossama Othman <ossama@uci.edu> - */ -//============================================================================= - -#ifndef FOO_IOR_INTERCEPTOR_H -#define FOO_IOR_INTERCEPTOR_H - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "tao/IORInterceptor/IORInterceptor.h" -#include "tao/CodecFactory/CodecFactory.h" -#include "tao/PortableInterceptorC.h" -#include "tao/LocalObject.h" - -#if defined(_MSC_VER) -#pragma warning(push) -#pragma warning(disable:4250) -#endif /* _MSC_VER */ - -/** - * @class FOO_IORInterceptor - * - * @brief Simple concrete IOR interceptor. - * - * This is a test IOR interceptor that embeds a tagged component in an - * IOR. That tagged component will then be verified on the client - * side to ensure that IOR interceptor support is functioning - * properly. - */ -class FOO_IORInterceptor - : public virtual PortableInterceptor::IORInterceptor_3_0, - public virtual TAO_Local_RefCounted_Object -{ -public: - - /// Constructor - FOO_IORInterceptor (IOP::Codec_ptr codec); - - /** - * @name Methods Required by the IOR Interceptor Interface - * - * These are methods that must be implemented since they are pure - * virtual in the abstract base class. They are the canonical - * methods required for all IOR interceptors. - */ - //@{ - /// Return the name of this IORInterceptor. - virtual char * name (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - /// Cleanup resources acquired by this IORInterceptor. - virtual void destroy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - /// Add the tagged components to the IOR. - virtual void establish_components ( - PortableInterceptor::IORInfo_ptr info - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual void components_established ( - PortableInterceptor::IORInfo_ptr info - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual void adapter_manager_state_changed ( - const char * id, - PortableInterceptor::AdapterState state - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC (( - CORBA::SystemException - )); - - virtual void adapter_state_changed ( - const PortableInterceptor::ObjectReferenceTemplateSeq & templates, - PortableInterceptor::AdapterState state - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC (( - CORBA::SystemException - )); - - //@} - -private: - - /// The CDR encapsulation coder/decoder used to encapsulate data - /// into a CDR encapsulation. - IOP::Codec_var codec_; - -}; - -#if defined(_MSC_VER) -#pragma warning(pop) -#endif /* _MSC_VER */ - -#endif /* FOO_IOR_INTERCEPTOR_H */ diff --git a/TAO/tests/Portable_Interceptors/IORInterceptor/FOO_IORInterceptor_ORBInitializer.cpp b/TAO/tests/Portable_Interceptors/IORInterceptor/FOO_IORInterceptor_ORBInitializer.cpp deleted file mode 100644 index 1930da1d6b0..00000000000 --- a/TAO/tests/Portable_Interceptors/IORInterceptor/FOO_IORInterceptor_ORBInitializer.cpp +++ /dev/null @@ -1,60 +0,0 @@ -// -*- C++ -*- - -#include "FOO_IORInterceptor_ORBInitializer.h" -#include "FOO_IORInterceptor.h" - -#include "tao/ORB_Constants.h" -#include "tao/CodecFactory/CodecFactory.h" - -ACE_RCSID (IORInterceptor, - FOO_IORInterceptor_ORBInitializer, - "$Id$") - -void -FOO_IORInterceptor_ORBInitializer::pre_init ( - PortableInterceptor::ORBInitInfo_ptr /* info */ - ACE_ENV_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ -} - -void -FOO_IORInterceptor_ORBInitializer::post_init ( - PortableInterceptor::ORBInitInfo_ptr info - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - IOP::CodecFactory_var codec_factory = - info->codec_factory (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - // Set up a structure that contains information necessary to - // create a GIOP 1.2 CDR encapsulation Codec. - IOP::Encoding encoding; - encoding.format = IOP::ENCODING_CDR_ENCAPS; - encoding.major_version = 1; - encoding.minor_version = 2; - - // Obtain the CDR encapsulation Codec. - IOP::Codec_var codec = - codec_factory->create_codec (encoding - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - PortableInterceptor::IORInterceptor_ptr foo; - ACE_NEW_THROW_EX (foo, - FOO_IORInterceptor (codec.in ()), - CORBA::NO_MEMORY ( - CORBA::SystemException::_tao_minor_code ( - TAO::VMCID, - ENOMEM), - CORBA::COMPLETED_NO)); - ACE_CHECK; - - PortableInterceptor::IORInterceptor_var ior_interceptor = - foo; - - info->add_ior_interceptor (ior_interceptor.in () - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; -} diff --git a/TAO/tests/Portable_Interceptors/IORInterceptor/FOO_IORInterceptor_ORBInitializer.h b/TAO/tests/Portable_Interceptors/IORInterceptor/FOO_IORInterceptor_ORBInitializer.h deleted file mode 100644 index 62daa94f1ae..00000000000 --- a/TAO/tests/Portable_Interceptors/IORInterceptor/FOO_IORInterceptor_ORBInitializer.h +++ /dev/null @@ -1,74 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file FOO_IORInterceptor_ORBInitializer.h - * - * $Id$ - * - * Implementation header for the "FOO" IOR test interceptor ORB - * initializer. - * - * @author Ossama Othman <ossama@uci.edu> - */ -//============================================================================= - -#ifndef FOO_IOR_INTERCEPTOR_ORB_INITIALIZER_H -#define FOO_IOR_INTERCEPTOR_ORB_INITIALIZER_H - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "tao/PI/PI.h" -#include "tao/LocalObject.h" - -#if defined(_MSC_VER) -#pragma warning(push) -#pragma warning(disable:4250) -#endif /* _MSC_VER */ - -/** - * @class FOO_IORInterceptor_ORBInitializer - * - * @brief Simple concrete ORB initializer. - * - * This is a test ORB initializer that registers an IORInterceptor for - * this test. - */ -class FOO_IORInterceptor_ORBInitializer : - public virtual PortableInterceptor::ORBInitializer, - public virtual TAO_Local_RefCounted_Object -{ -public: - - /** - * @name Methods Required by the ORBInitializer Interface - * - * These are methods that must be implemented since they are pure - * virtual in the abstract base class. They are the canonical - * methods required for all ORB initializers. - */ - //@{ - /// The pre-initialization hook. - virtual void pre_init ( - PortableInterceptor::ORBInitInfo_ptr info - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - /// The post-initialization hook. - virtual void post_init ( - PortableInterceptor::ORBInitInfo_ptr info - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - //@} - -}; - -#if defined(_MSC_VER) -#pragma warning(pop) -#endif /* _MSC_VER */ - -#endif /* FOO_IOR_INTERCEPTOR_ORB_INITIALIZER_H */ diff --git a/TAO/tests/Portable_Interceptors/IORInterceptor/PI_IORInterceptor.mpc b/TAO/tests/Portable_Interceptors/IORInterceptor/PI_IORInterceptor.mpc deleted file mode 100644 index fddc7298207..00000000000 --- a/TAO/tests/Portable_Interceptors/IORInterceptor/PI_IORInterceptor.mpc +++ /dev/null @@ -1,22 +0,0 @@ -// -*- MPC -*- -// $Id$ - -project(*Server): taoserver, iorinterceptor, interceptors { - Source_Files { - test_i.cpp - FOO_IORInterceptor_ORBInitializer.cpp - FOO_IORInterceptor.cpp - server.cpp - } -} - -project(*Client): taoclient, pi, interceptors { - after += *Server - Source_Files { - testC.cpp - FOO_Client_ORBInitializer.cpp - FOO_ClientRequestInterceptor.cpp - client.cpp - } -} - diff --git a/TAO/tests/Portable_Interceptors/IORInterceptor/README b/TAO/tests/Portable_Interceptors/IORInterceptor/README deleted file mode 100644 index fe3af0388b9..00000000000 --- a/TAO/tests/Portable_Interceptors/IORInterceptor/README +++ /dev/null @@ -1,28 +0,0 @@ -# $Id$ - -This test verifies that IOR interceptor support is working properly. -It does so by adding a unique tagged component to the IOR. If the -IOR interceptor support is working properly, then the it should be -possible to extract that tagged component from the IOR on the client -side via the - - PortableInterceptor::ClientRequestInfo::get_effective_component() - -method from within a ClientRequestInterceptor, for example. - -Run the test as follows: - - $ perl run_test.pl - -Output should be very similar to the following: - -==== Running IORInterceptor test -(4956|16384) Added tagged component containing the -(4956|16384) string "FOO_IORInterceptor" to all profiles. -(4956|16384) Added tagged component containing the -(4956|16384) string "FOO_IORInterceptor" to all IIOP profiles. -(4956|16384) Successfully retrieved effective policy. -FOO::test: <IOR:...> -(4957|16384) String extracted from tagged component data: FOO_IORInterceptor -"test_i" is shutting down. -Event loop finished. diff --git a/TAO/tests/Portable_Interceptors/IORInterceptor/client.cpp b/TAO/tests/Portable_Interceptors/IORInterceptor/client.cpp deleted file mode 100644 index a482b81963e..00000000000 --- a/TAO/tests/Portable_Interceptors/IORInterceptor/client.cpp +++ /dev/null @@ -1,95 +0,0 @@ -// -*- C++ -*- - -#include "ace/Get_Opt.h" - -#include "testC.h" -#include "FOO_Client_ORBInitializer.h" - -#include "tao/ORBInitializer_Registry.h" - -ACE_RCSID (IORInterceptor, - client, - "$Id$") - -const char *ior = "file://test.ior"; - -int -parse_args (int argc, char *argv[]) -{ - ACE_Get_Opt get_opts (argc, argv, "k:"); - int c; - - while ((c = get_opts ()) != -1) - switch (c) - { - case 'k': - ior = get_opts.opt_arg (); - break; - default: - ACE_ERROR_RETURN ((LM_ERROR, - "Usage: %s " - "-k IOR " - "\n", - argv[0]), - -1); - } - return 0; -} - -int -main (int argc, char *argv[]) -{ - ACE_DECLARE_NEW_CORBA_ENV; - ACE_TRY - { -#if TAO_HAS_INTERCEPTORS == 1 - PortableInterceptor::ORBInitializer_ptr temp_initializer = - PortableInterceptor::ORBInitializer::_nil (); - - ACE_NEW_RETURN (temp_initializer, - FOO_Client_ORBInitializer, - -1); // No exceptions yet! - PortableInterceptor::ORBInitializer_var orb_initializer = - temp_initializer; - - PortableInterceptor::register_orb_initializer (orb_initializer.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; -#endif /* TAO_HAS_INTERCEPTORS == 1 */ - - CORBA::ORB_var orb = - CORBA::ORB_init (argc, argv, "client_orb" ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (parse_args (argc, argv) != 0) - return 1; - - CORBA::Object_var obj = - orb->string_to_object (ior ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - FOO::test_var server = - FOO::test::_narrow (obj.in () ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (CORBA::is_nil (server.in ())) - { - ACE_ERROR_RETURN ((LM_ERROR, - "Object reference <%s> is nil.\n", - ior), - 1); - } - - server->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, - "IORInterceptor test (client-side):"); - return -1; - } - ACE_ENDTRY; - - return 0; -} diff --git a/TAO/tests/Portable_Interceptors/IORInterceptor/run_test.pl b/TAO/tests/Portable_Interceptors/IORInterceptor/run_test.pl deleted file mode 100755 index d6c417c48cb..00000000000 --- a/TAO/tests/Portable_Interceptors/IORInterceptor/run_test.pl +++ /dev/null @@ -1,50 +0,0 @@ -eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' - & eval 'exec perl -S $0 $argv:q' - if 0; - -# -*- perl -*- -# $Id$ - -use lib '../../../../bin'; -use PerlACE::Run_Test; - -$status = 0; -$file = PerlACE::LocalFile ("test.ior"); - -unlink $file; - -if (PerlACE::is_vxworks_test()) { - $SV = new PerlACE::ProcessVX ("server", "-o test.ior"); -} -else { - $SV = new PerlACE::Process ("server", "-o $file"); -} -$CL = new PerlACE::Process ("client", "-k file://$file"); - -print STDERR "\n\n==== Running IORInterceptor test\n"; - -$SV->Spawn (); - -if (PerlACE::waitforfile_timed ($file, 15) == -1) { - print STDERR "ERROR: cannot find file <$file>\n"; - $SV->Kill (); - exit 1; -} - -$client = $CL->SpawnWaitKill (60); - -if ($client != 0) { - print STDERR "ERROR: client returned $client\n"; - $status = 1; -} - -$server = $SV->WaitKill (5); - -if ($server != 0) { - print STDERR "ERROR: server returned $server\n"; - $status = 1; -} - -unlink $file; - -exit $status; diff --git a/TAO/tests/Portable_Interceptors/IORInterceptor/server.cpp b/TAO/tests/Portable_Interceptors/IORInterceptor/server.cpp deleted file mode 100644 index a91cf021548..00000000000 --- a/TAO/tests/Portable_Interceptors/IORInterceptor/server.cpp +++ /dev/null @@ -1,148 +0,0 @@ -// -*- C++ -*- - -#include "ace/Get_Opt.h" - -#include "test_i.h" -#include "FOO_IORInterceptor_ORBInitializer.h" - -#include "tao/ORBInitializer_Registry.h" -#include "ace/OS_NS_stdio.h" - -ACE_RCSID (IORInterceptor, - server, - "$Id$") - -const char *ior_output_file = "test.ior"; - -int -parse_args (int argc, char *argv[]) -{ - ACE_Get_Opt get_opts (argc, argv, "o:"); - int c; - - while ((c = get_opts ()) != -1) - switch (c) - { - case 'o': - ior_output_file = get_opts.opt_arg (); - break; - default: - ACE_ERROR_RETURN ((LM_ERROR, - "Usage: %s " - "-o <iorfile>" - "\n", - argv[0]), - -1); - } - - // Indicates sucessful parsing of the command line - return 0; -} - -int -main (int argc, char *argv[]) -{ - ACE_DECLARE_NEW_CORBA_ENV; - ACE_TRY - { -#if TAO_HAS_INTERCEPTORS == 1 - PortableInterceptor::ORBInitializer_ptr temp_initializer = - PortableInterceptor::ORBInitializer::_nil (); - - ACE_NEW_RETURN (temp_initializer, - FOO_IORInterceptor_ORBInitializer, - -1); // No CORBA exceptions yet! - PortableInterceptor::ORBInitializer_var orb_initializer = - temp_initializer; - - PortableInterceptor::register_orb_initializer (orb_initializer.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - -#endif /* TAO_HAS_INTERCEPTORS == 1 */ - - CORBA::ORB_var orb = CORBA::ORB_init (argc, - argv, - "test_orb" - 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 root_poa = - PortableServer::POA::_narrow (obj.in () ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (CORBA::is_nil (root_poa.in ())) - ACE_ERROR_RETURN ((LM_ERROR, - "Unable to obtain RootPOA reference.\n"), - -1); - - PortableServer::POAManager_var poa_manager = - root_poa->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - poa_manager->activate (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (parse_args (argc, argv) != 0) - return -1; - - test_i server_impl (orb.in ()); - - obj = server_impl._this (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - FOO::test_var server = FOO::test::_narrow (obj.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (CORBA::is_nil (server.in ())) - ACE_ERROR_RETURN ((LM_ERROR, - "Unable to obtain reference to FOO::test " - "object.\n"), - -1); - - CORBA::String_var ior = - orb->object_to_string (server.in () ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - ACE_DEBUG ((LM_INFO, "FOO::test: <%s>\n", ior.in ())); - - // If the ior_output_file exists, output the IOR to it. - if (ior_output_file != 0) - { - FILE *output_file = ACE_OS::fopen (ior_output_file, "w"); - if (output_file == 0) - ACE_ERROR_RETURN ((LM_ERROR, - "Cannot open output file for writing " - "IOR: %s", - ior_output_file), - 1); - ACE_OS::fprintf (output_file, "%s", ior.in ()); - ACE_OS::fclose (output_file); - } - - orb->run (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - ACE_DEBUG ((LM_INFO, "Event loop finished.\n")); - - // The interceptors will be destroyed when we call this - orb->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, - "IORInterceptor test (server-side):"); - - return -1; - } - ACE_ENDTRY; - - return 0; -} diff --git a/TAO/tests/Portable_Interceptors/IORInterceptor/test.idl b/TAO/tests/Portable_Interceptors/IORInterceptor/test.idl deleted file mode 100644 index f6914d3edcc..00000000000 --- a/TAO/tests/Portable_Interceptors/IORInterceptor/test.idl +++ /dev/null @@ -1,30 +0,0 @@ -// -*- IDL -*- - -//============================================================================= -/** - * @file test.idl - * - * $Id$ - * - * "test" IDL interface for the IORInterceptor test. - * - * @author Ossama Othman <ossama@uci.edu> - */ -//============================================================================= - - -#include "tao/IOP.pidl" - -module FOO -{ - - interface test - { - oneway void shutdown (); - }; - - // @@ Hopefully, this tagged component ID won't be reserved by - // anything, anytime soon. - const IOP::ComponentId COMPONENT_ID = 3456; - -}; diff --git a/TAO/tests/Portable_Interceptors/IORInterceptor/test_i.cpp b/TAO/tests/Portable_Interceptors/IORInterceptor/test_i.cpp deleted file mode 100644 index ecdb6b3560f..00000000000 --- a/TAO/tests/Portable_Interceptors/IORInterceptor/test_i.cpp +++ /dev/null @@ -1,21 +0,0 @@ -// -*- C++ -*- - -#include "test_i.h" - -ACE_RCSID (IORInterceptors, - test_i, - "$Id$") - -test_i::test_i (CORBA::ORB_ptr orb) - : orb_ (CORBA::ORB::_duplicate (orb)) -{ -} - -void -test_i::shutdown (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - ACE_DEBUG ((LM_DEBUG, - "\"test_i\" is shutting down.\n")); - this->orb_->shutdown (0 ACE_ENV_ARG_PARAMETER); -} diff --git a/TAO/tests/Portable_Interceptors/IORInterceptor/test_i.h b/TAO/tests/Portable_Interceptors/IORInterceptor/test_i.h deleted file mode 100644 index a712ff5c8d7..00000000000 --- a/TAO/tests/Portable_Interceptors/IORInterceptor/test_i.h +++ /dev/null @@ -1,47 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file test_i.h - * - * $Id$ - * - * Implementation header for the "test" IDL interface for the - * IORInterceptor test. - * - * @author Ossama Othman <ossama@uci.edu> - */ -//============================================================================= - -#ifndef TEST_I_H -#define TEST_I_H - -#include "testS.h" - -/** - * @class test_i - * - * @brief Simple test class. - * - * This class exists only to make it possible to generate an IOR to - * which the test IOR interceptor will add a tagged component. - */ -class test_i : public virtual POA_FOO::test -{ -public: - - /// Constructor. - test_i (CORBA::ORB_ptr orb); - - /// Shutdown the ORB. - virtual void shutdown (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - -private: - - /// Pseudo-reference to the ORB. - CORBA::ORB_var orb_; - -}; - -#endif /* TEST_I_H */ |