Search in sources :

Example 1 with Context

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;
}
Also used : Context(org.xbib.elasticsearch.jdbc.strategy.Context) InputStream(java.io.InputStream) Settings(org.elasticsearch.common.settings.Settings)

Example 2 with 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;
}
Also used : Context(org.xbib.elasticsearch.jdbc.strategy.Context) InputStream(java.io.InputStream) Settings(org.elasticsearch.common.settings.Settings)

Example 3 with 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;
}
Also used : Context(org.xbib.elasticsearch.jdbc.strategy.Context) JDBCImporter(org.xbib.tools.JDBCImporter)

Example 4 with Context

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);
}
Also used : Context(org.xbib.elasticsearch.jdbc.strategy.Context) Parameters(org.testng.annotations.Parameters) Test(org.testng.annotations.Test)

Aggregations

Context (org.xbib.elasticsearch.jdbc.strategy.Context)4 InputStream (java.io.InputStream)2 Settings (org.elasticsearch.common.settings.Settings)2 Parameters (org.testng.annotations.Parameters)1 Test (org.testng.annotations.Test)1 JDBCImporter (org.xbib.tools.JDBCImporter)1