Search in sources :

Example 76 with QueryEntity

use of org.apache.ignite.cache.QueryEntity in project ignite by apache.

the class GridIndexingSpiAbstractSelfTest method cacheBCfg.

/**
 */
private CacheConfiguration cacheBCfg() {
    CacheConfiguration cfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
    cfg.setName("B");
    QueryEntity eA = new QueryEntity(Integer.class.getName(), "A");
    eA.setFields(fieldsBA);
    cfg.setQueryEntities(Collections.singleton(eA));
    return cfg;
}
Also used : QueryEntity(org.apache.ignite.cache.QueryEntity) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration)

Example 77 with QueryEntity

use of org.apache.ignite.cache.QueryEntity in project ignite by apache.

the class JdbcErrorsAbstractSelfTest method beforeTestsStarted.

/**
 * {@inheritDoc}
 */
@Override
protected void beforeTestsStarted() throws Exception {
    super.beforeTestsStarted();
    IgniteEx grid = startGrid(getConfiguration(getTestIgniteInstanceName(0)).setCacheConfiguration(new CacheConfiguration("test").setQueryEntities(Collections.singletonList(new QueryEntity(Integer.class, Integer.class)))));
    // add cache template for cache with enabled read-through cache store
    grid.addCacheConfiguration(new CacheConfiguration<>(CACHE_STORE_TEMPLATE).setCacheStoreFactory(singletonFactory(new TestCacheStore())).setReadThrough(true));
    // add cache template for cache with enabled cache interceptor
    grid.addCacheConfiguration(new CacheConfiguration<>(CACHE_INTERCEPTOR_TEMPLATE).setInterceptor(new TestCacheInterceptor()));
}
Also used : IgniteEx(org.apache.ignite.internal.IgniteEx) QueryEntity(org.apache.ignite.cache.QueryEntity) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration)

Example 78 with QueryEntity

use of org.apache.ignite.cache.QueryEntity 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))));
    TcpDiscoverySpi disco = new TcpDiscoverySpi();
    disco.setIpFinder(IP_FINDER);
    cfg.setDiscoverySpi(disco);
    cfg.setConnectorConfiguration(new ConnectorConfiguration());
    return cfg;
}
Also used : 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) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Example 79 with QueryEntity

use of org.apache.ignite.cache.QueryEntity in project ignite by apache.

the class JdbcThinAbstractDmlStatementSelfTest method binaryCacheConfig.

/**
 * @return Cache configuration for binary marshaller tests.
 */
final CacheConfiguration binaryCacheConfig() {
    CacheConfiguration<?, ?> cache = defaultCacheConfiguration();
    cache.setCacheMode(PARTITIONED);
    cache.setBackups(1);
    cache.setWriteSynchronizationMode(FULL_SYNC);
    QueryEntity e = new QueryEntity();
    e.setKeyType(String.class.getName());
    e.setValueType("Person");
    e.addQueryField("id", Integer.class.getName(), null);
    e.addQueryField("age", Integer.class.getName(), null);
    e.addQueryField("firstName", String.class.getName(), null);
    e.addQueryField("lastName", String.class.getName(), null);
    cache.setQueryEntities(Collections.singletonList(e));
    return cache;
}
Also used : QueryEntity(org.apache.ignite.cache.QueryEntity)

Example 80 with QueryEntity

use of org.apache.ignite.cache.QueryEntity in project ignite by apache.

the class JdbcThinAbstractDmlStatementSelfTest method getBinaryConfiguration.

/**
 * @param igniteInstanceName Ignite instance name.
 * @return Grid configuration used for starting the grid ready for manipulating binary objects.
 * @throws Exception If failed.
 */
IgniteConfiguration getBinaryConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = getConfiguration0(igniteInstanceName);
    cfg.setMarshaller(new BinaryMarshaller());
    CacheConfiguration ccfg = cfg.getCacheConfiguration()[0];
    ccfg.getQueryEntities().clear();
    QueryEntity e = new QueryEntity();
    e.setKeyType(String.class.getName());
    e.setValueType("Person");
    e.addQueryField("id", Integer.class.getName(), null);
    e.addQueryField("age", Integer.class.getName(), null);
    e.addQueryField("firstName", String.class.getName(), null);
    e.addQueryField("lastName", String.class.getName(), null);
    ccfg.setQueryEntities(Collections.singletonList(e));
    return cfg;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) BinaryMarshaller(org.apache.ignite.internal.binary.BinaryMarshaller) QueryEntity(org.apache.ignite.cache.QueryEntity) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration)

Aggregations

QueryEntity (org.apache.ignite.cache.QueryEntity)97 CacheConfiguration (org.apache.ignite.configuration.CacheConfiguration)59 QueryIndex (org.apache.ignite.cache.QueryIndex)46 LinkedHashMap (java.util.LinkedHashMap)38 ArrayList (java.util.ArrayList)33 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)17 TcpDiscoverySpi (org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)12 HashSet (java.util.HashSet)8 NearCacheConfiguration (org.apache.ignite.configuration.NearCacheConfiguration)8 HashMap (java.util.HashMap)7 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)7 CacheKeyConfiguration (org.apache.ignite.cache.CacheKeyConfiguration)7 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)6 BinaryObject (org.apache.ignite.binary.BinaryObject)5 DynamicCacheDescriptor (org.apache.ignite.internal.processors.cache.DynamicCacheDescriptor)5 RendezvousAffinityFunction (org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction)4 BinaryMarshaller (org.apache.ignite.internal.binary.BinaryMarshaller)4 SchemaOperationException (org.apache.ignite.internal.processors.query.schema.SchemaOperationException)4 List (java.util.List)3 Map (java.util.Map)3