use of org.elasticsearch.test.cluster.NoopClusterService in project crate by crate.
the class WhereClauseAnalyzerTest method init.
@Before
public void init() throws Exception {
SQLExecutor.Builder builder = SQLExecutor.builder(new NoopClusterService());
registerTables(builder);
TestingTableInfo.Builder genInfo = TestingTableInfo.builder(new TableIdent(DocSchemaInfo.NAME, GENERATED_COL_TABLE_NAME), new Routing(ImmutableMap.<String, Map<String, List<Integer>>>of())).add("ts", DataTypes.TIMESTAMP, null).add("x", DataTypes.INTEGER, null).add("y", DataTypes.LONG, null).addGeneratedColumn("day", DataTypes.TIMESTAMP, "date_trunc('day', ts)", true).addGeneratedColumn("minus_y", DataTypes.LONG, "y * -1", true).addGeneratedColumn("x_incr", DataTypes.LONG, "x + 1", false).addPartitions(new PartitionName("generated_col", Arrays.asList(new BytesRef("1420070400000"), new BytesRef("-1"))).asIndexName(), new PartitionName("generated_col", Arrays.asList(new BytesRef("1420156800000"), new BytesRef("-2"))).asIndexName());
builder.addDocTable(genInfo);
TableIdent ident = new TableIdent(DocSchemaInfo.NAME, DOUBLE_GEN_PARTITIONED_TABLE_NAME);
TestingTableInfo.Builder doubleGenPartedInfo = TestingTableInfo.builder(ident, new Routing(ImmutableMap.<String, Map<String, List<Integer>>>of())).add("x", DataTypes.INTEGER, null).addGeneratedColumn("x1", DataTypes.LONG, "x+1", true).addGeneratedColumn("x2", DataTypes.LONG, "x+2", true).addPartitions(new PartitionName(ident, Arrays.asList(new BytesRef("4"), new BytesRef("5"))).toString(), new PartitionName(ident, Arrays.asList(new BytesRef("5"), new BytesRef("6"))).toString());
builder.addDocTable(doubleGenPartedInfo);
e = builder.build();
}
use of org.elasticsearch.test.cluster.NoopClusterService in project crate by crate.
the class TestGlobalSysExpressions method prepare.
@Before
public void prepare() throws Exception {
Injector injector = new ModulesBuilder().add(new SysClusterExpressionModule()).add((Module) binder -> {
binder.bind(ClusterService.class).toInstance(new NoopClusterService());
binder.bind(Settings.class).toInstance(Settings.EMPTY);
binder.bind(ClusterName.class).toInstance(new ClusterName("cluster"));
binder.bind(ClusterReferenceResolver.class).asEagerSingleton();
}).createInjector();
resolver = injector.getInstance(ClusterReferenceResolver.class);
}
use of org.elasticsearch.test.cluster.NoopClusterService in project crate by crate.
the class BlobIndicesServiceTest method testBlobComponentsAreNotCreatedForNonBlobIndex.
@Test
public void testBlobComponentsAreNotCreatedForNonBlobIndex() throws Exception {
CompletableFuture<IndicesLifecycle.Listener> listenerFuture = new CompletableFuture<>();
BlobIndicesService blobIndicesService = new BlobIndicesService(Settings.EMPTY, new NoopClusterService(), new IndicesLifecycle() {
@Override
public void addListener(Listener listener) {
listenerFuture.complete(listener);
}
@Override
public void removeListener(Listener listener) {
}
});
IndicesLifecycle.Listener listener = listenerFuture.get(30, TimeUnit.SECONDS);
IndexService indexService = mock(IndexService.class);
when(indexService.index()).thenReturn(new Index("dummy"));
listener.afterIndexCreated(indexService);
IndexShard indexShard = mock(IndexShard.class);
when(indexShard.indexService()).thenReturn(indexService);
listener.afterIndexShardCreated(indexShard);
assertThat(blobIndicesService.indices.keySet(), Matchers.empty());
}
use of org.elasticsearch.test.cluster.NoopClusterService in project crate by crate.
the class OptimizeTableAnalyzerTest method init.
@Before
public void init() throws Exception {
TableIdent myBlobsIdent = new TableIdent(BlobSchemaInfo.NAME, "blobs");
NoopClusterService clusterService = new NoopClusterService();
TestingBlobTableInfo myBlobsTableInfo = TableDefinitions.createBlobTable(myBlobsIdent, clusterService);
e = SQLExecutor.builder(clusterService).enableDefaultTables().addBlobTable(myBlobsTableInfo).build();
}
use of org.elasticsearch.test.cluster.NoopClusterService in project crate by crate.
the class UpdateAnalyzerTest method init.
@Before
public void init() {
SQLExecutor.Builder builder = SQLExecutor.builder(new NoopClusterService()).enableDefaultTables().addDocTable(nestedClusteredByTableInfo).addDocTable(testAliasTableInfo).addDocTable(tiNestedPk);
TableIdent partedGeneratedColumnTableIdent = new TableIdent(null, "parted_generated_column");
TestingTableInfo.Builder partedGeneratedColumnTableInfo = new TestingTableInfo.Builder(partedGeneratedColumnTableIdent, new Routing(ImmutableMap.<String, Map<String, List<Integer>>>of())).add("ts", DataTypes.TIMESTAMP, null).addGeneratedColumn("day", DataTypes.TIMESTAMP, "date_trunc('day', ts)", true);
builder.addDocTable(partedGeneratedColumnTableInfo);
TableIdent nestedPartedGeneratedColumnTableIdent = new TableIdent(null, "nested_parted_generated_column");
TestingTableInfo.Builder nestedPartedGeneratedColumnTableInfo = new TestingTableInfo.Builder(nestedPartedGeneratedColumnTableIdent, new Routing(ImmutableMap.<String, Map<String, List<Integer>>>of())).add("user", DataTypes.OBJECT, null).add("user", DataTypes.STRING, Arrays.asList("name")).addGeneratedColumn("name", DataTypes.STRING, "concat(user['name'], 'bar')", true);
builder.addDocTable(nestedPartedGeneratedColumnTableInfo);
e = builder.build();
}
Aggregations