Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/release-10.2.0' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
akantcheff committed Sep 24, 2024
2 parents 5811d6b + 70c424c commit ac2c38c
Show file tree
Hide file tree
Showing 34 changed files with 343 additions and 494 deletions.
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ commonsBeanutilsVersion = "1.9.4"
commonsCollectionsVersion = "4.4"
tomcatVersion = "9.0.95"
commonsCLIVersion = "1.9.0"
commonsTextVersion = "1.10.0"
semver4jVersion = '3.1.0'
slf4jVersion = "1.7.36"
# Attention, see PassingPropertiesJCacheRegionFactory javadoc if this version changes:
Expand Down Expand Up @@ -105,6 +106,7 @@ commonsBeanUtils = { group = "commons-beanutils", name = "commons-beanutils", ve
commonsCollections = { group = "org.apache.commons", name = "commons-collections4", version.ref = "commonsCollectionsVersion" }
tomcatDbcp = { group = "org.apache.tomcat", name = "tomcat-dbcp", version.ref = "tomcatVersion" }
commonsCLI = { group = "commons-cli", name = "commons-cli", version.ref = "commonsCLIVersion" }
commonsText = { group = "org.apache.commons", name = "commons-text", version.ref = "commonsTextVersion" }
semver4j = { group = "com.vdurmont", name = "semver4j", version.ref = "semver4jVersion" }
slf4jApi = { group = "org.slf4j", name = "slf4j-api", version.ref = "slf4jVersion" }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ protected String getInformationInitialValue() {
}
}

