Skip to content

Commit

Permalink
exclude log4j
Browse files Browse the repository at this point in the history
  • Loading branch information
xunliu committed Sep 18, 2024
1 parent 905f8f9 commit dba750d
Show file tree
Hide file tree
Showing 8 changed files with 89 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,8 @@ void testAllowUseSchemaPrivilege() throws InterruptedException {
UserEntity.builder()
.withId(1L)
.withName(userName1)
.withRoles(Collections.emptyList())
.withRoleNames(Collections.emptyList())
.withRoleIds(Collections.emptyList())
.withAuditInfo(auditInfo)
.build();
Assertions.assertTrue(
Expand Down
1 change: 0 additions & 1 deletion integration-test-common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ dependencies {
}
testImplementation(platform("org.junit:junit-bom:5.9.1"))
testImplementation("org.junit.jupiter:junit-jupiter")
testImplementation(libs.bundles.jetty)
testImplementation(libs.bundles.jersey)
}

Expand Down
8 changes: 8 additions & 0 deletions server-common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,17 @@ dependencies {
testRuntimeOnly(libs.junit.jupiter.engine)
}

tasks.register<Jar>("testJar") {
archiveClassifier.set("tests")
from(sourceSets["test"].output)
}

tasks {
test {
environment("GRAVITINO_HOME", rootDir.path)
environment("GRAVITINO_TEST", "true")
}
build {
dependsOn("testJar")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,19 @@ private void initializeWebAppServletContextHandler() {
* shadow mode. This causes Gravitino to fail to start. Similarly, this approach is supported
* for the future provision of individual miniGravitino modules.
*/
((WebAppContext) servletContextHandler).setDefaultsDescriptor(null);
String webXmlPath =
String.join(
File.separator,
System.getenv("GRAVITINO_ROOT_DIR"),
"server-common",
"build",
"resources",
"test",
"web.xml");
File xmlFile = new File(webXmlPath);
if (xmlFile.exists() && xmlFile.isFile()) {
((WebAppContext) servletContextHandler).setDefaultsDescriptor(webXmlPath);
}
}

// If in development/test mode, you can set `war` file or `web/dist` directory in the
Expand Down
34 changes: 34 additions & 0 deletions server-common/src/test/resources/web.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
~ Licensed to the Apache Software Foundation (ASF) under one or more
~ contributor license agreements. See the NOTICE file distributed with
~ this work for additional information regarding copyright ownership.
~ The ASF licenses this file to You under the Apache License, Version 2.0
~ (the "License"); you may not use this file except in compliance with
~ the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->

<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
<context-param>
<param-name>configuration</param-name>
<param-value>deployment</param-value>
</context-param>

<session-config>
<cookie-config>
<http-only>true</http-only>
<secure>true</secure>
</cookie-config>
</session-config>
</web-app>
24 changes: 18 additions & 6 deletions spark-connector/spark-common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,24 @@ dependencies {
testCompileOnly(libs.lombok)

// use log from spark, spark3.3 use low version of log4j, to avoid java.lang.NoSuchMethodError: org.apache.logging.slf4j.Log4jLoggerFactory: method <init>()V not found
testImplementation(project(":api"))
testImplementation(project(":clients:client-java"))
testImplementation(project(":core"))
testImplementation(project(":common"))
testImplementation(project(":server"))
testImplementation(project(":server-common"))
testImplementation(project(":api")) {
exclude("org.apache.logging.log4j")
}
testImplementation(project(":clients:client-java")) {
exclude("org.apache.logging.log4j")
}
testImplementation(project(":core")) {
exclude("org.apache.logging.log4j")
}
testImplementation(project(":common")) {
exclude("org.apache.logging.log4j")
}
testImplementation(project(":server")) {
exclude("org.apache.logging.log4j")
}
testImplementation(project(":server-common")) {
exclude("org.apache.logging.log4j")
}
testImplementation(project(":integration-test-common", "testArtifacts"))

testImplementation(libs.hive2.common) {
Expand Down
5 changes: 4 additions & 1 deletion spark-connector/v3.3/spark/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ dependencies {
exclude("org.apache.logging.log4j")
exclude("org.slf4j")
}
testImplementation(project(":integration-test-common", "testArtifacts"))
testImplementation(project(":integration-test-common", "testArtifacts")) {
exclude("org.apache.logging.log4j")
exclude("org.slf4j")
}
testImplementation(project(":server")) {
exclude("org.apache.logging.log4j")
exclude("org.slf4j")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@
// AbstractWebIT provides a WebDriver instance for WEB UI tests.
public class AbstractWebIT extends AbstractIT {
protected static final Logger LOG = LoggerFactory.getLogger(AbstractWebIT.class);
protected static WebDriver driver;
protected static volatile WebDriver driver = null;

// https://www.selenium.dev/documentation/webdriver/waits/#implicit-waits
protected static final long MAX_IMPLICIT_WAIT = 30;
protected static final long MAX_TIMEOUT = 20;
protected static final long MAX_TIMEOUT = 30;
protected static final long EACH_TEST_SLEEP_MILLIS = 1_000;
protected static final long ACTION_SLEEP_MILLIS = 1_000;

Expand Down Expand Up @@ -114,6 +114,14 @@ public void beforeEachTest() {

@BeforeAll
public static void startUp() {
if (driver == null) {
synchronized (AbstractWebIT.class) {
if (driver == null) {
driver = WebDriverManager.getWebDriver(getGravitinoServerPort());
}
}
}

driver = WebDriverManager.getWebDriver(getGravitinoServerPort());
}

Expand Down

0 comments on commit dba750d

Please sign in to comment.