http://git-wip-us.apache.org/repos/asf/ignite/blob/c5197e0a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcErrorsAbstractSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcErrorsAbstractSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcErrorsAbstractSelfTest.java index bdcfe5b..4de4c12 100644 --- a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcErrorsAbstractSelfTest.java +++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcErrorsAbstractSelfTest.java @@ -41,10 +41,14 @@ import org.apache.ignite.internal.IgniteEx; import org.apache.ignite.lang.IgniteCallable; import org.apache.ignite.testframework.GridTestUtils; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; /** * Test SQLSTATE codes propagation with (any) Ignite JDBC driver. */ +@RunWith(JUnit4.class) public abstract class JdbcErrorsAbstractSelfTest extends GridCommonAbstractTest { /** */ protected static final String CACHE_STORE_TEMPLATE = "cache_store"; @@ -73,6 +77,7 @@ public abstract class JdbcErrorsAbstractSelfTest extends GridCommonAbstractTest * Test that H2 specific error codes get propagated to Ignite SQL exceptions. * @throws SQLException if failed. */ + @Test public void testParsingErrors() throws SQLException { checkErrorState("gibberish", "42000", "Failed to parse query. Syntax error in SQL statement \"GIBBERISH[*] \""); @@ -82,6 +87,7 @@ public abstract class JdbcErrorsAbstractSelfTest extends GridCommonAbstractTest * Test that error codes from tables related DDL operations get propagated to Ignite SQL exceptions. * @throws SQLException if failed. */ + @Test public void testTableErrors() throws SQLException { checkErrorState("DROP TABLE \"PUBLIC\".missing", "42000", "Table doesn't exist: MISSING"); } @@ -90,6 +96,7 @@ public abstract class JdbcErrorsAbstractSelfTest extends GridCommonAbstractTest * Test that error codes from indexes related DDL operations get propagated to Ignite SQL exceptions. * @throws SQLException if failed. */ + @Test public void testIndexErrors() throws SQLException { checkErrorState("DROP INDEX \"PUBLIC\".missing", "42000", "Index doesn't exist: MISSING"); } @@ -98,6 +105,7 @@ public abstract class JdbcErrorsAbstractSelfTest extends GridCommonAbstractTest * Test that error codes from DML operations get propagated to Ignite SQL exceptions. * @throws SQLException if failed. */ + @Test public void testDmlErrors() throws SQLException { checkErrorState("INSERT INTO \"test\".INTEGER(_key, _val) values(1, null)", "22004", "Value for INSERT, COPY, MERGE, or UPDATE must not be null"); @@ -110,6 +118,7 @@ public abstract class JdbcErrorsAbstractSelfTest extends GridCommonAbstractTest * Test error code for the case when user attempts to refer a future currently unsupported. * @throws SQLException if failed. */ + @Test public void testUnsupportedSql() throws SQLException { checkErrorState("ALTER TABLE \"test\".Integer MODIFY COLUMN _key CHAR", "0A000", "ALTER COLUMN is not supported"); @@ -119,6 +128,7 @@ public abstract class JdbcErrorsAbstractSelfTest extends GridCommonAbstractTest * Test error code for the case when user attempts to use a closed connection. * @throws SQLException if failed. */ + @Test public void testConnectionClosed() throws SQLException { checkErrorState(new IgniteCallable<Void>() { @Override public Void call() throws Exception { @@ -231,6 +241,7 @@ public abstract class JdbcErrorsAbstractSelfTest extends GridCommonAbstractTest * Test error code for the case when user attempts to use a closed result set. * @throws SQLException if failed. */ + @Test public void testResultSetClosed() throws SQLException { checkErrorState(new ConnClosure() { @Override public void run(Connection conn) throws Exception { @@ -252,6 +263,7 @@ public abstract class JdbcErrorsAbstractSelfTest extends GridCommonAbstractTest * from column whose value can't be converted to an {@code int}. * @throws SQLException if failed. */ + @Test public void testInvalidIntFormat() throws SQLException { checkErrorState(new ConnClosure() { @Override public void run(Connection conn) throws Exception { @@ -271,6 +283,7 @@ public abstract class JdbcErrorsAbstractSelfTest extends GridCommonAbstractTest * from column whose value can't be converted to an {@code long}. * @throws SQLException if failed. */ + @Test public void testInvalidLongFormat() throws SQLException { checkErrorState(new ConnClosure() { @Override public void run(Connection conn) throws Exception { @@ -290,6 +303,7 @@ public abstract class JdbcErrorsAbstractSelfTest extends GridCommonAbstractTest * from column whose value can't be converted to an {@code float}. * @throws SQLException if failed. */ + @Test public void testInvalidFloatFormat() throws SQLException { checkErrorState(new ConnClosure() { @Override public void run(Connection conn) throws Exception { @@ -309,6 +323,7 @@ public abstract class JdbcErrorsAbstractSelfTest extends GridCommonAbstractTest * from column whose value can't be converted to an {@code double}. * @throws SQLException if failed. */ + @Test public void testInvalidDoubleFormat() throws SQLException { checkErrorState(new ConnClosure() { @Override public void run(Connection conn) throws Exception { @@ -328,6 +343,7 @@ public abstract class JdbcErrorsAbstractSelfTest extends GridCommonAbstractTest * from column whose value can't be converted to an {@code byte}. * @throws SQLException if failed. */ + @Test public void testInvalidByteFormat() throws SQLException { checkErrorState(new ConnClosure() { @Override public void run(Connection conn) throws Exception { @@ -347,6 +363,7 @@ public abstract class JdbcErrorsAbstractSelfTest extends GridCommonAbstractTest * from column whose value can't be converted to an {@code short}. * @throws SQLException if failed. */ + @Test public void testInvalidShortFormat() throws SQLException { checkErrorState(new ConnClosure() { @Override public void run(Connection conn) throws Exception { @@ -366,6 +383,7 @@ public abstract class JdbcErrorsAbstractSelfTest extends GridCommonAbstractTest * from column whose value can't be converted to an {@code BigDecimal}. * @throws SQLException if failed. */ + @Test public void testInvalidBigDecimalFormat() throws SQLException { checkErrorState(new ConnClosure() { @Override public void run(Connection conn) throws Exception { @@ -385,6 +403,7 @@ public abstract class JdbcErrorsAbstractSelfTest extends GridCommonAbstractTest * from column whose value can't be converted to an {@code boolean}. * @throws SQLException if failed. */ + @Test public void testInvalidBooleanFormat() throws SQLException { checkErrorState(new ConnClosure() { @Override public void run(Connection conn) throws Exception { @@ -404,6 +423,7 @@ public abstract class JdbcErrorsAbstractSelfTest extends GridCommonAbstractTest * from column whose value can't be converted to an {@code boolean}. * @throws SQLException if failed. */ + @Test public void testInvalidObjectFormat() throws SQLException { checkErrorState(new ConnClosure() { @Override public void run(Connection conn) throws Exception { @@ -423,6 +443,7 @@ public abstract class JdbcErrorsAbstractSelfTest extends GridCommonAbstractTest * from column whose value can't be converted to a {@link Date}. * @throws SQLException if failed. */ + @Test public void testInvalidDateFormat() throws SQLException { checkErrorState(new ConnClosure() { @Override public void run(Connection conn) throws Exception { @@ -442,6 +463,7 @@ public abstract class JdbcErrorsAbstractSelfTest extends GridCommonAbstractTest * from column whose value can't be converted to a {@link Time}. * @throws SQLException if failed. */ + @Test public void testInvalidTimeFormat() throws SQLException { checkErrorState(new ConnClosure() { @Override public void run(Connection conn) throws Exception { @@ -461,6 +483,7 @@ public abstract class JdbcErrorsAbstractSelfTest extends GridCommonAbstractTest * from column whose value can't be converted to a {@link Timestamp}. * @throws SQLException if failed. */ + @Test public void testInvalidTimestampFormat() throws SQLException { checkErrorState(new ConnClosure() { @Override public void run(Connection conn) throws Exception { @@ -480,6 +503,7 @@ public abstract class JdbcErrorsAbstractSelfTest extends GridCommonAbstractTest * from column whose value can't be converted to a {@link URL}. * @throws SQLException if failed. */ + @Test public void testInvalidUrlFormat() throws SQLException { checkErrorState(new ConnClosure() { @Override public void run(Connection conn) throws Exception { @@ -499,6 +523,7 @@ public abstract class JdbcErrorsAbstractSelfTest extends GridCommonAbstractTest * * @throws SQLException if failed. */ + @Test public void testNotNullViolation() throws SQLException { try (Connection conn = getConnection()) { conn.setSchema("PUBLIC"); @@ -528,6 +553,7 @@ public abstract class JdbcErrorsAbstractSelfTest extends GridCommonAbstractTest * * @throws SQLException if failed. */ + @Test public void testNotNullRestrictionReadThroughCacheStore() throws SQLException { checkErrorState(new ConnClosure() { @Override public void run(Connection conn) throws Exception { @@ -548,6 +574,7 @@ public abstract class JdbcErrorsAbstractSelfTest extends GridCommonAbstractTest * * @throws SQLException if failed. */ + @Test public void testNotNullRestrictionCacheInterceptor() throws SQLException { checkErrorState(new ConnClosure() { @Override public void run(Connection conn) throws Exception { @@ -566,6 +593,7 @@ public abstract class JdbcErrorsAbstractSelfTest extends GridCommonAbstractTest * * @throws SQLException If failed. */ + @Test public void testSelectWrongTable() throws SQLException { checkSqlErrorMessage("select from wrong", "42000", "Failed to parse query. Table \"WRONG\" not found"); @@ -576,6 +604,7 @@ public abstract class JdbcErrorsAbstractSelfTest extends GridCommonAbstractTest * * @throws SQLException If failed. */ + @Test public void testSelectWrongColumnName() throws SQLException { checkSqlErrorMessage("select wrong from test", "42000", "Failed to parse query. Column \"WRONG\" not found"); @@ -586,6 +615,7 @@ public abstract class JdbcErrorsAbstractSelfTest extends GridCommonAbstractTest * * @throws SQLException If failed. */ + @Test public void testSelectWrongSyntax() throws SQLException { checkSqlErrorMessage("select from test where", "42000", "Failed to parse query. Syntax error in SQL statement \"SELECT FROM TEST WHERE[*]"); @@ -596,6 +626,7 @@ public abstract class JdbcErrorsAbstractSelfTest extends GridCommonAbstractTest * * @throws SQLException If failed. */ + @Test public void testDmlWrongTable() throws SQLException { checkSqlErrorMessage("insert into wrong (id, val) values (3, 'val3')", "42000", "Failed to parse query. Table \"WRONG\" not found"); @@ -615,6 +646,7 @@ public abstract class JdbcErrorsAbstractSelfTest extends GridCommonAbstractTest * * @throws SQLException If failed. */ + @Test public void testDmlWrongColumnName() throws SQLException { checkSqlErrorMessage("insert into test (id, wrong) values (3, 'val3')", "42000", "Failed to parse query. Column \"WRONG\" not found"); @@ -634,6 +666,7 @@ public abstract class JdbcErrorsAbstractSelfTest extends GridCommonAbstractTest * * @throws SQLException If failed. */ + @Test public void testDmlWrongSyntax() throws SQLException { checkSqlErrorMessage("insert test (id, val) values (3, 'val3')", "42000", "Failed to parse query. Syntax error in SQL statement \"INSERT TEST[*] (ID, VAL)"); @@ -653,6 +686,7 @@ public abstract class JdbcErrorsAbstractSelfTest extends GridCommonAbstractTest * * @throws SQLException If failed. */ + @Test public void testDdlWrongTable() throws SQLException { checkSqlErrorMessage("create table test (id int primary key, val varchar)", "42000", "Table already exists: TEST"); @@ -675,6 +709,7 @@ public abstract class JdbcErrorsAbstractSelfTest extends GridCommonAbstractTest * * @throws SQLException If failed. */ + @Test public void testDdlWrongColumnName() throws SQLException { checkSqlErrorMessage("create index idx1 on test (wrong)", "42000", "Column doesn't exist: WRONG"); @@ -688,6 +723,7 @@ public abstract class JdbcErrorsAbstractSelfTest extends GridCommonAbstractTest * * @throws SQLException If failed. */ + @Test public void testDdlWrongSyntax() throws SQLException { checkSqlErrorMessage("create table test2 (id int wrong key, val varchar)", "42000", "Failed to parse query. Syntax error in SQL statement \"CREATE TABLE TEST2 (ID INT WRONG[*]");
http://git-wip-us.apache.org/repos/asf/ignite/blob/c5197e0a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcLocalCachesSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcLocalCachesSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcLocalCachesSelfTest.java index 9350e0d..6459448 100644 --- a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcLocalCachesSelfTest.java +++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcLocalCachesSelfTest.java @@ -29,6 +29,9 @@ import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi; import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder; import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; import static org.apache.ignite.IgniteJdbcDriver.PROP_NODE_ID; import static org.apache.ignite.cache.CacheMode.LOCAL; @@ -37,6 +40,7 @@ import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; /** * Test JDBC with several local caches. */ +@RunWith(JUnit4.class) public class JdbcLocalCachesSelfTest extends GridCommonAbstractTest { /** IP finder. */ private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true); @@ -95,6 +99,7 @@ public class JdbcLocalCachesSelfTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + @Test public void testCache1() throws Exception { Properties cfg = new Properties(); @@ -123,6 +128,7 @@ public class JdbcLocalCachesSelfTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + @Test public void testCache2() throws Exception { Properties cfg = new Properties(); @@ -147,4 +153,4 @@ public class JdbcLocalCachesSelfTest extends GridCommonAbstractTest { conn.close(); } } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/ignite/blob/c5197e0a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcMetadataSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcMetadataSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcMetadataSelfTest.java index 0613de7..802e576 100644 --- a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcMetadataSelfTest.java +++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcMetadataSelfTest.java @@ -40,6 +40,9 @@ import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi; import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder; import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; import static java.sql.Types.INTEGER; import static java.sql.Types.VARCHAR; @@ -52,6 +55,7 @@ import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; /** * Metadata tests. */ +@RunWith(JUnit4.class) public class JdbcMetadataSelfTest extends GridCommonAbstractTest { /** IP finder. */ private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true); @@ -114,6 +118,7 @@ public class JdbcMetadataSelfTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + @Test public void testResultSetMetaData() throws Exception { Statement stmt = DriverManager.getConnection(URL).createStatement(); @@ -146,6 +151,7 @@ public class JdbcMetadataSelfTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + @Test public void testDecimalAndDateTypeMetaData() throws Exception { try (Connection conn = DriverManager.getConnection(URL)) { Statement stmt = conn.createStatement(); @@ -180,6 +186,7 @@ public class JdbcMetadataSelfTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + @Test public void testGetTables() throws Exception { try (Connection conn = DriverManager.getConnection(URL)) { DatabaseMetaData meta = conn.getMetaData(); @@ -216,6 +223,7 @@ public class JdbcMetadataSelfTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + @Test public void testGetColumns() throws Exception { final boolean primitivesInformationIsLostAfterStore = ignite(0).configuration().getMarshaller() instanceof BinaryMarshaller; try (Connection conn = DriverManager.getConnection(URL)) { @@ -309,6 +317,7 @@ public class JdbcMetadataSelfTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + @Test public void testMetadataResultSetClose() throws Exception { try (Connection conn = DriverManager.getConnection(URL); ResultSet tbls = conn.getMetaData().getTables(null, null, "%", null)) { http://git-wip-us.apache.org/repos/asf/ignite/blob/c5197e0a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcNoDefaultCacheTest.java ---------------------------------------------------------------------- diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcNoDefaultCacheTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcNoDefaultCacheTest.java index adb5c30..5fcb7b3 100644 --- a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcNoDefaultCacheTest.java +++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcNoDefaultCacheTest.java @@ -31,10 +31,14 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder; import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.jetbrains.annotations.NotNull; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; /** * */ +@RunWith(JUnit4.class) public class JdbcNoDefaultCacheTest extends GridCommonAbstractTest { /** IP finder. */ private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true); @@ -109,6 +113,7 @@ public class JdbcNoDefaultCacheTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + @Test public void testDefaults() throws Exception { String url = getUrl(); @@ -124,6 +129,7 @@ public class JdbcNoDefaultCacheTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + @Test public void testNoCacheNameQuery() throws Exception { Statement stmt; http://git-wip-us.apache.org/repos/asf/ignite/blob/c5197e0a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcPojoLegacyQuerySelfTest.java ---------------------------------------------------------------------- diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcPojoLegacyQuerySelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcPojoLegacyQuerySelfTest.java index 4fa7ba5..4f63caf 100644 --- a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcPojoLegacyQuerySelfTest.java +++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcPojoLegacyQuerySelfTest.java @@ -18,10 +18,14 @@ package org.apache.ignite.jdbc; import java.sql.ResultSet; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; /** * Test for Jdbc driver query without class on client */ +@RunWith(JUnit4.class) public class JdbcPojoLegacyQuerySelfTest extends AbstractJdbcPojoQuerySelfTest { /** URL. */ private static final String URL = "jdbc:ignite://127.0.0.1/"; @@ -29,6 +33,7 @@ public class JdbcPojoLegacyQuerySelfTest extends AbstractJdbcPojoQuerySelfTest { /** * @throws Exception If failed. */ + @Test public void testJdbcQuery() throws Exception { stmt.execute("select * from JdbcTestObject"); http://git-wip-us.apache.org/repos/asf/ignite/blob/c5197e0a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcPojoQuerySelfTest.java ---------------------------------------------------------------------- diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcPojoQuerySelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcPojoQuerySelfTest.java index 6729d04..31ac22f 100644 --- a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcPojoQuerySelfTest.java +++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcPojoQuerySelfTest.java @@ -18,12 +18,16 @@ package org.apache.ignite.jdbc; import java.sql.ResultSet; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; import static org.apache.ignite.IgniteJdbcDriver.CFG_URL_PREFIX; /** * Test for Jdbc driver query without class on client */ +@RunWith(JUnit4.class) public class JdbcPojoQuerySelfTest extends AbstractJdbcPojoQuerySelfTest { /** URL. */ private static final String URL = CFG_URL_PREFIX + "cache=default@modules/clients/src/test/config/jdbc-bin-config.xml"; @@ -31,6 +35,7 @@ public class JdbcPojoQuerySelfTest extends AbstractJdbcPojoQuerySelfTest { /** * @throws Exception If failed. */ + @Test public void testJdbcQueryTask2() throws Exception { stmt.execute("select * from JdbcTestObject"); @@ -42,6 +47,7 @@ public class JdbcPojoQuerySelfTest extends AbstractJdbcPojoQuerySelfTest { /** * @throws Exception If failed. */ + @Test public void testJdbcQueryTask1() throws Exception { ResultSet rs = stmt.executeQuery("select * from JdbcTestObject"); http://git-wip-us.apache.org/repos/asf/ignite/blob/c5197e0a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcPreparedStatementSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcPreparedStatementSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcPreparedStatementSelfTest.java index 7a52edf..3af0ddc 100644 --- a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcPreparedStatementSelfTest.java +++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcPreparedStatementSelfTest.java @@ -36,6 +36,9 @@ import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi; import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder; import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; import static java.sql.Types.BIGINT; import static java.sql.Types.BINARY; @@ -57,6 +60,7 @@ import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; /** * Prepared statement test. */ +@RunWith(JUnit4.class) public class JdbcPreparedStatementSelfTest extends GridCommonAbstractTest { /** IP finder. */ private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true); @@ -151,6 +155,7 @@ public class JdbcPreparedStatementSelfTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + @Test public void testRepeatableUsage() throws Exception { stmt = conn.prepareStatement("select * from TestObject where id = ?"); @@ -186,6 +191,7 @@ public class JdbcPreparedStatementSelfTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + @Test public void testBoolean() throws Exception { stmt = conn.prepareStatement("select * from TestObject where boolVal is not distinct from ?"); @@ -223,6 +229,7 @@ public class JdbcPreparedStatementSelfTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + @Test public void testByte() throws Exception { stmt = conn.prepareStatement("select * from TestObject where byteVal is not distinct from ?"); @@ -260,6 +267,7 @@ public class JdbcPreparedStatementSelfTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + @Test public void testShort() throws Exception { stmt = conn.prepareStatement("select * from TestObject where shortVal is not distinct from ?"); @@ -297,6 +305,7 @@ public class JdbcPreparedStatementSelfTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + @Test public void testInteger() throws Exception { stmt = conn.prepareStatement("select * from TestObject where intVal is not distinct from ?"); @@ -334,6 +343,7 @@ public class JdbcPreparedStatementSelfTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + @Test public void testLong() throws Exception { stmt = conn.prepareStatement("select * from TestObject where longVal is not distinct from ?"); @@ -371,6 +381,7 @@ public class JdbcPreparedStatementSelfTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + @Test public void testFloat() throws Exception { stmt = conn.prepareStatement("select * from TestObject where floatVal is not distinct from ?"); @@ -408,6 +419,7 @@ public class JdbcPreparedStatementSelfTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + @Test public void testDouble() throws Exception { stmt = conn.prepareStatement("select * from TestObject where doubleVal is not distinct from ?"); @@ -445,6 +457,7 @@ public class JdbcPreparedStatementSelfTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + @Test public void testBigDecimal() throws Exception { stmt = conn.prepareStatement("select * from TestObject where bigVal is not distinct from ?"); @@ -482,6 +495,7 @@ public class JdbcPreparedStatementSelfTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + @Test public void testString() throws Exception { stmt = conn.prepareStatement("select * from TestObject where strVal is not distinct from ?"); @@ -519,6 +533,7 @@ public class JdbcPreparedStatementSelfTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + @Test public void testArray() throws Exception { stmt = conn.prepareStatement("select * from TestObject where arrVal is not distinct from ?"); @@ -556,6 +571,7 @@ public class JdbcPreparedStatementSelfTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + @Test public void testDate() throws Exception { stmt = conn.prepareStatement("select * from TestObject where dateVal is not distinct from ?"); @@ -593,6 +609,7 @@ public class JdbcPreparedStatementSelfTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + @Test public void testTime() throws Exception { stmt = conn.prepareStatement("select * from TestObject where timeVal is not distinct from ?"); @@ -630,6 +647,7 @@ public class JdbcPreparedStatementSelfTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + @Test public void testTimestamp() throws Exception { stmt = conn.prepareStatement("select * from TestObject where tsVal is not distinct from ?"); @@ -667,6 +685,7 @@ public class JdbcPreparedStatementSelfTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + @Test public void testUrl() throws Exception { stmt = conn.prepareStatement("select * from TestObject where urlVal is not distinct from ?"); @@ -772,4 +791,4 @@ public class JdbcPreparedStatementSelfTest extends GridCommonAbstractTest { this.id = id; } } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/ignite/blob/c5197e0a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcResultSetSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcResultSetSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcResultSetSelfTest.java index 2214139..f798839 100644 --- a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcResultSetSelfTest.java +++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcResultSetSelfTest.java @@ -44,6 +44,9 @@ import java.sql.*; import java.util.Arrays; import java.util.Objects; import java.util.concurrent.Callable; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; import static org.apache.ignite.cache.CacheMode.PARTITIONED; import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; @@ -52,6 +55,7 @@ import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; * Result set test. */ @SuppressWarnings("FloatingPointEquality") +@RunWith(JUnit4.class) public class JdbcResultSetSelfTest extends GridCommonAbstractTest { /** IP finder. */ private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true); @@ -156,6 +160,7 @@ public class JdbcResultSetSelfTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + @Test public void testBoolean() throws Exception { ResultSet rs = stmt.executeQuery(SQL); @@ -176,6 +181,7 @@ public class JdbcResultSetSelfTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + @Test public void testByte() throws Exception { ResultSet rs = stmt.executeQuery(SQL); @@ -196,6 +202,7 @@ public class JdbcResultSetSelfTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + @Test public void testShort() throws Exception { ResultSet rs = stmt.executeQuery(SQL); @@ -216,6 +223,7 @@ public class JdbcResultSetSelfTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + @Test public void testInteger() throws Exception { ResultSet rs = stmt.executeQuery(SQL); @@ -236,6 +244,7 @@ public class JdbcResultSetSelfTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + @Test public void testLong() throws Exception { ResultSet rs = stmt.executeQuery(SQL); @@ -256,6 +265,7 @@ public class JdbcResultSetSelfTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + @Test public void testFloat() throws Exception { ResultSet rs = stmt.executeQuery(SQL); @@ -276,6 +286,7 @@ public class JdbcResultSetSelfTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + @Test public void testDouble() throws Exception { ResultSet rs = stmt.executeQuery(SQL); @@ -296,6 +307,7 @@ public class JdbcResultSetSelfTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + @Test public void testBigDecimal() throws Exception { ResultSet rs = stmt.executeQuery(SQL); @@ -316,6 +328,7 @@ public class JdbcResultSetSelfTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + @Test public void testString() throws Exception { ResultSet rs = stmt.executeQuery(SQL); @@ -336,6 +349,7 @@ public class JdbcResultSetSelfTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + @Test public void testArray() throws Exception { ResultSet rs = stmt.executeQuery(SQL); @@ -357,6 +371,7 @@ public class JdbcResultSetSelfTest extends GridCommonAbstractTest { * @throws Exception If failed. */ @SuppressWarnings("deprecation") + @Test public void testDate() throws Exception { ResultSet rs = stmt.executeQuery(SQL); @@ -378,6 +393,7 @@ public class JdbcResultSetSelfTest extends GridCommonAbstractTest { * @throws Exception If failed. */ @SuppressWarnings("deprecation") + @Test public void testTime() throws Exception { ResultSet rs = stmt.executeQuery(SQL); @@ -398,6 +414,7 @@ public class JdbcResultSetSelfTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + @Test public void testTimestamp() throws Exception { ResultSet rs = stmt.executeQuery(SQL); @@ -418,6 +435,7 @@ public class JdbcResultSetSelfTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + @Test public void testUrl() throws Exception { ResultSet rs = stmt.executeQuery(SQL); @@ -507,6 +525,7 @@ public class JdbcResultSetSelfTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + @Test public void testObject() throws Exception { final Ignite ignite = ignite(0); final boolean binaryMarshaller = ignite.configuration().getMarshaller() instanceof BinaryMarshaller; @@ -541,6 +560,7 @@ public class JdbcResultSetSelfTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + @Test public void testNavigation() throws Exception { ResultSet rs = stmt.executeQuery("select * from TestObject where id > 0"); @@ -578,6 +598,7 @@ public class JdbcResultSetSelfTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + @Test public void testFindColumn() throws Exception { final ResultSet rs = stmt.executeQuery(SQL); @@ -789,4 +810,4 @@ public class JdbcResultSetSelfTest extends GridCommonAbstractTest { return S.toString(TestObjectField.class, this); } } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/ignite/blob/c5197e0a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcStatementSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcStatementSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcStatementSelfTest.java index 3530801..dc79903 100644 --- a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcStatementSelfTest.java +++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcStatementSelfTest.java @@ -32,6 +32,9 @@ import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi; import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder; import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; import static org.apache.ignite.cache.CacheMode.PARTITIONED; import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; @@ -39,6 +42,7 @@ import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; /** * Statement test. */ +@RunWith(JUnit4.class) public class JdbcStatementSelfTest extends GridCommonAbstractTest { /** IP finder. */ private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true); @@ -117,6 +121,7 @@ public class JdbcStatementSelfTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + @Test public void testExecuteQuery() throws Exception { ResultSet rs = stmt.executeQuery(SQL); @@ -149,6 +154,7 @@ public class JdbcStatementSelfTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + @Test public void testExecute() throws Exception { assert stmt.execute(SQL); @@ -185,6 +191,7 @@ public class JdbcStatementSelfTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + @Test public void testMaxRows() throws Exception { stmt.setMaxRows(1); @@ -282,4 +289,4 @@ public class JdbcStatementSelfTest extends GridCommonAbstractTest { this.age = age; } } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/ignite/blob/c5197e0a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcVersionMismatchSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcVersionMismatchSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcVersionMismatchSelfTest.java index 19e18a2..19a1be6 100644 --- a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcVersionMismatchSelfTest.java +++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcVersionMismatchSelfTest.java @@ -28,10 +28,14 @@ import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.List; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; /** * JDBC version mismatch test. */ +@RunWith(JUnit4.class) public class JdbcVersionMismatchSelfTest extends GridCommonAbstractTest { /** {@inheritDoc} */ @Override protected void beforeTest() throws Exception { @@ -53,6 +57,7 @@ public class JdbcVersionMismatchSelfTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + @Test public void testVersionMismatchJdbc() throws Exception { try (Connection conn1 = connect(); Connection conn2 = connect()) { conn1.setAutoCommit(false); http://git-wip-us.apache.org/repos/asf/ignite/blob/c5197e0a/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverMvccTestSuite.java ---------------------------------------------------------------------- diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverMvccTestSuite.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverMvccTestSuite.java index 66eafae..35a54ca 100644 --- a/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverMvccTestSuite.java +++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverMvccTestSuite.java @@ -17,6 +17,7 @@ package org.apache.ignite.jdbc.suite; +import junit.framework.JUnit4TestAdapter; import junit.framework.TestSuite; import org.apache.ignite.jdbc.JdbcVersionMismatchSelfTest; import org.apache.ignite.jdbc.thin.JdbcThinConnectionMvccEnabledSelfTest; @@ -35,16 +36,16 @@ public class IgniteJdbcDriverMvccTestSuite extends TestSuite { public static TestSuite suite() { TestSuite suite = new TestSuite("Ignite JDBC Driver Test Suite"); - suite.addTestSuite(JdbcThinConnectionMvccEnabledSelfTest.class); - suite.addTestSuite(JdbcVersionMismatchSelfTest.class); + suite.addTest(new JUnit4TestAdapter(JdbcThinConnectionMvccEnabledSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcVersionMismatchSelfTest.class)); // Transactions - suite.addTestSuite(JdbcThinTransactionsWithMvccEnabledSelfTest.class); - suite.addTestSuite(JdbcThinTransactionsClientAutoCommitComplexSelfTest.class); - suite.addTestSuite(JdbcThinTransactionsServerAutoCommitComplexSelfTest.class); - suite.addTestSuite(JdbcThinTransactionsClientNoAutoCommitComplexSelfTest.class); - suite.addTestSuite(JdbcThinTransactionsServerNoAutoCommitComplexSelfTest.class); - suite.addTestSuite(MvccJdbcTransactionFinishOnDeactivatedClusterSelfTest.class); + suite.addTest(new JUnit4TestAdapter(JdbcThinTransactionsWithMvccEnabledSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcThinTransactionsClientAutoCommitComplexSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcThinTransactionsServerAutoCommitComplexSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcThinTransactionsClientNoAutoCommitComplexSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcThinTransactionsServerNoAutoCommitComplexSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(MvccJdbcTransactionFinishOnDeactivatedClusterSelfTest.class)); return suite; } http://git-wip-us.apache.org/repos/asf/ignite/blob/c5197e0a/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverTestSuite.java ---------------------------------------------------------------------- diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverTestSuite.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverTestSuite.java index 747b13e..18e45f1 100644 --- a/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverTestSuite.java +++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverTestSuite.java @@ -17,6 +17,7 @@ package org.apache.ignite.jdbc.suite; +import junit.framework.JUnit4TestAdapter; import junit.framework.TestSuite; import org.apache.ignite.internal.jdbc2.JdbcBlobTest; import org.apache.ignite.internal.jdbc2.JdbcBulkLoadSelfTest; @@ -99,125 +100,125 @@ public class IgniteJdbcDriverTestSuite extends TestSuite { TestSuite suite = new TestSuite("Ignite JDBC Driver Test Suite"); // Thin client based driver tests. - suite.addTest(new TestSuite(JdbcConnectionSelfTest.class)); - suite.addTest(new TestSuite(JdbcStatementSelfTest.class)); - suite.addTest(new TestSuite(JdbcPreparedStatementSelfTest.class)); - suite.addTest(new TestSuite(JdbcResultSetSelfTest.class)); - suite.addTest(new TestSuite(JdbcComplexQuerySelfTest.class)); - suite.addTest(new TestSuite(JdbcMetadataSelfTest.class)); - suite.addTest(new TestSuite(JdbcEmptyCacheSelfTest.class)); - suite.addTest(new TestSuite(JdbcLocalCachesSelfTest.class)); - suite.addTest(new TestSuite(JdbcNoDefaultCacheTest.class)); - suite.addTest(new TestSuite(JdbcDefaultNoOpCacheTest.class)); - suite.addTest(new TestSuite(JdbcPojoQuerySelfTest.class)); - suite.addTest(new TestSuite(JdbcPojoLegacyQuerySelfTest.class)); - suite.addTest(new TestSuite(JdbcConnectionReopenTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcConnectionSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcStatementSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcPreparedStatementSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcResultSetSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcComplexQuerySelfTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcMetadataSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcEmptyCacheSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcLocalCachesSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcNoDefaultCacheTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcDefaultNoOpCacheTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcPojoQuerySelfTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcPojoLegacyQuerySelfTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcConnectionReopenTest.class)); // Ignite client node based driver tests - suite.addTest(new TestSuite(org.apache.ignite.internal.jdbc2.JdbcConnectionSelfTest.class)); - suite.addTest(new TestSuite(org.apache.ignite.internal.jdbc2.JdbcSpringSelfTest.class)); - suite.addTest(new TestSuite(org.apache.ignite.internal.jdbc2.JdbcStatementSelfTest.class)); - suite.addTest(new TestSuite(org.apache.ignite.internal.jdbc2.JdbcPreparedStatementSelfTest.class)); - suite.addTest(new TestSuite(org.apache.ignite.internal.jdbc2.JdbcResultSetSelfTest.class)); - suite.addTest(new TestSuite(org.apache.ignite.internal.jdbc2.JdbcComplexQuerySelfTest.class)); - suite.addTest(new TestSuite(JdbcDistributedJoinsQueryTest.class)); - suite.addTest(new TestSuite(org.apache.ignite.internal.jdbc2.JdbcMetadataSelfTest.class)); - suite.addTest(new TestSuite(org.apache.ignite.internal.jdbc2.JdbcEmptyCacheSelfTest.class)); - suite.addTest(new TestSuite(org.apache.ignite.internal.jdbc2.JdbcLocalCachesSelfTest.class)); - suite.addTest(new TestSuite(org.apache.ignite.internal.jdbc2.JdbcNoDefaultCacheTest.class)); - suite.addTest(new TestSuite(org.apache.ignite.internal.jdbc2.JdbcDefaultNoOpCacheTest.class)); - suite.addTest(new TestSuite(org.apache.ignite.internal.jdbc2.JdbcMergeStatementSelfTest.class)); - suite.addTest(new TestSuite(org.apache.ignite.internal.jdbc2.JdbcBinaryMarshallerMergeStatementSelfTest.class)); - suite.addTest(new TestSuite(org.apache.ignite.internal.jdbc2.JdbcUpdateStatementSelfTest.class)); - suite.addTest(new TestSuite(org.apache.ignite.internal.jdbc2.JdbcInsertStatementSelfTest.class)); - suite.addTest(new TestSuite(org.apache.ignite.internal.jdbc2.JdbcBinaryMarshallerInsertStatementSelfTest.class)); - suite.addTest(new TestSuite(org.apache.ignite.internal.jdbc2.JdbcDeleteStatementSelfTest.class)); - suite.addTest(new TestSuite(org.apache.ignite.internal.jdbc2.JdbcStatementBatchingSelfTest.class)); - suite.addTest(new TestSuite(org.apache.ignite.internal.jdbc2.JdbcErrorsSelfTest.class)); - suite.addTest(new TestSuite(org.apache.ignite.internal.jdbc2.JdbcStreamingToPublicCacheTest.class)); - suite.addTest(new TestSuite(org.apache.ignite.internal.jdbc2.JdbcNoCacheStreamingSelfTest.class)); - suite.addTest(new TestSuite(JdbcBulkLoadSelfTest.class)); - - suite.addTest(new TestSuite(JdbcBlobTest.class)); - suite.addTest(new TestSuite(org.apache.ignite.internal.jdbc2.JdbcStreamingSelfTest.class)); - suite.addTest(new TestSuite(JdbcThinStreamingNotOrderedSelfTest.class)); - suite.addTest(new TestSuite(JdbcThinStreamingOrderedSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(org.apache.ignite.internal.jdbc2.JdbcConnectionSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(org.apache.ignite.internal.jdbc2.JdbcSpringSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(org.apache.ignite.internal.jdbc2.JdbcStatementSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(org.apache.ignite.internal.jdbc2.JdbcPreparedStatementSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(org.apache.ignite.internal.jdbc2.JdbcResultSetSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(org.apache.ignite.internal.jdbc2.JdbcComplexQuerySelfTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcDistributedJoinsQueryTest.class)); + suite.addTest(new JUnit4TestAdapter(org.apache.ignite.internal.jdbc2.JdbcMetadataSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(org.apache.ignite.internal.jdbc2.JdbcEmptyCacheSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(org.apache.ignite.internal.jdbc2.JdbcLocalCachesSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(org.apache.ignite.internal.jdbc2.JdbcNoDefaultCacheTest.class)); + suite.addTest(new JUnit4TestAdapter(org.apache.ignite.internal.jdbc2.JdbcDefaultNoOpCacheTest.class)); + suite.addTest(new JUnit4TestAdapter(org.apache.ignite.internal.jdbc2.JdbcMergeStatementSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(org.apache.ignite.internal.jdbc2.JdbcBinaryMarshallerMergeStatementSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(org.apache.ignite.internal.jdbc2.JdbcUpdateStatementSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(org.apache.ignite.internal.jdbc2.JdbcInsertStatementSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(org.apache.ignite.internal.jdbc2.JdbcBinaryMarshallerInsertStatementSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(org.apache.ignite.internal.jdbc2.JdbcDeleteStatementSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(org.apache.ignite.internal.jdbc2.JdbcStatementBatchingSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(org.apache.ignite.internal.jdbc2.JdbcErrorsSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(org.apache.ignite.internal.jdbc2.JdbcStreamingToPublicCacheTest.class)); + suite.addTest(new JUnit4TestAdapter(org.apache.ignite.internal.jdbc2.JdbcNoCacheStreamingSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcBulkLoadSelfTest.class)); + + suite.addTest(new JUnit4TestAdapter(JdbcBlobTest.class)); + suite.addTest(new JUnit4TestAdapter(org.apache.ignite.internal.jdbc2.JdbcStreamingSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcThinStreamingNotOrderedSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcThinStreamingOrderedSelfTest.class)); // DDL tests. - suite.addTest(new TestSuite(org.apache.ignite.internal.jdbc2.JdbcDynamicIndexAtomicPartitionedNearSelfTest.class)); - suite.addTest(new TestSuite(org.apache.ignite.internal.jdbc2.JdbcDynamicIndexAtomicPartitionedSelfTest.class)); - suite.addTest(new TestSuite(org.apache.ignite.internal.jdbc2.JdbcDynamicIndexAtomicReplicatedSelfTest.class)); - suite.addTest(new TestSuite(org.apache.ignite.internal.jdbc2.JdbcDynamicIndexTransactionalPartitionedNearSelfTest.class)); - suite.addTest(new TestSuite(org.apache.ignite.internal.jdbc2.JdbcDynamicIndexTransactionalPartitionedSelfTest.class)); - suite.addTest(new TestSuite(org.apache.ignite.internal.jdbc2.JdbcDynamicIndexTransactionalReplicatedSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(org.apache.ignite.internal.jdbc2.JdbcDynamicIndexAtomicPartitionedNearSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(org.apache.ignite.internal.jdbc2.JdbcDynamicIndexAtomicPartitionedSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(org.apache.ignite.internal.jdbc2.JdbcDynamicIndexAtomicReplicatedSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(org.apache.ignite.internal.jdbc2.JdbcDynamicIndexTransactionalPartitionedNearSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(org.apache.ignite.internal.jdbc2.JdbcDynamicIndexTransactionalPartitionedSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(org.apache.ignite.internal.jdbc2.JdbcDynamicIndexTransactionalReplicatedSelfTest.class)); // New thin JDBC - suite.addTest(new TestSuite(JdbcThinConnectionSelfTest.class)); - suite.addTest(new TestSuite(JdbcThinConnectionMvccEnabledSelfTest.class)); - suite.addTest(new TestSuite(JdbcThinConnectionMultipleAddressesTest.class)); - suite.addTest(new TestSuite(JdbcThinTcpIoTest.class)); - suite.addTest(new TestSuite(JdbcThinConnectionSSLTest.class)); - suite.addTest(new TestSuite(JdbcThinDataSourceSelfTest.class)); - suite.addTest(new TestSuite(JdbcThinPreparedStatementSelfTest.class)); - suite.addTest(new TestSuite(JdbcThinResultSetSelfTest.class)); - - suite.addTest(new TestSuite(JdbcThinStatementSelfTest.class)); - suite.addTest(new TestSuite(JdbcThinComplexQuerySelfTest.class)); - suite.addTest(new TestSuite(JdbcThinNoDefaultSchemaTest.class)); - suite.addTest(new TestSuite(JdbcThinSchemaCaseTest.class)); - suite.addTest(new TestSuite(JdbcThinEmptyCacheSelfTest.class)); - suite.addTest(new TestSuite(JdbcThinMetadataSelfTest.class)); - suite.addTest(new TestSuite(JdbcThinMetadataPrimaryKeysSelfTest.class)); - suite.addTest(new TestSuite(JdbcThinErrorsSelfTest.class)); - - suite.addTest(new TestSuite(JdbcThinInsertStatementSelfTest.class)); - suite.addTest(new TestSuite(JdbcThinUpdateStatementSelfTest.class)); - suite.addTest(new TestSuite(JdbcThinMergeStatementSelfTest.class)); - suite.addTest(new TestSuite(JdbcThinDeleteStatementSelfTest.class)); - suite.addTest(new TestSuite(JdbcThinAutoCloseServerCursorTest.class)); - suite.addTest(new TestSuite(JdbcThinBatchSelfTest.class)); - suite.addTest(new TestSuite(JdbcThinMissingLongArrayResultsTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcThinConnectionSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcThinConnectionMvccEnabledSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcThinConnectionMultipleAddressesTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcThinTcpIoTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcThinConnectionSSLTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcThinDataSourceSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcThinPreparedStatementSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcThinResultSetSelfTest.class)); + + suite.addTest(new JUnit4TestAdapter(JdbcThinStatementSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcThinComplexQuerySelfTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcThinNoDefaultSchemaTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcThinSchemaCaseTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcThinEmptyCacheSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcThinMetadataSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcThinMetadataPrimaryKeysSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcThinErrorsSelfTest.class)); + + suite.addTest(new JUnit4TestAdapter(JdbcThinInsertStatementSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcThinUpdateStatementSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcThinMergeStatementSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcThinDeleteStatementSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcThinAutoCloseServerCursorTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcThinBatchSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcThinMissingLongArrayResultsTest.class)); // New thin JDBC driver, DDL tests - suite.addTest(new TestSuite(JdbcThinDynamicIndexAtomicPartitionedNearSelfTest.class)); - suite.addTest(new TestSuite(JdbcThinDynamicIndexAtomicPartitionedSelfTest.class)); - suite.addTest(new TestSuite(JdbcThinDynamicIndexAtomicReplicatedSelfTest.class)); - suite.addTest(new TestSuite(JdbcThinDynamicIndexTransactionalPartitionedNearSelfTest.class)); - suite.addTest(new TestSuite(JdbcThinDynamicIndexTransactionalPartitionedSelfTest.class)); - suite.addTest(new TestSuite(JdbcThinDynamicIndexTransactionalReplicatedSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcThinDynamicIndexAtomicPartitionedNearSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcThinDynamicIndexAtomicPartitionedSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcThinDynamicIndexAtomicReplicatedSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcThinDynamicIndexTransactionalPartitionedNearSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcThinDynamicIndexTransactionalPartitionedSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcThinDynamicIndexTransactionalReplicatedSelfTest.class)); // New thin JDBC driver, DML tests - suite.addTest(new TestSuite(JdbcThinBulkLoadAtomicPartitionedNearSelfTest.class)); - suite.addTest(new TestSuite(JdbcThinBulkLoadAtomicPartitionedSelfTest.class)); - suite.addTest(new TestSuite(JdbcThinBulkLoadAtomicReplicatedSelfTest.class)); - suite.addTest(new TestSuite(JdbcThinBulkLoadTransactionalPartitionedNearSelfTest.class)); - suite.addTest(new TestSuite(JdbcThinBulkLoadTransactionalPartitionedSelfTest.class)); - suite.addTest(new TestSuite(JdbcThinBulkLoadTransactionalReplicatedSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcThinBulkLoadAtomicPartitionedNearSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcThinBulkLoadAtomicPartitionedSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcThinBulkLoadAtomicReplicatedSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcThinBulkLoadTransactionalPartitionedNearSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcThinBulkLoadTransactionalPartitionedSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcThinBulkLoadTransactionalReplicatedSelfTest.class)); // New thin JDBC driver, full SQL tests - suite.addTest(new TestSuite(JdbcThinComplexDmlDdlSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcThinComplexDmlDdlSelfTest.class)); - suite.addTest(new TestSuite(JdbcThinSelectAfterAlterTable.class)); + suite.addTest(new JUnit4TestAdapter(JdbcThinSelectAfterAlterTable.class)); // Update on server - suite.addTest(new TestSuite(JdbcThinInsertStatementSkipReducerOnUpdateSelfTest.class)); - suite.addTest(new TestSuite(JdbcThinUpdateStatementSkipReducerOnUpdateSelfTest.class)); - suite.addTest(new TestSuite(JdbcThinMergeStatementSkipReducerOnUpdateSelfTest.class)); - suite.addTest(new TestSuite(JdbcThinComplexDmlDdlSkipReducerOnUpdateSelfTest.class)); - suite.addTest(new TestSuite(JdbcThinComplexDmlDdlCustomSchemaSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcThinInsertStatementSkipReducerOnUpdateSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcThinUpdateStatementSkipReducerOnUpdateSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcThinMergeStatementSkipReducerOnUpdateSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcThinComplexDmlDdlSkipReducerOnUpdateSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcThinComplexDmlDdlCustomSchemaSelfTest.class)); // Transactions - suite.addTest(new TestSuite(JdbcThinTransactionsSelfTest.class)); - suite.addTest(new TestSuite(JdbcThinTransactionsClientAutoCommitComplexSelfTest.class)); - suite.addTest(new TestSuite(JdbcThinTransactionsServerAutoCommitComplexSelfTest.class)); - suite.addTest(new TestSuite(JdbcThinTransactionsClientNoAutoCommitComplexSelfTest.class)); - suite.addTest(new TestSuite(JdbcThinTransactionsServerNoAutoCommitComplexSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcThinTransactionsSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcThinTransactionsClientAutoCommitComplexSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcThinTransactionsServerAutoCommitComplexSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcThinTransactionsClientNoAutoCommitComplexSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcThinTransactionsServerNoAutoCommitComplexSelfTest.class)); - suite.addTest(new TestSuite(JdbcThinLocalQueriesSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcThinLocalQueriesSelfTest.class)); // Various commands. - suite.addTest(new TestSuite(JdbcThinWalModeChangeSelfTest.class)); - suite.addTest(new TestSuite(JdbcThinAuthenticateConnectionSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcThinWalModeChangeSelfTest.class)); + suite.addTest(new JUnit4TestAdapter(JdbcThinAuthenticateConnectionSelfTest.class)); return suite; } http://git-wip-us.apache.org/repos/asf/ignite/blob/c5197e0a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinAuthenticateConnectionSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinAuthenticateConnectionSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinAuthenticateConnectionSelfTest.java index cb4d7f3..ee4a62f 100644 --- a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinAuthenticateConnectionSelfTest.java +++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinAuthenticateConnectionSelfTest.java @@ -31,11 +31,15 @@ import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi; import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder; import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; import org.apache.ignite.testframework.GridTestUtils; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; /** * Tests for authenticated an non authenticated JDBC thin connection. */ @SuppressWarnings("ThrowableNotThrown") +@RunWith(JUnit4.class) public class JdbcThinAuthenticateConnectionSelfTest extends JdbcThinAbstractSelfTest { /** IP finder. */ private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true); @@ -93,6 +97,7 @@ public class JdbcThinAuthenticateConnectionSelfTest extends JdbcThinAbstractSelf /** * @throws Exception If failed. */ + @Test public void testConnection() throws Exception { checkConnection(URL, "ignite", "ignite"); checkConnection(URL, "another_user", "passwd"); @@ -102,6 +107,7 @@ public class JdbcThinAuthenticateConnectionSelfTest extends JdbcThinAbstractSelf /** */ + @Test public void testInvalidUserPassword() { String err = "Unauthenticated sessions are prohibited"; checkInvalidUserPassword(URL, null, null, err); @@ -119,6 +125,7 @@ public class JdbcThinAuthenticateConnectionSelfTest extends JdbcThinAbstractSelf /** * @throws SQLException On failed. */ + @Test public void testUserSqlOnAuthorized() throws SQLException { try (Connection conn = DriverManager.getConnection(URL, "ignite", "ignite")) { conn.createStatement().execute("CREATE USER test WITH PASSWORD 'test'"); @@ -139,6 +146,7 @@ public class JdbcThinAuthenticateConnectionSelfTest extends JdbcThinAbstractSelf /** * @throws SQLException On error. */ + @Test public void testUserSqlWithNotIgniteUser() throws SQLException { try (Connection conn = DriverManager.getConnection(URL, "another_user", "passwd")) { String err = "User management operations are not allowed for user"; @@ -157,6 +165,7 @@ public class JdbcThinAuthenticateConnectionSelfTest extends JdbcThinAbstractSelf /** * @throws SQLException On error. */ + @Test public void testQuotedUsername() throws SQLException { // Spaces checkUserPassword(" test", " "); @@ -235,4 +244,4 @@ public class JdbcThinAuthenticateConnectionSelfTest extends JdbcThinAbstractSelf } }, SQLException.class, err); } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/ignite/blob/c5197e0a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinAutoCloseServerCursorTest.java ---------------------------------------------------------------------- diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinAutoCloseServerCursorTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinAutoCloseServerCursorTest.java index 0e0bcb7..f3d19ae 100644 --- a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinAutoCloseServerCursorTest.java +++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinAutoCloseServerCursorTest.java @@ -34,6 +34,9 @@ import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi; import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder; import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; import org.apache.ignite.testframework.GridTestUtils; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; import static org.apache.ignite.cache.CacheMode.PARTITIONED; import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; @@ -42,6 +45,7 @@ import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; * Tests an optional optimization that server cursor is closed automatically * when last result set page is transmitted. */ +@RunWith(JUnit4.class) public class JdbcThinAutoCloseServerCursorTest extends JdbcThinAbstractSelfTest { /** IP finder. */ private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true); @@ -95,6 +99,7 @@ public class JdbcThinAutoCloseServerCursorTest extends JdbcThinAbstractSelfTest * * @throws Exception If failed. */ + @Test public void testQuery() throws Exception { IgniteCache<Integer, Person> cache = grid(0).cache(CACHE_NAME); @@ -188,6 +193,7 @@ public class JdbcThinAutoCloseServerCursorTest extends JdbcThinAbstractSelfTest * * @throws Exception If failed. */ + @Test public void testInsert() throws Exception { try (Connection conn = DriverManager.getConnection(URL)) { conn.setSchema('"' + CACHE_NAME + '"'); @@ -217,6 +223,7 @@ public class JdbcThinAutoCloseServerCursorTest extends JdbcThinAbstractSelfTest * * @throws Exception If failed. */ + @Test public void testUpdate() throws Exception { IgniteCache<Integer, Person> cache = grid(0).cache(CACHE_NAME); @@ -242,6 +249,7 @@ public class JdbcThinAutoCloseServerCursorTest extends JdbcThinAbstractSelfTest * * @throws Exception If failed. */ + @Test public void testDelete() throws Exception { IgniteCache<Integer, Person> cache = grid(0).cache(CACHE_NAME); http://git-wip-us.apache.org/repos/asf/ignite/blob/c5197e0a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinBatchSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinBatchSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinBatchSelfTest.java index ca74fcd..6dcb9ec 100644 --- a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinBatchSelfTest.java +++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinBatchSelfTest.java @@ -28,12 +28,16 @@ import java.util.concurrent.Callable; import org.apache.ignite.internal.processors.cache.query.IgniteQueryErrorCode; import org.apache.ignite.internal.processors.odbc.SqlStateCode; import org.apache.ignite.testframework.GridTestUtils; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; import static org.junit.Assert.assertArrayEquals; /** * Statement test. */ +@RunWith(JUnit4.class) public class JdbcThinBatchSelfTest extends JdbcThinAbstractDmlStatementSelfTest { /** SQL query. */ private static final String SQL_PREPARED = "insert into Person(_key, id, firstName, lastName, age) values " + @@ -77,6 +81,7 @@ public class JdbcThinBatchSelfTest extends JdbcThinAbstractDmlStatementSelfTest /** * @throws SQLException If failed. */ + @Test public void testBatch() throws SQLException { final int BATCH_SIZE = 10; @@ -96,6 +101,7 @@ public class JdbcThinBatchSelfTest extends JdbcThinAbstractDmlStatementSelfTest /** * @throws SQLException If failed. */ + @Test public void testBatchOnClosedStatement() throws SQLException { final Statement stmt2 = conn.createStatement(); final PreparedStatement pstmt2 = conn.prepareStatement(""); @@ -155,6 +161,7 @@ public class JdbcThinBatchSelfTest extends JdbcThinAbstractDmlStatementSelfTest /** * @throws SQLException If failed. */ + @Test public void testBatchException() throws SQLException { final int BATCH_SIZE = 7; @@ -198,6 +205,7 @@ public class JdbcThinBatchSelfTest extends JdbcThinAbstractDmlStatementSelfTest /** * @throws SQLException If failed. */ + @Test public void testBatchParseException() throws SQLException { final int BATCH_SIZE = 7; @@ -241,6 +249,7 @@ public class JdbcThinBatchSelfTest extends JdbcThinAbstractDmlStatementSelfTest /** * @throws SQLException If failed. */ + @Test public void testBatchMerge() throws SQLException { final int BATCH_SIZE = 7; @@ -260,6 +269,7 @@ public class JdbcThinBatchSelfTest extends JdbcThinAbstractDmlStatementSelfTest /** * @throws SQLException If failed. */ + @Test public void testBatchMergeParseException() throws SQLException { final int BATCH_SIZE = 7; @@ -303,6 +313,7 @@ public class JdbcThinBatchSelfTest extends JdbcThinAbstractDmlStatementSelfTest /** * @throws SQLException If failed. */ + @Test public void testBatchKeyDuplicatesException() throws SQLException { final int BATCH_SIZE = 7; @@ -348,6 +359,7 @@ public class JdbcThinBatchSelfTest extends JdbcThinAbstractDmlStatementSelfTest /** * @throws SQLException If failed. */ + @Test public void testHeterogeneousBatch() throws SQLException { stmt.addBatch("insert into Person (_key, id, firstName, lastName, age) values ('p0', 0, 'Name0', 'Lastname0', 10)"); stmt.addBatch("insert into Person (_key, id, firstName, lastName, age) values ('p1', 1, 'Name1', 'Lastname1', 20), ('p2', 2, 'Name2', 'Lastname2', 30)"); @@ -365,6 +377,7 @@ public class JdbcThinBatchSelfTest extends JdbcThinAbstractDmlStatementSelfTest /** * @throws SQLException If failed. */ + @Test public void testHeterogeneousBatchException() throws SQLException { stmt.addBatch("insert into Person (_key, id, firstName, lastName, age) values ('p0', 0, 'Name0', 'Lastname0', 10)"); stmt.addBatch("insert into Person (_key, id, firstName, lastName, age) values ('p1', 1, 'Name1', 'Lastname1', 20), ('p2', 2, 'Name2', 'Lastname2', 30)"); @@ -396,6 +409,7 @@ public class JdbcThinBatchSelfTest extends JdbcThinAbstractDmlStatementSelfTest /** * @throws SQLException If failed. */ + @Test public void testBatchClear() throws SQLException { final int BATCH_SIZE = 7; @@ -418,6 +432,7 @@ public class JdbcThinBatchSelfTest extends JdbcThinAbstractDmlStatementSelfTest * * @throws SQLException on error. */ + @Test public void testEmptyBatchStreaming() throws SQLException { executeUpdateOn(conn, "SET STREAMING ON"); @@ -436,6 +451,7 @@ public class JdbcThinBatchSelfTest extends JdbcThinAbstractDmlStatementSelfTest * * @throws SQLException on error. */ + @Test public void testEmptyBatchStreamingPrepared() throws SQLException { try (Statement statement = conn.createStatement()) { statement.executeUpdate("SET STREAMING ON"); @@ -456,6 +472,7 @@ public class JdbcThinBatchSelfTest extends JdbcThinAbstractDmlStatementSelfTest /** * @throws SQLException If failed. */ + @Test public void testBatchPrepared() throws SQLException { final int BATCH_SIZE = 10; @@ -482,6 +499,7 @@ public class JdbcThinBatchSelfTest extends JdbcThinAbstractDmlStatementSelfTest /** * @throws SQLException If failed. */ + @Test public void testBatchExceptionPrepared() throws SQLException { final int BATCH_SIZE = 7; @@ -546,6 +564,7 @@ public class JdbcThinBatchSelfTest extends JdbcThinAbstractDmlStatementSelfTest /** * @throws SQLException If failed. */ + @Test public void testBatchMergePrepared() throws SQLException { final int BATCH_SIZE = 10; @@ -575,6 +594,7 @@ public class JdbcThinBatchSelfTest extends JdbcThinAbstractDmlStatementSelfTest /** * @throws SQLException If failed. */ + @Test public void testBatchMergeExceptionPrepared() throws SQLException { final int BATCH_SIZE = 7; @@ -655,6 +675,7 @@ public class JdbcThinBatchSelfTest extends JdbcThinAbstractDmlStatementSelfTest /** * @throws SQLException If failed. */ + @Test public void testBatchUpdatePrepared() throws SQLException { final int BATCH_SIZE = 10; @@ -679,6 +700,7 @@ public class JdbcThinBatchSelfTest extends JdbcThinAbstractDmlStatementSelfTest /** * @throws SQLException If failed. */ + @Test public void testBatchUpdateExceptionPrepared() throws SQLException { final int BATCH_SIZE = 7; @@ -734,6 +756,7 @@ public class JdbcThinBatchSelfTest extends JdbcThinAbstractDmlStatementSelfTest /** * @throws SQLException If failed. */ + @Test public void testBatchDeletePrepared() throws SQLException { final int BATCH_SIZE = 10; @@ -758,6 +781,7 @@ public class JdbcThinBatchSelfTest extends JdbcThinAbstractDmlStatementSelfTest /** * @throws SQLException If failed. */ + @Test public void testBatchDeleteExceptionPrepared() throws SQLException { final int BATCH_SIZE = 7; @@ -813,6 +837,7 @@ public class JdbcThinBatchSelfTest extends JdbcThinAbstractDmlStatementSelfTest /** * @throws SQLException If failed. */ + @Test public void testBatchClearPrepared() throws SQLException { final int BATCH_SIZE = 10; http://git-wip-us.apache.org/repos/asf/ignite/blob/c5197e0a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinBulkLoadAbstractSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinBulkLoadAbstractSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinBulkLoadAbstractSelfTest.java index 8eeac18..a1432fc 100644 --- a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinBulkLoadAbstractSelfTest.java +++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinBulkLoadAbstractSelfTest.java @@ -42,6 +42,9 @@ import org.apache.ignite.internal.processors.bulkload.BulkLoadCsvParser; import org.apache.ignite.internal.processors.query.QueryUtils; import org.apache.ignite.lang.IgniteClosure; import org.apache.ignite.testframework.GridTestUtils; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; import static org.apache.ignite.cache.CacheMode.PARTITIONED; import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; @@ -50,6 +53,7 @@ import static org.apache.ignite.internal.util.IgniteUtils.resolveIgnitePath; /** * COPY statement tests. */ +@RunWith(JUnit4.class) public abstract class JdbcThinBulkLoadAbstractSelfTest extends JdbcThinAbstractDmlStatementSelfTest { /** Subdirectory with CSV files */ private static final String CSV_FILE_SUBDIR = "/modules/clients/src/test/resources/"; @@ -195,6 +199,7 @@ public abstract class JdbcThinBulkLoadAbstractSelfTest extends JdbcThinAbstractD * * @throws SQLException If failed. */ + @Test public void testBasicStatement() throws SQLException { int updatesCnt = stmt.executeUpdate(BASIC_SQL_COPY_STMT); @@ -209,6 +214,7 @@ public abstract class JdbcThinBulkLoadAbstractSelfTest extends JdbcThinAbstractD * * @throws SQLException If failed. */ + @Test public void testEmptyFile() throws SQLException { int updatesCnt = stmt.executeUpdate( "copy from '" + BULKLOAD_EMPTY_CSV_FILE + "' into " + TBL_NAME + @@ -225,6 +231,7 @@ public abstract class JdbcThinBulkLoadAbstractSelfTest extends JdbcThinAbstractD * * @throws SQLException If failed. */ + @Test public void testOneLineFile() throws SQLException { int updatesCnt = stmt.executeUpdate( "copy from '" + BULKLOAD_ONE_LINE_CSV_FILE + "' into " + TBL_NAME + @@ -239,6 +246,7 @@ public abstract class JdbcThinBulkLoadAbstractSelfTest extends JdbcThinAbstractD /** * Verifies that error is reported for empty charset name. */ + @Test public void testEmptyCharset() { GridTestUtils.assertThrows(log, new Callable<Object>() { @Override public Object call() throws Exception { @@ -255,6 +263,7 @@ public abstract class JdbcThinBulkLoadAbstractSelfTest extends JdbcThinAbstractD /** * Verifies that error is reported for unsupported charset name. */ + @Test public void testNotSupportedCharset() { GridTestUtils.assertThrows(log, new Callable<Object>() { @Override public Object call() throws Exception { @@ -271,6 +280,7 @@ public abstract class JdbcThinBulkLoadAbstractSelfTest extends JdbcThinAbstractD /** * Verifies that error is reported for unknown charset name. */ + @Test public void testUnknownCharset() { GridTestUtils.assertThrows(log, new Callable<Object>() { @Override public Object call() throws Exception { @@ -289,6 +299,7 @@ public abstract class JdbcThinBulkLoadAbstractSelfTest extends JdbcThinAbstractD * * @throws SQLException If failed. */ + @Test public void testAsciiCharset() throws SQLException { int updatesCnt = stmt.executeUpdate( "copy from '" + BULKLOAD_TWO_LINES_CSV_FILE + "'" + @@ -307,6 +318,7 @@ public abstract class JdbcThinBulkLoadAbstractSelfTest extends JdbcThinAbstractD * * @throws SQLException If failed. */ + @Test public void testUtf8Charset() throws SQLException { checkBulkLoadWithCharset(BULKLOAD_UTF8_CSV_FILE, "utf-8"); } @@ -316,6 +328,7 @@ public abstract class JdbcThinBulkLoadAbstractSelfTest extends JdbcThinAbstractD * * @throws SQLException If failed. */ + @Test public void testWin1251Charset() throws SQLException { checkBulkLoadWithCharset(BULKLOAD_CP1251_CSV_FILE, "windows-1251"); } @@ -345,6 +358,7 @@ public abstract class JdbcThinBulkLoadAbstractSelfTest extends JdbcThinAbstractD * * @throws SQLException If failed. */ + @Test public void testWrongCharset_Utf8AsWin1251() throws SQLException { checkBulkLoadWithWrongCharset(BULKLOAD_UTF8_CSV_FILE, "UTF-8", "windows-1251"); } @@ -355,6 +369,7 @@ public abstract class JdbcThinBulkLoadAbstractSelfTest extends JdbcThinAbstractD * * @throws SQLException If failed. */ + @Test public void testWrongCharset_Win1251AsUtf8() throws SQLException { checkBulkLoadWithWrongCharset(BULKLOAD_CP1251_CSV_FILE, "windows-1251", "UTF-8"); } @@ -365,6 +380,7 @@ public abstract class JdbcThinBulkLoadAbstractSelfTest extends JdbcThinAbstractD * * @throws SQLException If failed. */ + @Test public void testWrongCharset_Utf8AsAscii() throws SQLException { checkBulkLoadWithWrongCharset(BULKLOAD_UTF8_CSV_FILE, "UTF-8", "ascii"); } @@ -375,6 +391,7 @@ public abstract class JdbcThinBulkLoadAbstractSelfTest extends JdbcThinAbstractD * * @throws SQLException If failed. */ + @Test public void testWrongCharset_Win1251AsAscii() throws SQLException { checkBulkLoadWithWrongCharset(BULKLOAD_CP1251_CSV_FILE, "windows-1251", "ascii"); } @@ -385,6 +402,7 @@ public abstract class JdbcThinBulkLoadAbstractSelfTest extends JdbcThinAbstractD * * @throws SQLException If failed. */ + @Test public void testPacketSize_1() throws SQLException { int updatesCnt = stmt.executeUpdate(BASIC_SQL_COPY_STMT + " packet_size 1"); @@ -399,6 +417,7 @@ public abstract class JdbcThinBulkLoadAbstractSelfTest extends JdbcThinAbstractD * * @throws SQLException If failed. */ + @Test public void testDefaultCharset() throws SQLException { int updatesCnt = stmt.executeUpdate( "copy from '" + BULKLOAD_UTF8_CSV_FILE + "' into " + TBL_NAME + @@ -415,6 +434,7 @@ public abstract class JdbcThinBulkLoadAbstractSelfTest extends JdbcThinAbstractD * * @throws SQLException If failed. */ + @Test public void testBulkLoadToNonAffinityNode() throws Exception { IgniteEx client = startGrid(getConfiguration("client").setClientMode(true)); @@ -443,6 +463,7 @@ public abstract class JdbcThinBulkLoadAbstractSelfTest extends JdbcThinAbstractD * * @throws SQLException If failed. */ + @Test public void testDefaultCharsetPacketSize1() throws SQLException { int updatesCnt = stmt.executeUpdate( "copy from '" + BULKLOAD_UTF8_CSV_FILE + "' into " + TBL_NAME + @@ -457,6 +478,7 @@ public abstract class JdbcThinBulkLoadAbstractSelfTest extends JdbcThinAbstractD /** * Checks that error is reported for a non-existent file. */ + @Test public void testWrongFileName() { GridTestUtils.assertThrows(log, new Callable<Object>() { @Override public Object call() throws Exception { @@ -473,6 +495,7 @@ public abstract class JdbcThinBulkLoadAbstractSelfTest extends JdbcThinAbstractD /** * Checks that error is reported if the destination table is missing. */ + @Test public void testMissingTable() { GridTestUtils.assertThrows(log, new Callable<Object>() { @Override public Object call() throws Exception { @@ -489,6 +512,7 @@ public abstract class JdbcThinBulkLoadAbstractSelfTest extends JdbcThinAbstractD /** * Checks that error is reported when a non-existing column is specified in the SQL command. */ + @Test public void testWrongColumnName() { GridTestUtils.assertThrows(log, new Callable<Object>() { @Override public Object call() throws Exception { @@ -505,6 +529,7 @@ public abstract class JdbcThinBulkLoadAbstractSelfTest extends JdbcThinAbstractD /** * Checks that error is reported if field read from CSV file cannot be converted to the type of the column. */ + @Test public void testWrongColumnType() { GridTestUtils.assertThrows(log, new Callable<Object>() { @Override public Object call() throws Exception { @@ -523,6 +548,7 @@ public abstract class JdbcThinBulkLoadAbstractSelfTest extends JdbcThinAbstractD * * @throws SQLException If failed. */ + @Test public void testFieldsSubset() throws SQLException { int updatesCnt = stmt.executeUpdate( "copy from '" + BULKLOAD_TWO_LINES_CSV_FILE + "'" + @@ -543,6 +569,7 @@ public abstract class JdbcThinBulkLoadAbstractSelfTest extends JdbcThinAbstractD * * @throws SQLException If failed. */ + @Test public void testCreateAndBulkLoadTable() throws SQLException { String tblName = QueryUtils.DFLT_SCHEMA + ".\"PersonTbl\""; @@ -568,6 +595,7 @@ public abstract class JdbcThinBulkLoadAbstractSelfTest extends JdbcThinAbstractD * @throws SQLException If failed. */ @SuppressWarnings("unchecked") + @Test public void testConfigureQueryEntityAndBulkLoad() throws SQLException { ignite(0).getOrCreateCache(cacheConfigWithQueryEntity()); @@ -583,6 +611,7 @@ public abstract class JdbcThinBulkLoadAbstractSelfTest extends JdbcThinAbstractD * * @throws SQLException If failed. */ + @Test public void testMultipleStatement() throws SQLException { GridTestUtils.assertThrows(log, new Callable<Object>() { @Override public Object call() throws Exception { @@ -608,6 +637,7 @@ public abstract class JdbcThinBulkLoadAbstractSelfTest extends JdbcThinAbstractD * * @throws SQLException If failed. */ + @Test public void testExecuteQuery() throws SQLException { GridTestUtils.assertThrows(log, new Callable<Object>() { @Override public Object call() throws Exception { @@ -623,6 +653,7 @@ public abstract class JdbcThinBulkLoadAbstractSelfTest extends JdbcThinAbstractD * * @throws SQLException If failed. */ + @Test public void testExecute() throws SQLException { boolean isRowSet = stmt.execute(BASIC_SQL_COPY_STMT); @@ -636,6 +667,7 @@ public abstract class JdbcThinBulkLoadAbstractSelfTest extends JdbcThinAbstractD * * @throws SQLException If failed. */ + @Test public void testPreparedStatementWithExecuteUpdate() throws SQLException { PreparedStatement pstmt = conn.prepareStatement(BASIC_SQL_COPY_STMT); @@ -651,6 +683,7 @@ public abstract class JdbcThinBulkLoadAbstractSelfTest extends JdbcThinAbstractD * * @throws SQLException If failed. */ + @Test public void testPreparedStatementWithParameter() throws SQLException { GridTestUtils.assertThrows(log, new Callable<Object>() { @Override public Object call() throws Exception { @@ -673,6 +706,7 @@ public abstract class JdbcThinBulkLoadAbstractSelfTest extends JdbcThinAbstractD * * @throws SQLException If failed. */ + @Test public void testPreparedStatementWithExecute() throws SQLException { PreparedStatement pstmt = conn.prepareStatement(BASIC_SQL_COPY_STMT); @@ -686,6 +720,7 @@ public abstract class JdbcThinBulkLoadAbstractSelfTest extends JdbcThinAbstractD /** * Verifies that COPY command is rejected by PreparedStatement.executeQuery(). */ + @Test public void testPreparedStatementWithExecuteQuery() { GridTestUtils.assertThrows(log, new Callable<Object>() { @Override public Object call() throws Exception {
