@Test public void testMultipleMappings() { checkParser(new ColumnMapping.Builder() .key("key_field") .column("username", "meta", "username") .column("email", "meta", "email") .keyAsColumn("map_field", "map_content", "key_") .counter("counter_field", "meta", "counter_field") .counter("counter_field2", "meta", "counter_field2") .build(), "[\n" + "{\"source\": \"key_field\", \"type\": \"key\"},\n" + "{\"source\": \"username\", \"type\": \"column\"," + "\"family\": \"meta\", \"qualifier\": \"username\"},\n" + "{\"source\": \"email\", \"type\": \"column\"," + "\"family\": \"meta\", \"qualifier\": \"email\"},\n" + "{\"source\": \"map_field\", \"type\": \"keyAsColumn\"," + "\"family\": \"map_content\", \"prefix\": \"key_\"},\n" + "{\"source\": \"counter_field\", \"type\": \"counter\"," + "\"family\": \"meta\", \"qualifier\": \"counter_field\"},\n" + "{\"source\": \"counter_field2\", \"type\": \"counter\"," + "\"family\": \"meta\", \"qualifier\": \"counter_field2\"}\n" + "]\n"); checkParser(new ColumnMapping.Builder() .key("key_field") .column("username", "meta", "username") .column("email", "meta", "email") .keyAsColumn("map_field", "map_content", "key_") .version("version") .build(), "[\n" + "{\"source\": \"key_field\", \"type\": \"key\"},\n" + "{\"source\": \"username\", \"type\": \"column\"," + "\"family\": \"meta\", \"qualifier\": \"username\"},\n" + "{\"source\": \"email\", \"type\": \"column\"," + "\"family\": \"meta\", \"qualifier\": \"email\"},\n" + "{\"source\": \"map_field\", \"type\": \"keyAsColumn\"," + "\"family\": \"map_content\", \"prefix\": \"key_\"},\n" + "{\"source\": \"version\", \"type\": \"occVersion\"}\n" + "]\n"); TestHelpers.assertThrows("Should reject counter and occVersion", ValidationException.class, new Runnable() { @Override public void run() { ColumnMappingParser.parse("[" + "{\"source\": \"v\", \"type\": \"occVersion\"}," + "{\"source\": \"c\", \"type\": \"counter\", \"value\": \"f:q\"}" + "]"); } } ); TestHelpers.assertThrows("Should reject more than one occVersion", ValidationException.class, new Runnable() { @Override public void run() { ColumnMappingParser.parse("[" + "{\"source\": \"v\", \"type\": \"occVersion\"}," + "{\"source\": \"v2\", \"type\": \"occVersion\"}" + "]"); } } ); }
public static ColumnMapping parse(String mappingDescriptor) { return buildColumnMapping(JsonUtil.parse(mappingDescriptor)); }
ColumnMappingParser { public static ColumnMapping parse(String mappingDescriptor) { return buildColumnMapping(JsonUtil.parse(mappingDescriptor)); } }
ColumnMappingParser { public static ColumnMapping parse(String mappingDescriptor) { return buildColumnMapping(JsonUtil.parse(mappingDescriptor)); }  }
ColumnMappingParser { public static ColumnMapping parse(String mappingDescriptor) { return buildColumnMapping(JsonUtil.parse(mappingDescriptor)); }  static ColumnMapping parse(String mappingDescriptor); static ColumnMapping parse(File file); static ColumnMapping parse(InputStream in); static boolean hasEmbeddedColumnMapping(Schema schema); static Schema removeEmbeddedMapping(Schema schema); static ColumnMapping parseFromSchema(Schema schema); static boolean hasEmbeddedFieldMappings(Schema schema); static ColumnMapping parseFromSchemaFields(Schema schema); static Schema embedColumnMapping(Schema schema, ColumnMapping mapping); static Map<Integer, FieldMapping> parseKeyMappingsFromSchemaFields(
      Schema schema); static FieldMapping parseFieldMapping(JsonNode mappingNode); static FieldMapping parseFieldMapping(String source, JsonNode mappingNode); static String toString(FieldMapping mapping); static String toString(ColumnMapping mapping, boolean pretty); }
ColumnMappingParser { public static ColumnMapping parse(String mappingDescriptor) { return buildColumnMapping(JsonUtil.parse(mappingDescriptor)); }  static ColumnMapping parse(String mappingDescriptor); static ColumnMapping parse(File file); static ColumnMapping parse(InputStream in); static boolean hasEmbeddedColumnMapping(Schema schema); static Schema removeEmbeddedMapping(Schema schema); static ColumnMapping parseFromSchema(Schema schema); static boolean hasEmbeddedFieldMappings(Schema schema); static ColumnMapping parseFromSchemaFields(Schema schema); static Schema embedColumnMapping(Schema schema, ColumnMapping mapping); static Map<Integer, FieldMapping> parseKeyMappingsFromSchemaFields(
      Schema schema); static FieldMapping parseFieldMapping(JsonNode mappingNode); static FieldMapping parseFieldMapping(String source, JsonNode mappingNode); static String toString(FieldMapping mapping); static String toString(ColumnMapping mapping, boolean pretty);  }