use of org.jumpmind.symmetric.io.stage.StagingManager in project symmetric-ds by JumpMind.
the class MsSqlBulkDatabaseWriterTest method setup.
@BeforeClass
public static void setup() throws Exception {
if (DbTestUtils.getEnvironmentSpecificProperties(DbTestUtils.ROOT).get(BasicDataSourcePropertyConstants.DB_POOL_DRIVER).equals("net.sourceforge.jtds.jdbc.Driver")) {
platform = DbTestUtils.createDatabasePlatform(DbTestUtils.ROOT);
platform.createDatabase(platform.readDatabaseFromXml("/testBulkWriter.xml", true), true, false);
stagingManager = new StagingManager("target/tmp");
}
}
use of org.jumpmind.symmetric.io.stage.StagingManager in project symmetric-ds by JumpMind.
the class MySqlBulkDatabaseWriterTest method setup.
@BeforeClass
public static void setup() throws Exception {
if (DbTestUtils.getEnvironmentSpecificProperties(DbTestUtils.ROOT).get(BasicDataSourcePropertyConstants.DB_POOL_DRIVER).equals("com.mysql.jdbc.Driver")) {
platform = DbTestUtils.createDatabasePlatform(DbTestUtils.ROOT);
platform.createDatabase(platform.readDatabaseFromXml("/testBulkWriter.xml", true), true, false);
stagingManager = new StagingManager("tmp");
}
}
use of org.jumpmind.symmetric.io.stage.StagingManager in project symmetric-ds by JumpMind.
the class StagingDataWriterTest method readThenWrite.
public void readThenWrite(long threshold) throws Exception {
InputStreamReader is = new InputStreamReader(getClass().getResourceAsStream("FileCsvDataWriterTest.1.csv"));
String origCsv = IOUtils.toString(is);
is.close();
StagingManager stagingManager = new StagingManager(DIR.getAbsolutePath());
ProtocolDataReader reader = new ProtocolDataReader(BatchType.LOAD, "test", origCsv);
StagingDataWriter writer = new StagingDataWriter(threshold, false, "aaa", "test", stagingManager, new BatchListener());
DataProcessor processor = new DataProcessor(reader, writer, "test");
processor.process(new DataContext());
assertEquals(1, batchesWritten.size());
assertEquals(convertEol(origCsv), convertEol(batchesWritten.get(0)));
IStagedResource resource = (IStagedResource) stagingManager.find("test", "aaa", 1);
assertNotNull(resource);
if (threshold > origCsv.length()) {
assertFalse(resource.getFile().exists());
} else {
assertTrue(resource.getFile().exists());
}
resource.delete();
assertFalse(resource.getFile().exists());
}
Aggregations