use of org.xbib.elasticsearch.jdbc.strategy.Context in project elasticsearch-jdbc by jprante.
the class AbstractSinkTest method createContext.
protected Context createContext(String resource) throws Exception {
InputStream in = getClass().getResourceAsStream(resource);
Settings settings = Settings.settingsBuilder().put("jdbc.elasticsearch.cluster", "elasticsearch").putArray("jdbc.elasticsearch.host", getHosts()).loadFromStream("test", in).build().getAsSettings("jdbc");
Context context = newContext();
context.setSettings(settings);
return context;
}
use of org.xbib.elasticsearch.jdbc.strategy.Context in project elasticsearch-jdbc by jprante.
the class AbstractColumnStrategyTest method createContext.
protected Context createContext(String resource) throws Exception {
//waitForYellow("1");
InputStream in = getClass().getResourceAsStream(resource);
Settings settings = createSettings(resource);
Context context = newContext();
context.setSettings(settings);
//context.getSink().setIngestFactory(createIngestFactory(settings));
logger.info("created context {} with cluster name {}", context, "elasticsearch");
return context;
}
use of org.xbib.elasticsearch.jdbc.strategy.Context in project elasticsearch-jdbc by jprante.
the class StandardScheduleTests method createImporter.
private JDBCImporter createImporter(final String resource) throws Exception {
final JDBCImporter importer = new JDBCImporter();
Context context = createContext(resource);
logger.info("createImporter: setting context {}", context);
importer.setContext(context);
logger.info("createImporter: settings = {}", context.getSettings());
// dispatch in a thread
new Thread() {
public void run() {
importer.run();
}
}.start();
return importer;
}
use of org.xbib.elasticsearch.jdbc.strategy.Context in project elasticsearch-jdbc by jprante.
the class StandardScriptTests method testSimpleTaskOnce.
/**
* Orders table (star query)
*
* @param resource the definition
* @throws Exception if test fails
*/
@Test
@Parameters({ "task1" })
public void testSimpleTaskOnce(String resource) throws Exception {
Context context = createContext(resource);
boolean b = waitFor(context, Context.State.IDLE, 5000L);
logger.info("after wait for: {}", b);
}
Aggregations