Search in sources :

Example 1 with TestingDocTableInfoFactory

use of io.crate.metadata.doc.TestingDocTableInfoFactory 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();
}
Also used : DocTableInfo(io.crate.metadata.doc.DocTableInfo) DocSchemaInfo(io.crate.metadata.doc.DocSchemaInfo) NoopClusterService(org.elasticsearch.test.cluster.NoopClusterService) ClusterService(org.elasticsearch.cluster.ClusterService) TestingDocTableInfoFactory(io.crate.metadata.doc.TestingDocTableInfoFactory) TableIdent(io.crate.metadata.TableIdent) NoopClusterService(org.elasticsearch.test.cluster.NoopClusterService) DocTableInfoFactory(io.crate.metadata.doc.DocTableInfoFactory) TestingDocTableInfoFactory(io.crate.metadata.doc.TestingDocTableInfoFactory) Before(org.junit.Before)

Example 2 with TestingDocTableInfoFactory

use of io.crate.metadata.doc.TestingDocTableInfoFactory 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);
}
Also used : SysSchemaInfo(io.crate.metadata.sys.SysSchemaInfo) RecoveryShardReferenceResolver(io.crate.metadata.shard.RecoveryShardReferenceResolver) NoopClusterService(org.elasticsearch.test.cluster.NoopClusterService) ClusterService(org.elasticsearch.cluster.ClusterService) DocSchemaInfoFactory(io.crate.metadata.doc.DocSchemaInfoFactory) TestingDocTableInfoFactory(io.crate.metadata.doc.TestingDocTableInfoFactory) NoopClusterService(org.elasticsearch.test.cluster.NoopClusterService) ShardReferenceResolver(io.crate.metadata.shard.ShardReferenceResolver) RecoveryShardReferenceResolver(io.crate.metadata.shard.RecoveryShardReferenceResolver) Before(org.junit.Before)

Example 3 with TestingDocTableInfoFactory

use of io.crate.metadata.doc.TestingDocTableInfoFactory in project crate by crate.

the class SysShardsExpressionsTest method prepare.

@Before
public void prepare() {
    NodeContext nodeCtx = createNodeContext();
    indexShard = mockIndexShard();
    CrateSettings crateSettings = new CrateSettings(clusterService, clusterService.getSettings());
    UserDefinedFunctionService udfService = new UserDefinedFunctionService(clusterService, nodeCtx);
    schemas = new Schemas(Map.of("sys", new SysSchemaInfo(this.clusterService, crateSettings)), clusterService, new DocSchemaInfoFactory(new TestingDocTableInfoFactory(Collections.emptyMap()), (ident, state) -> null, nodeCtx, udfService));
    resolver = new ShardReferenceResolver(schemas, new ShardRowContext(indexShard, clusterService));
    sysShards = schemas.getTableInfo(SysShardsTableInfo.IDENT);
}
Also used : UserDefinedFunctionService(io.crate.expression.udf.UserDefinedFunctionService) ShardRowContext(io.crate.expression.reference.sys.shard.ShardRowContext) SysSchemaInfo(io.crate.metadata.sys.SysSchemaInfo) DocSchemaInfoFactory(io.crate.metadata.doc.DocSchemaInfoFactory) CrateSettings(io.crate.metadata.settings.CrateSettings) TestingDocTableInfoFactory(io.crate.metadata.doc.TestingDocTableInfoFactory) TestingHelpers.createNodeContext(io.crate.testing.TestingHelpers.createNodeContext) NodeContext(io.crate.metadata.NodeContext) Schemas(io.crate.metadata.Schemas) ShardReferenceResolver(io.crate.metadata.shard.ShardReferenceResolver) Before(org.junit.Before)

Aggregations

TestingDocTableInfoFactory (io.crate.metadata.doc.TestingDocTableInfoFactory)3 Before (org.junit.Before)3 DocSchemaInfoFactory (io.crate.metadata.doc.DocSchemaInfoFactory)2 ShardReferenceResolver (io.crate.metadata.shard.ShardReferenceResolver)2 SysSchemaInfo (io.crate.metadata.sys.SysSchemaInfo)2 ClusterService (org.elasticsearch.cluster.ClusterService)2 NoopClusterService (org.elasticsearch.test.cluster.NoopClusterService)2 ShardRowContext (io.crate.expression.reference.sys.shard.ShardRowContext)1 UserDefinedFunctionService (io.crate.expression.udf.UserDefinedFunctionService)1 NodeContext (io.crate.metadata.NodeContext)1 Schemas (io.crate.metadata.Schemas)1 TableIdent (io.crate.metadata.TableIdent)1 DocSchemaInfo (io.crate.metadata.doc.DocSchemaInfo)1 DocTableInfo (io.crate.metadata.doc.DocTableInfo)1 DocTableInfoFactory (io.crate.metadata.doc.DocTableInfoFactory)1 CrateSettings (io.crate.metadata.settings.CrateSettings)1 RecoveryShardReferenceResolver (io.crate.metadata.shard.RecoveryShardReferenceResolver)1 TestingHelpers.createNodeContext (io.crate.testing.TestingHelpers.createNodeContext)1