private void insertTenant() {
protected void insertTenant() {
final String sql = "INSERT INTO tenant (id, created, createdBy, description, defaultTenant, name, status) " +
"VALUES (?, ?, ?, ?, ?, ?, ?)";

Expand Down
35 changes: 11 additions & 24 deletions platform/platform-setup/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,33 +12,24 @@ configurations {
}

dependencies {
api "org.apache.commons:commons-text:1.10.0"
api project(':platform:platform-resources')
api libs.commonsText
api libs.slf4jApi
api(libs.springBootStarter) {
exclude(module: 'jul-to-slf4j')
exclude(module: 'log4j-to-slf4j')
exclude(module: 'snakeyaml')
}
api libs.springBootStarterJdbc
api(libs.postgresql)
api(libs.mysql) {
exclude(module: 'protobuf-java')
}
api libs.msSqlServer
api(libs.h2)
api(libs.oracle) {
exclude(module: "ons")
exclude(module: "oraclepki")
exclude(module: "osdt_cert")
exclude(module: "osdt_core")
exclude(module: "ucp")
exclude(module: "simplefan")
}
api libs.h2
api libs.postgresql
api libs.commonsCLI

annotationProcessor libs.lombok
compileOnly libs.lombok
api(project(":platform:platform-resources"))
runtimeOnly(libs.logback)

runtimeOnly libs.logback

testImplementation "junit:junit:${Deps.junit4Version}"
testImplementation "org.assertj:assertj-core:${Deps.assertjVersion}"
testImplementation "org.mockito:mockito-core:${Deps.mockitoVersion}"
Expand Down Expand Up @@ -76,6 +67,7 @@ processResources {
}

distTar.enabled = false

distributions {
main {
distributionBaseName = "Bonita-platform-setup"
Expand Down Expand Up @@ -124,21 +116,16 @@ distributions {
}
}


tasks.distZip.dependsOn configurations.inDistrib

artifacts { distributionZip distZip }

test { include '**/*Test.class' }


def iT = tasks.getByName("integrationTest")
iT.configure {
tasks.named("integrationTest").configure {
def testDir = new File(buildDir, "integrationTest")
doFirst {
testDir.mkdirs()
systemProperty "bonita.distribution.path", distZip.outputs.files.first()
}
workingDir testDir
dependsOn distZip
}
tasks.integrationTest.dependsOn distZip
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,16 @@
import java.nio.file.Path;
import java.nio.file.Paths;

import lombok.extern.slf4j.Slf4j;
import org.bonitasoft.platform.exception.PlatformException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* This class contains the logic to determine if we are in the context of an application server that we must configure.
* Only Tomcat is supported.
*
* @author Emmanuel Duchastenier
*/
@Slf4j
class BundleResolver {

private static final Logger LOGGER = LoggerFactory.getLogger(BundleConfigurator.class);

private final Path rootPath;

BundleResolver() {
Expand All @@ -48,7 +44,7 @@ class BundleResolver {
private boolean fileExists(Path filePath) {
final boolean exists = Files.exists(filePath);
if (!exists) {
LOGGER.debug("File " + filePath.toString() + " does not exist.");
log.debug("File {} does not exist.", filePath);
}
return exists;
}
Expand All @@ -71,8 +67,8 @@ BundleConfigurator getConfigurator() throws PlatformException {
if (isTomcatEnvironment()) {
return new TomcatBundleConfigurator(rootPath);
} else {
LOGGER.info(
"No Application Server detected. You may need to manually configure the access to the database. Only Tomcat 8.x is supported");
log.info("No Application Server detected. You may need to manually configure the access to the database. " +
"Only Tomcat 9.0.x is supported");
return null;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,12 @@

import java.util.Properties;

import lombok.extern.slf4j.Slf4j;
import org.bonitasoft.platform.exception.PlatformException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* @author Emmanuel Duchastenier
*/
@Slf4j
public class PropertyReader {

// Use BundleConfigurator logger for easier configuration (no need for a specific logger here):
private static final Logger LOGGER = LoggerFactory.getLogger(BundleConfigurator.class);

private final Properties properties;

public PropertyReader(Properties properties) {
Expand All @@ -37,7 +31,7 @@ public String getPropertyAndFailIfNull(String propertyName) throws PlatformExcep
// Any property value can be overridden by system property with the same name:
final String sysPropValue = System.getProperty(propertyName);
if (sysPropValue != null) {
LOGGER.info("System property '{}' set to '{}', overriding value from file database.properties.",
log.info("System property '{}' set to '{}', overriding value from file database.properties.",
propertyName, sysPropValue);
return sysPropValue.trim();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,14 @@
**/
package org.bonitasoft.platform.setup.dbconfig;

import org.springframework.context.annotation.Profile;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

/**
* This is enough to get a Datasource that spring creates using parameters provided in properties.
*
* @author Emmanuel Duchastenier
* Used by Spring to create an instance of {@link javax.sql.DataSource} using parameters provided in properties.
*/
@Component
@PropertySource(value = { "classpath:/database.properties", "classpath:/internal.properties" })
@Profile("default")
public class GenericDataSourceConfig {
public class DataSourceConfig {

}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
spring.profiles.active=h2
db.vendor=${sysprop.bonita.db.vendor:h2}
2 changes: 1 addition & 1 deletion platform/platform-setup/src/main/standalone/setup.bat
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ IF NOT "%BONITA_DATABASE%" == "h2" IF NOT "%BONITA_DATABASE%" == "postgres" (
exit /b 1
)

"%JAVA_CMD%" -cp "%BASEDIR%;%CFG_FOLDER%;%INITIAL_CFG_FOLDER%;%LIB_FOLDER%\*" -Dspring.profiles.active=default -Dsysprop.bonita.db.vendor=%BONITA_DATABASE% org.bonitasoft.platform.setup.PlatformSetupApplication %*
"%JAVA_CMD%" -cp "%BASEDIR%;%CFG_FOLDER%;%INITIAL_CFG_FOLDER%;%LIB_FOLDER%\*" -Dsysprop.bonita.db.vendor=%BONITA_DATABASE% org.bonitasoft.platform.setup.PlatformSetupApplication %*

if errorlevel 1 (
exit /b 1
Expand Down
2 changes: 1 addition & 1 deletion platform/platform-setup/src/main/standalone/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ if [ "$BONITA_DATABASE" != "h2" ] && [ "$BONITA_DATABASE" != "postgres" ]; then
exit 1
fi

"${JAVA_EXE}" -cp "${BASEDIR}:${CFG_FOLDER}:${INITIAL_CFG_FOLDER}${LIBS_CP}" ${JVM_OPTS} -Dspring.profiles.active=default -Dsysprop.bonita.db.vendor=${BONITA_DATABASE} org.bonitasoft.platform.setup.PlatformSetupApplication "$@"
"${JAVA_EXE}" -cp "${BASEDIR}:${CFG_FOLDER}:${INITIAL_CFG_FOLDER}${LIBS_CP}" ${JVM_OPTS} -Dsysprop.bonita.db.vendor=${BONITA_DATABASE} org.bonitasoft.platform.setup.PlatformSetupApplication "$@"
COD_RET=$?
if [ ${COD_RET} -ne 0 ]; then
cd - 1>/dev/null
Expand Down
Loading

0 comments on commit ac2c38c

Please sign in to comment.