An update:
In switching to the Grizzly container I realized that app descriptors
contain separate descriptions for the container and for the client. In my
email (below) I said that I had included .initParam( ... ) which I now
realize only affects the container. To make it work with Grizzly I added
.clientConfig( ... ) as in:
@Override
protected AppDescriptor configure() {
ClientConfig cc = new DefaultClientConfig();
cc.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE
);
return new WebAppDescriptor.Builder("com.mycompany.resources").initParam(
"com.sun.jersey.api.json.POJOMappingFeature", "true")
.clientConfig(cc).build();
}
This works with Grizzly, but InMemoryTestContainer doesn't respect the
client config, as stated in the bug... so my original question still stands
(any way to use Jackson with the in-memory test container?) but I just
wanted to be clear that I was correctly passing a client config.
Mike.
---------- Forwarded message ----------
From: <michael.iles_at_gmail.com>
Date: 20 December 2012 21:43
Subject: [Jersey] Use Jackson With the In-Memory Test Container?
To: users_at_jersey.java.net
I just spent a frustrating few hours trying to figure out why my unit
tests wouldn't work with the in-memory container, and reached the
conclusion that the in-memory container wasn't respecting the app
descriptor when it returned a client.
(My app descriptor includes
.initParam("com.sun.jersey.api.json.POJOMappingFeature", "true"). )
This led me to this bug:
http://java.net/jira/browse/JERSEY-622?page=com.atlassian.jira.plugin.s
ystem.issuetabpanels%3Aall-tabpanel
If I read the bug correctly, there's a patch against 1.6 but this code
hasn't been put into production yet.
So is there any way to use Jackson with the in-memory test container?
If I copy the InMemoryTestContainerFactory and patch it... how will
Jersey find my new instance?
Or is my only option to switch to the Grizzly test container?
Thanks,
Mike.