Search in sources :

Example 6 with SqlConfiguration

use of org.apache.ignite.configuration.SqlConfiguration in project ignite by apache.

the class JdbcThinComplexDmlDdlCustomSchemaSelfTest method getConfiguration.

/**
 * {@inheritDoc}
 */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
    cfg.setSqlConfiguration(new SqlConfiguration().setSqlSchemas(SCHEMA_1, SCHEMA_2));
    return cfg;
}
Also used : SqlConfiguration(org.apache.ignite.configuration.SqlConfiguration) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration)

Example 7 with SqlConfiguration

use of org.apache.ignite.configuration.SqlConfiguration in project ignite by apache.

the class JdbcMetadataSelfTest method getConfiguration.

/**
 * {@inheritDoc}
 */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
    LinkedHashMap<String, Boolean> persFields = new LinkedHashMap<>();
    persFields.put("name", true);
    persFields.put("age", false);
    cfg.setCacheConfiguration(cacheConfiguration("pers").setQueryEntities(Arrays.asList(new QueryEntityEx(new QueryEntity(AffinityKey.class.getName(), Person.class.getName()).addQueryField("name", String.class.getName(), null).addQueryField("age", Integer.class.getName(), null).addQueryField("orgId", Integer.class.getName(), null).setIndexes(Arrays.asList(new QueryIndex("orgId"), new QueryIndex().setFields(persFields)))).setNotNullFields(new HashSet<>(Arrays.asList("age", "name"))))), cacheConfiguration("org").setQueryEntities(Arrays.asList(new QueryEntity(AffinityKey.class, Organization.class))), cacheConfiguration("metaTest").setQueryEntities(Arrays.asList(new QueryEntity(AffinityKey.class, MetaTest.class))));
    cfg.setConnectorConfiguration(new ConnectorConfiguration());
    cfg.setSqlConfiguration(new SqlConfiguration().setSqlSchemas("PREDEFINED_SCHEMAS_1", "PREDEFINED_SCHEMAS_2"));
    return cfg;
}
Also used : SqlConfiguration(org.apache.ignite.configuration.SqlConfiguration) QueryEntityEx(org.apache.ignite.internal.processors.query.QueryEntityEx) ConnectorConfiguration(org.apache.ignite.configuration.ConnectorConfiguration) QueryEntity(org.apache.ignite.cache.QueryEntity) LinkedHashMap(java.util.LinkedHashMap) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) QueryIndex(org.apache.ignite.cache.QueryIndex) AffinityKey(org.apache.ignite.cache.affinity.AffinityKey) HashSet(java.util.HashSet)

Example 8 with SqlConfiguration

use of org.apache.ignite.configuration.SqlConfiguration in project ignite by apache.

the class IgniteCacheLocalQueryDefaultTimeoutSelfTest method getConfiguration.

/**
 * {@inheritDoc}
 */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
    CacheConfiguration<Integer, String> ccfg = new CacheConfiguration<Integer, String>(DEFAULT_CACHE_NAME).setIndexedTypes(Integer.class, String.class).setCacheMode(LOCAL).setSqlFunctionClasses(TimedQueryHelper.class);
    cfg.setCacheConfiguration(ccfg);
    cfg.setSqlConfiguration(new SqlConfiguration().setDefaultQueryTimeout(DEFAULT_QUERY_TIMEOUT));
    return cfg;
}
Also used : SqlConfiguration(org.apache.ignite.configuration.SqlConfiguration) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration)

Example 9 with SqlConfiguration

use of org.apache.ignite.configuration.SqlConfiguration in project ignite by apache.

the class IgniteSqlSkipReducerOnUpdateDmlSelfTest method getConfiguration.

/**
 * {@inheritDoc}
 */
@Override
protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    IgniteConfiguration c = super.getConfiguration(gridName);
    List<CacheConfiguration> ccfgs = new ArrayList<>();
    ccfgs.add(buildCacheConfiguration(CACHE_ORG));
    ccfgs.add(buildCacheConfiguration(CACHE_PERSON));
    ccfgs.add(buildCacheConfiguration(CACHE_POSITION));
    c.setCacheConfiguration(ccfgs.toArray(new CacheConfiguration[ccfgs.size()]));
    c.setSqlConfiguration(new SqlConfiguration().setLongQueryWarningTimeout(10000));
    c.setIncludeEventTypes(EventType.EVTS_ALL);
    return c;
}
Also used : SqlConfiguration(org.apache.ignite.configuration.SqlConfiguration) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) ArrayList(java.util.ArrayList) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration)

Example 10 with SqlConfiguration

use of org.apache.ignite.configuration.SqlConfiguration in project ignite by apache.

the class IgniteSqlSchemasDiffConfigurationsTest method testDiffSqlSchemasCfgProp.

/**
 */
@Test
public void testDiffSqlSchemasCfgProp() throws Exception {
    startGrid(getConfiguration("ign1").setSqlConfiguration(new SqlConfiguration().setSqlSchemas(SCHEMA_NAME_1, SCHEMA_NAME_2)));
    startGrid(getConfiguration("ign2").setSqlConfiguration(new SqlConfiguration().setSqlSchemas(SCHEMA_NAME_3, SCHEMA_NAME_4)));
    List<List<String>> exp = Arrays.asList(Arrays.asList(SCHEMA_NAME_1, "cache_1"), Arrays.asList(SCHEMA_NAME_2, "cache_2"), Arrays.asList(SCHEMA_NAME_3, "cache_3"), Arrays.asList(SCHEMA_NAME_4, "cache_4"));
    for (List<String> row : exp) grid("ign1").createCache(new CacheConfiguration<>(row.get(1)).setSqlSchema(row.get(0)));
    List<List<?>> res = execSql("ign1", "SELECT SQL_SCHEMA, CACHE_NAME FROM " + t(QueryUtils.SCHEMA_SYS, "CACHES") + " WHERE CACHE_NAME LIKE 'cache%' ORDER BY SQL_SCHEMA");
    Assert.assertEquals(exp, res);
}
Also used : SqlConfiguration(org.apache.ignite.configuration.SqlConfiguration) List(java.util.List) AbstractIndexingCommonTest(org.apache.ignite.internal.processors.cache.index.AbstractIndexingCommonTest) Test(org.junit.Test)

Aggregations

SqlConfiguration (org.apache.ignite.configuration.SqlConfiguration)11 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)8 List (java.util.List)4 Test (org.junit.Test)4 ArrayList (java.util.ArrayList)3 Arrays.asList (java.util.Arrays.asList)3 HashSet (java.util.HashSet)3 IgniteEx (org.apache.ignite.internal.IgniteEx)3 CacheConfiguration (org.apache.ignite.configuration.CacheConfiguration)2 AbstractIndexingCommonTest (org.apache.ignite.internal.processors.cache.index.AbstractIndexingCommonTest)2 LinkedHashMap (java.util.LinkedHashMap)1 Set (java.util.Set)1 Collectors.toSet (java.util.stream.Collectors.toSet)1 QueryEntity (org.apache.ignite.cache.QueryEntity)1 QueryIndex (org.apache.ignite.cache.QueryIndex)1 AffinityKey (org.apache.ignite.cache.affinity.AffinityKey)1 ConnectorConfiguration (org.apache.ignite.configuration.ConnectorConfiguration)1 CommandList (org.apache.ignite.internal.commandline.CommandList)1 AbstractExporterSpiTest (org.apache.ignite.internal.metric.AbstractExporterSpiTest)1 AbstractSchemaSelfTest (org.apache.ignite.internal.processors.cache.index.AbstractSchemaSelfTest)1