Search in sources :

Example 61 with RunnableX

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);
}
Also used : RunnableX(org.apache.ignite.testframework.GridTestUtils.RunnableX) QueryIndex(org.apache.ignite.cache.QueryIndex) CacheException(javax.cache.CacheException) IgniteException(org.apache.ignite.IgniteException) IgniteSQLException(org.apache.ignite.internal.processors.query.IgniteSQLException) SchemaOperationException(org.apache.ignite.internal.processors.query.schema.SchemaOperationException)

Example 62 with RunnableX

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);
}
Also used : RunnableX(org.apache.ignite.testframework.GridTestUtils.RunnableX) QueryIndex(org.apache.ignite.cache.QueryIndex) CacheException(javax.cache.CacheException) IgniteException(org.apache.ignite.IgniteException) IgniteSQLException(org.apache.ignite.internal.processors.query.IgniteSQLException) SchemaOperationException(org.apache.ignite.internal.processors.query.schema.SchemaOperationException)

Example 63 with RunnableX

use of org.apache.ignite.testframework.GridTestUtils.RunnableX in project ignite by apache.

the class DynamicIndexAbstractBasicSelfTest method checkDropNoIndex.

/**
 * Check drop when there is no index.
 *
 * @param mode Mode.
 * @param atomicityMode Atomicity mode.
 * @param near Near flag.
 * @throws Exception If failed.
 */
private void checkDropNoIndex(CacheMode mode, CacheAtomicityMode atomicityMode, boolean near) throws Exception {
    initialize(mode, atomicityMode, near);
    assertIgniteSqlException(new RunnableX() {

        @Override
        public void runx() throws Exception {
            dynamicIndexDrop(CACHE_NAME, IDX_NAME_1, false);
        }
    }, IgniteQueryErrorCode.INDEX_NOT_FOUND);
    dynamicIndexDrop(CACHE_NAME, IDX_NAME_1, true);
    assertNoIndex(CACHE_NAME, TBL_NAME, IDX_NAME_1);
}
Also used : RunnableX(org.apache.ignite.testframework.GridTestUtils.RunnableX) CacheException(javax.cache.CacheException) IgniteException(org.apache.ignite.IgniteException) IgniteSQLException(org.apache.ignite.internal.processors.query.IgniteSQLException) SchemaOperationException(org.apache.ignite.internal.processors.query.schema.SchemaOperationException)

Aggregations

RunnableX (org.apache.ignite.testframework.GridTestUtils.RunnableX)63 SQLException (java.sql.SQLException)52 SQLFeatureNotSupportedException (java.sql.SQLFeatureNotSupportedException)40 Test (org.junit.Test)39 Connection (java.sql.Connection)32 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)27 SQLClientInfoException (java.sql.SQLClientInfoException)25 JdbcThinConnection (org.apache.ignite.internal.jdbc.thin.JdbcThinConnection)25 IgniteException (org.apache.ignite.IgniteException)11 SchemaOperationException (org.apache.ignite.internal.processors.query.schema.SchemaOperationException)10 ResultSet (java.sql.ResultSet)9 Savepoint (java.sql.Savepoint)9 CacheException (javax.cache.CacheException)8 QueryIndex (org.apache.ignite.cache.QueryIndex)8 IgniteSQLException (org.apache.ignite.internal.processors.query.IgniteSQLException)8 DatabaseMetaData (java.sql.DatabaseMetaData)5 PreparedStatement (java.sql.PreparedStatement)5 MalformedURLException (java.net.MalformedURLException)3 Statement (java.sql.Statement)3 Ignite (org.apache.ignite.Ignite)3