Configuration config = new ConfigurationImpl();
((ConfigurationImpl) config).setProperties(props);
((ConfigurationImpl) config).setThreshold(0.85);
((ConfigurationImpl) config).setMaybeThreshold(0.7);
CSVDataSource csv = new CSVDataSource();
csv.setInputFile("test.csv");
csv.addColumn(new Column("id", "ID", null, null));
csv.addColumn(new Column("name", "NAME", null, null));
Column emailCol = new Column("email", "EMAIL", null, null);
emailCol.setSplitOn(";");
csv.addColumn(emailCol);
((ConfigurationImpl) config).addDataSource(0, csv);
// --- write and reload
File outfile = tmpdir.newFile("config.xml");
ConfigWriter.write(config, outfile.getAbsolutePath());
config = ConfigLoader.load(outfile.getAbsolutePath());
// --- verify loaded correctly
assertEquals(1, config.getDataSources().size());
csv = (CSVDataSource) config.getDataSources().iterator().next();
assertTrue(csv.getInputFile().endsWith("test.csv"));
assertEquals(3, csv.getColumns().size());
Collection<Column> csvEmailColList = csv.getColumn("email");
Column csvEmailCol = (Column) csvEmailColList.toArray()[0];
assertTrue(csvEmailCol.isSplit());
// FIXME: check the columns (kind of hard given lack of ordering)
assertTrue(config.getDataSources(1).isEmpty());