Search in sources :

Example 1 with NoopClusterService

use of org.elasticsearch.test.cluster.NoopClusterService in project crate by crate.

the class RefreshAnalyzerTest method init.

@Before
public void init() throws Exception {
    NoopClusterService clusterService = new NoopClusterService();
    TestingBlobTableInfo myBlobsTableInfo = TableDefinitions.createBlobTable(myBlobsIdent, clusterService);
    e = SQLExecutor.builder(clusterService).enableDefaultTables().addBlobTable(myBlobsTableInfo).build();
}
Also used : NoopClusterService(org.elasticsearch.test.cluster.NoopClusterService) Before(org.junit.Before)

Example 2 with NoopClusterService

use of org.elasticsearch.test.cluster.NoopClusterService in project crate by crate.

the class CreateAlterTableStatementAnalyzerTest method init.

@Before
public void init() throws Exception {
    String analyzerSettings = FulltextAnalyzerResolver.encodeSettings(Settings.builder().put("search", "foobar").build()).toUtf8();
    MetaData metaData = MetaData.builder().persistentSettings(Settings.builder().put("crate.analysis.custom.analyzer.ft_search", analyzerSettings).build()).build();
    ClusterState state = ClusterState.builder(ClusterName.DEFAULT).nodes(DiscoveryNodes.builder().put(new DiscoveryNode("n1", DummyTransportAddress.INSTANCE, org.elasticsearch.Version.CURRENT)).put(new DiscoveryNode("n2", DummyTransportAddress.INSTANCE, org.elasticsearch.Version.CURRENT)).put(new DiscoveryNode("n3", DummyTransportAddress.INSTANCE, org.elasticsearch.Version.CURRENT)).localNodeId("n1")).metaData(metaData).build();
    e = SQLExecutor.builder(new NoopClusterService(state)).enableDefaultTables().build();
}
Also used : ClusterState(org.elasticsearch.cluster.ClusterState) DiscoveryNode(org.elasticsearch.cluster.node.DiscoveryNode) MetaData(org.elasticsearch.cluster.metadata.MetaData) DocIndexMetaData(io.crate.metadata.doc.DocIndexMetaData) TestingHelpers.mapToSortedString(io.crate.testing.TestingHelpers.mapToSortedString) NoopClusterService(org.elasticsearch.test.cluster.NoopClusterService) Before(org.junit.Before)

Example 3 with NoopClusterService

use of org.elasticsearch.test.cluster.NoopClusterService in project crate by crate.

the class InsertFromSubQueryAnalyzerTest method initGeneratedColumnTable.

@Before
public void initGeneratedColumnTable() throws Exception {
    SQLExecutor.Builder builder = SQLExecutor.builder(new NoopClusterService()).enableDefaultTables();
    TableIdent usersGeneratedIdent = new TableIdent(null, "users_generated");
    TestingTableInfo.Builder usersGenerated = new TestingTableInfo.Builder(usersGeneratedIdent, SHARD_ROUTING).add("id", DataTypes.LONG).add("firstname", DataTypes.STRING).add("lastname", DataTypes.STRING).addGeneratedColumn("name", DataTypes.STRING, "firstname || ' ' || lastname", false).addPrimaryKey("id");
    builder.addDocTable(usersGenerated);
    e = builder.build();
}
Also used : SQLExecutor(io.crate.testing.SQLExecutor) TableIdent(io.crate.metadata.TableIdent) NoopClusterService(org.elasticsearch.test.cluster.NoopClusterService) TestingTableInfo(io.crate.metadata.table.TestingTableInfo) Before(org.junit.Before)

Example 4 with NoopClusterService

use of org.elasticsearch.test.cluster.NoopClusterService in project crate by crate.

the class SnapshotRestoreAnalyzerTest method before.

@Before
public void before() throws Exception {
    RepositoriesMetaData repositoriesMetaData = new RepositoriesMetaData(new RepositoryMetaData("my_repo", "fs", Settings.builder().put("location", "/tmp/my_repo").build()));
    ClusterState clusterState = ClusterState.builder(new ClusterName("testing")).metaData(MetaData.builder().putCustom(RepositoriesMetaData.TYPE, repositoriesMetaData)).build();
    NoopClusterService clusterService = new NoopClusterService(clusterState);
    executor = SQLExecutor.builder(clusterService).addDocTable(USER_TABLE_INFO).addDocTable(TEST_DOC_LOCATIONS_TABLE_INFO).addDocTable(TEST_PARTITIONED_TABLE_INFO).build();
}
Also used : RepositoriesMetaData(org.elasticsearch.cluster.metadata.RepositoriesMetaData) ClusterState(org.elasticsearch.cluster.ClusterState) RepositoryMetaData(org.elasticsearch.cluster.metadata.RepositoryMetaData) ClusterName(org.elasticsearch.cluster.ClusterName) NoopClusterService(org.elasticsearch.test.cluster.NoopClusterService) Before(org.junit.Before)

Example 5 with NoopClusterService

use of org.elasticsearch.test.cluster.NoopClusterService in project crate by crate.

the class CreateAlterPartitionedTableAnalyzerTest method init.

@Before
public void init() throws Exception {
    String analyzerSettings = FulltextAnalyzerResolver.encodeSettings(Settings.builder().put("search", "foobar").build()).toUtf8();
    MetaData metaData = MetaData.builder().persistentSettings(Settings.builder().put("crate.analysis.custom.analyzer.ft_search", analyzerSettings).build()).build();
    ClusterState state = ClusterState.builder(ClusterName.DEFAULT).metaData(metaData).build();
    e = SQLExecutor.builder(new NoopClusterService(state)).enableDefaultTables().build();
}
Also used : ClusterState(org.elasticsearch.cluster.ClusterState) MetaData(org.elasticsearch.cluster.metadata.MetaData) TestingHelpers.mapToSortedString(io.crate.testing.TestingHelpers.mapToSortedString) NoopClusterService(org.elasticsearch.test.cluster.NoopClusterService) Before(org.junit.Before)

Aggregations

NoopClusterService (org.elasticsearch.test.cluster.NoopClusterService)25 Before (org.junit.Before)19 ClusterService (org.elasticsearch.cluster.ClusterService)8 TableIdent (io.crate.metadata.TableIdent)6 ClusterState (org.elasticsearch.cluster.ClusterState)6 TestingTableInfo (io.crate.metadata.table.TestingTableInfo)4 SQLExecutor (io.crate.testing.SQLExecutor)4 ClusterName (org.elasticsearch.cluster.ClusterName)4 Test (org.junit.Test)4 ImmutableMap (com.google.common.collect.ImmutableMap)3 JobContextService (io.crate.jobs.JobContextService)3 JobsLogs (io.crate.operation.collect.stats.JobsLogs)3 CrateUnitTest (io.crate.test.integration.CrateUnitTest)3 MetaData (org.elasticsearch.cluster.metadata.MetaData)3 RepositoriesMetaData (org.elasticsearch.cluster.metadata.RepositoriesMetaData)3 RepositoryMetaData (org.elasticsearch.cluster.metadata.RepositoryMetaData)3 TransportService (org.elasticsearch.transport.TransportService)3 Routing (io.crate.metadata.Routing)2 TestingDocTableInfoFactory (io.crate.metadata.doc.TestingDocTableInfoFactory)2 RoutedCollectPhase (io.crate.planner.node.dql.RoutedCollectPhase)2