[Engine-devel] [Jenkins] unit test fails
Juan Hernandez
juan.hernandez at redhat.com
Thu Apr 19 20:23:08 UTC 2012
On 04/19/2012 09:28 PM, Eyal Edri wrote:
> fyi,
>
> 1 unit test fails after these commits: (lots of commits, since the Jenkins server was stuck during that time).
>
> http://jenkins.ovirt.org/job/ovirt_engine_unit_tests/626/
>
> the failed test: org.ovirt.engine.core.utils.serialization.json.JsonObjectSerializerTest.testSerialize
That test is serializing an object with Jackson and then manually, and
comparing the result. It is failing because it gets this two things:
Manually:
{"integer":1992604070,"object":["org.ovirt.engine.core.compat.Guid",{"uuid":"7d47be2e-bc38-4d97-8489-21fcb316d799"}],"string":"\\VS|6BfM/!","guid":["org.ovirt.engine.core.compat.Guid",{"uuid":"cb15e87b-2878-4dcf-86e6-e388a32ff228"}]}
Using Jackson:
{"integer":1992604070,"guid":["org.ovirt.engine.core.compat.Guid",{"uuid":"cb15e87b-2878-4dcf-86e6-e388a32ff228"}],"string":"\\VS|6BfM/!","object":["org.ovirt.engine.core.compat.Guid",{"uuid":"7d47be2e-bc38-4d97-8489-21fcb316d799"}]}
The only difference is the order of the fields. When generated manually
the order is the one defined in the code, but when using Jackson the
order depends on the internal ordering of the fields, and that can
change between Jackson versions (we just updated to 1.9.4) or even when
compiling with different compilers.
The @JsonPropertyOrder annotation can be used like this to force the order:
@JsonPropertyOrder({ "integer", "object", "string", "guid" })
public class JsonSerializablePojo implements Serializable {
I am proposing this change to add the annotation so that the test will pass:
http://gerrit.ovirt.org/3740
More information about the Engine-devel
mailing list