Skip to content

Commit b95f0d8

Browse files
committed
[#14105] test: Replace the last JUnit 4 code and declare the test libraries each module uses
1 parent 5c8c1d9 commit b95f0d8

86 files changed

Lines changed: 503 additions & 419 deletions

File tree

Some content is hidden

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

‎authorizations/authorization-chain/src/test/java/org/apache/gravitino/authorization/chain/integration/test/TestChainedAuthorizationIT.java‎

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -326,67 +326,80 @@ public void testCreateSchema() throws InterruptedException {
326326
}
327327

328328
@Test
329-
void testCreateTable() throws InterruptedException {
329+
@Override
330+
protected void testCreateTable() {
330331
// TODO
331332
}
332333

333334
@Test
334-
void testSelectModifyTableWithMetalakeLevelRole() throws InterruptedException {
335+
@Override
336+
protected void testSelectModifyTableWithMetalakeLevelRole() {
335337
// TODO
336338
}
337339

338340
@Test
339-
void testSelectModifyTableWithTableLevelRole() throws InterruptedException {
341+
@Override
342+
protected void testSelectModifyTableWithTableLevelRole() {
340343
// TODO
341344
}
342345

343346
@Test
344-
void testSelectOnlyTable() throws InterruptedException {
347+
@Override
348+
protected void testSelectOnlyTable() {
345349
// TODO
346350
}
347351

348352
@Test
349-
void testModifyOnlyTable() throws InterruptedException {
353+
@Override
354+
protected void testModifyOnlyTable() {
350355
// TODO
351356
}
352357

353358
@Test
354-
void testCreateAllPrivilegesRole() throws InterruptedException {
359+
@Override
360+
protected void testCreateAllPrivilegesRole() {
355361
// TODO
356362
}
357363

358364
@Test
359-
void testDeleteAndRecreateRole() throws InterruptedException {
365+
@Override
366+
protected void testDeleteAndRecreateRole() {
360367
// TODO
361368
}
362369

363370
@Test
364-
void testDeleteAndRecreateMetadataObject() throws InterruptedException {
371+
@Override
372+
protected void testDeleteAndRecreateMetadataObject() {
365373
// TODO
366374
}
367375

368376
@Test
369-
void testRenameMetadataObject() throws InterruptedException {
377+
@Override
378+
protected void testRenameMetadataObject() {
370379
// TODO
371380
}
372381

373382
@Test
374-
void testRenameMetadataObjectPrivilege() throws InterruptedException {
383+
@Override
384+
protected void testRenameMetadataObjectPrivilege() {
375385
// TODO
376386
}
377387

378388
@Test
379-
void testChangeOwner() throws InterruptedException {
389+
@Override
390+
protected void testChangeOwner() {
380391
// TODO
381392
}
382393

383394
@Test
384-
void testDenyPrivileges() throws InterruptedException {
395+
@Override
396+
protected void testDenyPrivileges() {
385397
// TODO
386398
}
387399

388400
@Test
389-
void testGrantPrivilegesForMetalake() throws InterruptedException {
401+
@Override
402+
protected void testGrantPrivilegesForMetalake() {
390403
// TODO
391404
}
392405

‎authorizations/authorization-ranger/src/test/java/org/apache/gravitino/authorization/ranger/integration/test/RangerBaseE2EIT.java‎

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ void checkCreateTable() {
279279
}
280280

281281
@Test
282-
void testCreateTable() {
282+
protected void testCreateTable() {
283283
// Choose a catalog
284284
reset();
285285

@@ -345,7 +345,7 @@ void checkCreateTable() {
345345
}
346346

347347
@Test
348-
void testSelectModifyTableWithMetalakeLevelRole() {
348+
protected void testSelectModifyTableWithMetalakeLevelRole() {
349349
// Choose a catalog
350350
reset();
351351

@@ -430,7 +430,7 @@ protected abstract static class TestSelectModifyTableChecker {
430430
}
431431

432432
@Test
433-
void testSelectModifyTableWithTableLevelRole() {
433+
protected void testSelectModifyTableWithTableLevelRole() {
434434
// Choose a catalog
435435
reset();
436436

@@ -496,7 +496,7 @@ void testSelectModifyTableWithTableLevelRole() {
496496
}
497497

498498
@Test
499-
void testSelectOnlyTable() {
499+
protected void testSelectOnlyTable() {
500500
// Choose a catalog
501501
reset();
502502

@@ -603,7 +603,7 @@ protected abstract static class TestSelectOnlyTableChecker {
603603
}
604604

605605
@Test
606-
void testModifyOnlyTable() {
606+
protected void testModifyOnlyTable() {
607607
// Choose a catalog
608608
reset();
609609

@@ -686,7 +686,7 @@ protected abstract static class TestModifyOnlyTableChecker {
686686
}
687687

688688
@Test
689-
void testCreateAllPrivilegesRole() {
689+
protected void testCreateAllPrivilegesRole() {
690690
// Choose a catalog
691691
reset();
692692

@@ -735,7 +735,7 @@ void testCreateAllPrivilegesRole() {
735735
}
736736

737737
@Test
738-
void testDeleteAndRecreateRole() {
738+
protected void testDeleteAndRecreateRole() {
739739
// Choose a catalog
740740
reset();
741741

@@ -801,7 +801,7 @@ void checkCreateSchema() {
801801
}
802802

803803
@Test
804-
void testDeleteAndRecreateMetadataObject() {
804+
protected void testDeleteAndRecreateMetadataObject() {
805805
// Choose a catalog
806806
reset();
807807

@@ -872,7 +872,7 @@ void checkRecreateSchema() {
872872
}
873873

874874
@Test
875-
void testRenameMetadataObject() {
875+
protected void testRenameMetadataObject() {
876876
// Choose a catalog
877877
reset();
878878

@@ -910,7 +910,7 @@ void testRenameMetadataObject() {
910910
}
911911

912912
@Test
913-
void testRenameMetadataObjectPrivilege() {
913+
protected void testRenameMetadataObjectPrivilege() {
914914
// Choose a catalog
915915
reset();
916916

@@ -959,7 +959,7 @@ void testRenameMetadataObjectPrivilege() {
959959
}
960960

961961
@Test
962-
void testChangeOwner() {
962+
protected void testChangeOwner() {
963963
// Choose a catalog
964964
reset();
965965

@@ -1183,7 +1183,7 @@ void checkShowSchemasAgain() {
11831183
}
11841184
}
11851185

1186-
void testDenyPrivileges() {
1186+
protected void testDenyPrivileges() {
11871187
// Choose a catalog
11881188
reset();
11891189

@@ -1248,7 +1248,7 @@ void testDenyPrivileges() {
12481248

12491249
// ISSUE-5892 Fix to grant privilege for the metalake
12501250
@Test
1251-
void testGrantPrivilegesForMetalake() {
1251+
protected void testGrantPrivilegesForMetalake() {
12521252
// Choose a catalog
12531253
reset();
12541254

‎build.gradle.kts‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,7 @@ fun excludePackagesForSparkConnector(project: Project) {
583583
}
584584

585585
val commonsBeanutilsVersion: String = libs.versions.commons.beanutils.get()
586+
val checkstyleVersion: String = libs.versions.checkstyle.get()
586587

587588
subprojects {
588589
// Gravitino Python client project didn't need to apply the java plugin
@@ -613,6 +614,17 @@ subprojects {
613614
exclude(group = "log4j", module = "log4j")
614615
}
615616

617+
// Checkstyle carries only the import bans Spotless cannot express, such as JUnit 4.
618+
apply(plugin = "checkstyle")
619+
configure<CheckstyleExtension> {
620+
toolVersion = checkstyleVersion
621+
configFile = rootProject.file("config/checkstyle/checkstyle.xml")
622+
maxWarnings = 0
623+
}
624+
// The import bans need no type information; an empty classpath keeps checkstyle from building
625+
// other modules' test jars.
626+
tasks.withType<Checkstyle>().configureEach { classpath = files() }
627+
616628
repositories {
617629
mavenCentral()
618630
mavenLocal()

‎catalogs-contrib/catalog-jdbc-hologres/src/test/java/org/apache/gravitino/catalog/hologres/integration/test/CatalogHologresIT.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import java.util.Map;
2828
import java.util.Set;
2929
import java.util.stream.Collectors;
30+
import org.apache.commons.lang3.StringUtils;
3031
import org.apache.gravitino.Catalog;
3132
import org.apache.gravitino.NameIdentifier;
3233
import org.apache.gravitino.Namespace;
@@ -63,7 +64,6 @@
6364
import org.junit.jupiter.api.TestInstance.Lifecycle;
6465
import org.junit.jupiter.api.condition.EnabledIf;
6566
import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable;
66-
import org.junit.platform.commons.util.StringUtils;
6767
import org.slf4j.Logger;
6868
import org.slf4j.LoggerFactory;
6969

‎catalogs/catalog-fileset/src/test/java/org/apache/gravitino/catalog/fileset/integration/test/FilesetABSCatalogIT.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import java.io.IOException;
2626
import java.net.URI;
2727
import java.util.Map;
28+
import org.apache.commons.lang3.StringUtils;
2829
import org.apache.gravitino.Catalog;
2930
import org.apache.gravitino.NameIdentifier;
3031
import org.apache.gravitino.Schema;
@@ -39,7 +40,6 @@
3940
import org.junit.jupiter.api.BeforeAll;
4041
import org.junit.jupiter.api.Test;
4142
import org.junit.jupiter.api.condition.EnabledIf;
42-
import org.junit.platform.commons.util.StringUtils;
4343

4444
@EnabledIf("absIsConfigured")
4545
public class FilesetABSCatalogIT extends FilesetCatalogIT {

‎catalogs/catalog-fileset/src/test/java/org/apache/gravitino/catalog/fileset/integration/test/FilesetCOSCatalogIT.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import java.io.IOException;
2727
import java.net.URI;
2828
import java.util.Map;
29+
import org.apache.commons.lang3.StringUtils;
2930
import org.apache.gravitino.Catalog;
3031
import org.apache.gravitino.NameIdentifier;
3132
import org.apache.gravitino.Schema;
@@ -40,7 +41,6 @@
4041
import org.junit.jupiter.api.BeforeAll;
4142
import org.junit.jupiter.api.Test;
4243
import org.junit.jupiter.api.condition.EnabledIf;
43-
import org.junit.platform.commons.util.StringUtils;
4444

4545
/**
4646
* Integration test for the fileset catalog backed by Tencent Cloud COS. It is disabled unless the

‎catalogs/catalog-fileset/src/test/java/org/apache/gravitino/catalog/fileset/integration/test/FilesetOSSCatalogIT.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import java.io.IOException;
2727
import java.net.URI;
2828
import java.util.Map;
29+
import org.apache.commons.lang3.StringUtils;
2930
import org.apache.gravitino.Catalog;
3031
import org.apache.gravitino.NameIdentifier;
3132
import org.apache.gravitino.Schema;
@@ -40,7 +41,6 @@
4041
import org.junit.jupiter.api.BeforeAll;
4142
import org.junit.jupiter.api.Test;
4243
import org.junit.jupiter.api.condition.EnabledIf;
43-
import org.junit.platform.commons.util.StringUtils;
4444
import org.slf4j.Logger;
4545
import org.slf4j.LoggerFactory;
4646

‎catalogs/catalog-jdbc-common/build.gradle.kts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ dependencies {
6868
testImplementation(libs.mockito.core)
6969
testImplementation(libs.sqlite.jdbc)
7070
testImplementation(libs.testcontainers)
71+
testImplementation(libs.testcontainers.jdbc)
7172
testImplementation(libs.testcontainers.mysql)
7273
testImplementation(libs.testcontainers.postgresql)
7374

‎catalogs/catalog-jdbc-doris/src/test/java/org/apache/gravitino/catalog/doris/operation/TestDorisTableOperations.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
*/
1919
package org.apache.gravitino.catalog.doris.operation;
2020

21-
import static org.junit.Assert.assertEquals;
22-
import static org.junit.Assert.assertTrue;
21+
import static org.junit.jupiter.api.Assertions.assertEquals;
22+
import static org.junit.jupiter.api.Assertions.assertTrue;
2323

2424
import com.google.common.collect.Maps;
2525
import java.sql.Connection;

‎catalogs/catalog-jdbc-doris/src/test/java/org/apache/gravitino/catalog/doris/operation/TestDorisTablePartitionOperations.java‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@
1818
*/
1919
package org.apache.gravitino.catalog.doris.operation;
2020

21-
import static org.junit.Assert.assertEquals;
22-
import static org.junit.Assert.assertFalse;
23-
import static org.junit.Assert.assertThrows;
24-
import static org.junit.Assert.assertTrue;
21+
import static org.junit.jupiter.api.Assertions.assertEquals;
22+
import static org.junit.jupiter.api.Assertions.assertFalse;
23+
import static org.junit.jupiter.api.Assertions.assertThrows;
24+
import static org.junit.jupiter.api.Assertions.assertTrue;
2525

2626
import com.google.common.collect.ImmutableMap;
2727
import java.sql.Connection;

0 commit comments

Comments
 (0)