@BeforeClass public void setUp() throws Exception { String avroSchemaString = IOUtils.toString(this.getClass().getResourceAsStream("/converter/jsonToAvroSchema.avsc"), StandardCharsets.UTF_8); this.jsonRecord = new JsonParser().parse(IOUtils.toString(this.getClass().getResourceAsStream( "/converter/jsonToAvroRecord.json"), StandardCharsets.UTF_8)).getAsJsonObject(); SourceState source = new SourceState(); this.state = new WorkUnitState( source.createWorkUnit(source.createExtract(TableType.SNAPSHOT_ONLY, "test_table", "test_namespace"))); this.state.setProp(ConfigurationKeys.CONVERTER_AVRO_SCHEMA_KEY, avroSchemaString); this.state.setProp(ConfigurationKeys.CONVERTER_IGNORE_FIELDS, "fieldToIgnore"); }
@BeforeClass public static void setUp() { Type listType = new TypeToken<JsonObject>() { }.getType(); Gson gson = new Gson(); JsonObject testData = gson.fromJson( new InputStreamReader(JsonIntermediateToParquetGroupConverter.class.getResourceAsStream(RESOURCE_PATH)), listType); testCases = testData.getAsJsonObject(); SourceState source = new SourceState(); workUnit = new WorkUnitState( source.createWorkUnit(source.createExtract(Extract.TableType.SNAPSHOT_ONLY, "test_namespace", "test_table"))); }
WorkUnit wu = sourceState.createWorkUnit(extract);