use of org.apache.ignite.cache.query.SpiQuery in project ignite by apache.
the class IndexingSpiQuerySelfTest method testIndexingSpiWithDisabledQueryProcessor.
/**
* @throws Exception If failed.
*/
public void testIndexingSpiWithDisabledQueryProcessor() throws Exception {
IgniteConfiguration cfg = configuration();
cfg.setIndexingSpi(new MyIndexingSpi());
Ignite ignite = Ignition.start(cfg);
CacheConfiguration<Integer, Integer> ccfg = cacheConfiguration(CACHE_NAME);
IgniteCache<Integer, Integer> cache = ignite.createCache(ccfg);
for (int i = 0; i < 10; i++) cache.put(i, i);
QueryCursor<Cache.Entry<Integer, Integer>> cursor = cache.query(new SpiQuery<Integer, Integer>().setArgs(2, 5));
for (Cache.Entry<Integer, Integer> entry : cursor) System.out.println(entry);
}
use of org.apache.ignite.cache.query.SpiQuery in project ignite by apache.
the class IndexingSpiQuerySelfTest method testBinaryIndexingSpi.
/**
* @throws Exception If failed.
*/
public void testBinaryIndexingSpi() throws Exception {
IgniteConfiguration cfg = configuration();
cfg.setIndexingSpi(new MyBinaryIndexingSpi());
Ignite ignite = Ignition.start(cfg);
CacheConfiguration<PersonKey, Person> ccfg = cacheConfiguration(CACHE_NAME);
IgniteCache<PersonKey, Person> cache = ignite.createCache(ccfg);
for (int i = 0; i < 10; i++) {
PersonKey key = new PersonKey(i);
cache.put(key, new Person("John Doe " + i));
}
QueryCursor<Cache.Entry<PersonKey, Person>> cursor = cache.query(new SpiQuery<PersonKey, Person>().setArgs(new PersonKey(2), new PersonKey(5)));
for (Cache.Entry<PersonKey, Person> entry : cursor) System.out.println(entry);
cache.remove(new PersonKey(9));
}
use of org.apache.ignite.cache.query.SpiQuery in project ignite by apache.
the class IndexingSpiQuerySelfTest method testSimpleIndexingSpi.
/**
* @throws Exception If failed.
*/
public void testSimpleIndexingSpi() throws Exception {
IgniteConfiguration cfg = configuration();
cfg.setIndexingSpi(new MyIndexingSpi());
Ignite ignite = Ignition.start(cfg);
CacheConfiguration<Integer, Integer> ccfg = cacheConfiguration(CACHE_NAME);
IgniteCache<Integer, Integer> cache = ignite.createCache(ccfg);
for (int i = 0; i < 10; i++) cache.put(i, i);
QueryCursor<Cache.Entry<Integer, Integer>> cursor = cache.query(new SpiQuery<Integer, Integer>().setArgs(2, 5));
for (Cache.Entry<Integer, Integer> entry : cursor) System.out.println(entry);
}
Aggregations