diff --git a/build.gradle b/build.gradle index 185260365..f72dc3020 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,5 @@ import org.gradle.internal.os.OperatingSystem +import java.util.concurrent.TimeUnit buildscript { repositories { @@ -14,7 +15,7 @@ buildscript { plugins { id 'org.springframework.boot' version "${spring_boot_version}" id "com.moowork.node" version "1.2.0" - id "io.spring.dependency-management" version "1.0.7.RELEASE" + id "io.spring.dependency-management" version "1.0.10.RELEASE" id 'de.undercouch.download' version '4.1.1' apply false id "io.github.gradle-nexus.publish-plugin" version "1.0.0" } @@ -174,7 +175,7 @@ dependencies { implementation group: 'com.google.code.findbugs', name: 'jsr305', version: findbugAnnotationVersion implementation "org.hibernate:hibernate-envers:${hibernate_version}" implementation "org.hibernate:hibernate-validator:6.2.0.Final" - implementation("org.liquibase:liquibase-core") + implementation("org.liquibase:liquibase-core:${liquibase_version}") implementation "com.mattbertolini:liquibase-slf4j:${liquibase_slf4j_version}" implementation "org.springframework.boot:spring-boot-actuator" implementation "org.springframework.boot:spring-boot-autoconfigure" @@ -186,7 +187,7 @@ dependencies { exclude group: 'org.hibernate', module: 'hibernate-entitymanager' } implementation "org.springframework.boot:spring-boot-starter-security" - implementation("org.springframework.cloud:spring-cloud-starter-netflix-zuul:${zuul_proxy_version}") + implementation("org.springframework.cloud:spring-cloud-starter-netflix-zuul") implementation "org.springframework.cloud:spring-cloud-context" implementation "org.springframework.cloud:spring-cloud-commons" implementation("org.springframework.boot:spring-boot-starter-web") { @@ -203,6 +204,7 @@ dependencies { } implementation "org.springframework.security:spring-security-jwt:${spring_security_jwt_versions}" implementation "org.springframework.security.oauth:spring-security-oauth2:${spring_security_oauth2_version}" + implementation "org.springframework.security.oauth.boot:spring-security-oauth2-autoconfigure:${spring_security_oauth2_version}" implementation("io.springfox:springfox-swagger2:${springfox_version}") { exclude module: 'mapstruct' } @@ -231,6 +233,12 @@ dependencies { annotationProcessor group: 'org.springframework.boot', name: 'spring-boot-configuration-processor' } +dependencyManagement { + imports { + mavenBom "org.springframework.cloud:spring-cloud-dependencies:Hoxton.SR9" + } +} + clean { delete "target" } @@ -286,3 +294,46 @@ nexusPublishing { } } } + +class TimingsListener implements TaskExecutionListener, BuildListener { + private long startTime + private timings = [] + + @Override + void beforeExecute(Task task) { + startTime = System.nanoTime() + } + + @Override + void afterExecute(Task task, TaskState taskState) { + def ms = TimeUnit.MILLISECONDS.convert(System.nanoTime() - startTime, TimeUnit.NANOSECONDS); + timings.add([ms, task.path]) + task.project.logger.warn "${task.path} took ${ms}ms" + } + + @Override + void buildFinished(BuildResult result) { + println "Task timings:" + for (timing in timings) { + if (timing[0] >= 50) { + printf "%7sms %s\n", timing + } + } + } + + @Override + void buildStarted(Gradle gradle) {} + + @Override + void projectsEvaluated(Gradle gradle) {} + + @Override + void projectsLoaded(Gradle gradle) {} + + @Override + void settingsEvaluated(Settings settings) {} +} +if (project.hasProperty('dev')) { + gradle.addListener new TimingsListener() +} + diff --git a/gradle.properties b/gradle.properties index b18d1adc6..bc7e97448 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,24 +12,23 @@ json_path_version=0.9.1 jhipster_server_version=1.1.2 hazelcast_hibernate52_version=1.2 hibernate_version=5.2.12.Final -hikaricp_version=2.7.4 -liquibase_slf4j_version=2.0.0 -liquibase_hibernate5_version=3.6 +hikaricp_version=3.4.5 +liquibase_slf4j_version=4.0.0 +liquibase_version=4.3.0 metrics_spring_version=3.1.3 node_version=6.10.0 npm_version=4.3.0 prometheus_simpleclient_version=0.0.20 postgresql_version=42.2.14 -spring_security_jwt_versions=1.0.9.RELEASE -spring_security_oauth2_version=2.3.5.RELEASE +spring_security_jwt_versions=1.1.1.RELEASE +spring_security_oauth2_version=2.3.8.RELEASE springfox_version=2.6.1 -spring_boot_version=2.3.10.RELEASE +spring_boot_version=2.3.7.RELEASE gatling_version=3.3.1 mapstruct_version=1.1.0.Final undertow_version=1.4.10.Final yarn_version=0.21.3 -zuul_proxy_version=2.2.8.RELEASE -spring_data_envers_version=2.3.9.RELEASE +spring_data_envers_version=2.0.4.RELEASE jackson_version=2.9.10 jackson_dataformat_version=2.9.10 javaxXmlBindVersion=2.3.3 diff --git a/gradle/liquibase.gradle b/gradle/liquibase.gradle index 0dcdd76db..777795037 100644 --- a/gradle/liquibase.gradle +++ b/gradle/liquibase.gradle @@ -5,7 +5,7 @@ configurations { } dependencies { - liquibase "org.liquibase.ext:liquibase-hibernate5:${liquibase_hibernate5_version}" + liquibase "org.liquibase.ext:liquibase-hibernate5:${liquibase_version}" } if (OperatingSystem.current().isWindows()) { diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 4d9ca1649..aca8dc15c 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,3 +3,5 @@ distributionPath=wrapper/dists distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists +org.gradle.caching=true +org.gradle.parallel=true diff --git a/oauth-client-util/src/main/java/org/radarbase/oauth/OAuth2AccessTokenDetails.java b/oauth-client-util/src/main/java/org/radarbase/oauth/OAuth2AccessTokenDetails.java index 43ae14e0a..b2fbe83c6 100644 --- a/oauth-client-util/src/main/java/org/radarbase/oauth/OAuth2AccessTokenDetails.java +++ b/oauth-client-util/src/main/java/org/radarbase/oauth/OAuth2AccessTokenDetails.java @@ -26,7 +26,7 @@ /** * This class captures the response from ManagementPortal's /oauth/token endpoint. The actual access * token can be retrieved with the {@link #getAccessToken()} method. This is a token in JWT format, - * and can be parsed with a JWT library of your preference. You can ise {@link #isValid()} to check + * and can be parsed with a JWT library of your preference. You can use {@link #isValid()} to check * if you got a valid token, or an error response. If {@link #isValid()} returns false, * you can use {@link #getError()} and {@link #getErrorDescription()} to find the error message * that was returned by ManagementPortal. You can also use {@link #isExpired()} to find out if the diff --git a/src/main/docker/postgresql.yml b/src/main/docker/postgresql.yml index 3c0bfb779..e653c678e 100644 --- a/src/main/docker/postgresql.yml +++ b/src/main/docker/postgresql.yml @@ -6,3 +6,5 @@ services: - POSTGRES_USER=radarbase - POSTGRES_PASSWORD=radarbase - POSTGRES_DB=managementportal + ports: + - 5432:5432 diff --git a/src/main/resources/config/application-dev.yml b/src/main/resources/config/application-dev.yml index 05f3cd57d..d4ee15d09 100644 --- a/src/main/resources/config/application-dev.yml +++ b/src/main/resources/config/application-dev.yml @@ -26,19 +26,21 @@ spring: serialization.indent_output: true datasource: type: com.zaxxer.hikari.HikariDataSource - url: jdbc:h2:mem:managementportal;DB_CLOSE_DELAY=-1 -# driverClassName: org.postgresql.Driver -# url: jdbc:postgresql://localhost:5432/managementportal - username: ManagementPortal - password: +# url: jdbc:h2:mem:managementportal;DB_CLOSE_DELAY=-1 + driverClassName: org.postgresql.Driver + url: jdbc:postgresql://localhost:5432/managementportal +# username: ManagementPortal +# password: + username: radarbase + password: radarbase h2: console: enabled: false jpa: - database-platform: io.github.jhipster.domain.util.FixedH2Dialect -# database-platform: org.hibernate.dialect.PostgreSQLDialect - database: H2 -# database: POSTGRESQL +# database-platform: org.hibernate.dialect.H2Dialect + database-platform: org.hibernate.dialect.PostgreSQLDialect +# database: H2 + database: POSTGRESQL show-sql: true properties: hibernate.id.new_generator_mappings: true @@ -49,6 +51,7 @@ spring: hibernate.cache.hazelcast.instance_name: ManagementPortal hibernate.cache.use_minimal_puts: true hibernate.cache.hazelcast.use_lite_member: true + hibernate.ddl-auto: none mail: host: # for hotmail port: diff --git a/src/main/resources/config/application.yml b/src/main/resources/config/application.yml index 51d46d8f9..861018dc0 100644 --- a/src/main/resources/config/application.yml +++ b/src/main/resources/config/application.yml @@ -77,6 +77,10 @@ spring: audit_strategy_validity_store_revend_timestamp: true global_with_modified_flag: true track_entities_changed_in_revision: true + hibernate: + jdbc: + lob: + non_contextual_creation: true messages: basename: i18n/messages mvc: diff --git a/src/test/bash/run-prod-e2e.sh b/src/test/bash/run-prod-e2e.sh index e10e18f5b..c44db9592 100755 --- a/src/test/bash/run-prod-e2e.sh +++ b/src/test/bash/run-prod-e2e.sh @@ -14,8 +14,11 @@ set -e echo "Running production e2e tests" cp src/test/resources/config/keystore.p12 src/main/docker/etc/config cp src/test/resources/config/keystore.p12 src/main/resources/config -sed -i .bak "s|contexts: prod|contexts: dev|" src/main/resources/config/application-prod.yml # set liquibase context to dev so it loads demo data and back the original at src/main/resources/config/application-prod.yml.bak + +# set liquibase context to dev so it loads demo data +sed -i "" "s|contexts: prod|contexts: dev|" src/main/resources/config/application-prod.yml ./gradlew -Pprod buildDocker -x test -x javadocJar +# recover the prod liquibase context git checkout src/main/resources/config/application-prod.yml docker-compose -f src/main/docker/app.yml up -d # spin up production mode application