From 25cada6b6470f2ba672beba2196443434c5a7bbd Mon Sep 17 00:00:00 2001 From: cbornet Date: Fri, 19 Apr 2019 15:43:40 +0200 Subject: [PATCH 1/8] Add possibility to also authenticate by Basic auth on monoliths secured by JWT --- .../main/java/package/config/SecurityConfiguration.java.ejs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/generators/server/templates/src/main/java/package/config/SecurityConfiguration.java.ejs b/generators/server/templates/src/main/java/package/config/SecurityConfiguration.java.ejs index 9963ab635883..6e09c0d94ca7 100644 --- a/generators/server/templates/src/main/java/package/config/SecurityConfiguration.java.ejs +++ b/generators/server/templates/src/main/java/package/config/SecurityConfiguration.java.ejs @@ -278,6 +278,10 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter<% if (au .antMatchers("/management/prometheus").permitAll() .antMatchers("/management/**").hasAuthority(AuthoritiesConstants.ADMIN)<%_ if (authenticationType === 'session') { %>;<% } %> <%_ if (authenticationType === 'jwt') { _%> + <%_ if (applicationType === 'monolith') { _%> + .and() + .httpBasic() + <%_ } _%> .and() .apply(securityConfigurerAdapter()); <%_ } else if (authenticationType === 'oauth2') { _%> From 7d6caef13f8efb8d5ef81fa55ea1ed1cf637b5e7 Mon Sep 17 00:00:00 2001 From: George Tavares Date: Tue, 14 May 2019 07:55:33 -0300 Subject: [PATCH 2/8] Fix entities with mongo and elastic mapping, avoinding no associated errors in jest queries --- .../package/config/ElasticsearchConfiguration.java.ejs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/generators/server/templates/src/main/java/package/config/ElasticsearchConfiguration.java.ejs b/generators/server/templates/src/main/java/package/config/ElasticsearchConfiguration.java.ejs index 0ffd86434f4c..617e06b32a49 100644 --- a/generators/server/templates/src/main/java/package/config/ElasticsearchConfiguration.java.ejs +++ b/generators/server/templates/src/main/java/package/config/ElasticsearchConfiguration.java.ejs @@ -64,16 +64,22 @@ public class ElasticsearchConfiguration { @Primary public ElasticsearchOperations elasticsearchTemplate(final JestClient jestClient, final ElasticsearchConverter elasticsearchConverter, + <%_ if (databaseType !== 'mongodb') { _%> final SimpleElasticsearchMappingContext simpleElasticsearchMappingContext, + <%_ } _%> EntityMapper mapper) { + <%_ if (databaseType === 'mongodb') { _%> + CustomElasticsearchMappingContext mappingContext = new CustomElasticsearchMappingContext(); + <%_ } _%> return new JestElasticsearchTemplate( jestClient, <%_ if (databaseType === 'mongodb') { _%> - new MappingElasticsearchConverter(new CustomElasticsearchMappingContext()), + new MappingElasticsearchConverter(mappingContext), + new DefaultJestResultsMapper(mappingContext, mapper)); <%_ } else { _%> elasticsearchConverter, - <%_ } _%> new DefaultJestResultsMapper(simpleElasticsearchMappingContext, mapper)); + <%_ } _%> } public class CustomEntityMapper implements EntityMapper { From dbe72c6f8383cf965588d8f5686cd8c91a3fc027 Mon Sep 17 00:00:00 2001 From: "P. Mohan" Date: Fri, 17 May 2019 23:43:41 +0630 Subject: [PATCH 3/8] Fix syntax error and remove unnecessary variable --- .../config/liquibase/changelog/added_entity.xml.ejs | 2 +- .../src/main/resources/config/liquibase/data/table.csv.ejs | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/generators/entity-server/templates/src/main/resources/config/liquibase/changelog/added_entity.xml.ejs b/generators/entity-server/templates/src/main/resources/config/liquibase/changelog/added_entity.xml.ejs index fb90b27259a9..ecf15cd1c806 100644 --- a/generators/entity-server/templates/src/main/resources/config/liquibase/changelog/added_entity.xml.ejs +++ b/generators/entity-server/templates/src/main/resources/config/liquibase/changelog/added_entity.xml.ejs @@ -178,7 +178,7 @@ loadColumnType = 'string'; } else if (columnType === 'blob' || columnType === 'longblob') { loadColumnType = 'blob'; - } else if (columnType === 'clob') { + } else if (columnType === '${clobType}') { loadColumnType = 'clob'; } _%> diff --git a/generators/entity-server/templates/src/main/resources/config/liquibase/data/table.csv.ejs b/generators/entity-server/templates/src/main/resources/config/liquibase/data/table.csv.ejs index 765ea533c2db..f9b9d299adb5 100644 --- a/generators/entity-server/templates/src/main/resources/config/liquibase/data/table.csv.ejs +++ b/generators/entity-server/templates/src/main/resources/config/liquibase/data/table.csv.ejs @@ -63,7 +63,6 @@ for (lineNb = 1; lineNb <= numberOfRows; lineNb++) { for (idx in fields) { let data = ''; let columnType = fields[idx].columnType; - let fieldType = fields[idx].fieldType; if (columnType === 'integer' || columnType === 'bigint' || columnType === 'double' @@ -135,9 +134,9 @@ for (lineNb = 1; lineNb <= numberOfRows; lineNb++) { data = ''; } } - if (fieldType === 'byte[]' && fields[idx].fieldTypeBlobContent !== 'text') { + if (columnType === 'blob' || columnType === 'longblob') { data = '../data/blob/hipster.png' - } else if (fieldType === 'byte[]' && fields[idx].fieldTypeBlobContent === 'text'){ + } else if (columnType === '${clobType}'){ data = '../data/blob/hipster.txt' } @@ -184,7 +183,7 @@ for (lineNb = 1; lineNb <= numberOfRows; lineNb++) { } line.push(data); - if (fieldType === 'byte[]' && fields[idx].fieldTypeBlobContent !== 'text') { + if (columnType === 'blob' || columnType === 'longblob') { line.push('image/png'); } } From be7a2d4c099dcb0ec1d20a901a82880c35f484f1 Mon Sep 17 00:00:00 2001 From: cbornet Date: Fri, 17 May 2019 22:32:14 +0200 Subject: [PATCH 4/8] Add dev server urls to API-first's OAS --- .../server/templates/src/main/resources/swagger/api.yml.ejs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/generators/server/templates/src/main/resources/swagger/api.yml.ejs b/generators/server/templates/src/main/resources/swagger/api.yml.ejs index 470afed43b7f..a34f03171be6 100644 --- a/generators/server/templates/src/main/resources/swagger/api.yml.ejs +++ b/generators/server/templates/src/main/resources/swagger/api.yml.ejs @@ -22,6 +22,11 @@ openapi: "3.0.1" info: title: "<%= baseName %>" version: 0.0.1 +servers: + - url: http://localhost:<%= serverPort %> + description: Developpement server + - url: https://localhost:<%= serverPort %> + description: Developpement server with TLS Profile paths: {} <% if(authenticationType === 'jwt') { %> components: From c92bd1e89bc4ddde2d1adf2fbcc73a3014ee5a28 Mon Sep 17 00:00:00 2001 From: Pascal Grimaud Date: Sat, 18 May 2019 23:31:27 +0200 Subject: [PATCH 5/8] Add artifact classes needed by jib [ci skip] --- generators/ci-cd/templates/.gitlab-ci.yml.ejs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/generators/ci-cd/templates/.gitlab-ci.yml.ejs b/generators/ci-cd/templates/.gitlab-ci.yml.ejs index 497368474f6e..3b3a273b71a5 100644 --- a/generators/ci-cd/templates/.gitlab-ci.yml.ejs +++ b/generators/ci-cd/templates/.gitlab-ci.yml.ejs @@ -116,6 +116,7 @@ gradle-package: artifacts: paths: - build/libs/*.jar + - build/classes expire_in: 1 day # Uncomment the following line to use gitlabs container registry. You need to adapt the REGISTRY_URL in case you are not using gitlab.com @@ -208,6 +209,7 @@ maven-package: artifacts: paths: - target/*.jar + - target/classes expire_in: 1 day # Uncomment the following line to use gitlabs container registry. You need to adapt the REGISTRY_URL in case you are not using gitlab.com From e47f1536bbbe19f7e0a641b4e8a0f4be9fb6c72d Mon Sep 17 00:00:00 2001 From: Pascal Grimaud Date: Sun, 19 May 2019 10:32:01 +0200 Subject: [PATCH 6/8] Upgrade to jhipster-registry v5.0.1 --- generators/generator-constants.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generators/generator-constants.js b/generators/generator-constants.js index 86b310426591..650767f5b640 100644 --- a/generators/generator-constants.js +++ b/generators/generator-constants.js @@ -18,7 +18,7 @@ */ // version of docker images -const DOCKER_JHIPSTER_REGISTRY = 'jhipster/jhipster-registry:v5.0.0'; +const DOCKER_JHIPSTER_REGISTRY = 'jhipster/jhipster-registry:v5.0.1'; const DOCKER_JAVA_JRE = 'adoptopenjdk/openjdk11:alpine-jre'; const DOCKER_MYSQL = 'mysql:8.0.16'; const DOCKER_MARIADB = 'mariadb:10.4.4'; From 0bfde57e573ea453e21426de54fe70f91ca1708c Mon Sep 17 00:00:00 2001 From: Frederik Hahne Date: Sun, 19 May 2019 21:02:26 +0200 Subject: [PATCH 7/8] generate jacoco report for all test tasks --- generators/server/templates/gradle/sonar.gradle.ejs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/generators/server/templates/gradle/sonar.gradle.ejs b/generators/server/templates/gradle/sonar.gradle.ejs index 05530cf0caf0..1dbebd541fc9 100644 --- a/generators/server/templates/gradle/sonar.gradle.ejs +++ b/generators/server/templates/gradle/sonar.gradle.ejs @@ -21,6 +21,9 @@ jacoco { } jacocoTestReport { + executionData tasks.withType(Test) + classDirectories = files(sourceSets.main.output.classesDirs) + sourceDirectories = files(sourceSets.main.java.srcDirs) reports { xml.enabled true } From add8106f6b8bb5bd2732da616d5a1e09f818f702 Mon Sep 17 00:00:00 2001 From: "P. Mohan" Date: Tue, 21 May 2019 01:23:39 +0000 Subject: [PATCH 8/8] Add option to suppress the transfer progress --- test-integration/scripts/21-tests-backend.sh | 8 ++++---- test-integration/scripts/23-package.sh | 6 +++--- test-integration/scripts/25-sonar-analyze.sh | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/test-integration/scripts/21-tests-backend.sh b/test-integration/scripts/21-tests-backend.sh index 754422d4dc1d..3f07c87c9021 100755 --- a/test-integration/scripts/21-tests-backend.sh +++ b/test-integration/scripts/21-tests-backend.sh @@ -8,7 +8,7 @@ source $(dirname $0)/00-init-env.sh #------------------------------------------------------------------------------- cd "$JHI_FOLDER_APP" if [ -f "mvnw" ]; then - ./mvnw enforcer:display-info + ./mvnw -ntp enforcer:display-info elif [ -f "gradlew" ]; then ./gradlew -v fi @@ -17,7 +17,7 @@ fi # Check Javadoc generation #------------------------------------------------------------------------------- if [ -f "mvnw" ]; then - ./mvnw javadoc:javadoc + ./mvnw -ntp javadoc:javadoc elif [ -f "gradlew" ]; then ./gradlew javadoc fi @@ -27,7 +27,7 @@ fi #------------------------------------------------------------------------------- if [[ "$JHI_APP" == *"uaa"* ]]; then cd "$JHI_FOLDER_UAA" - ./mvnw verify + ./mvnw -ntp verify fi #------------------------------------------------------------------------------- @@ -35,7 +35,7 @@ fi #------------------------------------------------------------------------------- cd "$JHI_FOLDER_APP" if [ -f "mvnw" ]; then - ./mvnw verify \ + ./mvnw -ntp verify \ -Dlogging.level.ROOT=OFF \ -Dlogging.level.org.zalando=OFF \ -Dlogging.level.io.github.jhipster=OFF \ diff --git a/test-integration/scripts/23-package.sh b/test-integration/scripts/23-package.sh index 34dbd306bc20..90cc1fb6468d 100755 --- a/test-integration/scripts/23-package.sh +++ b/test-integration/scripts/23-package.sh @@ -8,7 +8,7 @@ source $(dirname $0)/00-init-env.sh #------------------------------------------------------------------------------- if [[ "$JHI_APP" == *"uaa"* ]]; then cd "$JHI_FOLDER_UAA" - ./mvnw verify -DskipTests -Pdev + ./mvnw -ntp verify -DskipTests -Pdev mv target/*.jar app.jar fi @@ -26,7 +26,7 @@ fi # Package the application #------------------------------------------------------------------------------- if [ -f "mvnw" ]; then - ./mvnw verify -DskipTests -P"$JHI_PROFILE" + ./mvnw -ntp verify -DskipTests -P"$JHI_PROFILE" mv target/*.jar app.jar elif [ -f "gradlew" ]; then ./gradlew bootJar -P"$JHI_PROFILE" -x test @@ -45,7 +45,7 @@ fi #------------------------------------------------------------------------------- if [ "$JHI_WAR" == 1 ]; then if [ -f "mvnw" ]; then - ./mvnw verify -DskipTests -P"$JHI_PROFILE",war + ./mvnw -ntp verify -DskipTests -P"$JHI_PROFILE",war mv target/*.war app.war elif [ -f "gradlew" ]; then ./gradlew bootWar -P"$JHI_PROFILE" -Pwar -x test diff --git a/test-integration/scripts/25-sonar-analyze.sh b/test-integration/scripts/25-sonar-analyze.sh index 9989cf23af82..2357e67eea3d 100755 --- a/test-integration/scripts/25-sonar-analyze.sh +++ b/test-integration/scripts/25-sonar-analyze.sh @@ -9,14 +9,14 @@ cd "$JHI_FOLDER_APP" if [[ "$JHI_APP" = "ngx-default" && "$TRAVIS_REPO_SLUG" = "jhipster/generator-jhipster" && "$TRAVIS_BRANCH" = "master" && "$TRAVIS_PULL_REQUEST" = "false" ]]; then echo "*** Sonar analyze for master branch" - ./mvnw initialize org.jacoco:jacoco-maven-plugin:prepare-agent sonar:sonar \ + ./mvnw -ntp initialize org.jacoco:jacoco-maven-plugin:prepare-agent sonar:sonar \ -Dsonar.host.url=https://sonarcloud.io \ -Dsonar.projectKey=io.github.jhipster.sample:jhipster-sample-application \ -Dsonar.login=$SONAR_TOKEN elif [[ $JHI_SONAR = 1 ]]; then echo "*** Sonar analyze locally" - ./mvnw initialize org.jacoco:jacoco-maven-plugin:prepare-agent sonar:sonar \ + ./mvnw -ntp initialize org.jacoco:jacoco-maven-plugin:prepare-agent sonar:sonar \ -Dsonar.host.url=http://localhost:9001 \ -Dsonar.projectKey=JHipsterSonar