Created
May 14, 2017 20:09
-
-
Save knoguchi/da4125b66ca20e3b0d1f26f35ac2d6ea to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.fasterxml.jackson.dataformat.protobuf.schema; | |
import com.fasterxml.jackson.databind.JsonNode; | |
import com.fasterxml.jackson.dataformat.protobuf.ProtobufMapper; | |
import com.fasterxml.jackson.dataformat.protobuf.ProtobufTestBase; | |
import java.io.IOException; | |
import java.io.InputStream; | |
public class DeserializeTest extends ProtobufTestBase | |
{ | |
private final ProtobufMapper MAPPER = new ProtobufMapper(); | |
public void testDeserialize() throws IOException | |
{ | |
// Prepare schema | |
InputStream in = this.getClass().getResourceAsStream("/descriptor.proto"); | |
ProtobufSchema schema = ProtobufSchemaLoader.std.load(in); | |
// System.out.println(schema.toString()); | |
// Deserialize the descriptor PB | |
InputStream pb = this.getClass().getResourceAsStream("/unittest_proto3.desc"); | |
JsonNode t = MAPPER.readerFor(JsonNode.class).with(schema).readValue(pb); | |
assertNotNull(t); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment