use of org.apache.gobblin.converter.avro.JsonElementConversionFactory.RecordConverter in project incubator-gobblin by apache.
the class JsonElementConversionFactoryTest method schemaWithMapValuesAsJsonNull.
@Test(expectedExceptions = UnsupportedOperationException.class)
public void schemaWithMapValuesAsJsonNull() throws Exception {
String testName = "schemaWithMapValuesAsJsonNull";
JsonObject schema = getSchemaData(testName).getAsJsonObject();
new RecordConverter(new JsonSchema(schema), state, buildNamespace(state.getExtract().getNamespace(), "something"));
}
use of org.apache.gobblin.converter.avro.JsonElementConversionFactory.RecordConverter in project incubator-gobblin by apache.
the class JsonElementConversionFactoryTest method schemaWithRecordIsNullable.
@Test
public void schemaWithRecordIsNullable() throws Exception {
String testName = "schemaWithRecordIsNullable";
JsonObject schema = getSchemaData(testName).getAsJsonObject();
JsonArray expected = getExpectedSchema(testName).getAsJsonArray();
RecordConverter converter = new RecordConverter(new JsonSchema(schema), state, buildNamespace(state.getExtract().getNamespace(), "something"));
Assert.assertEquals(avroSchemaToJsonElement(converter), expected);
}
use of org.apache.gobblin.converter.avro.JsonElementConversionFactory.RecordConverter in project incubator-gobblin by apache.
the class JsonElementConversionFactoryTest method schemaWithRecordOfArray.
@Test
public void schemaWithRecordOfArray() throws Exception {
String testName = "schemaWithRecordOfArray";
JsonObject schema = getSchemaData(testName).getAsJsonObject();
JsonObject expected = getExpectedSchema(testName).getAsJsonObject();
RecordConverter converter = new RecordConverter(new JsonSchema(schema), state, buildNamespace(state.getExtract().getNamespace(), "something"));
Assert.assertEquals(avroSchemaToJsonElement(converter), expected);
}
use of org.apache.gobblin.converter.avro.JsonElementConversionFactory.RecordConverter in project incubator-gobblin by apache.
the class JsonElementConversionFactoryTest method schemaWithRecordOfMap.
@Test
public void schemaWithRecordOfMap() throws Exception {
String testName = "schemaWithRecordOfMap";
JsonObject schema = getSchemaData(testName).getAsJsonObject();
JsonObject expected = getExpectedSchema(testName).getAsJsonObject();
RecordConverter converter = new RecordConverter(new JsonSchema(schema), state, buildNamespace(state.getExtract().getNamespace(), "something"));
Assert.assertEquals(avroSchemaToJsonElement(converter), expected);
}
use of org.apache.gobblin.converter.avro.JsonElementConversionFactory.RecordConverter in project incubator-gobblin by apache.
the class JsonElementConversionFactoryTest method schemaWithRecordOfRecordCheckNamespace.
@Test
public void schemaWithRecordOfRecordCheckNamespace() throws Exception {
String testName = "schemaWithRecordOfRecordCheckNamespace";
JsonObject schema = getSchemaData(testName).getAsJsonObject();
JsonObject expected = getExpectedSchema(testName).getAsJsonObject();
RecordConverter converter = new RecordConverter(new JsonSchema(schema), state, buildNamespace(state.getExtract().getNamespace(), "person"));
Assert.assertEquals(avroSchemaToJsonElement(converter), expected);
Assert.assertEquals(converter.schema().getField("someperson").schema().getNamespace(), "namespace.person.myrecord");
Assert.assertEquals(converter.schema().getNamespace(), "namespace.person");
}
Aggregations