Search in sources :

Example 1 with PlainIndexableObject

use of org.xbib.elasticsearch.common.util.PlainIndexableObject in project elasticsearch-jdbc by jprante.

the class ColumnStrategySourceTests method createFixturesAndPopulateSink.

private ProductFixtures createFixturesAndPopulateSink(boolean[] shouldProductsBeDeleted, MockSink sink) throws IOException {
    ProductFixture[] fixtures = new ProductFixture[shouldProductsBeDeleted.length];
    int expectedExistsCountAfterRun = 0;
    for (int i = 0; i < shouldProductsBeDeleted.length; i++) {
        IndexableObject p = new PlainIndexableObject().id(Integer.toString(i)).source(createSource(i)).optype("delete");
        sink.index(p, false);
        Timestamp deletedAt;
        if (shouldProductsBeDeleted[i]) {
            deletedAt = okTimestamp();
        } else {
            deletedAt = oldTimestamp();
            expectedExistsCountAfterRun++;
        }
        fixtures[i] = ProductFixture.one().setId(i).createdAt(oldTimestamp()).updatedAt(oldTimestamp()).deletedAt(deletedAt);
    }
    return new ProductFixtures(fixtures, expectedExistsCountAfterRun);
}
Also used : PlainIndexableObject(org.xbib.elasticsearch.common.util.PlainIndexableObject) IndexableObject(org.xbib.elasticsearch.common.util.IndexableObject) PlainIndexableObject(org.xbib.elasticsearch.common.util.PlainIndexableObject) Timestamp(java.sql.Timestamp)

Aggregations

Timestamp (java.sql.Timestamp)1 IndexableObject (org.xbib.elasticsearch.common.util.IndexableObject)1 PlainIndexableObject (org.xbib.elasticsearch.common.util.PlainIndexableObject)1