use of org.xbib.elasticsearch.jdbc.strategy.mock.MockJDBCSource in project elasticsearch-jdbc by jprante.
the class ColumnStrategyContextTests method testReadLastRunTime.
@Test
@Parameters({ "existedWhereClause" })
@SuppressWarnings("unchecked")
public void testReadLastRunTime(String resource) throws Exception {
Settings settings = createSettings(resource);
final DateTime lastRunAt = new DateTime(new DateTime().getMillis() - 600);
context = newContext();
MockJDBCSource source = new MockJDBCSource() {
@Override
public void fetch() {
DateTime readlastRunAt = context.getLastRunTimestamp();
assertNotNull(readlastRunAt);
assertEquals(readlastRunAt, lastRunAt);
}
};
MockSink mockSink = new MockSink();
context.setSettings(settings).setSink(mockSink).setSource(source);
//mockSink.setIngestFactory(createIngestFactory(settings));
context.setLastRunTimeStamp(lastRunAt);
context.execute();
}
use of org.xbib.elasticsearch.jdbc.strategy.mock.MockJDBCSource in project elasticsearch-jdbc by jprante.
the class ColumnStrategyContextTests method testWriteLastRunTime.
@Test
@Parameters({ "existedWhereClause" })
@SuppressWarnings("unchecked")
public void testWriteLastRunTime(String resource) throws Exception {
Settings settings = createSettings(resource);
context = newContext();
MockJDBCSource source = new MockJDBCSource() {
@Override
public void fetch() {
}
};
MockSink mockSink = new MockSink();
context.setSettings(settings).setSink(mockSink).setSource(source);
//mockSink.setIngestFactory(createIngestFactory(settings));
context.execute();
assertNotNull(context.getLastRunTimestamp());
}
Aggregations