use of org.apache.ignite.testframework.GridTestUtils.RunnableX in project ignite by apache.
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);
}
});
}
use of org.apache.ignite.testframework.GridTestUtils.RunnableX in project ignite by apache.
the class JdbcThinStatementSelfTest method testCursorName.
/**
* @throws Exception If failed.
*/
@org.junit.Test
public void testCursorName() throws Exception {
checkNotSupported(new RunnableX() {
@Override
public void runx() throws Exception {
stmt.setCursorName("test");
}
});
stmt.close();
checkStatementClosed(new RunnableX() {
@Override
public void runx() throws Exception {
stmt.setCursorName("test");
}
});
}
use of org.apache.ignite.testframework.GridTestUtils.RunnableX in project ignite by apache.
the class JdbcThinResultSetSelfTest method testNotSupportedTypes.
/**
* @throws Exception If failed.
*/
@Test
public void testNotSupportedTypes() throws Exception {
final ResultSet rs = stmt.executeQuery(SQL);
assert rs.next();
checkNotSupported(new RunnableX() {
@Override
public void runx() throws Exception {
rs.getArray(1);
}
});
checkNotSupported(new RunnableX() {
@Override
public void runx() throws Exception {
rs.getArray("id");
}
});
checkNotSupported(new RunnableX() {
@Override
public void runx() throws Exception {
rs.getAsciiStream(1);
}
});
checkNotSupported(new RunnableX() {
@Override
public void runx() throws Exception {
rs.getAsciiStream("id");
}
});
checkNotSupported(new RunnableX() {
@Override
public void runx() throws Exception {
rs.getBinaryStream(1);
}
});
checkNotSupported(new RunnableX() {
@Override
public void runx() throws Exception {
rs.getBinaryStream("id");
}
});
checkNotSupported(new RunnableX() {
@Override
public void runx() throws Exception {
rs.getBlob(1);
}
});
checkNotSupported(new RunnableX() {
@Override
public void runx() throws Exception {
rs.getBlob("id");
}
});
checkNotSupported(new RunnableX() {
@Override
public void runx() throws Exception {
rs.getClob(1);
}
});
checkNotSupported(new RunnableX() {
@Override
public void runx() throws Exception {
rs.getClob("id");
}
});
checkNotSupported(new RunnableX() {
@Override
public void runx() throws Exception {
rs.getCharacterStream(1);
}
});
checkNotSupported(new RunnableX() {
@Override
public void runx() throws Exception {
rs.getCharacterStream("id");
}
});
checkNotSupported(new RunnableX() {
@Override
public void runx() throws Exception {
rs.getNCharacterStream(1);
}
});
checkNotSupported(new RunnableX() {
@Override
public void runx() throws Exception {
rs.getNCharacterStream("id");
}
});
checkNotSupported(new RunnableX() {
@Override
public void runx() throws Exception {
rs.getNClob(1);
}
});
checkNotSupported(new RunnableX() {
@Override
public void runx() throws Exception {
rs.getNClob("id");
}
});
checkNotSupported(new RunnableX() {
@Override
public void runx() throws Exception {
rs.getRef(1);
}
});
checkNotSupported(new RunnableX() {
@Override
public void runx() throws Exception {
rs.getRef("id");
}
});
checkNotSupported(new RunnableX() {
@Override
public void runx() throws Exception {
rs.getRowId(1);
}
});
checkNotSupported(new RunnableX() {
@Override
public void runx() throws Exception {
rs.getRowId("id");
}
});
checkNotSupported(new RunnableX() {
@Override
public void runx() throws Exception {
rs.getSQLXML(1);
}
});
checkNotSupported(new RunnableX() {
@Override
public void runx() throws Exception {
rs.getSQLXML("id");
}
});
}
use of org.apache.ignite.testframework.GridTestUtils.RunnableX in project ignite by apache.
the class DynamicIndexAbstractConcurrentSelfTest 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.
* @throws Exception If failed.
*/
private void checkClientReconnect(final boolean restartCache) throws Exception {
// Start complex topology.
final Ignite srv = ignitionStart(serverConfiguration(1));
ignitionStart(serverConfiguration(2));
ignitionStart(serverConfiguration(3, true));
final Ignite cli = ignitionStart(clientConfiguration(4));
createSqlCache(cli);
// Check index create.
reconnectClientNode(srv, cli, restartCache, new RunnableX() {
@Override
public void runx() throws Exception {
final QueryIndex idx = index(IDX_NAME_1, field(FIELD_NAME_1));
queryProcessor(srv).dynamicIndexCreate(CACHE_NAME, CACHE_NAME, TBL_NAME, idx, false, 0).get();
}
});
assertIndex(cli, CACHE_NAME, TBL_NAME, IDX_NAME_1, QueryIndex.DFLT_INLINE_SIZE, field(FIELD_NAME_1));
assertIndexUsed(IDX_NAME_1, SQL_SIMPLE_FIELD_1, SQL_ARG_1);
// Check index drop.
reconnectClientNode(srv, cli, restartCache, new RunnableX() {
@Override
public void runx() throws Exception {
if (!restartCache)
queryProcessor(srv).dynamicIndexDrop(CACHE_NAME, CACHE_NAME, IDX_NAME_1, false).get();
}
});
assertNoIndex(cli, CACHE_NAME, TBL_NAME, IDX_NAME_1);
assertIndexNotUsed(IDX_NAME_1, SQL_SIMPLE_FIELD_1, SQL_ARG_1);
// Update existing index.
QueryIndex idx = index(IDX_NAME_2, field(aliasUnescaped(FIELD_NAME_2)));
queryProcessor(srv).dynamicIndexCreate(CACHE_NAME, CACHE_NAME, TBL_NAME, idx, false, 0).get();
assertIndex(cli, CACHE_NAME, TBL_NAME, IDX_NAME_2, QueryIndex.DFLT_INLINE_SIZE, field(aliasUnescaped(FIELD_NAME_2)));
assertIndexUsed(IDX_NAME_2, SQL_SIMPLE_FIELD_2, SQL_ARG_2);
reconnectClientNode(srv, cli, restartCache, new RunnableX() {
@Override
public void runx() throws Exception {
if (!restartCache)
queryProcessor(srv).dynamicIndexDrop(CACHE_NAME, CACHE_NAME, IDX_NAME_2, false).get();
final QueryIndex idx = index(IDX_NAME_2, field(FIELD_NAME_1), field(aliasUnescaped(FIELD_NAME_2)));
queryProcessor(srv).dynamicIndexCreate(CACHE_NAME, CACHE_NAME, TBL_NAME, idx, false, 0).get();
}
});
assertIndex(CACHE_NAME, TBL_NAME, IDX_NAME_2, QueryIndex.DFLT_INLINE_SIZE, field(FIELD_NAME_1), field(aliasUnescaped(FIELD_NAME_2)));
assertIndexUsed(IDX_NAME_2, SQL_COMPOSITE, SQL_ARG_1, SQL_ARG_2);
}
use of org.apache.ignite.testframework.GridTestUtils.RunnableX in project ignite by apache.
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);
}
Aggregations