use of io.atlasmap.json.v2.JsonField in project atlasmap by atlasmap.
the class JsonDocumentInspectionServiceTest method inspectISO8601DatesNoRoot.
@Test
public void inspectISO8601DatesNoRoot() throws Exception {
final String instance = new String(Files.readAllBytes(Paths.get("src/test/resources/inspect/iso8601dates-unrooted.json")));
JsonDocument document = inspectionService.inspectJsonDocument(instance);
Assert.assertNotNull(document);
Assert.assertThat(document.getFields().getField().size(), Is.is(7));
JsonField yyyy = (JsonField) document.getFields().getField().get(0);
Assert.assertNotNull(yyyy);
Assert.assertThat(yyyy.getName(), Is.is("YYYY"));
Assert.assertThat(yyyy.getValue(), Is.is("1997"));
Assert.assertThat(yyyy.getPath(), Is.is("/YYYY"));
Assert.assertThat(yyyy.getFieldType(), Is.is(FieldType.STRING));
Assert.assertThat(yyyy.getStatus(), Is.is(FieldStatus.SUPPORTED));
JsonField yyyymm = (JsonField) document.getFields().getField().get(1);
Assert.assertNotNull(yyyymm);
Assert.assertThat(yyyymm.getName(), Is.is("YYYY-MM"));
Assert.assertThat(yyyymm.getValue(), Is.is("1997-07"));
Assert.assertThat(yyyymm.getPath(), Is.is("/YYYY-MM"));
Assert.assertThat(yyyymm.getFieldType(), Is.is(FieldType.STRING));
Assert.assertThat(yyyymm.getStatus(), Is.is(FieldStatus.SUPPORTED));
JsonField yyyymmdd = (JsonField) document.getFields().getField().get(2);
Assert.assertNotNull(yyyymmdd);
Assert.assertThat(yyyymmdd.getName(), Is.is("YYYY-MM-DD"));
Assert.assertThat(yyyymmdd.getValue(), Is.is("1997-07-16"));
Assert.assertThat(yyyymmdd.getPath(), Is.is("/YYYY-MM-DD"));
Assert.assertThat(yyyymmdd.getFieldType(), Is.is(FieldType.STRING));
Assert.assertThat(yyyymmdd.getStatus(), Is.is(FieldStatus.SUPPORTED));
JsonField yyyymmddthhmmtzd = (JsonField) document.getFields().getField().get(3);
Assert.assertNotNull(yyyymmddthhmmtzd);
Assert.assertThat(yyyymmddthhmmtzd.getName(), Is.is("YYYY-MM-DDThh:mmTZD"));
Assert.assertThat(yyyymmddthhmmtzd.getValue(), Is.is("1997-07-16T19:20+01:00"));
Assert.assertThat(yyyymmddthhmmtzd.getPath(), Is.is("/YYYY-MM-DDThh:mmTZD"));
Assert.assertThat(yyyymmddthhmmtzd.getFieldType(), Is.is(FieldType.STRING));
Assert.assertThat(yyyymmddthhmmtzd.getStatus(), Is.is(FieldStatus.SUPPORTED));
JsonField yyyymmddthhmmsstzd = (JsonField) document.getFields().getField().get(4);
Assert.assertNotNull(yyyymmddthhmmsstzd);
Assert.assertThat(yyyymmddthhmmsstzd.getName(), Is.is("YYYY-MM-DDThh:mm:ssTZD"));
Assert.assertThat(yyyymmddthhmmsstzd.getValue(), Is.is("1997-07-16T19:20:30+01:00"));
Assert.assertThat(yyyymmddthhmmsstzd.getPath(), Is.is("/YYYY-MM-DDThh:mm:ssTZD"));
Assert.assertThat(yyyymmddthhmmsstzd.getFieldType(), Is.is(FieldType.STRING));
Assert.assertThat(yyyymmddthhmmsstzd.getStatus(), Is.is(FieldStatus.SUPPORTED));
JsonField yyyymmddthhmmssstzd = (JsonField) document.getFields().getField().get(5);
Assert.assertNotNull(yyyymmddthhmmssstzd);
Assert.assertThat(yyyymmddthhmmssstzd.getName(), Is.is("YYYY-MM-DDThh:mm:ss.sTZD"));
Assert.assertThat(yyyymmddthhmmssstzd.getValue(), Is.is("1997-07-16T19:20:30.45+01:00"));
Assert.assertThat(yyyymmddthhmmssstzd.getPath(), Is.is("/YYYY-MM-DDThh:mm:ss.sTZD"));
Assert.assertThat(yyyymmddthhmmssstzd.getFieldType(), Is.is(FieldType.STRING));
Assert.assertThat(yyyymmddthhmmssstzd.getStatus(), Is.is(FieldStatus.SUPPORTED));
JsonField yyyymmddthhmmssutz = (JsonField) document.getFields().getField().get(6);
Assert.assertNotNull(yyyymmddthhmmssutz);
Assert.assertThat(yyyymmddthhmmssutz.getName(), Is.is("YYYY-MM-DDThh:mm:ssUTZ"));
Assert.assertThat(yyyymmddthhmmssutz.getValue(), Is.is("1994-11-05T13:15:30Z"));
Assert.assertThat(yyyymmddthhmmssutz.getPath(), Is.is("/YYYY-MM-DDThh:mm:ssUTZ"));
Assert.assertThat(yyyymmddthhmmssutz.getFieldType(), Is.is(FieldType.STRING));
Assert.assertThat(yyyymmddthhmmssutz.getStatus(), Is.is(FieldStatus.SUPPORTED));
}
use of io.atlasmap.json.v2.JsonField in project atlasmap by atlasmap.
the class JsonDocumentInspectionServiceTest method inspectJsonDocumentSimpleObjectArray.
@Test
public void inspectJsonDocumentSimpleObjectArray() throws Exception {
final String instance = "[\n" + "\t{\n" + "\t\t\"color\": \"red\",\n" + "\t\t\"value\": \"#f00\"\n" + "\t},\n" + "\t{\n" + "\t\t\"color\": \"green\",\n" + "\t\t\"value\": \"#0f0\"\n" + "\t},\n" + "\t{\n" + "\t\t\"color\": \"blue\",\n" + "\t\t\"value\": \"#00f\"\n" + "\t}]";
JsonDocument document = inspectionService.inspectJsonDocument(instance);
Assert.assertNotNull(document);
Assert.assertThat(1, Is.is(document.getFields().getField().size()));
JsonField jsonField = (JsonField) document.getFields().getField().get(0);
Assert.assertTrue(jsonField.getStatus().compareTo(FieldStatus.UNSUPPORTED) == 0);
Assert.assertTrue(jsonField.getCollectionType().compareTo(CollectionType.ARRAY) == 0);
Assert.assertNull(jsonField.getFieldType());
Assert.assertNull(jsonField.getName());
Assert.assertNull(jsonField.getPath());
// printDocument(document);
}
use of io.atlasmap.json.v2.JsonField in project atlasmap by atlasmap.
the class JsonDocumentInspectionServiceTest method inspectRepeatingComplexObjectWithRoot.
@Test
public void inspectRepeatingComplexObjectWithRoot() throws Exception {
final String instance = new String(Files.readAllBytes(Paths.get("src/test/resources/inspect/complex-repeated-rooted.json")));
JsonDocument document = inspectionService.inspectJsonDocument(instance);
Assert.assertNotNull(document);
Assert.assertThat(document.getFields().getField().size(), Is.is(1));
JsonComplexType root = (JsonComplexType) document.getFields().getField().get(0);
Assert.assertNotNull(root);
Assert.assertThat(root.getJsonFields().getJsonField().size(), Is.is(3));
Assert.assertThat(root.getName(), Is.is("SourceOrderList"));
JsonComplexType orders = (JsonComplexType) root.getJsonFields().getJsonField().get(0);
Assert.assertNotNull(orders);
Assert.assertThat(orders.getJsonFields().getJsonField().size(), Is.is(15));
Assert.assertThat(orders.getName(), Is.is("orders"));
JsonField orderBatchNumber = root.getJsonFields().getJsonField().get(1);
Assert.assertNotNull(orderBatchNumber);
Assert.assertThat(orderBatchNumber.getName(), Is.is("orderBatchNumber"));
Assert.assertThat(orderBatchNumber.getValue(), Is.is(4123562));
Assert.assertThat(orderBatchNumber.getPath(), Is.is("/SourceOrderList/orderBatchNumber"));
Assert.assertThat(orderBatchNumber.getFieldType(), Is.is(FieldType.INTEGER));
Assert.assertThat(orderBatchNumber.getStatus(), Is.is(FieldStatus.SUPPORTED));
JsonField numberOrders = root.getJsonFields().getJsonField().get(2);
Assert.assertNotNull(numberOrders);
Assert.assertThat(numberOrders.getName(), Is.is("numberOrders"));
Assert.assertThat(numberOrders.getValue(), Is.is(5));
Assert.assertThat(numberOrders.getPath(), Is.is("/SourceOrderList/numberOrders"));
Assert.assertThat(numberOrders.getFieldType(), Is.is(FieldType.INTEGER));
Assert.assertThat(numberOrders.getStatus(), Is.is(FieldStatus.SUPPORTED));
JsonComplexType complexAddress11 = (JsonComplexType) orders.getJsonFields().getJsonField().get(0);
Assert.assertNotNull(complexAddress11);
Assert.assertThat(complexAddress11.getJsonFields().getJsonField().size(), Is.is(5));
Assert.assertThat(complexAddress11.getName(), Is.is("address"));
Assert.assertThat(complexAddress11.getPath(), Is.is("/SourceOrderList/orders/address"));
JsonField address11 = complexAddress11.getJsonFields().getJsonField().get(0);
Assert.assertNotNull(address11);
Assert.assertThat(address11.getName(), Is.is("addressLine1"));
Assert.assertThat(address11.getValue(), Is.is("123 Main St"));
Assert.assertThat(address11.getPath(), Is.is("/SourceOrderList/orders/address/addressLine1"));
Assert.assertThat(address11.getFieldType(), Is.is(FieldType.STRING));
Assert.assertThat(address11.getStatus(), Is.is(FieldStatus.SUPPORTED));
JsonField address12 = complexAddress11.getJsonFields().getJsonField().get(1);
Assert.assertNotNull(address12);
Assert.assertThat(address12.getName(), Is.is("addressLine2"));
Assert.assertThat(address12.getValue(), Is.is("Suite 42b"));
Assert.assertThat(address12.getPath(), Is.is("/SourceOrderList/orders/address/addressLine2"));
Assert.assertThat(address12.getFieldType(), Is.is(FieldType.STRING));
Assert.assertThat(address12.getStatus(), Is.is(FieldStatus.SUPPORTED));
JsonField city = complexAddress11.getJsonFields().getJsonField().get(2);
Assert.assertNotNull(city);
Assert.assertThat(city.getName(), Is.is("city"));
Assert.assertThat(city.getValue(), Is.is("Anytown"));
Assert.assertThat(city.getPath(), Is.is("/SourceOrderList/orders/address/city"));
Assert.assertThat(city.getFieldType(), Is.is(FieldType.STRING));
Assert.assertThat(city.getStatus(), Is.is(FieldStatus.SUPPORTED));
JsonField state = complexAddress11.getJsonFields().getJsonField().get(3);
Assert.assertNotNull(state);
Assert.assertThat(state.getName(), Is.is("state"));
Assert.assertThat(state.getValue(), Is.is("NY"));
Assert.assertThat(state.getPath(), Is.is("/SourceOrderList/orders/address/state"));
Assert.assertThat(state.getFieldType(), Is.is(FieldType.STRING));
Assert.assertThat(state.getStatus(), Is.is(FieldStatus.SUPPORTED));
JsonField postalCode = complexAddress11.getJsonFields().getJsonField().get(4);
Assert.assertNotNull(postalCode);
Assert.assertThat(postalCode.getName(), Is.is("zipCode"));
Assert.assertThat(postalCode.getValue(), Is.is("90210"));
Assert.assertThat(postalCode.getPath(), Is.is("/SourceOrderList/orders/address/zipCode"));
Assert.assertThat(postalCode.getFieldType(), Is.is(FieldType.STRING));
Assert.assertThat(postalCode.getStatus(), Is.is(FieldStatus.SUPPORTED));
JsonComplexType complexContact11 = (JsonComplexType) orders.getJsonFields().getJsonField().get(1);
Assert.assertNotNull(complexContact11);
Assert.assertThat(complexContact11.getJsonFields().getJsonField().size(), Is.is(4));
Assert.assertThat(complexContact11.getName(), Is.is("contact"));
Assert.assertThat(complexContact11.getPath(), Is.is("/SourceOrderList/orders/contact"));
JsonField firstName = complexContact11.getJsonFields().getJsonField().get(0);
Assert.assertNotNull(firstName);
Assert.assertThat(firstName.getName(), Is.is("firstName"));
Assert.assertThat(firstName.getValue(), Is.is("Ozzie"));
Assert.assertThat(firstName.getPath(), Is.is("/SourceOrderList/orders/contact/firstName"));
Assert.assertThat(firstName.getFieldType(), Is.is(FieldType.STRING));
Assert.assertThat(firstName.getStatus(), Is.is(FieldStatus.SUPPORTED));
JsonField lastName = complexContact11.getJsonFields().getJsonField().get(1);
Assert.assertNotNull(lastName);
Assert.assertThat(lastName.getName(), Is.is("lastName"));
Assert.assertThat(lastName.getValue(), Is.is("Smith"));
Assert.assertThat(lastName.getPath(), Is.is("/SourceOrderList/orders/contact/lastName"));
Assert.assertThat(lastName.getFieldType(), Is.is(FieldType.STRING));
Assert.assertThat(lastName.getStatus(), Is.is(FieldStatus.SUPPORTED));
JsonField phoneNumber = complexContact11.getJsonFields().getJsonField().get(2);
Assert.assertNotNull(phoneNumber);
Assert.assertThat(phoneNumber.getName(), Is.is("phoneNumber"));
Assert.assertThat(phoneNumber.getValue(), Is.is("5551212"));
Assert.assertThat(phoneNumber.getPath(), Is.is("/SourceOrderList/orders/contact/phoneNumber"));
Assert.assertThat(phoneNumber.getFieldType(), Is.is(FieldType.STRING));
Assert.assertThat(phoneNumber.getStatus(), Is.is(FieldStatus.SUPPORTED));
JsonField zipCode = complexContact11.getJsonFields().getJsonField().get(3);
Assert.assertNotNull(zipCode);
Assert.assertThat(zipCode.getName(), Is.is("zipCode"));
Assert.assertThat(zipCode.getValue(), Is.is("81111"));
Assert.assertThat(zipCode.getPath(), Is.is("/SourceOrderList/orders/contact/zipCode"));
Assert.assertThat(zipCode.getFieldType(), Is.is(FieldType.STRING));
Assert.assertThat(zipCode.getStatus(), Is.is(FieldStatus.SUPPORTED));
// repeat
JsonComplexType complexAddress12 = (JsonComplexType) orders.getJsonFields().getJsonField().get(3);
Assert.assertNotNull(complexAddress12);
Assert.assertThat(complexAddress12.getJsonFields().getJsonField().size(), Is.is(5));
Assert.assertThat(complexAddress12.getName(), Is.is("address"));
Assert.assertThat(complexAddress12.getPath(), Is.is("/SourceOrderList/orders[1]/address"));
JsonField address2 = complexAddress12.getJsonFields().getJsonField().get(0);
Assert.assertNotNull(address2);
Assert.assertThat(address2.getName(), Is.is("addressLine1"));
Assert.assertThat(address2.getValue(), Is.is("123 Main St"));
Assert.assertThat(address2.getPath(), Is.is("/SourceOrderList/orders[1]/address/addressLine1"));
Assert.assertThat(address2.getFieldType(), Is.is(FieldType.STRING));
Assert.assertThat(address2.getStatus(), Is.is(FieldStatus.SUPPORTED));
JsonField address22 = complexAddress12.getJsonFields().getJsonField().get(1);
Assert.assertNotNull(address22);
Assert.assertThat(address22.getName(), Is.is("addressLine2"));
Assert.assertThat(address22.getValue(), Is.is("Suite 42b"));
Assert.assertThat(address22.getPath(), Is.is("/SourceOrderList/orders[1]/address/addressLine2"));
Assert.assertThat(address22.getFieldType(), Is.is(FieldType.STRING));
Assert.assertThat(address22.getStatus(), Is.is(FieldStatus.SUPPORTED));
JsonField city2 = complexAddress12.getJsonFields().getJsonField().get(2);
Assert.assertNotNull(city2);
Assert.assertThat(city2.getName(), Is.is("city"));
Assert.assertThat(city2.getValue(), Is.is("Anytown"));
Assert.assertThat(city2.getPath(), Is.is("/SourceOrderList/orders[1]/address/city"));
Assert.assertThat(city2.getFieldType(), Is.is(FieldType.STRING));
Assert.assertThat(city2.getStatus(), Is.is(FieldStatus.SUPPORTED));
JsonField state2 = complexAddress12.getJsonFields().getJsonField().get(3);
Assert.assertNotNull(state2);
Assert.assertThat(state2.getName(), Is.is("state"));
Assert.assertThat(state2.getValue(), Is.is("NY"));
Assert.assertThat(state2.getPath(), Is.is("/SourceOrderList/orders[1]/address/state"));
Assert.assertThat(state2.getFieldType(), Is.is(FieldType.STRING));
Assert.assertThat(state2.getStatus(), Is.is(FieldStatus.SUPPORTED));
JsonField postalCode2 = complexAddress12.getJsonFields().getJsonField().get(4);
Assert.assertNotNull(postalCode2);
Assert.assertThat(postalCode2.getName(), Is.is("zipCode"));
Assert.assertThat(postalCode2.getValue(), Is.is("90210"));
Assert.assertThat(postalCode2.getPath(), Is.is("/SourceOrderList/orders[1]/address/zipCode"));
Assert.assertThat(postalCode2.getFieldType(), Is.is(FieldType.STRING));
Assert.assertThat(postalCode2.getStatus(), Is.is(FieldStatus.SUPPORTED));
JsonComplexType complexContact12 = (JsonComplexType) orders.getJsonFields().getJsonField().get(4);
Assert.assertNotNull(complexContact12);
Assert.assertThat(complexContact12.getJsonFields().getJsonField().size(), Is.is(4));
Assert.assertThat(complexContact12.getName(), Is.is("contact"));
Assert.assertThat(complexContact12.getPath(), Is.is("/SourceOrderList/orders[1]/contact"));
JsonField firstName2 = complexContact12.getJsonFields().getJsonField().get(0);
Assert.assertNotNull(firstName2);
Assert.assertThat(firstName2.getName(), Is.is("firstName"));
Assert.assertThat(firstName2.getValue(), Is.is("Ozzie"));
Assert.assertThat(firstName2.getPath(), Is.is("/SourceOrderList/orders[1]/contact/firstName"));
Assert.assertThat(firstName2.getFieldType(), Is.is(FieldType.STRING));
Assert.assertThat(firstName2.getStatus(), Is.is(FieldStatus.SUPPORTED));
JsonField lastName2 = complexContact12.getJsonFields().getJsonField().get(1);
Assert.assertNotNull(lastName2);
Assert.assertThat(lastName2.getName(), Is.is("lastName"));
Assert.assertThat(lastName2.getValue(), Is.is("Smith"));
Assert.assertThat(lastName2.getPath(), Is.is("/SourceOrderList/orders[1]/contact/lastName"));
Assert.assertThat(lastName2.getFieldType(), Is.is(FieldType.STRING));
Assert.assertThat(lastName2.getStatus(), Is.is(FieldStatus.SUPPORTED));
JsonField phoneNumber2 = complexContact12.getJsonFields().getJsonField().get(2);
Assert.assertNotNull(phoneNumber2);
Assert.assertThat(phoneNumber2.getName(), Is.is("phoneNumber"));
Assert.assertThat(phoneNumber2.getValue(), Is.is("5551212"));
Assert.assertThat(phoneNumber2.getPath(), Is.is("/SourceOrderList/orders[1]/contact/phoneNumber"));
Assert.assertThat(phoneNumber2.getFieldType(), Is.is(FieldType.STRING));
Assert.assertThat(phoneNumber2.getStatus(), Is.is(FieldStatus.SUPPORTED));
JsonField zipCode2 = complexContact12.getJsonFields().getJsonField().get(3);
Assert.assertNotNull(zipCode2);
Assert.assertThat(zipCode2.getName(), Is.is("zipCode"));
Assert.assertThat(zipCode2.getValue(), Is.is("81111"));
Assert.assertThat(zipCode2.getPath(), Is.is("/SourceOrderList/orders[1]/contact/zipCode"));
Assert.assertThat(zipCode2.getFieldType(), Is.is(FieldType.STRING));
Assert.assertThat(zipCode2.getStatus(), Is.is(FieldStatus.SUPPORTED));
// etc......
// printDocument(document);
}
use of io.atlasmap.json.v2.JsonField in project atlasmap by atlasmap.
the class JsonDocumentInspectionServiceTest method inspectFlatPrimitiveNoRoot.
// FlatPrimitive
@Test
public void inspectFlatPrimitiveNoRoot() throws Exception {
final String instance = new String(Files.readAllBytes(Paths.get("src/test/resources/inspect/flatprimitive-base-unrooted.json")));
JsonDocument document = inspectionService.inspectJsonDocument(instance);
Assert.assertNotNull(document);
Assert.assertThat(document.getFields().getField().size(), Is.is(7));
for (int i = 0; i < document.getFields().getField().size(); i++) {
JsonField field = (JsonField) document.getFields().getField().get(i);
if (i == 0) {
Assert.assertThat(field.getName(), Is.is("booleanField"));
Assert.assertThat(field.getValue(), Is.is(false));
Assert.assertThat(field.getPath(), Is.is("/".concat(field.getName())));
Assert.assertThat(field.getFieldType(), Is.is(FieldType.BOOLEAN));
Assert.assertThat(field.getStatus(), Is.is(FieldStatus.SUPPORTED));
} else if (i == 1) {
Assert.assertThat(field.getName(), Is.is("charField"));
Assert.assertThat(field.getValue(), Is.is("a"));
Assert.assertThat(field.getPath(), Is.is("/".concat(field.getName())));
// FIXME DOES NOT RECOGNIZE CHAR DISTINCTLY AND RETURNS THIS AS A STRING
// (TEXTUAL)
Assert.assertThat(field.getFieldType(), Is.is(FieldType.STRING));
Assert.assertThat(field.getStatus(), Is.is(FieldStatus.SUPPORTED));
} else if (i == 2) {
Assert.assertThat(field.getName(), Is.is("doubleField"));
Assert.assertThat(field.getValue(), Is.is(-27152745.3422));
Assert.assertThat(field.getPath(), Is.is("/".concat(field.getName())));
Assert.assertThat(field.getFieldType(), Is.is(FieldType.DOUBLE));
Assert.assertThat(field.getStatus(), Is.is(FieldStatus.SUPPORTED));
} else if (i == 3) {
Assert.assertThat(field.getName(), Is.is("floatField"));
Assert.assertThat(field.getValue(), Is.is(-63988281.00));
Assert.assertThat(field.getPath(), Is.is("/".concat(field.getName())));
// FIXME DOES NOT RECOGNIZE FLOAT DISTINCTLY AND RETURNS THIS AS A DOUBLE
Assert.assertThat(field.getFieldType(), Is.is(FieldType.DOUBLE));
Assert.assertThat(field.getStatus(), Is.is(FieldStatus.SUPPORTED));
} else if (i == 4) {
Assert.assertThat(field.getName(), Is.is("intField"));
Assert.assertThat(field.getValue(), Is.is(8281));
Assert.assertThat(field.getPath(), Is.is("/".concat(field.getName())));
Assert.assertThat(field.getFieldType(), Is.is(FieldType.INTEGER));
Assert.assertThat(field.getStatus(), Is.is(FieldStatus.SUPPORTED));
} else if (i == 5) {
Assert.assertThat(field.getName(), Is.is("shortField"));
Assert.assertThat(field.getValue(), Is.is(81));
Assert.assertThat(field.getPath(), Is.is("/".concat(field.getName())));
// FIXME JSON DOES NOT RECOGNIZE SHORT DISTINCTLY AND RETURNS THIS AS A INTEGER
Assert.assertThat(field.getFieldType(), Is.is(FieldType.INTEGER));
Assert.assertThat(field.getStatus(), Is.is(FieldStatus.SUPPORTED));
} else if (i == 6) {
Assert.assertThat(field.getName(), Is.is("longField"));
Assert.assertThat(field.getValue(), Is.is(3988281));
Assert.assertThat(field.getPath(), Is.is("/".concat(field.getName())));
// FIXME JSON DOES NOT RECOGNIZE LONG DISTINCTLY AND RETURNS THIS AS A INTEGER
Assert.assertThat(field.getFieldType(), Is.is(FieldType.INTEGER));
Assert.assertThat(field.getStatus(), Is.is(FieldStatus.SUPPORTED));
}
}
}
use of io.atlasmap.json.v2.JsonField in project atlasmap by atlasmap.
the class JsonDocumentInspectionServiceTest method inspectJsonDocumentArrayHighlyNestedObjects.
@Test
public void inspectJsonDocumentArrayHighlyNestedObjects() throws Exception {
final String instance = new String(Files.readAllBytes(Paths.get("src/test/resources/inspect/array-highly-nested-objects.json")));
JsonDocument document = inspectionService.inspectJsonDocument(instance);
Assert.assertNotNull(document);
Assert.assertThat(document.getFields().getField().size(), Is.is(1));
JsonField jsonField = (JsonField) document.getFields().getField().get(0);
Assert.assertTrue(jsonField.getStatus().compareTo(FieldStatus.UNSUPPORTED) == 0);
Assert.assertTrue(jsonField.getCollectionType().compareTo(CollectionType.ARRAY) == 0);
// printDocument(document);
}
Aggregations