0 Replies Latest reply on Jul 8, 2010 11:35 AM by Andrew Rubinger

    Testing Serialization Protocols

    Andrew Rubinger Master
      Hey guys:

      Had a good talk w/ Dan and Lincoln at the conclusion of JBossWorld regarding wire compatibility and was asked to pass references along to this list.

      The key is that marking a class as "implements Serializable" isn't sufficient to:

      1) Make it really Serializable
      2) Ensure that the wire protocol maintains compatibility across releases

      I've been using a technique documented by Bob Lee awhile back:


      The idea is that after you've formalized your protocol (ie. Externalizable or readObject/writeObject explicitly), you make a copy of this original class.  Then, using a special ObjectOutputStream, you can redefine this class as a new name, hence converting from old to new or new to old.

      For instance, I implement this here in ShrinkWrap to make Archives Serializable:


      Recommend this approach, or one similar.  Some folks like to serialize the original version into a .ser file which stays in SCM, and ends up being the basis for the test point.  But that can only test compat in one direction.