use of org.jumpmind.symmetric.io.data.writer.ConflictException in project symmetric-ds by JumpMind.
the class DbExportImportTest method importSymXmlData.
@Test
public void importSymXmlData() throws Exception {
final String FILE = "/test-dbimport-1-sym_xml-1.xml";
ISymmetricEngine engine = getSymmetricEngine();
recreateImportTable();
assertCountDbImportTableRecords(0);
DbImport importCsv = new DbImport(engine.getDatabasePlatform());
importCsv.setFormat(DbImport.Format.SYM_XML);
importCsv.importTables(getClass().getResourceAsStream(FILE));
assertCountDbImportTableRecords(2);
try {
importCsv.importTables(getClass().getResourceAsStream(FILE));
Assert.fail("Expected a sql exception");
} catch (ConflictException ex) {
}
assertCountDbImportTableRecords(2);
recreateImportTable();
importCsv.setReplaceRows(true);
importCsv.importTables(getClass().getResourceAsStream(FILE));
assertCountDbImportTableRecords(2);
}
Aggregations