Search in sources :

Example 31 with ObjectReader

use of com.fasterxml.jackson.databind.ObjectReader in project drill by apache.

the class TestParsePhysicalPlan method parseSimplePlan.

@Test
public void parseSimplePlan() throws Exception {
    DrillConfig c = DrillConfig.create();
    ScanResult scanResult = ClassPathScanner.fromPrescan(c);
    LogicalPlanPersistence lpp = new LogicalPlanPersistence(c, scanResult);
    PhysicalPlanReader reader = new PhysicalPlanReader(c, scanResult, lpp, CoordinationProtos.DrillbitEndpoint.getDefaultInstance(), null);
    ObjectReader r = lpp.getMapper().reader(PhysicalPlan.class);
    ObjectWriter writer = lpp.getMapper().writer();
    PhysicalPlan plan = reader.readPhysicalPlan(Files.toString(FileUtils.getResourceAsFile("/physical_test1.json"), Charsets.UTF_8));
    String unparse = plan.unparse(writer);
//    System.out.println(unparse);
}
Also used : ScanResult(org.apache.drill.common.scanner.persistence.ScanResult) PhysicalPlan(org.apache.drill.exec.physical.PhysicalPlan) DrillConfig(org.apache.drill.common.config.DrillConfig) PhysicalPlanReader(org.apache.drill.exec.planner.PhysicalPlanReader) ObjectWriter(com.fasterxml.jackson.databind.ObjectWriter) ObjectReader(com.fasterxml.jackson.databind.ObjectReader) LogicalPlanPersistence(org.apache.drill.common.config.LogicalPlanPersistence) Test(org.junit.Test) ExecTest(org.apache.drill.exec.ExecTest)

Example 32 with ObjectReader

use of com.fasterxml.jackson.databind.ObjectReader in project logging-log4j2 by apache.

the class LevelMixInTest method testContainer.

@Test
public void testContainer() throws IOException {
    final Fixture expected = new Fixture();
    final String str = writer.writeValueAsString(expected);
    Assert.assertTrue(str.contains("DEBUG"));
    final ObjectReader fixtureReader = log4jObjectMapper.readerFor(Fixture.class);
    final Fixture actual = fixtureReader.readValue(str);
    Assert.assertEquals(expected, actual);
}
Also used : ObjectReader(com.fasterxml.jackson.databind.ObjectReader) Test(org.junit.Test)

Aggregations

ObjectReader (com.fasterxml.jackson.databind.ObjectReader)32 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)13 Test (org.junit.Test)12 IOException (java.io.IOException)6 JavaType (com.fasterxml.jackson.databind.JavaType)5 ObjectWriter (com.fasterxml.jackson.databind.ObjectWriter)4 PluginTestVerifier (com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier)2 Method (java.lang.reflect.Method)2 NoSuchElementException (java.util.NoSuchElementException)2 AclEntry (org.apache.hadoop.fs.permission.AclEntry)2 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)1 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 InvalidFormatException (com.fasterxml.jackson.databind.exc.InvalidFormatException)1 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)1 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)1 FilterProvider (com.fasterxml.jackson.databind.ser.FilterProvider)1 SimpleFilterProvider (com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider)1 AvroFactory (com.fasterxml.jackson.dataformat.avro.AvroFactory)1 AvroSchema (com.fasterxml.jackson.dataformat.avro.AvroSchema)1