[weld-dev] Wire Compatibility
Andrew Lee Rubinger
andrew.rubinger at redhat.com
Mon Jun 28 10:18:23 EDT 2010
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:
http://crazybob.org/2006/01/unit-testing-serialization-evolution_13.html
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:
http://anonsvn.jboss.org/repos/common/shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/serialization/SerializationTestCase.java
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.
S,
ALR
More information about the weld-dev
mailing list