Search in sources :

Example 6 with KafkaConnectDocument

use of io.atlasmap.kafkaconnect.v2.KafkaConnectDocument in project atlasmap by atlasmap.

the class KafkaConnectInspectionServiceTest method testJsonComplex.

@Test
public void testJsonComplex() throws Exception {
    InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("json-complex.json");
    KafkaConnectDocument doc = service.inspectJson(new String(is.readAllBytes()), options);
    assertNotNull(doc);
    assertEquals("struct", doc.getName());
    assertEquals("/", doc.getPath());
    assertEquals(FieldType.COMPLEX, doc.getFieldType());
    List<Field> fields = doc.getFields().getField();
    assertEquals(2, fields.size());
    Field field1 = fields.get(0);
    assertEquals("field1", field1.getName());
    assertEquals("/field1", field1.getPath());
    assertEquals(FieldType.BOOLEAN, field1.getFieldType());
    Field field2 = fields.get(1);
    assertEquals("field2", field2.getName());
    assertEquals("/field2", field2.getPath());
    assertEquals(FieldType.STRING, field2.getFieldType());
}
Also used : KafkaConnectEnumField(io.atlasmap.kafkaconnect.v2.KafkaConnectEnumField) KafkaConnectField(io.atlasmap.kafkaconnect.v2.KafkaConnectField) Field(io.atlasmap.v2.Field) InputStream(java.io.InputStream) KafkaConnectDocument(io.atlasmap.kafkaconnect.v2.KafkaConnectDocument) Test(org.junit.jupiter.api.Test)

Example 7 with KafkaConnectDocument

use of io.atlasmap.kafkaconnect.v2.KafkaConnectDocument in project atlasmap by atlasmap.

the class KafkaConnectInspectionServiceTest method testJsonPrimitive.

@Test
public void testJsonPrimitive() throws Exception {
    InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("json-primitive.json");
    KafkaConnectDocument doc = service.inspectJson(new String(is.readAllBytes()), options);
    assertNotNull(doc);
    assertEquals("primitive", doc.getName());
    assertEquals("/", doc.getPath());
    assertEquals(FieldType.STRING, doc.getFieldType());
}
Also used : InputStream(java.io.InputStream) KafkaConnectDocument(io.atlasmap.kafkaconnect.v2.KafkaConnectDocument) Test(org.junit.jupiter.api.Test)

Example 8 with KafkaConnectDocument

use of io.atlasmap.kafkaconnect.v2.KafkaConnectDocument in project atlasmap by atlasmap.

the class KafkaConnectInspectionServiceTest method testAvroPrimitive.

@Test
public void testAvroPrimitive() throws Exception {
    InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("avro-primitive.json");
    KafkaConnectDocument doc = service.inspectAvro(new String(is.readAllBytes()), options);
    assertNotNull(doc);
    assertNull(doc.getName());
    assertEquals("/", doc.getPath());
    assertEquals(FieldType.STRING, doc.getFieldType());
}
Also used : InputStream(java.io.InputStream) KafkaConnectDocument(io.atlasmap.kafkaconnect.v2.KafkaConnectDocument) Test(org.junit.jupiter.api.Test)

Aggregations

KafkaConnectDocument (io.atlasmap.kafkaconnect.v2.KafkaConnectDocument)8 InputStream (java.io.InputStream)6 Test (org.junit.jupiter.api.Test)6 KafkaConnectEnumField (io.atlasmap.kafkaconnect.v2.KafkaConnectEnumField)3 KafkaConnectField (io.atlasmap.kafkaconnect.v2.KafkaConnectField)2 KafkaConnectInspectionResponse (io.atlasmap.kafkaconnect.v2.KafkaConnectInspectionResponse)2 Field (io.atlasmap.v2.Field)2 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 AtlasPath (io.atlasmap.core.AtlasPath)1 KafkaConnectInspectionService (io.atlasmap.kafkaconnect.inspect.KafkaConnectInspectionService)1 KafkaConnectComplexType (io.atlasmap.kafkaconnect.v2.KafkaConnectComplexType)1 KafkaConnectInspectionRequest (io.atlasmap.kafkaconnect.v2.KafkaConnectInspectionRequest)1 KafkaConnectSchemaType (io.atlasmap.kafkaconnect.v2.KafkaConnectSchemaType)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 WebApplicationException (javax.ws.rs.WebApplicationException)1 Response (javax.ws.rs.core.Response)1 Schema (org.apache.kafka.connect.data.Schema)1