Search in sources :

Example 6 with JsonFields

use of io.atlasmap.json.v2.JsonFields in project atlasmap by atlasmap.

the class JsonFieldReaderTest method testRangeOutValue.

private void testRangeOutValue(String fileName, String fieldPath, FieldType fieldType, String errorMessage, String errorValue) throws Exception {
    String filePath = "src" + File.separator + "test" + File.separator + "resources" + File.separator + "jsonFields" + File.separator + fileName;
    String document = new String(Files.readAllBytes(Paths.get(filePath)));
    reader.setDocument(document);
    JsonField field = AtlasJsonModelFactory.createJsonField();
    field.setPath(fieldPath);
    field.setFieldType(fieldType);
    AtlasInternalSession session = read(field);
    assertEquals(null, field.getValue());
    assertEquals(1, session.getAudits().getAudit().size());
    assertEquals(errorMessage, session.getAudits().getAudit().get(0).getMessage());
    assertEquals(errorValue, session.getAudits().getAudit().get(0).getValue());
    assertEquals(AuditStatus.ERROR, session.getAudits().getAudit().get(0).getStatus());
}
Also used : JsonField(io.atlasmap.json.v2.JsonField) AtlasInternalSession(io.atlasmap.spi.AtlasInternalSession)

Aggregations

JsonComplexType (io.atlasmap.json.v2.JsonComplexType)4 JsonFields (io.atlasmap.json.v2.JsonFields)4 JsonField (io.atlasmap.json.v2.JsonField)3 AtlasInternalSession (io.atlasmap.spi.AtlasInternalSession)2 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 JsonDocument (io.atlasmap.json.v2.JsonDocument)1 IOException (java.io.IOException)1 Iterator (java.util.Iterator)1 Map (java.util.Map)1 Ignore (org.junit.Ignore)1 Test (org.junit.Test)1