use of org.elasticsearch.test.cluster.NoopClusterService in project crate by crate.
the class SelectStatementAnalyzerTest method init.
@Before
public void init() throws Exception {
DocTableInfo fooUserTableInfo = TestingTableInfo.builder(new TableIdent("foo", "users"), SHARD_ROUTING).add("id", DataTypes.LONG, null).add("name", DataTypes.STRING, null).addPrimaryKey("id").build();
DocTableInfoFactory fooTableFactory = new TestingDocTableInfoFactory(ImmutableMap.of(fooUserTableInfo.ident(), fooUserTableInfo));
ClusterService clusterService = new NoopClusterService();
sqlExecutor = SQLExecutor.builder(clusterService).enableDefaultTables().addSchema(new DocSchemaInfo("foo", clusterService, fooTableFactory)).build();
}
use of org.elasticsearch.test.cluster.NoopClusterService in project crate by crate.
the class SysShardsExpressionsTest method prepare.
@Before
public void prepare() throws Exception {
ClusterService clusterService = new NoopClusterService();
indexShard = mockIndexShard();
schemas = new Schemas(Settings.EMPTY, ImmutableMap.of("sys", new SysSchemaInfo(clusterService)), clusterService, new DocSchemaInfoFactory(new TestingDocTableInfoFactory(Collections.emptyMap())));
ShardReferenceResolver shardRefResolver = new ShardReferenceResolver(clusterService, schemas, indexShard);
resolver = new RecoveryShardReferenceResolver(shardRefResolver, indexShard);
}
use of org.elasticsearch.test.cluster.NoopClusterService in project crate by crate.
the class BulkRetryCoordinatorPoolTest method prepare.
@Before
public void prepare() {
MetaData metaData = MetaData.builder().put(IndexMetaData.builder(TEST_INDEX).settings(settings(Version.CURRENT)).numberOfShards(3).numberOfReplicas(0)).build();
RoutingTable routingTable = RoutingTable.builder().addAsNew(metaData.index(TEST_INDEX)).build();
ClusterState state = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build();
state = ClusterState.builder(state).nodes(DiscoveryNodes.builder().put(newNode(NODE_IDS[0])).localNodeId(NODE_IDS[0])).build();
AllocationService allocationService = createAllocationService();
routingTable = allocationService.reroute(state, "test").routingTable();
state = ClusterState.builder(state).routingTable(routingTable).build();
ClusterService clusterService = new NoopClusterService(state);
this.state = state;
pool = new BulkRetryCoordinatorPool(Settings.EMPTY, clusterService, mock(ThreadPool.class));
pool.start();
}
use of org.elasticsearch.test.cluster.NoopClusterService in project crate by crate.
the class DecommissioningServiceTest method setUp.
@Before
public void setUp() throws Exception {
NodeSettingsService settingsService = new NodeSettingsService(Settings.EMPTY);
threadPool = mock(ThreadPool.class, Answers.RETURNS_MOCKS.get());
jobsLogs = new JobsLogs(() -> true);
sqlOperations = mock(SQLOperations.class, Answers.RETURNS_MOCKS.get());
decommissioningService = new TestableDecommissioningService(Settings.EMPTY, new NoopClusterService(), jobsLogs, threadPool, settingsService, sqlOperations, mock(TransportClusterHealthAction.class), mock(TransportClusterUpdateSettingsAction.class));
}
use of org.elasticsearch.test.cluster.NoopClusterService in project crate by crate.
the class DocTableInfoBuilderTest method testNoTableInfoFromOrphanedPartition.
@Test
public void testNoTableInfoFromOrphanedPartition() throws Exception {
String schemaName = randomSchema();
PartitionName partitionName = new PartitionName(schemaName, "test", Collections.singletonList(new BytesRef("boo")));
IndexMetaData.Builder indexMetaDataBuilder = IndexMetaData.builder(partitionName.asIndexName()).settings(Settings.builder().put("index.version.created", Version.CURRENT).build()).numberOfReplicas(0).numberOfShards(5).putMapping(Constants.DEFAULT_MAPPING_TYPE, "{" + " \"default\": {" + " \"properties\":{" + " \"id\": {" + " \"type\": \"integer\"," + " \"index\": \"not_analyzed\"" + " }" + " }" + " }" + "}");
MetaData metaData = MetaData.builder().put(indexMetaDataBuilder).build();
NoopClusterService clusterService = new NoopClusterService(ClusterState.builder(ClusterName.DEFAULT).metaData(metaData).build());
DocTableInfoBuilder builder = new DocTableInfoBuilder(functions, new TableIdent(schemaName, "test"), clusterService, new IndexNameExpressionResolver(Settings.EMPTY), mock(TransportPutIndexTemplateAction.class), executorService, false);
expectedException.expect(TableUnknownException.class);
expectedException.expectMessage(String.format(Locale.ENGLISH, "Table '%s.test' unknown", schemaName));
builder.build();
}
Aggregations