Search in sources :

Example 1 with MapConverter

use of org.apache.gobblin.converter.avro.JsonElementConversionFactory.MapConverter in project incubator-gobblin by apache.

the class JsonElementConversionFactoryTest method schemaWithMapOfArrays.

@Test
public void schemaWithMapOfArrays() throws Exception {
    String testName = "schemaWithMapOfArrays";
    JsonObject schema = getSchemaData(testName).getAsJsonObject();
    JsonObject expected = getExpectedSchema(testName).getAsJsonObject();
    MapConverter converter = new MapConverter(new JsonSchema(schema), state);
    Assert.assertEquals(avroSchemaToJsonElement(converter), expected);
}
Also used : MapConverter(org.apache.gobblin.converter.avro.JsonElementConversionFactory.MapConverter) JsonSchema(org.apache.gobblin.converter.json.JsonSchema) JsonObject(com.google.gson.JsonObject) Test(org.testng.annotations.Test)

Example 2 with MapConverter

use of org.apache.gobblin.converter.avro.JsonElementConversionFactory.MapConverter 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);
}
Also used : MapConverter(org.apache.gobblin.converter.avro.JsonElementConversionFactory.MapConverter) JsonSchema(org.apache.gobblin.converter.json.JsonSchema) JsonObject(com.google.gson.JsonObject) Test(org.testng.annotations.Test)

Example 3 with MapConverter

use of org.apache.gobblin.converter.avro.JsonElementConversionFactory.MapConverter 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);
}
Also used : MapConverter(org.apache.gobblin.converter.avro.JsonElementConversionFactory.MapConverter) JsonSchema(org.apache.gobblin.converter.json.JsonSchema) JsonObject(com.google.gson.JsonObject) Test(org.testng.annotations.Test)

Example 4 with MapConverter

use of org.apache.gobblin.converter.avro.JsonElementConversionFactory.MapConverter in project incubator-gobblin by apache.

the class JsonElementConversionFactoryTest method schemaWithMapIsNullable.

@Test
public void schemaWithMapIsNullable() throws Exception {
    String testName = "schemaWithMapIsNullable";
    JsonObject schema = getSchemaData(testName).getAsJsonObject();
    JsonArray expected = getExpectedSchema(testName).getAsJsonArray();
    MapConverter converter = new MapConverter(new JsonSchema(schema), state);
    Assert.assertEquals(avroSchemaToJsonElement(converter), expected);
}
Also used : JsonArray(com.google.gson.JsonArray) MapConverter(org.apache.gobblin.converter.avro.JsonElementConversionFactory.MapConverter) JsonSchema(org.apache.gobblin.converter.json.JsonSchema) JsonObject(com.google.gson.JsonObject) Test(org.testng.annotations.Test)

Example 5 with MapConverter

use of org.apache.gobblin.converter.avro.JsonElementConversionFactory.MapConverter in project incubator-gobblin by apache.

the class JsonElementConversionFactoryTest method schemaWithMapOfRecords.

@Test
public void schemaWithMapOfRecords() throws Exception {
    String testName = "schemaWithMapOfRecords";
    JsonObject schema = getSchemaData(testName).getAsJsonObject();
    JsonObject expected = getExpectedSchema(testName).getAsJsonObject();
    MapConverter converter = new MapConverter(new JsonSchema(schema), state);
    Assert.assertEquals(avroSchemaToJsonElement(converter), expected);
}
Also used : MapConverter(org.apache.gobblin.converter.avro.JsonElementConversionFactory.MapConverter) JsonSchema(org.apache.gobblin.converter.json.JsonSchema) JsonObject(com.google.gson.JsonObject) Test(org.testng.annotations.Test)

Aggregations

JsonObject (com.google.gson.JsonObject)5 MapConverter (org.apache.gobblin.converter.avro.JsonElementConversionFactory.MapConverter)5 JsonSchema (org.apache.gobblin.converter.json.JsonSchema)5 Test (org.testng.annotations.Test)5 JsonArray (com.google.gson.JsonArray)1