Configuration config = new ConfigurationImpl();
((ConfigurationImpl) config).setProperties(props);
((ConfigurationImpl) config).setThreshold(0.85);
((ConfigurationImpl) config).setMaybeThreshold(0.7);
JNDIDataSource jndi = new JNDIDataSource();
jndi.setJndiPath("path");
jndi.setQuery("select");
jndi.addColumn(new Column("id", "ID", null, null));
jndi.addColumn(new Column("name", "NAME", null, null));
jndi.addColumn(new Column("email", "EMAIL", null, null));
((ConfigurationImpl) config).addDataSource(0, jndi);
// --- 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());
jndi = (JNDIDataSource) config.getDataSources().iterator().next();
assertEquals("select", jndi.getQuery());
assertEquals(3, jndi.getColumns().size());
// FIXME: check the columns (kind of hard given lack of ordering)
assertTrue(config.getDataSources(1).isEmpty());
assertTrue(config.getDataSources(2).isEmpty());
assertEquals(config.getThreshold(), 0.85);