Skip to content

Commit 1d0b267

Browse files
committed
Revert "GG-19470 [IGNITE-9560] Security Engine fixes and test coverage. Phase #1."
This reverts commit 7c9e79d
1 parent dbfe7aa commit 1d0b267

File tree

78 files changed

+833
-4591
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+833
-4591
lines changed

modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcDynamicIndexAbstractSelfTest.java

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import org.apache.ignite.configuration.CacheConfiguration;
3131
import org.apache.ignite.configuration.NearCacheConfiguration;
3232
import org.apache.ignite.internal.util.typedef.F;
33-
import org.apache.ignite.testframework.GridTestUtils.RunnableX;
3433
import org.junit.Test;
3534
import org.junit.runner.RunWith;
3635
import org.junit.runners.JUnit4;
@@ -176,7 +175,7 @@ public void testCreateIndexWithDuplicateName() throws SQLException {
176175

177176
assertSqlException(new RunnableX() {
178177
/** {@inheritDoc} */
179-
@Override public void runx() throws Exception {
178+
@Override public void run() throws Exception {
180179
jdbcRun(CREATE_INDEX);
181180
}
182181
});
@@ -230,7 +229,7 @@ public void testDropIndex() throws SQLException {
230229
public void testDropMissingIndex() {
231230
assertSqlException(new RunnableX() {
232231
/** {@inheritDoc} */
233-
@Override public void runx() throws Exception {
232+
@Override public void run() throws Exception {
234233
jdbcRun(DROP_INDEX);
235234
}
236235
});
@@ -325,7 +324,7 @@ private static void assertSqlException(RunnableX r) {
325324
// We expect IgniteSQLException with given code inside CacheException inside JDBC SQLException.
326325

327326
try {
328-
r.runx();
327+
r.run();
329328
}
330329
catch (SQLException e) {
331330
return;
@@ -336,4 +335,16 @@ private static void assertSqlException(RunnableX r) {
336335

337336
fail(SQLException.class.getSimpleName() + " is not thrown.");
338337
}
338+
339+
/**
340+
* Runnable which can throw checked exceptions.
341+
*/
342+
private interface RunnableX {
343+
/**
344+
* Do run.
345+
*
346+
* @throws Exception If failed.
347+
*/
348+
public void run() throws Exception;
349+
}
339350
}

modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinAbstractSelfTest.java

Lines changed: 37 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@
2727
import java.util.Collection;
2828
import java.util.Collections;
2929
import java.util.List;
30+
import java.util.concurrent.Callable;
3031
import org.apache.ignite.internal.IgniteEx;
3132
import org.apache.ignite.internal.processors.odbc.ClientListenerProcessor;
3233
import org.apache.ignite.internal.processors.port.GridPortRecord;
3334
import org.apache.ignite.internal.util.typedef.F;
3435
import org.apache.ignite.testframework.GridTestUtils;
35-
import org.apache.ignite.testframework.GridTestUtils.RunnableX;
3636
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
3737

3838
/**
@@ -44,45 +44,68 @@ public class JdbcThinAbstractSelfTest extends GridCommonAbstractTest {
4444
* @param r Runnable to check support.
4545
*/
4646
protected void checkNotSupported(final RunnableX r) {
47-
GridTestUtils.assertThrowsWithCause(r, SQLFeatureNotSupportedException.class);
47+
GridTestUtils.assertThrows(log,
48+
new Callable<Object>() {
49+
@Override public Object call() throws Exception {
50+
r.run();
51+
52+
return null;
53+
}
54+
}, SQLFeatureNotSupportedException.class, null);
4855
}
4956

5057
/**
5158
* @param r Runnable to check on closed connection.
5259
*/
5360
protected void checkConnectionClosed(final RunnableX r) {
54-
GridTestUtils.assertThrowsAnyCause(log,
55-
() -> {
56-
r.run();
61+
GridTestUtils.assertThrows(log,
62+
new Callable<Object>() {
63+
@Override public Object call() throws Exception {
64+
r.run();
5765

58-
return null;
66+
return null;
67+
}
5968
}, SQLException.class, "Connection is closed");
6069
}
6170

6271
/**
6372
* @param r Runnable to check on closed statement.
6473
*/
6574
protected void checkStatementClosed(final RunnableX r) {
66-
GridTestUtils.assertThrowsAnyCause(log,
67-
() -> {
68-
r.run();
75+
GridTestUtils.assertThrows(log,
76+
new Callable<Object>() {
77+
@Override public Object call() throws Exception {
78+
r.run();
6979

70-
return null;
80+
return null;
81+
}
7182
}, SQLException.class, "Statement is closed");
7283
}
7384

7485
/**
7586
* @param r Runnable to check on closed result set.
7687
*/
7788
protected void checkResultSetClosed(final RunnableX r) {
78-
GridTestUtils.assertThrowsAnyCause(log,
79-
() -> {
80-
r.run();
89+
GridTestUtils.assertThrows(log,
90+
new Callable<Object>() {
91+
@Override public Object call() throws Exception {
92+
r.run();
8193

82-
return null;
94+
return null;
95+
}
8396
}, SQLException.class, "Result set is closed");
8497
}
8598

99+
/**
100+
* Runnable that can throw an exception.
101+
*/
102+
interface RunnableX {
103+
/**
104+
* @throws Exception On error.
105+
*/
106+
void run() throws Exception;
107+
}
108+
86109
/**
87110
* @param node Node to connect to.
88111
* @param params Connection parameters.

modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinConnectionMvccEnabledSelfTest.java

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import org.apache.ignite.configuration.IgniteConfiguration;
2828
import org.apache.ignite.internal.binary.BinaryMarshaller;
2929
import org.apache.ignite.testframework.GridStringLogger;
30+
import org.apache.ignite.testframework.GridTestUtils;
3031
import org.jetbrains.annotations.NotNull;
3132
import org.junit.Test;
3233
import org.junit.runner.RunWith;
@@ -37,8 +38,6 @@
3738
import static java.sql.Connection.TRANSACTION_READ_UNCOMMITTED;
3839
import static java.sql.Connection.TRANSACTION_REPEATABLE_READ;
3940
import static java.sql.Connection.TRANSACTION_SERIALIZABLE;
40-
import static org.apache.ignite.testframework.GridTestUtils.RunnableX;
41-
import static org.apache.ignite.testframework.GridTestUtils.assertThrows;
4241

4342
/**
4443
* Connection test.
@@ -129,7 +128,7 @@ public void testGetSetAutoCommit() throws Exception {
129128

130129
// Exception when called on closed connection
131130
checkConnectionClosed(new RunnableX() {
132-
@Override public void runx() throws Exception {
131+
@Override public void run() throws Exception {
133132
conn.setAutoCommit(true);
134133
}
135134
});
@@ -145,7 +144,7 @@ public void testCommit() throws Exception {
145144
assertTrue(conn.getMetaData().supportsTransactions());
146145

147146
// Should not be called in auto-commit mode
148-
assertThrows(log,
147+
GridTestUtils.assertThrows(log,
149148
new Callable<Object>() {
150149
@Override public Object call() throws Exception {
151150
conn.commit();
@@ -165,7 +164,7 @@ public void testCommit() throws Exception {
165164

166165
// Exception when called on closed connection
167166
checkConnectionClosed(new RunnableX() {
168-
@Override public void runx() throws Exception {
167+
@Override public void run() throws Exception {
169168
conn.commit();
170169
}
171170
});
@@ -181,7 +180,7 @@ public void testRollback() throws Exception {
181180
assertTrue(conn.getMetaData().supportsTransactions());
182181

183182
// Should not be called in auto-commit mode
184-
assertThrows(log,
183+
GridTestUtils.assertThrows(log,
185184
new Callable<Object>() {
186185
@Override public Object call() throws Exception {
187186
conn.rollback();
@@ -201,7 +200,7 @@ public void testRollback() throws Exception {
201200

202201
// Exception when called on closed connection
203202
checkConnectionClosed(new RunnableX() {
204-
@Override public void runx() throws Exception {
203+
@Override public void run() throws Exception {
205204
conn.rollback();
206205
}
207206
});
@@ -217,7 +216,7 @@ public void testSetSavepoint() throws Exception {
217216
assert !conn.getMetaData().supportsSavepoints();
218217

219218
// Disallowed in auto-commit mode
220-
assertThrows(log,
219+
GridTestUtils.assertThrows(log,
221220
new Callable<Object>() {
222221
@Override public Object call() throws Exception {
223222
conn.setSavepoint();
@@ -233,15 +232,15 @@ public void testSetSavepoint() throws Exception {
233232

234233
// Unsupported
235234
checkNotSupported(new RunnableX() {
236-
@Override public void runx() throws Exception {
235+
@Override public void run() throws Exception {
237236
conn.setSavepoint();
238237
}
239238
});
240239

241240
conn.close();
242241

243242
checkConnectionClosed(new RunnableX() {
244-
@Override public void runx() throws Exception {
243+
@Override public void run() throws Exception {
245244
conn.setSavepoint();
246245
}
247246
});
@@ -257,7 +256,7 @@ public void testSetSavepointName() throws Exception {
257256
assert !conn.getMetaData().supportsSavepoints();
258257

259258
// Invalid arg
260-
assertThrows(log,
259+
GridTestUtils.assertThrows(log,
261260
new Callable<Object>() {
262261
@Override public Object call() throws Exception {
263262
conn.setSavepoint(null);
@@ -272,7 +271,7 @@ public void testSetSavepointName() throws Exception {
272271
final String name = "savepoint";
273272

274273
// Disallowed in auto-commit mode
275-
assertThrows(log,
274+
GridTestUtils.assertThrows(log,
276275
new Callable<Object>() {
277276
@Override public Object call() throws Exception {
278277
conn.setSavepoint(name);
@@ -288,15 +287,15 @@ public void testSetSavepointName() throws Exception {
288287

289288
// Unsupported
290289
checkNotSupported(new RunnableX() {
291-
@Override public void runx() throws Exception {
290+
@Override public void run() throws Exception {
292291
conn.setSavepoint(name);
293292
}
294293
});
295294

296295
conn.close();
297296

298297
checkConnectionClosed(new RunnableX() {
299-
@Override public void runx() throws Exception {
298+
@Override public void run() throws Exception {
300299
conn.setSavepoint(name);
301300
}
302301
});
@@ -312,7 +311,7 @@ public void testRollbackSavePoint() throws Exception {
312311
assert !conn.getMetaData().supportsSavepoints();
313312

314313
// Invalid arg
315-
assertThrows(log,
314+
GridTestUtils.assertThrows(log,
316315
new Callable<Object>() {
317316
@Override public Object call() throws Exception {
318317
conn.rollback(null);
@@ -327,7 +326,7 @@ public void testRollbackSavePoint() throws Exception {
327326
final Savepoint savepoint = getFakeSavepoint();
328327

329328
// Disallowed in auto-commit mode
330-
assertThrows(log,
329+
GridTestUtils.assertThrows(log,
331330
new Callable<Object>() {
332331
@Override public Object call() throws Exception {
333332
conn.rollback(savepoint);
@@ -343,15 +342,15 @@ public void testRollbackSavePoint() throws Exception {
343342

344343
// Unsupported
345344
checkNotSupported(new RunnableX() {
346-
@Override public void runx() throws Exception {
345+
@Override public void run() throws Exception {
347346
conn.rollback(savepoint);
348347
}
349348
});
350349

351350
conn.close();
352351

353352
checkConnectionClosed(new RunnableX() {
354-
@Override public void runx() throws Exception {
353+
@Override public void run() throws Exception {
355354
conn.rollback(savepoint);
356355
}
357356
});

0 commit comments

Comments
 (0)