Skip to content

Commit

Permalink
feat(java17): Compile using java 17 (#2797)
Browse files Browse the repository at this point in the history
* feat(java17): Compile using java 17

* [SpotlessApply] Squash me

---------

Co-authored-by: Bonita CI <[email protected]>
  • Loading branch information
rbioteau and bonita-ci authored Nov 22, 2023
1 parent cd4e1cd commit aee7bff
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,9 @@ private GroovyClassLoader createPageClassloader(final String pageName, final Fil
GroovyClassLoader pageClassLoader = new GroovyClassLoader(getParentClassloader(pageName,
new CustomPageDependenciesResolver(pageName, pageDirectory, getWebBonitaConstantsUtils()),
bdmDependenciesResolver));
pageClassLoader.addClasspath(pageDirectory.getPath());
if (pageDirectory.exists()) {
pageClassLoader.addClasspath(pageDirectory.getPath());
}
return pageClassLoader;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@
package org.bonitasoft.console.common.server.page;

import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.inOrder;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import static org.mockito.Mockito.*;

import java.io.File;
import java.io.InputStream;
Expand All @@ -28,7 +25,6 @@
import java.util.List;
import java.util.Map;

import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
Expand Down Expand Up @@ -56,13 +52,6 @@ public void setUp() throws Exception {
when(customPageDependenciesResolver.getTempFolder()).thenReturn(tmpRule.newFolder());
}

@After
public void tearDown() throws Exception {
if (classLoader != null) {
classLoader.close();
}
}

@Test
public void should_add_custom_page_jar_resources_in_classloader_urls() throws Exception {
classLoader = newClassloader();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,7 @@ public void should_ensure_page_is_up_to_date_with_empty_folder() throws Exceptio
File pageDirectory = spy(new File("target/bonita/home/client/tenants/1/pages/page2"));
doReturn(new String[0]).when(pageDirectory).list();
doReturn(true).when(pageDirectory).exists();
doReturn("target/bonita/home/client/tenants/1/pages/page2").when(pageDirectory).getPath();
initializePageMocks(pageDirectory);
doNothing().when(customPageService).removePage(pageResourceProvider, true);
doNothing().when(customPageService).retrievePageZipContent(apiSession, pageResourceProvider);
Expand Down
8 changes: 4 additions & 4 deletions buildSrc/src/main/groovy/Deps.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Deps {
public static String commonsDbcp2Version = "2.5.0"
public static String commonsCLIVersion = "1.4"
public static String semver4jVersion = '3.1.0'
public static String slf4jVersion = "1.7.30"
public static String slf4jVersion = "1.7.36"
public static String h2Version = "1.4.199"
public static String hibernateVersion = "5.4.32.Final"
public static String jacksonBomVersion = "2.15.3"
Expand All @@ -39,11 +39,11 @@ class Deps {
public static String mssqlVersion = "8.4.1.jre8"
public static String oracleVersion = "19.3.0.0"
public static String postgresqlVersion = "42.4.3"
public static String lombokVersion = "1.18.24"
public static String lombokVersion = "1.18.30"

public static String narayanaVersion = "5.10.6.Final"
public static String jaxbVersion = "2.3.1"
public static String logbackVersion = "1.2.11"
public static String logbackVersion = "1.2.12"
public static String javaxAnnotationsVersion = "1.3.2"

// extensions versions
Expand Down Expand Up @@ -81,7 +81,7 @@ class Deps {
public static String systemRulesVersion = "1.19.0"
public static String systemLambdaVersion = "1.2.0"
public static String concurrentUnitVersion = "0.4.6"
public static String junitQuickCheck = "0.9.1"
public static String junitQuickCheck = "1.0"
public static String jettyVersion = "9.4.9.v20180320"
public static String jbossLoggingVersion = "3.1.3.GA"
public static String commonsExecVersion = "1.3"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ class DockerDatabaseContainerTasksCreator {
group = "Verification"
description = "Runs slow integration test suite on $vendor.name database."
systemProperty "bonita.version", project.version
jvmArgs += ['--add-opens','java.base/java.util=ALL-UNNAMED','--add-opens','java.base/java.lang=ALL-UNNAMED','-Dfile.encoding=UTF-8']
classpath += project.files(project.configurations.drivers)

doFirst {
Expand Down
5 changes: 4 additions & 1 deletion common.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ subprojects {

java {
toolchain {
languageVersion = JavaLanguageVersion.of(11)
languageVersion = JavaLanguageVersion.of(17)
}
}
configurations.configureEach {
Expand All @@ -73,6 +73,9 @@ subprojects {
options.encoding = 'UTF-8'
options.fork = true
}
tasks.named('test') {
jvmArgs += ['--add-opens','java.base/java.util=ALL-UNNAMED','--add-opens','java.base/java.lang=ALL-UNNAMED','-Dfile.encoding=UTF-8']
}
tasks.withType(Javadoc).configureEach {
options.addStringOption('Xdoclint:none', '-quiet')
options.encoding = 'UTF-8'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,9 @@

import javax.sql.DataSource;

import lombok.extern.slf4j.Slf4j;
import org.bonitasoft.platform.exception.PlatformException;
import org.bonitasoft.platform.version.VersionService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
Expand All @@ -45,6 +44,7 @@
/**
* @author Emmanuel Duchastenier
*/
@Slf4j
@Component
@PropertySource("classpath:/application.properties")
public class ScriptExecutor {
Expand All @@ -53,8 +53,6 @@ public class ScriptExecutor {

public static final boolean FAIL_ON_ERROR = false;

private final Logger logger = LoggerFactory.getLogger(ScriptExecutor.class);

private final String sqlFolder;

private final DataSource datasource;
Expand All @@ -71,7 +69,7 @@ public ScriptExecutor(@Value("${db.vendor}") String dbVendor, DataSource datasou
}
this.dbVendor = dbVendor;
this.datasource = datasource;
logger.info("configuration for Database vendor: " + dbVendor);
log.info("configuration for Database vendor: " + dbVendor);
this.sqlFolder = "/sql/" + dbVendor;
this.versionService = versionService;
}
Expand All @@ -98,7 +96,7 @@ public void createAndInitializePlatformIfNecessary() throws PlatformException {
insertPlatform();
insertTenant();
} else {
logger.info("Bonita platform already exists. Nothing to do. Stopping.");
log.info("Bonita platform already exists. Nothing to do. Stopping.");
}
}

Expand Down Expand Up @@ -161,7 +159,7 @@ private Resource getResourceFromFileSystem(String setupFolderPath, String sqlFil
return new FileSystemResource(file);
} else {
final String msg = "SQL resource file not found in filesystem: " + file.getAbsolutePath();
logger.error(msg);
log.error(msg);
throw new RuntimeException(msg);
}
}
Expand All @@ -173,7 +171,7 @@ private Resource getResourceFromClassPath(String sqlFolder, String sqlFile) {
return new UrlResource(url);
} else {
final String msg = "SQL resource file not found in classpath: " + resourcePath;
logger.warn(msg);
log.warn(msg);
throw new RuntimeException(msg);
}
}
Expand All @@ -191,7 +189,7 @@ protected void executeSQLResource(final String sqlFile, boolean shouldContinueOn
populate.addScript(sqlResource);
populate.setSeparator(getSeparator());
populate.execute(datasource);
logger.info("Executed SQL script " + sqlResource.getURL().getFile());
log.info("Executed SQL script " + sqlResource.getURL().getFile());
}

private String getSeparator() {
Expand Down

0 comments on commit aee7bff

Please sign in to comment.