# $Id: README 82258 2008-07-06 20:50:04Z nanbor $

This test verifies that the PortableInterceptor::ForwardRequest
exception support is working properly.  There are four cases that it
tests:

  - PortableInterceptor::ForwardRequest exception thrown from a client
    request interception point.
  - PortableInterceptor::ForwardRequest exception thrown from the
    receive_request_service_contexts() server request interception
    point.
  - PortableInterceptor::ForwardRequest exception thrown from the
    receive_request() server request interception point.
  - PortableInterceptor::ForwardRequest exception thrown from the
    send_exception() server request interception point.

The reason why there are two server side cases is because the
receive_request_service_contexts() interception point occurs before
the operation is dispatched to the servant.  Hence, the implementation
of the PortableInterceptor::ForwardRequest-to-LOCATION_FORWARD GIOP
reply conversion in that interception point differs from the
conversion that occurs in interception points in servant skeletons.

Two servants are activated.  Their corresponding references are then
passed to the client.  The following sequence of operations then
occurs:

  1) Issue client request.
  2) Intercept the request on the client side.
  3) Forward the request to servant two by throwing the
     PortableInterceptor::ForwardRequest in the
     ClientRequestInterceptor::send_reply() interception point.
  4) The server will receive the request.
  5) However, it will be intercepted by the server request
     interceptor.
  6) The ServerRequestInterceptor::receive_request_service_contexts()
     then forwards the client request back to servant one by throwing
     the PortableInterceptor::ForwardRequest exception.
  7) That exception will be converted to a LOCATION_FORWARD GIOP
     reply.
  8) The client will receive the LOCATION_FORWARD reply, and then
     transparently forward its request to servant one.
  9) The ServerRequestInterceptor::receive_request() interception
     point will then throw the PortableInterceptor::ForwardRequest
     exception to cause the request to be forwarded back to servant
     two.
 10) The ServerRequestInterceptor::receive_request() interception
     point then throw an OBJ_NOT_EXIST system exception which will be
     caught in the ServerRequestInterceptor::send_exception()
     interception point.  We will then throw the
     PortableInterceptor::ForwardRequest exception to cause the
     request to be forwarded back to servant one again.
 11) At this point, the request will actually be handled by servant
     one.

Test output should be similar to the following:

==== Running PortableInterceptor::ForwardRequest test

ForwardRequestTest::test servant 1: <IOR:010000002000...>
ForwardRequestTest::test servant 2: <IOR:010000002001...>
CLIENT: Issuing request 1.
CLIENT: Request 1 handled by object 1.
CLIENT: Issuing request 2.
CLIENT (1376|1540) Request 2 will be forwarded to object 2
CLIENT (1376|1540) via send_request().
CLIENT: Request 2 handled by object 2.
CLIENT: Issuing request 3.
SERVER (1604|1276) Request 3 will be forwarded to object 1
SERVER (1604|1276) via receive_request_service_contexts().
CLIENT (1376|1540) Received LOCATION_FORWARD reply.
CLIENT: Request 3 handled by object 1.
CLIENT: Issuing request 4.
SERVER (1604|1276) Request 4 will be forwarded to object 2
SERVER (1604|1276) via receive_request().
CLIENT (1376|1540) Received LOCATION_FORWARD reply.
CLIENT: Request 4 handled by object 2.
CLIENT: Issuing request 5.
SERVER (597|3081500368) OBJ_NOT_EXIST exception thrown for request 5
SERVER (597|3081500368) via receive_request().
SERVER (597|3081500368) OBJ_NOT_EXIST exception caught for request 5
SERVER (597|3081500368) will be forwarded to object 1
SERVER (597|3081500368) via send_exception().
CLIENT (598|3080672976) Received LOCATION_FORWARD reply.
CLIENT: Request 5 handled by object 1.
Server is shutting down via object 1.
Event loop finished.
PortableInterceptor::ForwardRequest test passed.
