diff options
author | William R. Otte <wotte@dre.vanderbilt.edu> | 2006-07-24 15:50:11 +0000 |
---|---|---|
committer | William R. Otte <wotte@dre.vanderbilt.edu> | 2006-07-24 15:50:11 +0000 |
commit | 6b846cf03c0bcbd8c276cb0af61a181e5f98eaae (patch) | |
tree | da50d054f9c761c3f6a5923f6979e93306c56d68 /TAO/tests/Portable_Interceptors/Request_Interceptor_Flow | |
parent | 0e555b9150d38e3b3473ba325b56db2642e6352b (diff) | |
download | ATCD-6b846cf03c0bcbd8c276cb0af61a181e5f98eaae.tar.gz |
Repo restructuring
Diffstat (limited to 'TAO/tests/Portable_Interceptors/Request_Interceptor_Flow')
19 files changed, 0 insertions, 1965 deletions
diff --git a/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/.cvsignore b/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/.cvsignore deleted file mode 100644 index f2ad85300eb..00000000000 --- a/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -client -server diff --git a/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/Client_ORBInitializer.cpp b/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/Client_ORBInitializer.cpp deleted file mode 100644 index ceb1ab95ee1..00000000000 --- a/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/Client_ORBInitializer.cpp +++ /dev/null @@ -1,77 +0,0 @@ -#include "Client_ORBInitializer.h" - -ACE_RCSID (Request_Interceptor_Flow, - Client_ORBInitializer, - "$Id$") - - -#include "tao/Exception.h" -#include "tao/ORB_Constants.h" - -#include "Client_Request_Interceptor.h" - - -void -Client_ORBInitializer::pre_init ( - PortableInterceptor::ORBInitInfo_ptr - ACE_ENV_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ -} - -void -Client_ORBInitializer::post_init ( - PortableInterceptor::ORBInitInfo_ptr info - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - - // Create and register the test request interceptors. - PortableInterceptor::ClientRequestInterceptor_ptr ci = - PortableInterceptor::ClientRequestInterceptor::_nil (); - ACE_NEW_THROW_EX (ci, - Client_Request_Interceptor ("CLIENT A"), - CORBA::NO_MEMORY ( - CORBA::SystemException::_tao_minor_code ( - TAO::VMCID, - ENOMEM), - CORBA::COMPLETED_NO)); - ACE_CHECK; - - PortableInterceptor::ClientRequestInterceptor_var ci_interceptor = - ci; - - info->add_client_request_interceptor (ci_interceptor.in () - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - ACE_NEW_THROW_EX (ci, - Client_Request_Interceptor ("CLIENT B"), - CORBA::NO_MEMORY ( - CORBA::SystemException::_tao_minor_code ( - TAO::VMCID, - ENOMEM), - CORBA::COMPLETED_NO)); - ACE_CHECK; - - ci_interceptor = ci; - - info->add_client_request_interceptor (ci_interceptor.in () - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - ACE_NEW_THROW_EX (ci, - Client_Request_Interceptor ("CLIENT C"), - CORBA::NO_MEMORY ( - CORBA::SystemException::_tao_minor_code ( - TAO::VMCID, - ENOMEM), - CORBA::COMPLETED_NO)); - ACE_CHECK; - - ci_interceptor = ci; - - info->add_client_request_interceptor (ci_interceptor.in () - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; -} diff --git a/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/Client_ORBInitializer.h b/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/Client_ORBInitializer.h deleted file mode 100644 index 9a14c62287c..00000000000 --- a/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/Client_ORBInitializer.h +++ /dev/null @@ -1,64 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Client_ORBInitializer.h - * - * $Id$ - * - * @author Ossama Othman <ossama@uci.edu> - */ -//============================================================================= - - -#ifndef TAO_CLIENT_ORB_INITIALIZER_H -#define TAO_CLIENT_ORB_INITIALIZER_H - -#include /**/ "ace/pre.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" - -// This is to remove "inherits via dominance" warnings from MSVC. -// MSVC is being a little too paranoid. -#if defined(_MSC_VER) -#pragma warning(push) -#pragma warning(disable:4250) -#endif /* _MSC_VER */ - -/** - * @name Client_ORBInitializer - * - * @brief - * ORB initializer that registers all client request interceptors used - * in this test. - */ -class Client_ORBInitializer : - public virtual PortableInterceptor::ORBInitializer, - public virtual TAO_Local_RefCounted_Object -{ -public: - - virtual void pre_init (PortableInterceptor::ORBInitInfo_ptr info - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - 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 */ - -#include /**/ "ace/post.h" - -#endif /* TAO_CLIENT_ORB_INITIALIZER_H */ diff --git a/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/Client_Request_Interceptor.cpp b/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/Client_Request_Interceptor.cpp deleted file mode 100644 index dba6578f6f2..00000000000 --- a/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/Client_Request_Interceptor.cpp +++ /dev/null @@ -1,273 +0,0 @@ -// -*- C++ -*- - -#include "Client_Request_Interceptor.h" -#include "testC.h" - -#include "tao/AnyTypeCode/TypeCode.h" -#include "tao/AnyTypeCode/AnyTypeCode_Adapter_Impl.h" -#include "ace/OS_NS_string.h" - -ACE_RCSID (Request_Interceptor_Flow, - Client_Request_Interceptor, - "$Id$") - -Client_Request_Interceptor::Client_Request_Interceptor (const char *name) - : Request_Interceptor (name) -{ -} - -void -Client_Request_Interceptor::send_request ( - PortableInterceptor::ClientRequestInfo_ptr ri - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)) -{ - CORBA::Boolean client_side = - this->client_side_test (ri ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - if (!client_side) - return; // Don't continue if the server side is being tested. - - ACE_DEBUG ((LM_INFO, - "%s.send_request", - this->name_.in ())); - - if (ACE_OS::strcmp ("CLIENT B", this->name_.in ()) == 0) - { - // Determine which test scenario we are in - Dynamic::ParameterList_var paramlist = - ri->arguments (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - Test::TestScenario scenario; - CORBA::ULong i = 0; // index -- explicitly used to avoid - // overloaded operator ambiguity. - if (paramlist[i].argument >>= scenario) - { - switch (scenario) - { - case 2: - // We can only throw a CORBA::SystemException or a - // PortableInteceptor::ForwardRequest exception due to - // the restricted exception specification dictated by - // the IDL for request interceptors. As such, an - // arbitrary CORBA::SystemException was chosen - // (NO_PERMISSION, in this case). - ACE_DEBUG ((LM_DEBUG, - " raised CORBA::NO_PERMISSION exception\n")); - ACE_THROW (CORBA::NO_PERMISSION ()); // Expected exception. - - default: - break; - } - } - else - ACE_ERROR ((LM_ERROR, - "\nERROR: send_request - Could not extract " - "arguments.\n")); - } - - ACE_DEBUG ((LM_DEBUG, - "\n")); - - this->starting_interception_point_count_++; -} - -void -Client_Request_Interceptor::send_poll ( - PortableInterceptor::ClientRequestInfo_ptr ri - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - - CORBA::Boolean client_side = - this->client_side_test (ri ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - if (!client_side) - return; // Don't continue if the server side is being tested. - - ACE_DEBUG ((LM_INFO, - "%s.send_poll\n", - this->name_.in ())); - - this->starting_interception_point_count_++; -} - -void -Client_Request_Interceptor::receive_reply ( - PortableInterceptor::ClientRequestInfo_ptr ri - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - - CORBA::Boolean client_side = - this->client_side_test (ri ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - if (!client_side) - return; // Don't continue if the server side is being tested. - - this->ending_interception_point_count_++; - - ACE_DEBUG ((LM_INFO, - "%s.receive_reply", - this->name_.in ())); - - if (ACE_OS::strcmp ("CLIENT B", this->name_.in ()) == 0) - { - // Determine which test scenario we are in - Dynamic::ParameterList_var paramlist = - ri->arguments (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - Test::TestScenario scenario; - CORBA::ULong i = 0; // index -- explicitly used to avoid - // overloaded operator ambiguity. - if (paramlist[i].argument >>= scenario) - { - switch (scenario) - { - case 3: - // We can only throw a CORBA::SystemException or a - // PortableInteceptor::ForwardRequest exception due to - // the restricted exception specification dictated by - // the IDL for request interceptors. As such, an - // arbitrary CORBA::SystemException was chosen - // (NO_PERMISSION, in this case). - ACE_DEBUG ((LM_DEBUG, - " raised CORBA::NO_PERMISSION exception\n")); - ACE_THROW (CORBA::NO_PERMISSION ()); // Expected exception. - - default: - break; - } - } - else - ACE_ERROR ((LM_ERROR, - "\nERROR: receive_reply - Could not extract " - "arguments.\n")); - } - - ACE_DEBUG ((LM_DEBUG, - "\n")); -} - -void -Client_Request_Interceptor::receive_exception ( - PortableInterceptor::ClientRequestInfo_ptr ri - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)) -{ - - CORBA::Boolean client_side = - this->client_side_test (ri ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - if (!client_side) - return; // Don't continue if the server side is being tested. - - this->ending_interception_point_count_++; - - ACE_DEBUG ((LM_INFO, - "%s.receive_exception", - this->name_.in ())); - - if (ACE_OS::strcmp ("CLIENT B", this->name_.in ()) == 0) - { - // Determine which test scenario we are in - Dynamic::ParameterList_var paramlist = - ri->arguments (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - Test::TestScenario scenario; - CORBA::ULong i = 0; // index -- explicitly used to avoid - // overloaded operator ambiguity. - if (paramlist[i].argument >>= scenario) - { - CORBA::Any_var exception; - CORBA::TypeCode_var tc; - const char * id = 0; - - switch (scenario) - { - case 4: - exception = ri->received_exception (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - tc = exception->type (); - - id = tc->id (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - if (ACE_OS::strcmp (id, "IDL:Test/X:1.0") == 0) - { - // We can only throw a CORBA::SystemException or a - // PortableInteceptor::ForwardRequest exception due - // to the restricted exception specification - // dictated by the IDL for request interceptors. As - // such, an arbitrary CORBA::SystemException was - // chosen (NO_PERMISSION, in this case). - ACE_DEBUG ((LM_DEBUG, - " transformed Test::X exception to " - "CORBA::NO_PERMISSION exception\n")); - - // Expected exception. - ACE_THROW (CORBA::NO_PERMISSION ()); - } - else - { - ACE_ERROR ((LM_ERROR, - "\nERROR: receive_exception - Received " - "unexpected exception!\n")); - } - break; - default: - break; - } - } - else - ACE_ERROR ((LM_ERROR, - "\nERROR: receive_exception - Could not extract " - "arguments.\n")); - } - - ACE_DEBUG ((LM_DEBUG, - "\n")); -} - -void -Client_Request_Interceptor::receive_other ( - PortableInterceptor::ClientRequestInfo_ptr ri - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)) -{ - - CORBA::Boolean client_side = - this->client_side_test (ri ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - if (!client_side) - return; // Don't continue if the server side is being tested. - - this->ending_interception_point_count_++; - - ACE_DEBUG ((LM_INFO, - "%s.receive_other\n", - this->name_.in ())); -} - -CORBA::Boolean -Client_Request_Interceptor::client_side_test ( - PortableInterceptor::ClientRequestInfo_ptr info - ACE_ENV_ARG_DECL) -{ - CORBA::String_var op = info->operation (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - - return ACE_OS::strcmp (op.in (), "client_test") == 0 ? 1 : 0; -} diff --git a/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/Client_Request_Interceptor.h b/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/Client_Request_Interceptor.h deleted file mode 100644 index bb1f24cbdcc..00000000000 --- a/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/Client_Request_Interceptor.h +++ /dev/null @@ -1,105 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Client_Request_Interceptor.h - * - * $Id$ - * - * Implementation header for the client request interceptor for the - * request interceptor flow test. - * - * @author Ossama Othman <ossama@uci.edu> - */ -//============================================================================= - -#ifndef CLIENT_REQUEST_INTERCEPTOR_H -#define CLIENT_REQUEST_INTERCEPTOR_H - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "Request_Interceptor.h" - -#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 Client_Request_Interceptor - * - * @brief Client request interceptor that exercises - * PortableInterceptor::ForwardRequest support. - * - */ -class Client_Request_Interceptor - : public virtual PortableInterceptor::ClientRequestInterceptor, - public virtual TAO_Local_RefCounted_Object, - public virtual Request_Interceptor -{ -public: - - /// Constructor. - Client_Request_Interceptor (const char *name); - - /** - * @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. - */ - //@{ - 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: - - // Returns 1 if the client-side test is currently being run, and 0 - // otherwise. - CORBA::Boolean client_side_test ( - PortableInterceptor::ClientRequestInfo_ptr info - ACE_ENV_ARG_DECL); - -}; - -#if defined(_MSC_VER) -#pragma warning(pop) -#endif /* _MSC_VER */ - -#endif /* CLIENT_REQUEST_INTERCEPTOR_H */ diff --git a/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/PI_Request_Interceptor_Flow.mpc b/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/PI_Request_Interceptor_Flow.mpc deleted file mode 100644 index ee81ede8553..00000000000 --- a/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/PI_Request_Interceptor_Flow.mpc +++ /dev/null @@ -1,24 +0,0 @@ -// -*- MPC -*- -// $Id$ - -project(*Server): taoserver, pi_server, interceptors { - Source_Files { - test_i.cpp - Server_ORBInitializer.cpp - Server_Request_Interceptor.cpp - Request_Interceptor.cpp - server.cpp - } -} - -project(*Client): taoclient, pi, interceptors { - after += *Server - Source_Files { - testC.cpp - Client_ORBInitializer.cpp - Client_Request_Interceptor.cpp - Request_Interceptor.cpp - client.cpp - } -} - diff --git a/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/README b/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/README deleted file mode 100644 index 2db42413933..00000000000 --- a/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/README +++ /dev/null @@ -1,168 +0,0 @@ -# $Id$ - -NOTE: The code in this test is highly specialized and very brittle. - Do not use it as a model for "real world" interceptor code. - - -This test verifies that proper request interceptor flow semantics -occur during a given request/invocation. It does so by executing a -canned (hard-coded) set of scenarios. Each scenario excercises a -specific flow behavior. All scenarios correspond to the ones detailed -in the Portable Interceptor specification (00-04-05). They are listed -below: - -Client Request Interceptor Flow -=============================== - -Given client request interceptors A, B and C. - ------------------------------------------------------------------------- - - Scenario 1: an exception arrives from the server: - - A.send_request is called; - B.send_request is called; - C.send_request is called; - C.receive_exception is called; - B.receive_exception is called; - A.receive_exception is called. - -The starting interception point (send_request) on each of the -client request interceptors was invoked successfully, so the ending -interception point (receive_exception in this case since the server -raised an exception) will be invoked on each of the client request -interceptors. - ------------------------------------------------------------------------- - - Scenario 2: B.send_request raises an exception: - A.send_request is called; - B.send_request is called and raises an exception - A.receive_exception is called. - -Only the starting interception point (send_request) on client request -interceptor A was completed successfully, so only its ending -interception point (receive_exception in this case) will be invoked. -No ending interception point from interceptor B will be invoked. - ------------------------------------------------------------------------- - - Scenario 3: a reply returns successfully from the server, but - B.receive_reply raises an exception: - - A.send_request is called; - B.send_request is called; - C.send_request is called; - C.receive_reply is called; - B.receive_reply is called and raises an exception - A.receive_exception is called. - -Since B.receive_reply raises an exception, and since B's and C's -ending interception point (receive_reply) has already been invoked, -then only A's ending interception point is invoked since it hasn't -been invoked yet. In this case, since an exception was raised, A's -receive_exception ending interception point is invoked. - ------------------------------------------------------------------------- - - Scenario 4: an exception X is returned by the server, but - B.receive_exception changes the exception to Y: - - A.send_request is called; - B.send_request is called; - C.send_request is called; - C.receive_exception is called with X; - B.receive_exception is called with X, raises Y; - A.receive_exception is called with Y. - -Since each client request interceptor's starting interception point -(send_request) was invoked, each client request interceptor's ending -interception point (receive_exception in this case) will be invoked. -However, A's receive_exception ending interception point will be -handed exception Y instead of exception X. - -************************************************************************ - -Server Request Interceptor Flow -=============================== - -Given server request interceptors A, B and C. - ------------------------------------------------------------------------- - - Scenario 1: an exception is raised by the target: - - A.receive_request_service_contexts is called; - B.receive_request_service_contexts is called; - C.receive_request_service_contexts is called; - A.receive_request is called; - B.receive_request is called; - C.receive_request is called; - C.send_exception is called; - B.send_exception is called; - A.send_exception is called. - -Each server request interceptor's starting interception point -(receive_request_service_contexts) was invoked, meaning that each -server request interceptor's intermediate interception point -(receive_request) will be invoked. The operation itself raises an -exception, meaning that each server request interceptor's ending -interception point (send_exception) will be invoked. - ------------------------------------------------------------------------- - - Scenario 2: B.receive_request_service_contexts raises an exception: - - A.receive_request_service_contexts is called; - B.receive_request_service_contexts is called and raises an exception - A.send_exception is called. - -Only interceptor A's starting interception point -(receive_request_service_contexts) was completed successfully, so only -its ending interception point (send_exception in this case) will be -invoked. - ------------------------------------------------------------------------- - - Scenario 3: the target invocation returns successfully, but - B.send_reply raises an exception: - - A.receive_request_service_contexts is called; - B.receive_request_service_contexts is called; - C.receive_request_service_contexts is called; - A.receive_request is called; - B.receive_request is called; - C.receive_request is called; - C.send_reply is called; - B.send_reply is called and raises an exception; - A.send_exception is called. - -Each server request interceptor's starting interception point was -invoked successfully, so each will have one (and only one) of its -ending interception points (send_reply or send_exception) invoked. In -this case, B's send_reply interception point raises an exception. B's -and C's ending interception point has already been invoked so only A's -send_exception (rather thans send_reply) ending interception point is -invoked. - ------------------------------------------------------------------------- - - Scenario 4: an exception X is raised by the target, but - B.send_exception changes the exception to Y: - - A.receive_request_service_contexts is called; - B.receive_request_service_contexts is called; - C.receive_request_service_contexts is called; - A.receive_request is called; - B.receive_request is called; - C.receive_request is called; - C.send_exception is called with X; - B.send_exception is called with X, raises Y; - A.send_exception is called with Y. - -Since each server request interceptor's starting interception point -(receive_request_service_contexts) was invoked, each server request -interceptor's ending interception point (receive_exception in this -case) will be invoked. However, A's send_exception ending -interception point will be handed exception Y exception instead of -exception X. diff --git a/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/Request_Interceptor.cpp b/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/Request_Interceptor.cpp deleted file mode 100644 index c918a767b2c..00000000000 --- a/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/Request_Interceptor.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// -*- C++ -*- - -#include "Request_Interceptor.h" - -ACE_RCSID (Request_Interceptor_Flow, - Request_Interceptor, - "$Id$") - -Request_Interceptor::Request_Interceptor (const char *name) - : name_ (name), - starting_interception_point_count_ (0), - ending_interception_point_count_ (0) -{ -} - -char * -Request_Interceptor::name ( - ACE_ENV_SINGLE_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return CORBA::string_dup (this->name_.in ()); -} - -void -Request_Interceptor::destroy (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - - CORBA::ULong s_count = - this->starting_interception_point_count_.value (); - - CORBA::ULong e_count = - this->ending_interception_point_count_.value (); - - if (s_count == 0) - { - ACE_ERROR ((LM_ERROR, - "(%P) ERROR: Interceptor %d \"%s\"\n" - "(%P) The number of starting interception point calls " - "is zero\n", s_count, - this->name_.in ())); - - ACE_THROW (CORBA::INTERNAL ()); - } - - if (e_count == 0) - { - ACE_ERROR ((LM_ERROR, - "(%P) ERROR: Interceptor %d \"%s\"\n" - "(%P) The number of ending interception point calls" - "is zero\n", - e_count, this->name_.in ())); - - ACE_THROW (CORBA::INTERNAL ()); - } - - if (s_count != e_count) - { - ACE_ERROR ((LM_ERROR, - "(%P) ERROR: Interceptor \"%s\"\n" - "(%P) The number of starting interception point " - "calls (%u)\n" - "(%P) did not equal the number of ending " - "interception \n" - "(%P) point calls (%u).\n\n", - this->name_.in (), - s_count, - e_count)); - - ACE_THROW (CORBA::INTERNAL ()); - } -} diff --git a/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/Request_Interceptor.h b/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/Request_Interceptor.h deleted file mode 100644 index ade0ae89891..00000000000 --- a/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/Request_Interceptor.h +++ /dev/null @@ -1,89 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Request_Interceptor.h - * - * $Id$ - * - * Implementation header for the request interceptor base class for - * the request interceptor flow test. - * - * @author Ossama Othman <ossama@uci.edu> - */ -//============================================================================= - -#ifndef REQUEST_INTERCEPTOR_H -#define 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" -#include "tao/CORBA_String.h" - -#include "ace/Atomic_Op.h" - -#if defined(_MSC_VER) -#pragma warning(push) -#pragma warning(disable:4250) -#endif /* _MSC_VER */ - -/** - * @class Request_Interceptor - * - * @brief Abstract base class for request interceptors used in this - * test. - */ -class Request_Interceptor - : public virtual PortableInterceptor::Interceptor -{ -public: - - /// Constructor. - Request_Interceptor (const char *name); - - /** - * @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 Requestinterceptor. - 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)); - //@} - -protected: - - /// The name of this interceptor. - CORBA::String_var name_; - - /// The number of times a starting interception point has been - /// called. - ACE_Atomic_Op<TAO_SYNCH_MUTEX, CORBA::ULong> - starting_interception_point_count_; - - /// The number of times an ending interception point has been - /// called. - ACE_Atomic_Op<TAO_SYNCH_MUTEX, CORBA::ULong> - ending_interception_point_count_; - -}; - -#if defined(_MSC_VER) -#pragma warning(pop) -#endif /* _MSC_VER */ - -#endif /* REQUEST_INTERCEPTOR_H */ diff --git a/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/Server_ORBInitializer.cpp b/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/Server_ORBInitializer.cpp deleted file mode 100644 index eaf11509671..00000000000 --- a/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/Server_ORBInitializer.cpp +++ /dev/null @@ -1,75 +0,0 @@ -#include "Server_ORBInitializer.h" - -ACE_RCSID (Request_Interceptor_Flow, - Server_ORBInitializer, - "$Id$") - -#include "tao/Exception.h" -#include "tao/ORB_Constants.h" - -#include "Server_Request_Interceptor.h" - -void -Server_ORBInitializer::pre_init ( - PortableInterceptor::ORBInitInfo_ptr - ACE_ENV_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ -} - -void -Server_ORBInitializer::post_init ( - PortableInterceptor::ORBInitInfo_ptr info - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - - // Create and register the test request interceptors. - PortableInterceptor::ServerRequestInterceptor_ptr si = - PortableInterceptor::ServerRequestInterceptor::_nil (); - ACE_NEW_THROW_EX (si, - Server_Request_Interceptor ("SERVER A"), - CORBA::NO_MEMORY ( - CORBA::SystemException::_tao_minor_code ( - TAO::VMCID, - ENOMEM), - CORBA::COMPLETED_NO)); - ACE_CHECK; - - PortableInterceptor::ServerRequestInterceptor_var si_interceptor = - si; - - info->add_server_request_interceptor (si_interceptor.in () - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - ACE_NEW_THROW_EX (si, - Server_Request_Interceptor ("SERVER B"), - CORBA::NO_MEMORY ( - CORBA::SystemException::_tao_minor_code ( - TAO::VMCID, - ENOMEM), - CORBA::COMPLETED_NO)); - ACE_CHECK; - - si_interceptor = si; - - info->add_server_request_interceptor (si_interceptor.in () - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - ACE_NEW_THROW_EX (si, - Server_Request_Interceptor ("SERVER C"), - CORBA::NO_MEMORY ( - CORBA::SystemException::_tao_minor_code ( - TAO::VMCID, - ENOMEM), - CORBA::COMPLETED_NO)); - ACE_CHECK; - - si_interceptor = si; - - info->add_server_request_interceptor (si_interceptor.in () - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; -} diff --git a/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/Server_ORBInitializer.h b/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/Server_ORBInitializer.h deleted file mode 100644 index 0d011a67032..00000000000 --- a/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/Server_ORBInitializer.h +++ /dev/null @@ -1,64 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Server_ORBInitializer.h - * - * $Id$ - * - * @author Ossama Othman <ossama@uci.edu> - */ -//============================================================================= - - -#ifndef TAO_SERVER_ORB_INITIALIZER_H -#define TAO_SERVER_ORB_INITIALIZER_H - -#include /**/ "ace/pre.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" - -// This is to remove "inherits via dominance" warnings from MSVC. -// MSVC is being a little too paranoid. -#if defined(_MSC_VER) -#pragma warning(push) -#pragma warning(disable:4250) -#endif /* _MSC_VER */ - -/** - * @name Server_ORBInitializer - * - * @brief - * ORB initializer that registers all server request interceptors used - * in this test. - */ -class Server_ORBInitializer : - public virtual PortableInterceptor::ORBInitializer, - public virtual TAO_Local_RefCounted_Object -{ -public: - - virtual void pre_init (PortableInterceptor::ORBInitInfo_ptr info - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - 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 */ - -#include /**/ "ace/post.h" - -#endif /* TAO_SERVER_ORB_INITIALIZER_H */ diff --git a/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/Server_Request_Interceptor.cpp b/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/Server_Request_Interceptor.cpp deleted file mode 100644 index 45e9c1b1650..00000000000 --- a/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/Server_Request_Interceptor.cpp +++ /dev/null @@ -1,263 +0,0 @@ -// -*- C++ -*- - -#include "Server_Request_Interceptor.h" - -ACE_RCSID (Request_Interceptor_Flow, - Server_Request_Interceptor, - "$Id$") - -#include "testC.h" - -#include "tao/AnyTypeCode/AnyTypeCode_Adapter_Impl.h" -#include "tao/AnyTypeCode/TypeCode.h" - -#include "ace/OS_NS_string.h" - -Server_Request_Interceptor::Server_Request_Interceptor (const char *name) - : Request_Interceptor (name), - scenario_ (0) -{ -} - -void -Server_Request_Interceptor::receive_request_service_contexts ( - PortableInterceptor::ServerRequestInfo_ptr ri - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)) -{ - - CORBA::Boolean server_side = - this->server_side_test (ri ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - if (!server_side) - return; // Don't continue if the client side is being tested. - - ACE_DEBUG ((LM_INFO, - "%s.receive_request_service_contexts", - this->name_.in ())); - - if (ACE_OS::strcmp ("SERVER B", this->name_.in ()) == 0) - { - this->scenario_++; - - switch (this->scenario_) - { - case 2: - // We can only throw a CORBA::SystemException or a - // PortableInteceptor::ForwardRequest exception due to - // the restricted exception specification dictated by - // the IDL for request interceptors. As such, an - // arbitrary CORBA::SystemException was chosen - // (NO_PERMISSION, in this case). - ACE_DEBUG ((LM_DEBUG, - " raised CORBA::NO_PERMISSION exception\n")); - ACE_THROW (CORBA::NO_PERMISSION ()); // Expected exception. - - default: - break; - } - } - - ACE_DEBUG ((LM_DEBUG, - "\n")); - - this->starting_interception_point_count_++; -} - -void -Server_Request_Interceptor::receive_request ( - PortableInterceptor::ServerRequestInfo_ptr ri - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)) -{ - - CORBA::Boolean server_side = - this->server_side_test (ri ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - if (!server_side) - return; // Don't continue if the client side is being tested. - - ACE_DEBUG ((LM_INFO, - "%s.receive_request\n", - this->name_.in ())); -} - -void -Server_Request_Interceptor::send_reply ( - PortableInterceptor::ServerRequestInfo_ptr ri - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - - CORBA::Boolean server_side = - this->server_side_test (ri ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - if (!server_side) - return; // Don't continue if the client side is being tested. - - this->ending_interception_point_count_++; - - ACE_DEBUG ((LM_INFO, - "%s.send_reply", - this->name_.in ())); - - if (ACE_OS::strcmp ("SERVER B", this->name_.in ()) == 0) - { - // Determine which test scenario we are in - Dynamic::ParameterList_var paramlist = - ri->arguments (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - Test::TestScenario scenario; - CORBA::ULong i = 0; // index -- explicitly used to avoid - // overloaded operator ambiguity. - if (paramlist[i].argument >>= scenario) - { - switch (scenario) - { - case 3: - // We can only throw a CORBA::SystemException or a - // PortableInteceptor::ForwardRequest exception due to - // the restricted exception specification dictated by - // the IDL for request interceptors. As such, an - // arbitrary CORBA::SystemException was chosen - // (NO_PERMISSION, in this case). - ACE_DEBUG ((LM_DEBUG, - " raised CORBA::NO_PERMISSION exception\n")); - ACE_THROW (CORBA::NO_PERMISSION ()); // Expected exception. - - default: - break; - } - } - else - ACE_ERROR ((LM_ERROR, - "\nERROR: send_reply - Could not extract " - "arguments.\n")); - } - - ACE_DEBUG ((LM_DEBUG, - "\n")); -} - -void -Server_Request_Interceptor::send_exception ( - PortableInterceptor::ServerRequestInfo_ptr ri - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)) -{ - - CORBA::Boolean server_side = - this->server_side_test (ri ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - if (!server_side) - return; // Don't continue if the client side is being tested. - - this->ending_interception_point_count_++; - - ACE_DEBUG ((LM_INFO, - "%s.send_exception", - this->name_.in ())); - - if (ACE_OS::strcmp ("SERVER B", this->name_.in ()) == 0) - { - // Determine which test scenario we are in - Dynamic::ParameterList_var paramlist = - ri->arguments (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - Test::TestScenario scenario; - CORBA::ULong i = 0; // index -- explicitly used to avoid - // overloaded operator ambiguity. - if (paramlist[i].argument >>= scenario) - { - CORBA::Any_var exception; - CORBA::TypeCode_var tc; - const char *id = 0; - - switch (scenario) - { - case 4: - exception = ri->sending_exception (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - tc = exception->type (); - - id = tc->id (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - if (ACE_OS::strcmp (id, "IDL:Test/X:1.0") == 0) - { - // We can only throw a CORBA::SystemException or a - // PortableInteceptor::ForwardRequest exception due - // to the restricted exception specification - // dictated by the IDL for request interceptors. As - // such, an arbitrary CORBA::SystemException was - // chosen (NO_PERMISSION, in this case). - ACE_DEBUG ((LM_DEBUG, - " transformed Test::X exception to " - "CORBA::NO_PERMISSION exception\n")); - - // Expected exception. - ACE_THROW (CORBA::NO_PERMISSION ()); - } - else - { - ACE_ERROR ((LM_ERROR, - "\nERROR: send_exception - Received " - "unexpected exception!\n")); - } - break; - default: - break; - } - } - else - ACE_ERROR ((LM_ERROR, - "\nERROR: send_exception - Could not extract " - "arguments.\n")); - } - - ACE_DEBUG ((LM_DEBUG, - "\n")); -} - -void -Server_Request_Interceptor::send_other ( - PortableInterceptor::ServerRequestInfo_ptr ri - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)) -{ - - CORBA::Boolean server_side = - this->server_side_test (ri ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - if (!server_side) - return; // Don't continue if the client side is being tested. - - this->ending_interception_point_count_++; - - ACE_DEBUG ((LM_INFO, - "%s.send_other", - this->name_.in ())); -} - -CORBA::Boolean -Server_Request_Interceptor::server_side_test ( - PortableInterceptor::ServerRequestInfo_ptr info - ACE_ENV_ARG_DECL) -{ - CORBA::String_var op = info->operation (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - - return ACE_OS::strcmp (op.in (), "server_test") == 0 ? 1 : 0; -} diff --git a/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/Server_Request_Interceptor.h b/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/Server_Request_Interceptor.h deleted file mode 100644 index e0a9c66c947..00000000000 --- a/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/Server_Request_Interceptor.h +++ /dev/null @@ -1,112 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Server_Request_Interceptor.h - * - * $Id$ - * - * Implementation header for the server request interceptor for the - * request interceptor flow test. - * - * @author Ossama Othman <ossama@uci.edu> - */ -//============================================================================= - -#ifndef SERVER_REQUEST_INTERCEPTOR_H -#define SERVER_REQUEST_INTERCEPTOR_H - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "Request_Interceptor.h" - -#include "tao/PI_Server/PI_Server.h" -#include "tao/PortableInterceptorC.h" -#include "tao/LocalObject.h" - -#if defined(_MSC_VER) -#pragma warning(push) -#pragma warning(disable:4250) -#endif /* _MSC_VER */ - -/** - * @class Server_Request_Interceptor - * - * @brief Simple concrete server request interceptor. - * - * See the README file for test details. - */ -class Server_Request_Interceptor - : public virtual PortableInterceptor::ServerRequestInterceptor, - public virtual TAO_Local_RefCounted_Object, - public virtual Request_Interceptor -{ -public: - - /// Constructor. Accepts the name of the interceptor. - Server_Request_Interceptor (const char *name); - - /** - * @name Methods Required by the Server 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 server request interceptors. - */ - //@{ - virtual void receive_request_service_contexts ( - PortableInterceptor::ServerRequestInfo_ptr ri - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)); - - virtual void receive_request ( - PortableInterceptor::ServerRequestInfo_ptr ri - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)); - - virtual void send_reply ( - PortableInterceptor::ServerRequestInfo_ptr ri - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual void send_exception ( - PortableInterceptor::ServerRequestInfo_ptr ri - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)); - - virtual void send_other ( - PortableInterceptor::ServerRequestInfo_ptr ri - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::ForwardRequest)); - //@} - -private: - - /// Returns 1 if the server-side test is currently being run, and 0 - /// otherwise. - CORBA::Boolean server_side_test ( - PortableInterceptor::ServerRequestInfo_ptr info - ACE_ENV_ARG_DECL); - -private: - - /// Variable used to keep track of the scenario count. Used to get - /// around the inability to call RequestInfo::arguments() in the - /// receive_service_contexts() interception point. - CORBA::ULong scenario_; -}; - -#if defined(_MSC_VER) -#pragma warning(pop) -#endif /* _MSC_VER */ - -#endif /* SERVER_REQUEST_INTERCEPTOR_H */ diff --git a/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/client.cpp b/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/client.cpp deleted file mode 100644 index 52caf89e452..00000000000 --- a/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/client.cpp +++ /dev/null @@ -1,224 +0,0 @@ -// -*- C++ -*- - -#include "ace/Get_Opt.h" - -#include "testC.h" -#include "Client_ORBInitializer.h" - -#include "tao/ORBInitializer_Registry.h" - -ACE_RCSID (Request_Interceptor_Flow, - client, - "$Id$") - -const char *ior = 0; - -int -parse_args (int argc, char *argv[]) -{ - if (argc != 3) // foo -k IOR - ACE_ERROR_RETURN ((LM_ERROR, - "Wrong number of arguments.\n"), - -1); - - ACE_Get_Opt get_opts (argc, argv, "k:"); - int c; - - while ((c = get_opts ()) != -1) - switch (c) - { - case 'k': - if (ior == 0) - ior = get_opts.opt_arg (); - break; - default: - ACE_ERROR_RETURN ((LM_ERROR, - "Usage: %s " - "-k IOR\n", - argv[0]), - -1); - } - - return 0; -} - -void -client_test (Test_ptr server ACE_ENV_ARG_DECL) -{ - // Currently, there are only four scenarios for the client side - // tests. - const Test::TestScenario MAX_CLIENT_SCENARIO = 4; - - for (Test::TestScenario i = 1; i <= MAX_CLIENT_SCENARIO; ++i) - { - ACE_DEBUG ((LM_INFO, - "\nCLIENT SCENARIO %d\n" - "------------------\n", - i)); - - ACE_TRY - { - server->client_test (i ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (i == 1) - { - ACE_ERROR ((LM_ERROR, - "\nERROR: No exception has been thrown from client_test() " - "operation.\n")); - } - } - ACE_CATCH (Test::X, ex) - { - // Expected exception. Ignore it. - } - ACE_CATCH (CORBA::NO_PERMISSION, ex) - { - // Expected exception. Ignore it. - } - ACE_CATCH (Test::UnknownScenario, ex) - { - ACE_ERROR ((LM_ERROR, - "\nERROR: Unknown scenario <%d> condition " - "returned from client_test() " - "operation.\n", - ex.scenario)); - ACE_RE_THROW; - } - ACE_CATCHANY - { - ACE_ERROR ((LM_ERROR, - "\nERROR: Exception thrown from client_test() " - "operation.\n")); - ACE_RE_THROW; - } - ACE_ENDTRY; - ACE_CHECK; - } -} - -void -server_test (Test_ptr server ACE_ENV_ARG_DECL) -{ - // Currently, there are only four scenarios for the server side - // tests. - const Test::TestScenario MAX_SERVER_SCENARIO = 4; - - for (Test::TestScenario i = 1; i <= MAX_SERVER_SCENARIO; ++i) - { - ACE_DEBUG ((LM_INFO, - "\nSERVER SCENARIO %d\n" - "------------------\n", - i)); - - ACE_TRY - { - CORBA::ULongSeq_var ulongseq; - server->server_test (i, ulongseq.out () ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (i == 1) - { - ACE_ERROR ((LM_ERROR, - "\nERROR: No exception has been thrown from server_test() " - "operation.\n")); - } - } - ACE_CATCH (Test::X, ex) - { - // Expected exception. Ignore it. - } - ACE_CATCH (CORBA::NO_PERMISSION, ex) - { - // Expected exception. Ignore it. - } - ACE_CATCH (Test::UnknownScenario, ex) - { - ACE_ERROR ((LM_ERROR, - "\nERROR: Unknown scenario <%d> condition " - "returned from server_test() " - "operation.\n", - ex.scenario)); - ACE_RE_THROW; - } - ACE_CATCHANY - { - ACE_ERROR ((LM_ERROR, - "\nERROR: Exception thrown from server_test() " - "operation.\n")); - ACE_RE_THROW; - } - ACE_ENDTRY; - ACE_CHECK; - } -} - -int -main (int argc, char *argv[]) -{ - ACE_DECLARE_NEW_CORBA_ENV; - ACE_TRY - { - PortableInterceptor::ORBInitializer_ptr temp_initializer = - PortableInterceptor::ORBInitializer::_nil (); - - ACE_NEW_RETURN (temp_initializer, - 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; - - 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 object = - orb->string_to_object (ior ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - Test_var server = - Test::_narrow (object.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); - } - - ::client_test (server.in () ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - ::server_test (server.in () ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - server->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - orb->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, - "Caught exception:"); - return -1; - } - ACE_ENDTRY; - - ACE_DEBUG ((LM_INFO, - "Request interceptor flow test passed.\n")); - - return 0; -} diff --git a/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/run_test.pl b/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/run_test.pl deleted file mode 100755 index 162acd63c17..00000000000 --- a/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/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 Request_Interceptor_Flow 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/Request_Interceptor_Flow/server.cpp b/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/server.cpp deleted file mode 100644 index 6e4fa0d21d3..00000000000 --- a/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/server.cpp +++ /dev/null @@ -1,135 +0,0 @@ -// -*- C++ -*- - -#include "ace/Get_Opt.h" -#include "test_i.h" -#include "Server_ORBInitializer.h" - -#include "tao/ORBInitializer_Registry.h" -#include "ace/OS_NS_stdio.h" - -ACE_RCSID (Request_Interceptor_Flow, - server, - "$Id$") - -const char *ior_file = 0; - -int -parse_args (int argc, char *argv[]) -{ - if (argc != 3) // foo -o IOR - ACE_ERROR_RETURN ((LM_ERROR, - "Wrong number of arguments.\n"), - -1); - - ACE_Get_Opt get_opts (argc, argv, "o:"); - int c; - - while ((c = get_opts ()) != -1) - switch (c) - { - case 'o': - - ior_file = get_opts.opt_arg (); - break; - - default: - ACE_ERROR_RETURN ((LM_ERROR, - "Usage: %s " - "-o IOR\n", - argv[0]), - -1); - } - - return 0; -} - -int -main (int argc, char *argv[]) -{ - ACE_DECLARE_NEW_CORBA_ENV; - ACE_TRY - { - Server_ORBInitializer *temp_initializer = 0; - ACE_NEW_RETURN (temp_initializer, - Server_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; - - CORBA::ORB_var orb = - CORBA::ORB_init (argc, argv, "Server ORB" ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - CORBA::Object_var poa_object = - orb->resolve_initial_references ("RootPOA" ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (CORBA::is_nil (poa_object.in ())) - ACE_ERROR_RETURN ((LM_ERROR, - " (%P|%t) Unable to initialize the POA.\n"), - 1); - - PortableServer::POA_var root_poa = - PortableServer::POA::_narrow (poa_object.in () ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - PortableServer::POAManager_var poa_manager = - root_poa->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (::parse_args (argc, argv) != 0) - return -1; - - test_i servant (orb.in ()); - - CORBA::Object_var obj = servant._this (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - CORBA::String_var ior = - orb->object_to_string (obj.in () ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - ACE_DEBUG ((LM_DEBUG, - "Servant:\n<%s>\n", - ior.in ())); - - poa_manager->activate (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - // Write IOR to a file. - FILE *output_file= ACE_OS::fopen (ior_file, "w"); - if (output_file == 0) - ACE_ERROR_RETURN ((LM_ERROR, - "Cannot open output file <%s> for writing " - "IOR: %s", - ior.in ()), - 1); - ACE_OS::fprintf (output_file, "%s", ior.in ()); - ACE_OS::fclose (output_file); - - // Run the ORB event loop. - orb->run (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - root_poa->destroy (1, 1 ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - orb->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - ACE_DEBUG ((LM_DEBUG, "Event loop finished.\n")); - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, - "Caught exception:"); - return -1; - } - ACE_ENDTRY; - - return 0; -} diff --git a/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/test.idl b/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/test.idl deleted file mode 100644 index 036fe0dd66e..00000000000 --- a/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/test.idl +++ /dev/null @@ -1,38 +0,0 @@ -// -*- IDL -*- - -//============================================================================= -/** - * @file test.idl - * - * $Id$ - * - * IDL file to test request interceptor flow. - * - * @author Ossama Othman <ossama@uci.edu> - */ -//============================================================================= - -#include "tao/ULongSeq.pidl" - -interface Test -{ - typedef short TestScenario; - - /// Dummy exception used during the test. - exception X {}; - - /// Unknown scenario number was passed to the test operation. - exception UnknownScenario { - TestScenario scenario; - }; - - /// The client-side test operation. - void client_test (in TestScenario scenario) raises (X, UnknownScenario); - - /// The server-side test operation. - void server_test (in TestScenario scenario, out CORBA::ULongSeq myseq) raises (X, UnknownScenario); - - /// Shutdown the server. - oneway void shutdown (); - -}; diff --git a/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/test_i.cpp b/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/test_i.cpp deleted file mode 100644 index 17dee50ac55..00000000000 --- a/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/test_i.cpp +++ /dev/null @@ -1,69 +0,0 @@ -// -*- C++ -*- - -#include "test_i.h" - -ACE_RCSID (Request_Interceptor_Flow, - test_i, - "$Id$") - -test_i::test_i (CORBA::ORB_ptr orb) - : orb_ (CORBA::ORB::_duplicate (orb)) -{ -} - -void -test_i::client_test (Test::TestScenario scenario - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((Test::X, - Test::UnknownScenario, - CORBA::SystemException)) -{ - switch (scenario) - { - case 1: - case 4: - // Both the client-side and server-side tests throw this - // exception in these scenarios. - ACE_THROW (Test::X ()); // Expected test exception - case 2: - case 3: - break; - default: - ACE_THROW (Test::UnknownScenario (scenario)); // Unexpected! - } -} - -void -test_i::server_test (Test::TestScenario scenario, - CORBA::ULongSeq_out myseq - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((Test::X, - Test::UnknownScenario, - CORBA::SystemException)) -{ - myseq = new CORBA::ULongSeq; - - switch (scenario) - { - case 1: - case 4: - // Both the client-side and server-side tests throw this - // exception in these scenarios. - ACE_THROW (Test::X ()); // Expected test exception - case 2: - case 3: - break; - default: - ACE_THROW (Test::UnknownScenario (scenario)); // Unexpected! - } -} - -void -test_i::shutdown (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - ACE_DEBUG ((LM_INFO, - "Server is shutting down.\n")); - - this->orb_->shutdown (0 ACE_ENV_ARG_PARAMETER); -} diff --git a/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/test_i.h b/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/test_i.h deleted file mode 100644 index 604d4ffb432..00000000000 --- a/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/test_i.h +++ /dev/null @@ -1,61 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file test_i.h - * - * $Id$ - * - * Implementation header for the "test" IDL interface for the - * request interceptor flow 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 implements the "test" interface used in this test. - */ -class test_i : public virtual POA_Test -{ -public: - - /// Constructor. - test_i (CORBA::ORB_ptr orb); - - /// The client-side test operation. - virtual void client_test (Test::TestScenario scenario - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((Test::X, - Test::UnknownScenario, - CORBA::SystemException)); - - /// The server-side test operation. - virtual void server_test (Test::TestScenario scenario, - CORBA::ULongSeq_out myseq - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((Test::X, - Test::UnknownScenario, - CORBA::SystemException)); - - /// 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 */ |