use of io.atlasmap.json.v2.JsonField in project atlasmap by atlasmap.
the class JsonFieldWriterTest method testWriteFlatPrimitiveObjectUnrooted.
@Test
public void testWriteFlatPrimitiveObjectUnrooted() throws Exception {
JsonField booleanField = AtlasJsonModelFactory.createJsonField();
booleanField.setFieldType(FieldType.BOOLEAN);
booleanField.setValue(false);
booleanField.setPath("/booleanField");
booleanField.setStatus(FieldStatus.SUPPORTED);
write(booleanField);
Assert.assertNotNull(writer.getRootNode());
JsonField charField = AtlasJsonModelFactory.createJsonField();
charField.setFieldType(FieldType.CHAR);
charField.setValue('a');
charField.setPath("/charField");
charField.setStatus(FieldStatus.SUPPORTED);
write(charField);
JsonField doubleField = AtlasJsonModelFactory.createJsonField();
doubleField.setFieldType(FieldType.DOUBLE);
doubleField.setValue(-27152745.3422);
doubleField.setPath("/doubleField");
doubleField.setStatus(FieldStatus.SUPPORTED);
write(doubleField);
JsonField floatField = AtlasJsonModelFactory.createJsonField();
floatField.setFieldType(FieldType.FLOAT);
floatField.setValue(-63988281.00);
floatField.setPath("/floatField");
floatField.setStatus(FieldStatus.SUPPORTED);
write(floatField);
JsonField intField = AtlasJsonModelFactory.createJsonField();
intField.setFieldType(FieldType.INTEGER);
intField.setValue(8281);
intField.setPath("/intField");
intField.setStatus(FieldStatus.SUPPORTED);
write(intField);
JsonField shortField = AtlasJsonModelFactory.createJsonField();
shortField.setFieldType(FieldType.SHORT);
shortField.setValue(81);
shortField.setPath("/shortField");
shortField.setStatus(FieldStatus.SUPPORTED);
write(shortField);
JsonField longField = AtlasJsonModelFactory.createJsonField();
longField.setFieldType(FieldType.LONG);
longField.setValue(3988281);
longField.setPath("/longField");
longField.setStatus(FieldStatus.SUPPORTED);
write(longField);
Assert.assertThat(writer.getRootNode().toString(), Is.is("{\"booleanField\":false,\"charField\":\"a\",\"doubleField\":-27152745.3422,\"floatField\":-63988281,\"intField\":8281,\"shortField\":81,\"longField\":3988281}"));
}
use of io.atlasmap.json.v2.JsonField in project atlasmap by atlasmap.
the class JavaJsonFlatMappingTest method generateJsonField.
protected JsonField generateJsonField(String parent, String path) {
JsonField field = AtlasJsonModelFactory.createJsonField();
field.setPath("/" + parent + "/" + path);
return field;
}
use of io.atlasmap.json.v2.JsonField in project atlasmap by atlasmap.
the class JsonJavaFlatMappingTest method generateJsonField.
protected JsonField generateJsonField(String parent, String path) {
JsonField field = AtlasJsonModelFactory.createJsonField();
field.setPath("/" + parent + "/" + path);
return field;
}
Aggregations