use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.deser.std.StdDeserializer in project pentaho-metaverse by pentaho.
the class KettleObjectMapperTest method testReadValue.
@Test
public void testReadValue() throws Exception {
StdDeserializer deserializer = new TransMetaJsonDeserializer(TransMeta.class, null);
deserializers.add(deserializer);
mapper = new KettleObjectMapper(null, deserializers);
assertNotNull(mapper);
mapper.readValue(TRANS_JSON, TransMeta.class);
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.deser.std.StdDeserializer in project bson4jackson by michel-kraemer.
the class BsonParserTest method parseObjectId.
/**
* Check if org.bson.types.ObjectId can be serialized and deserialized as
* a byte array. See issue #38
* @throws Exception if something goes wrong
*/
@Test
public void parseObjectId() throws Exception {
class ObjectIdDeserializer extends StdDeserializer<org.bson.types.ObjectId> {
private static final long serialVersionUID = 6934309887169924897L;
protected ObjectIdDeserializer() {
super(org.bson.types.ObjectId.class);
}
@Override
public org.bson.types.ObjectId deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonGenerationException {
return new org.bson.types.ObjectId(jp.getBinaryValue());
}
}
org.bson.types.ObjectId oid = new org.bson.types.ObjectId();
BSONObject o = new BasicBSONObject();
o.put("oid", oid.toByteArray());
SimpleModule mod = new SimpleModule();
mod.addDeserializer(org.bson.types.ObjectId.class, new ObjectIdDeserializer());
ObjectIdClass res = parseBsonObject(o, ObjectIdClass.class, mod);
assertEquals(oid, res.oid);
}
Aggregations