Schema schema = new Parser().parse(new File("src/test/resources/test-avro-schemas/interop.avsc"));
morphline = createMorphline("test-morphlines/toAvroWithSchemaFile");
byte[] bytes = new byte[] {47, 13};
byte[] fixed = new byte[16];
Record jdoc1 = new Record();
jdoc1.put("_dataset_descriptor_schema", schema);
collector.reset();
assertFalse(morphline.process(jdoc1)); // "has no default value"
jdoc1.put("intField", "notAnInteger");
collector.reset();
assertFalse(morphline.process(jdoc1)); // can't convert
jdoc1.replaceValues("intField", "20");
jdoc1.put("longField", "200");
jdoc1.put("stringField", "abc");
jdoc1.put("boolField", "true");
jdoc1.put("floatField", "200");
jdoc1.put("doubleField","200");
jdoc1.put("bytesField", bytes);
jdoc1.put("nullField", null);
jdoc1.getFields().putAll("arrayField", Arrays.asList(10.0, 20.0));
jdoc1.put("mapField",
new HashMap(ImmutableMap.of("myMap",
ImmutableMap.of("label", "car")
))
);
jdoc1.put("unionField", new ArrayList(Arrays.asList(bytes)));
jdoc1.put("enumField", "B");
jdoc1.put("fixedField", fixed);
jdoc1.put("recordField",
ImmutableMap.of(
"label", "house",
"children", new ArrayList(Arrays.asList(bytes)))
);
collector.reset();