use of org.apache.ignite.testframework.GridTestUtils.RunnableX in project gridgain by gridgain.
the class DynamicIndexAbstractBasicSelfTest method checkCreate.
/**
* Check normal create operation.
*
* @param mode Mode.
* @param atomicityMode Atomicity mode.
* @param near Near flag.
* @throws Exception If failed.
*/
private void checkCreate(CacheMode mode, CacheAtomicityMode atomicityMode, boolean near) throws Exception {
initialize(mode, atomicityMode, near);
final QueryIndex idx = index(IDX_NAME_1, field(FIELD_NAME_1_ESCAPED));
dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx, false, 0);
assertIndex(CACHE_NAME, TBL_NAME, IDX_NAME_1, QueryIndex.DFLT_INLINE_SIZE, field(FIELD_NAME_1_ESCAPED));
assertIgniteSqlException(new RunnableX() {
@Override
public void runx() throws Exception {
dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx, false, 0);
}
}, IgniteQueryErrorCode.INDEX_ALREADY_EXISTS);
dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx, true, 0);
assertIndex(CACHE_NAME, TBL_NAME, IDX_NAME_1, QueryIndex.DFLT_INLINE_SIZE, field(FIELD_NAME_1_ESCAPED));
assertSimpleIndexOperations(SQL_SIMPLE_FIELD_1);
assertIndexUsed(IDX_NAME_1, SQL_SIMPLE_FIELD_1, SQL_ARG_1);
}
use of org.apache.ignite.testframework.GridTestUtils.RunnableX in project gridgain by gridgain.
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 DynamicIndexAbstractBasicSelfTest method checkCreateNoTable.
/**
* Check create when table doesn't exist.
*
* @param mode Mode.
* @param atomicityMode Atomicity mode.
* @param near Near flag.
* @throws Exception If failed.
*/
private void checkCreateNoTable(CacheMode mode, CacheAtomicityMode atomicityMode, boolean near) throws Exception {
initialize(mode, atomicityMode, near);
final QueryIndex idx = index(IDX_NAME_1, field(FIELD_NAME_1_ESCAPED));
assertIgniteSqlException(new RunnableX() {
@Override
public void runx() throws Exception {
dynamicIndexCreate(CACHE_NAME, randomString(), idx, false, 0);
}
}, IgniteQueryErrorCode.TABLE_NOT_FOUND);
assertNoIndex(CACHE_NAME, TBL_NAME, IDX_NAME_1);
}
use of org.apache.ignite.testframework.GridTestUtils.RunnableX in project gridgain by gridgain.
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 gridgain by gridgain.
the class JdbcThinStatementSelfTest method testGetMoreResultsKeepCurrent.
/**
* @throws Exception If failed.
*/
@org.junit.Test
public void testGetMoreResultsKeepCurrent() throws Exception {
assertFalse(stmt.getMoreResults(Statement.CLOSE_CURRENT_RESULT));
assertFalse(stmt.getMoreResults(Statement.KEEP_CURRENT_RESULT));
assertFalse(stmt.getMoreResults(Statement.CLOSE_ALL_RESULTS));
stmt.execute("select 1; ");
ResultSet rs = stmt.getResultSet();
assertFalse(stmt.getMoreResults(Statement.KEEP_CURRENT_RESULT));
assertFalse(rs.isClosed());
stmt.close();
checkStatementClosed(new RunnableX() {
@Override
public void runx() throws Exception {
stmt.getMoreResults(Statement.KEEP_CURRENT_RESULT);
}
});
}
Aggregations