MorphlineDeriver implements Deriver, ProvidesAlias, ProvidesValidations,
    InstantiatesComponents { protected StructType getSchema() { return this.schema; }  @Override void configure(Config config); @Override Dataset<Row> derive(Map<String, Dataset<Row>> dependencies); @Override String getAlias(); @Override Validations getValidations(); @Override Set<InstantiatedComponent> getComponents(Config config, boolean configure); static final String STEP_NAME_CONFIG; static final String MORPHLINE; static final String MORPHLINE_ID; static final String SCHEMA_CONFIG; static final String ERROR_ON_EMPTY; }
@Test public void getSchema() throws Exception { Map<String, Object> paramMap = new HashMap<>(); paramMap.put(MorphlineDeriver.STEP_NAME_CONFIG, "dep1"); paramMap.put(MorphlineDeriver.MORPHLINE, getResourcePath(MORPHLINE_FILE)); paramMap.put(MorphlineDeriver.MORPHLINE_ID, "id"); paramMap.put(MorphlineDeriver.SCHEMA_CONFIG + "." + ComponentFactory.TYPE_CONFIG_NAME, "flat"); paramMap.put(MorphlineDeriver.SCHEMA_CONFIG + "." + FlatSchema.FIELD_NAMES_CONFIG, Lists.newArrayList("foo", "bar")); paramMap.put(MorphlineDeriver.SCHEMA_CONFIG + "." + FlatSchema.FIELD_TYPES_CONFIG, Lists.newArrayList("int", "string")); final Config config = ConfigFactory.parseMap(paramMap); MorphlineDeriver deriver = new MorphlineDeriver(); assertNoValidationFailures(deriver, config); deriver.configure(config); StructType schema = deriver.getSchema(); assertEquals("Invalid number of SchemaFields", 2, schema.fields().length); assertEquals("Invalid DataType", DataTypes.IntegerType, schema.fields()[0].dataType()); assertEquals("Invalid DataType", DataTypes.StringType, schema.fields()[1].dataType()); }