use of org.apache.gobblin.converter.json.JsonSchema in project incubator-gobblin by apache.
the class JsonElementConversionFactoryTest method schemaWithIsNullable.
@Test
public void schemaWithIsNullable() throws Exception {
String testName = "schemaWithIsNullable";
JsonObject schema = getSchemaData(testName).getAsJsonObject();
JsonArray expected = getExpectedSchema(testName).getAsJsonArray();
StringConverter converter = new StringConverter(new JsonSchema(schema));
Assert.assertEquals(avroSchemaToJsonElement(converter), expected);
}
use of org.apache.gobblin.converter.json.JsonSchema in project incubator-gobblin by apache.
the class JsonElementConversionFactoryTest method schemaWithMap.
@Test
public void schemaWithMap() throws Exception {
String testName = "schemaWithMap";
JsonObject schema = getSchemaData(testName).getAsJsonObject();
JsonObject expected = getExpectedSchema(testName).getAsJsonObject();
MapConverter converter = new MapConverter(new JsonSchema(schema), state);
Assert.assertEquals(avroSchemaToJsonElement(converter), expected);
}
use of org.apache.gobblin.converter.json.JsonSchema in project incubator-gobblin by apache.
the class JsonElementConversionFactoryTest method schemaWithArrayOfInts.
@Test
public void schemaWithArrayOfInts() throws Exception {
String testName = "schemaWithArrayOfInts";
JsonObject schema = getSchemaData(testName).getAsJsonObject();
JsonObject expected = getExpectedSchema(testName).getAsJsonObject();
ArrayConverter converter = new ArrayConverter(new JsonSchema(schema), state);
Assert.assertEquals(avroSchemaToJsonElement(converter), expected);
}
use of org.apache.gobblin.converter.json.JsonSchema in project incubator-gobblin by apache.
the class JsonElementConversionFactoryTest method schemaWithMapOfEnum.
@Test
public void schemaWithMapOfEnum() throws Exception {
String testName = "schemaWithMapOfEnum";
JsonObject schema = getSchemaData(testName).getAsJsonObject();
JsonObject expected = getExpectedSchema(testName).getAsJsonObject();
MapConverter converter = new MapConverter(new JsonSchema(schema), state);
Assert.assertEquals(avroSchemaToJsonElement(converter), expected);
}
use of org.apache.gobblin.converter.json.JsonSchema in project incubator-gobblin by apache.
the class JsonElementConversionFactoryTest method schemaWithEnumIsNullable.
@Test
public void schemaWithEnumIsNullable() throws Exception {
String testName = "schemaWithEnumIsNullable";
JsonObject schema = getSchemaData(testName).getAsJsonObject();
JsonArray expected = getExpectedSchema(testName).getAsJsonArray();
EnumConverter converter = new EnumConverter(new JsonSchema(schema), "something");
Assert.assertEquals(avroSchemaToJsonElement(converter), expected);
}
Aggregations