use of org.apache.ignite.testframework.GridTestUtils.RunnableX in project ignite by apache.
the class DynamicIndexAbstractBasicSelfTest method checkCreateIndexOnColumnWithAlias.
/**
* Check index creation on aliased column.
*
* @param mode Mode.
* @param atomicityMode Atomicity mode.
* @param near Near flag.
* @throws Exception If failed.
*/
private void checkCreateIndexOnColumnWithAlias(CacheMode mode, CacheAtomicityMode atomicityMode, boolean near) throws Exception {
initialize(mode, atomicityMode, near);
assertIgniteSqlException(new RunnableX() {
@Override
public void runx() throws Exception {
QueryIndex idx = index(IDX_NAME_1, field(FIELD_NAME_2_ESCAPED));
dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx, false, 0);
}
}, IgniteQueryErrorCode.COLUMN_NOT_FOUND);
assertNoIndex(CACHE_NAME, TBL_NAME, IDX_NAME_1);
QueryIndex idx = index(IDX_NAME_1, field(alias(FIELD_NAME_2_ESCAPED)));
dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx, false, 0);
assertIndex(CACHE_NAME, TBL_NAME, IDX_NAME_1, QueryIndex.DFLT_INLINE_SIZE, field(alias(FIELD_NAME_2_ESCAPED)));
assertSimpleIndexOperations(SQL_SIMPLE_FIELD_2);
assertIndexUsed(IDX_NAME_1, SQL_SIMPLE_FIELD_2, SQL_ARG_1);
}
use of org.apache.ignite.testframework.GridTestUtils.RunnableX in project ignite by apache.
the class DynamicIndexAbstractBasicSelfTest method checkNoIndexIsCreatedForParallelism.
/**
* Verifies that no index is created and an exception is thrown.
*
* @param parallel Parallelism level in the CREATE INDEX statement.
* @param igniteQryErrorCode Expected error code in the thrown exception.
* @throws Exception If failed for any other reason than the expected exception.
*/
private void checkNoIndexIsCreatedForParallelism(final int parallel, int igniteQryErrorCode) throws Exception {
assertIgniteSqlException(new RunnableX() {
@Override
public void runx() throws Exception {
QueryIndex idx = index(IDX_NAME_1, field(FIELD_NAME_1_ESCAPED));
dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx, false, parallel);
}
}, igniteQryErrorCode);
assertNoIndex(CACHE_NAME, TBL_NAME, IDX_NAME_1);
}
use of org.apache.ignite.testframework.GridTestUtils.RunnableX in project ignite by apache.
the class DynamicIndexAbstractBasicSelfTest method checkCreateIndexNoColumn.
/**
* Check create when table doesn't exist.
*
* @param mode Mode.
* @param atomicityMode Atomicity mode.
* @param near Near flag.
* @throws Exception If failed.
*/
private void checkCreateIndexNoColumn(CacheMode mode, CacheAtomicityMode atomicityMode, boolean near) throws Exception {
initialize(mode, atomicityMode, near);
final QueryIndex idx = index(IDX_NAME_1, field(randomString()));
assertIgniteSqlException(new RunnableX() {
@Override
public void runx() throws Exception {
dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx, false, 0);
}
}, IgniteQueryErrorCode.COLUMN_NOT_FOUND);
assertNoIndex(CACHE_NAME, TBL_NAME, IDX_NAME_1);
}
use of org.apache.ignite.testframework.GridTestUtils.RunnableX in project ignite by apache.
the class DynamicIndexAbstractBasicSelfTest method checkNoIndexIsCreatedForInlineSize.
/**
* Verifies that no index is created and an exception is thrown.
*
* @param inlineSize Inline size value in the CREATE INDEX statement.
* @param igniteQryErrorCode Expected error code in the thrown exception.
* @throws Exception If failed for any other reason than the expected exception.
*/
private void checkNoIndexIsCreatedForInlineSize(final int inlineSize, int igniteQryErrorCode) throws Exception {
assertIgniteSqlException(new RunnableX() {
@Override
public void runx() throws Exception {
QueryIndex idx = index(IDX_NAME_1, field(FIELD_NAME_1_ESCAPED));
idx.setInlineSize(inlineSize);
dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx, false, 0);
}
}, igniteQryErrorCode);
assertNoIndex(CACHE_NAME, TBL_NAME, IDX_NAME_1);
}
use of org.apache.ignite.testframework.GridTestUtils.RunnableX in project gridgain by gridgain.
the class DynamicColumnsAbstractConcurrentSelfTest method checkClientReconnect.
/**
* Make sure that client receives schema changes made while it was disconnected, optionally with cache restart
* in the interim.
*
* @param restartCache Whether cache needs to be recreated during client's absence.
* @param dynamicCache Whether recreate, if needed, should be done on dynamic or static cache.
* @throws Exception If failed.
*/
private void checkClientReconnect(final boolean restartCache, boolean dynamicCache) throws Exception {
// Start complex topology.
final IgniteEx srv = ignitionStart(serverConfiguration(1));
ignitionStart(serverConfiguration(2));
ignitionStart(serverConfiguration(3, true));
final Ignite cli = ignitionStart(clientConfiguration(4));
if (dynamicCache) {
createSqlCache(cli);
run(cli, createSql);
}
final String schemaName = dynamicCache ? QueryUtils.DFLT_SCHEMA : "idx";
final QueryField[] cols = new QueryField[] { c("age", Integer.class.getName()), c("city", String.class.getName()) };
// Check index create.
reconnectClientNode(srv, cli, restartCache, dynamicCache, new RunnableX() {
@Override
public void runx() throws Exception {
addCols(srv, schemaName, cols).get();
dropCols(srv, schemaName, "NAME").get();
}
});
checkTableState(srv, schemaName, TBL_NAME, cols);
}
Aggregations