use of org.apache.ignite.internal.IgniteEx in project ignite by apache.
the class SchemaExchangeSelfTest method checkClientCacheStart.
/**
* Check client cache start.
*
* @throws Exception If failed.
*/
private void checkClientCacheStart(boolean dynamic) throws Exception {
IgniteEx node1 = startNoCache(1);
IgniteEx node2;
if (dynamic) {
node2 = startClientNoCache(2);
createSqlCache(node2, cacheConfiguration(KeyClass.class, ValueClass.class));
} else
node2 = startClient(2, KeyClass.class, ValueClass.class);
assertTypes(node1, ValueClass.class);
assertTypes(node2, ValueClass.class);
IgniteEx node3 = start(3);
IgniteEx node4 = start(4, KeyClass.class, ValueClass.class, KeyClass2.class, ValueClass2.class);
IgniteEx node5 = startNoCache(5);
IgniteEx node6 = startClient(6);
IgniteEx node7 = startClient(7, KeyClass.class, ValueClass.class, KeyClass2.class, ValueClass2.class);
IgniteEx node8 = startClientNoCache(8);
assertTypes(node1, ValueClass.class);
assertTypes(node2, ValueClass.class);
assertTypes(node3, ValueClass.class);
assertTypes(node4, ValueClass.class);
assertTypes(node5, ValueClass.class);
assertTypes(node6, ValueClass.class);
assertTypes(node7, ValueClass.class);
assertTypes(node8);
node8.cache(CACHE_NAME);
assertTypes(node8, ValueClass.class);
destroySqlCache(node2);
node2.getOrCreateCache(cacheConfiguration(KeyClass.class, ValueClass.class, KeyClass2.class, ValueClass2.class));
assertTypes(node1, ValueClass.class, ValueClass2.class);
assertTypes(node2, ValueClass.class, ValueClass2.class);
assertTypes(node3, ValueClass.class, ValueClass2.class);
assertTypes(node4, ValueClass.class, ValueClass2.class);
assertTypes(node5, ValueClass.class, ValueClass2.class);
assertTypes(node6);
assertTypes(node7);
assertTypes(node8);
node6.cache(CACHE_NAME);
node7.cache(CACHE_NAME);
node8.cache(CACHE_NAME);
assertTypes(node6, ValueClass.class, ValueClass2.class);
assertTypes(node7, ValueClass.class, ValueClass2.class);
assertTypes(node8, ValueClass.class, ValueClass2.class);
}
use of org.apache.ignite.internal.IgniteEx in project ignite by apache.
the class SchemaExchangeSelfTest method testServerRestartWithNewTypes.
/**
* Test client reconnect after server restart accompanied by schema change.
*
* @throws Exception If failed.
*/
public void testServerRestartWithNewTypes() throws Exception {
IgniteEx node1 = start(1, KeyClass.class, ValueClass.class);
assertTypes(node1, ValueClass.class);
IgniteEx node2 = startClientNoCache(2);
assertTypes(node2);
node2.cache(CACHE_NAME);
assertTypes(node2, ValueClass.class);
stopGrid(1);
assertTrue(GridTestUtils.waitForCondition(new GridAbsPredicate() {
@Override
public boolean apply() {
return grid(2).context().clientDisconnected();
}
}, 10_000L));
IgniteFuture reconnFut = null;
try {
node2.cache(CACHE_NAME);
fail();
} catch (IgniteClientDisconnectedException e) {
reconnFut = e.reconnectFuture();
}
node1 = start(1, KeyClass.class, ValueClass.class, KeyClass2.class, ValueClass2.class);
assertTypes(node1, ValueClass.class, ValueClass2.class);
reconnFut.get();
assertTypes(node2);
node2.cache(CACHE_NAME);
assertTypes(node2, ValueClass.class, ValueClass2.class);
}
use of org.apache.ignite.internal.IgniteEx in project ignite by apache.
the class SchemaExchangeSelfTest method testDynamicRestarts.
/**
* Make sure that new metadata can be propagated after destroy.
*
* @throws Exception If failed.
*/
public void testDynamicRestarts() throws Exception {
IgniteEx node1 = start(1, KeyClass.class, ValueClass.class);
IgniteEx node2 = startNoCache(2);
IgniteEx node3 = startClientNoCache(3);
IgniteEx node4 = startClientNoCache(4);
assertTypes(node1, ValueClass.class);
assertTypes(node2, ValueClass.class);
assertTypes(node3);
node3.cache(CACHE_NAME);
assertTypes(node3, ValueClass.class);
// Check restarts from the first node.
destroySqlCache(node1);
node1.getOrCreateCache(cacheConfiguration());
assertTypes(node1);
assertTypes(node2);
assertTypes(node3);
node1.destroyCache(CACHE_NAME);
node1.getOrCreateCache(cacheConfiguration(KeyClass.class, ValueClass.class, KeyClass2.class, ValueClass2.class));
assertTypes(node1, ValueClass.class, ValueClass2.class);
assertTypes(node2, ValueClass.class, ValueClass2.class);
assertTypes(node3);
node3.cache(CACHE_NAME);
assertTypes(node3, ValueClass.class, ValueClass2.class);
// Check restarts from the second node.
node2.destroyCache(CACHE_NAME);
node2.getOrCreateCache(cacheConfiguration());
assertTypes(node1);
assertTypes(node2);
assertTypes(node3);
node2.destroyCache(CACHE_NAME);
node2.getOrCreateCache(cacheConfiguration(KeyClass.class, ValueClass.class, KeyClass2.class, ValueClass2.class));
assertTypes(node1, ValueClass.class, ValueClass2.class);
assertTypes(node2, ValueClass.class, ValueClass2.class);
assertTypes(node3);
node3.cache(CACHE_NAME);
assertTypes(node3, ValueClass.class, ValueClass2.class);
assertTypes(node4);
node4.cache(CACHE_NAME);
assertTypes(node4, ValueClass.class, ValueClass2.class);
// Make sure that joining node observes correct state.
assertTypes(start(5), ValueClass.class, ValueClass2.class);
assertTypes(startNoCache(6), ValueClass.class, ValueClass2.class);
assertTypes(startClient(7), ValueClass.class, ValueClass2.class);
IgniteEx node8 = startClientNoCache(8);
assertTypes(node8);
node8.cache(CACHE_NAME);
assertTypes(node8, ValueClass.class, ValueClass2.class);
}
use of org.apache.ignite.internal.IgniteEx in project ignite by apache.
the class SchemaExchangeSelfTest method testNodeFilter.
/**
* Test behavior when node filter is set.
*
* @throws Exception If failed.
*/
public void testNodeFilter() throws Exception {
filterNodeName = getTestIgniteInstanceName(1);
IgniteEx node1 = start(1, KeyClass.class, ValueClass.class);
assertTypes(node1, ValueClass.class);
IgniteEx node2 = start(2, KeyClass.class, ValueClass.class);
assertTypes(node1, ValueClass.class);
assertTypes(node2, ValueClass.class);
IgniteEx node3 = startNoCache(3);
assertTypes(node1, ValueClass.class);
assertTypes(node2, ValueClass.class);
assertTypes(node3);
node3.cache(CACHE_NAME);
assertTypes(node3, ValueClass.class);
}
use of org.apache.ignite.internal.IgniteEx in project ignite by apache.
the class IgniteDbSingleNodeWithIndexingPutGetTest method testGroupIndexes.
/**
*/
public void testGroupIndexes() {
IgniteEx ig = grid(0);
IgniteCache<Integer, Abc> cache = ig.cache("abc");
long cnt = 50_000;
for (int i = 0; i < cnt; i++) cache.put(i, new Abc(i, i % 10, i % 100));
assertEquals(1, querySize(cache, "select count(*) from Abc"));
assertEquals(Long.valueOf(cnt), queryOne(cache, "select count(*) from Abc"));
assertEquals((int) cnt, querySize(cache, "select count(*) from Abc group by a"));
assertEquals(Long.valueOf(1L), queryOne(cache, "select count(*) from Abc group by a"));
assertEquals(Long.valueOf(1L), queryOne(cache, "select count(*) from Abc where a = 1"));
assertEquals(10, querySize(cache, "select count(*) from Abc group by b"));
assertEquals(Long.valueOf(cnt / 10), queryOne(cache, "select count(*) from Abc group by b"));
assertEquals(Long.valueOf(cnt / 10), queryOne(cache, "select count(*) from Abc where b = 1"));
assertEquals(100, querySize(cache, "select count(*) from Abc group by c"));
assertEquals(Long.valueOf(cnt / 100), queryOne(cache, "select count(*) from Abc group by c"));
assertEquals(Long.valueOf(cnt / 100), queryOne(cache, "select count(*) from Abc where c = 1"));
}
Aggregations