use of org.jumpmind.symmetric.io.MsSqlBulkDatabaseWriter in project symmetric-ds by JumpMind.
the class MsSqlBulkDatabaseWriterTest method testInsertReorderColumns.
@Test
public void testInsertReorderColumns() throws Exception {
if (shouldTestRun(platform)) {
String id = getNextId();
String[] values = { "string with space in it", "string-with-no-space", "string with space in it", "string-with-no-space", "2007-01-02 00:00:00.000", "2007-02-03 04:05:06.000", "0", "47", "67.89", "-0.0747663", encode("string with space in it"), id };
List<CsvData> data = new ArrayList<CsvData>();
data.add(new CsvData(DataEventType.INSERT, (String[]) ArrayUtils.clone(values)));
Table table = (Table) platform.getTableFromCache(getTestTable(), false).clone();
Column firstColumn = table.getColumn(0);
table.removeColumn(firstColumn);
table.addColumn(firstColumn);
writeData(new MsSqlBulkDatabaseWriter(platform, stagingManager, new CommonsDbcpNativeJdbcExtractor(), 1000, false, uncPath, null, null), new TableCsvData(table, data));
values = (String[]) ArrayUtils.remove(values, values.length - 1);
values = (String[]) ArrayUtils.add(values, 0, id);
assertTestTableEquals(id, values);
}
}
Aggregations