Search in sources :

Example 11 with DbImport

use of org.jumpmind.symmetric.io.data.DbImport in project symmetric-ds by JumpMind.

the class DbExportImportTest method importXmlData.

@Test
public void importXmlData() throws Exception {
    final String FILE = "/test-dbimport-1-xml-1.xml";
    ISymmetricEngine engine = getSymmetricEngine();
    DbImport importer = new DbImport(engine.getDatabasePlatform());
    importer.setFormat(DbImport.Format.XML);
    importer.setDropIfExists(true);
    importer.setAlterCaseToMatchDatabaseDefaultCase(true);
    importer.importTables(getClass().getResourceAsStream(FILE));
    assertCountDbImportTableRecords(3);
    // table should be dropped so this should work again
    importer.importTables(getClass().getResourceAsStream(FILE));
    assertCountDbImportTableRecords(3);
}
Also used : DbImport(org.jumpmind.symmetric.io.data.DbImport) AbstractServiceTest(org.jumpmind.symmetric.service.impl.AbstractServiceTest) Test(org.junit.Test)

Aggregations

DbImport (org.jumpmind.symmetric.io.data.DbImport)11 AbstractServiceTest (org.jumpmind.symmetric.service.impl.AbstractServiceTest)9 Test (org.junit.Test)9 IDatabasePlatform (org.jumpmind.db.platform.IDatabasePlatform)6 Table (org.jumpmind.db.model.Table)5 Database (org.jumpmind.db.model.Database)4 DbExport (org.jumpmind.symmetric.io.data.DbExport)4 File (java.io.File)2 ISqlTemplate (org.jumpmind.db.sql.ISqlTemplate)2 Row (org.jumpmind.db.sql.Row)2 SqlException (org.jumpmind.db.sql.SqlException)2 DbFill (org.jumpmind.symmetric.io.data.DbFill)2 BufferedInputStream (java.io.BufferedInputStream)1 FileInputStream (java.io.FileInputStream)1 Column (org.jumpmind.db.model.Column)1 ConflictException (org.jumpmind.symmetric.io.data.writer.ConflictException)1 IDatabaseWriterFilter (org.jumpmind.symmetric.io.data.writer.IDatabaseWriterFilter)1