@Test public void testDublinCoreRecord() throws Exception { ObjectMapper om = new JacksonProvider().getContext(DublinCoreRecord.class); om.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true); URL resource = JacksonProviderTest.class.getResource("dc_test.xml"); assertNotNull(resource); OaiDcType dc = JAXB.unmarshal(resource, OaiDcType.class); DublinCoreRecord dr = new DublinCoreRecord(dc, System.currentTimeMillis(), "uuid:1"); String toJson = om.writeValueAsString(dr); DublinCoreRecord ndr = om.readValue(toJson, DublinCoreRecord.class); assertEquals(dr.getBatchId(), ndr.getBatchId()); assertEquals(dr.getPid(), ndr.getPid()); assertEquals(dr.getTimestamp(), ndr.getTimestamp()); assertEquals(dr.getDc().getIdentifiers(), ndr.getDc().getIdentifiers()); assertEquals(dr.getDc().getTitles(), ndr.getDc().getTitles()); assertEquals(dr.getDc().getCreators(), ndr.getDc().getCreators()); StringWriter toXml = new StringWriter(); DcUtils.marshal(new StreamResult(toXml), ndr.getDc(), true); toXml.flush(); }
@Override public ObjectMapper getContext(Class<?> type) { return mapper; }
JacksonProvider implements ContextResolver<ObjectMapper> { @Override public ObjectMapper getContext(Class<?> type) { return mapper; } }
JacksonProvider implements ContextResolver<ObjectMapper> { @Override public ObjectMapper getContext(Class<?> type) { return mapper; } JacksonProvider(); }
JacksonProvider implements ContextResolver<ObjectMapper> { @Override public ObjectMapper getContext(Class<?> type) { return mapper; } JacksonProvider(); @Override ObjectMapper getContext(Class<?> type); }
JacksonProvider implements ContextResolver<ObjectMapper> { @Override public ObjectMapper getContext(Class<?> type) { return mapper; } JacksonProvider(); @Override ObjectMapper getContext(Class<?> type);  }