Uploaded image for project: 'Commons Proxy'
  1. Commons Proxy
  2. PROXY-4

SerializingInterceptor

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.0
    • None

    Description

      When unit testing classes that are going to be invoked remotely, it's important to test that the parameters and return types can be serialized/deserialized properly. What if commons-proxy included a neat little helper class that makes a serialized copy of the parameters of an invocation before passing them to the target object and then makes a serialized copy of the return value before returning it?

      public class SerializingInterceptor
      {
      public Object intercept(Invocation invocation)

      { Object[] argumentsCopy = ( Object[] )serializedCopy(invocation.getArguments()); System.arrayCopy(argumentsCopy,0,invocation.getArguments(),0,argumentsCopy.length); return serializedCopy(invocation.proceed()); }

      private Object serializedCopy(Serializable original);
      }

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            jwcarman James Carman
            jwcarman James Carman
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment