Repository: jhipster/generator-jhipster
Pull request #10376 (2019-09-09 13:53:01)

aws-containers subgenerator bug fixes
Resolve some bugs in the aws-containers subgenerator.

#8366

-   Please make sure the below checklist is followed for Pull Requests.

-   [x] [Travis tests](https://travis-ci.org/jhipster/generator-jhipster/pull_requests) are green
-   [x] Tests are added where necessary
-   [x] Documentation is added/updated where necessary
-   [x] Coding Rules & Commit Guidelines as per our [CONTRIBUTING.md document](https://github.com/jhipster/generator-jhipster/blob/master/CONTRIBUTING.md) are followed

<!--
Please also reference the issue number in a commit message to [automatically close the related Github issue](https://help.github.com/articles/closing-issues-via-commit-messages/)

Note: It is also possible to add `[skip ci]` to your commit message to skip Travis tests
-->


SudharakaP: Close/Reopen for tests

Patch:
diff --git a/generators/aws-containers/aws-client.js b/generators/aws-containers/aws-client.js
index 6d8c61247e..c22a633b9d 100644
--- a/generators/aws-containers/aws-client.js
+++ b/generators/aws-containers/aws-client.js
@@ -77,9 +77,9 @@ function loadAWS(generator) {
             ora = require('ora'); // eslint-disable-line
         } catch (e) {
             generator.log('Installing AWS dependencies');
-            let installCommand = 'yarn add aws-sdk@2.167.0 progress@2.0.0 ora@1.3.0';
+            let installCommand = 'yarn add aws-sdk@2.524.0 progress@2.0.3 ora@3.4.0';
             if (generator.config.get('clientPackageManager') === 'npm') {
-                installCommand = 'npm install aws-sdk@2.167.0 progress@2.0.0 ora@1.3.0--save';
+                installCommand = 'npm install aws-sdk@2.524.0 progress@2.0.3 ora@3.4.0--save';
             }
             shelljs.exec(installCommand, { silent: false }, code => {
                 if (code !== 0) {
diff --git a/generators/aws-containers/constants.js b/generators/aws-containers/constants.js
deleted file mode 100644
index 31c76c5d5d..0000000000
--- a/generators/aws-containers/constants.js
+++ /dev/null
@@ -1,28 +0,0 @@
-/**
- * Copyright 2013-2019 the original author or authors from the JHipster project.
- *
- * This file is part of the JHipster project, see https://www.jhipster.tech/
- * for more information.
- *
- * Licensed 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.
- */
-
-const configuration = {
-    aws: 'aws'
-};
-
-const constants = {
-    conf: configuration
-};
-
-module.exports = constants;
diff --git a/generators/aws-containers/index.js b/generators/aws-containers/index.js
index fe8d1c65f9..46a4ff9e78 100644
--- a/generators/aws-containers/index.js
+++ b/generators/aws-containers/index.js
@@ -19,6 +19,8 @@
 const _ = require('lodash');
 const chalk = require('chalk');
 const databaseTypes = require('jhipster-core').JHipsterDatabaseTypes;
+const fileUtils = require('jhipster-core').FileUtils;
+const fs = require('fs');
 
 const BaseGenerator = require('../generator-base');
 const docker = require('../docker-base');
@@ -26,7 +28,6 @@ const dockerCli = require('../docker-cli');
 const dockerUtils = require('../docker-utils');
 const dockerPrompts = require('../docker-prompts');
 const constants = require('../generator-constants');
-const awsConstants = require('./constants');
 
 const prompts = require('./prompts');
 const awsClient = require('./aws-client');
@@ -100,16 +101,18 @@ module.exports = class extends BaseGenerator {
                 this.skipBuild = this.options['skip-build'];
             },
             getConfig() {
-                this.aws = {
-                    apps: [],
-                    vpc: {},
-                    dockerLogin: {
-                        accountId: null,
-                        password: null
-                    },
-                    ...this.config.get('aws')
-                };
-
+                if (fileUtils.doesFileExist('awsConstants.json')) {
+                    this.aws = JSON.parse(fs.readFileSync('awsConstants.json', { encoding: 'utf-8' }));
+                } else {
+                    this.aws = {
+                        apps: [],
+                        vpc: {},
+                        dockerLogin: {
+                            accountId: null,
+                            password: null
+                        }
+                    };
+                }
                 this.defaultAppsFolders = this.aws.apps.map(a => a.baseName);
             },
             checkDocker: docker.checkDocker,
@@ -136,8 +139,7 @@ module.exports = class extends BaseGenerator {
                     })
                     .catch(() => {
                         this.log.error(chalk.red(`No AWS credentials found for profile ${chalk.bold(profile)}`));
-                        this.abort = true;
-                        done();
+                        done('Please setup AWS credentials; https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html');
                     });
             },
             initAwsStuff() {
@@ -174,10 +176,6 @@ module.exports = class extends BaseGenerator {
 
     get prompting() {
         return {
-            bonjour() {
-                if (this.abort) return;
-                this.log(chalk.bold('❓ AWS prompting'));
-            },
             askTypeOfApplication: prompts.askTypeOfApplication,
             askDirectoryPath: dockerPrompts.askForPath,
             askForApps: dockerPrompts.askForApps,
@@ -254,6 +252,10 @@ module.exports = class extends BaseGenerator {
             purgeAwsApps() {
                 this.aws.apps = this.aws.apps.filter(app => this.appConfigs.find(conf => conf.baseName === app.baseName));
             },
+            setBucketName() {
+                this.aws.s3BucketName =
+                    this.aws.s3BucketName || awsClient.sanitizeBucketName(`${this.aws.cloudFormationName}_${new Date().getTime()}`);
+            },
             getDockerLogin() {
                 if (this.abort) return null;
                 const done = this.async;
@@ -269,10 +271,6 @@ module.exports = class extends BaseGenerator {
                         this.abort = true;
                         done();
                     });
-            },
-            setBucketName() {
-                this.aws.s3BucketName =
-                    this.aws.s3BucketName || awsClient.sanitizeBucketName(`${this.aws.cloudFormationName}_${new Date().getTime()}`);
             }
         };
     }
@@ -363,6 +361,16 @@ module.exports = class extends BaseGenerator {
         };
     }
 
+    _writeFileErrorHandler(generator) {
+        fs.writeFile('awsConstants.json', JSON.stringify(this.aws), function(error) {
+            if (error) {
+                generator.log.error(`There was an error writing the awsConstants.json file: ${error.message}`);
+            } else {
+                generator.log(chalk.green.bold('Configuration saved at awsConstants.json'));
+            }
+        });
+    }
+
     _uploadTemplateToAWS(filename, path) {
         if (this.abort) return null;
         const done = this.async;
@@ -667,14 +675,16 @@ module.exports = class extends BaseGenerator {
                         done();
                     })
                     .catch(error => {
-                        this.log.error(`There was an error updating the stack: ${error.message}`);
+                        this.log.error(`There was an error updating the stack: ${error.message}\n`);
+                        this.log.error(error);
                         this.abort = true;
                         done();
                     });
             },
             saveConf() {
                 delete this.aws.dockerLogin;
-                this.config.set(awsConstants.conf.aws, this.aws);
+                // eslint-disable-next-line no-undef
+                this._writeFileErrorHandler(this);
             }
         };
     }
diff --git a/generators/client/templates/angular/src/main/webapp/app/app.module.ts.ejs b/generators/client/templates/angular/src/main/webapp/app/app.module.ts.ejs
index 2e98bc665d..11fd27a915 100644
--- a/generators/client/templates/angular/src/main/webapp/app/app.module.ts.ejs
+++ b/generators/client/templates/angular/src/main/webapp/app/app.module.ts.ejs
@@ -16,9 +16,15 @@
  See the License for the specific language governing permissions and
  limitations under the License.
 -%>
-import { HTTP_INTERCEPTORS } from '@angular/common/http';
+import { HTTP_INTERCEPTORS, <% if (enableTranslation) { %>HttpClient<% } %> } from '@angular/common/http';
 import { NgModule } from '@angular/core';
 import { BrowserModule } from '@angular/platform-browser';
+import { NgbDatepickerConfig } from '@ng-bootstrap/ng-bootstrap';
+<%_ if (enableTranslation) { _%>
+import { TranslateModule, TranslateLoader, MissingTranslationHandler } from '@ngx-translate/core';
+<%_ } _%>
+import { NgxWebstorageModule } from 'ngx-webstorage';
+import { NgJhipsterModule, <% if (enableTranslation) { %>translatePartialLoader, missingTranslationHandler, JhiConfigService<% } %> } from 'ng-jhipster';
 
 import './vendor';
 <%_ if (authenticationType === 'jwt') { _%>
@@ -32,6 +38,7 @@ import { <%=angularXAppName%>CoreModule } from 'app/core/core.module';
 import { <%=angularXAppName%>AppRoutingModule} from './app-routing.module';
 import { <%=angularXAppName%>HomeModule } from './home/home.module';
 import { <%=angularXAppName%>EntityModule } from './entities/entity.module';
+import * as moment from 'moment';
 // jhipster-needle-angular-add-module-import JHipster will add new module here
 import { <%=jhiPrefixCapitalized%>MainComponent } from './layouts/main/main.component';
 import { NavbarComponent } from './layouts/navbar/navbar.component';
@@ -45,6 +52,30 @@ import { ErrorComponent } from './layouts/error/error.component';
 @NgModule({
     imports: [
         BrowserModule,
+        NgxWebstorageModule.forRoot({ prefix: '<%=jhiPrefixDashed %>', separator: '-'}),
+        NgJhipsterModule.forRoot({
+            // set below to true to make alerts look like toast
+            alertAsToast: false,
+            alertTimeout: 5000,
+            <%_ if (enableTranslation) { _%>
+            i18nEnabled: true,
+            defaultI18nLang: '<%= nativeLanguage %>'
+            <%_ } _%>
+        }),
+        <%_ if (enableTranslation) { _%>
+        TranslateModule.forRoot({
+            loader: {
+                provide: TranslateLoader,
+                useFactory: translatePartialLoader,
+                deps: [HttpClient]
+            },
+            missingTranslationHandler: {
+                provide: MissingTranslationHandler,
+                useFactory: missingTranslationHandler,
+                deps: [JhiConfigService]
+            }
+        }),
+        <%_ } _%>
         <%=angularXAppName%>SharedModule,
         <%=angularXAppName%>CoreModule,
         <%=angularXAppName%>HomeModule,
@@ -88,4 +119,8 @@ import { ErrorComponent } from './layouts/error/error.component';
     ],
     bootstrap: [ <%=jhiPrefixCapitalized%>MainComponent ]
 })
-export class <%=angularXAppName%>AppModule {}
+export class <%=angularXAppName%>AppModule {
+    constructor(private dpConfig: NgbDatepickerConfig) {
+        this.dpConfig.minDate = {year: moment().year() - 100, month: 1, day: 1};
+    }
+}
diff --git a/generators/client/templates/angular/src/main/webapp/app/core/core.module.ts.ejs b/generators/client/templates/angular/src/main/webapp/app/core/core.module.ts.ejs
index 6b8d7c4230..00dc96438e 100644
--- a/generators/client/templates/angular/src/main/webapp/app/core/core.module.ts.ejs
+++ b/generators/client/templates/angular/src/main/webapp/app/core/core.module.ts.ejs
@@ -1,58 +1,28 @@
 import { NgModule, LOCALE_ID } from '@angular/core';
 import { DatePipe, registerLocaleData } from '@angular/common';
-import { <% if (enableTranslation) { %>HttpClient, <% } %>HttpClientModule } from '@angular/common/http';
+import { HttpClientModule } from '@angular/common/http';
 import { Title } from '@angular/platform-browser';
 import { FaIconLibrary } from '@fortawesome/angular-fontawesome';
 import { fas } from '@fortawesome/free-solid-svg-icons';
-import { CookieModule } from 'ngx-cookie';
-<%_ if (enableTranslation) { _%>
-import { TranslateModule, TranslateLoader, MissingTranslationHandler } from '@ngx-translate/core';
-<%_ } _%>
-import { NgxWebstorageModule } from 'ngx-webstorage';
-import { NgJhipsterModule<% if (enableTranslation) { %>, translatePartialLoader, missingTranslationHandler, JhiConfigService<% } %> } from 'ng-jhipster';
 <%_ const localeId = getLocaleId(nativeLanguage); _%>
 import locale from '@angular/common/locales/<%= localeId %>';
 
-import * as moment from 'moment';
 <%_ if (enableI18nRTL) { _%>
 import {
     FindLanguageFromKeyPipe
 } from 'app/shared/language/find-language-from-key.pipe';
 <%_ } _%>
-import { NgbDateAdapter, NgbDatepickerConfig } from '@ng-bootstrap/ng-bootstrap';
+import { NgbDateAdapter } from '@ng-bootstrap/ng-bootstrap';
 import { NgbDateMomentAdapter } from 'app/shared/util/datepicker-adapter';
 
 import { fontAwesomeIcons } from './icons/font-awesome-icons';
 
 @NgModule({
     imports: [
-        HttpClientModule,
-        CookieModule.forRoot(),
-        NgxWebstorageModule.forRoot({ prefix: '<%=jhiPrefixDashed %>', separator: '-'}),
-        NgJhipsterModule.forRoot({
-            // set below to true to make alerts look like toast
-            alertAsToast: false,
-            alertTimeout: 5000,
-            <%_ if (enableTranslation) { _%>
-            i18nEnabled: true,
-            defaultI18nLang: '<%= nativeLanguage %>'
-            <%_ } _%>
-        }),
-        <%_ if (enableTranslation) { _%>
-        TranslateModule.forRoot({
-            loader: {
-                provide: TranslateLoader,
-                useFactory: translatePartialLoader,
-                deps: [HttpClient]
-            },
-            missingTranslationHandler: {
-                provide: MissingTranslationHandler,
-                useFactory: missingTranslationHandler,
-                deps: [JhiConfigService]
-            }
-        })
-        <%_ } _%>
+        HttpClientModule
     ],
+    exports: [],
+    declarations: [],
     providers: [
         Title,
         {
@@ -71,10 +41,9 @@ import { fontAwesomeIcons } from './icons/font-awesome-icons';
     ]
 })
 export class <%=angularXAppName%>CoreModule {
-    constructor(iconLibrary: FaIconLibrary, private dpConfig: NgbDatepickerConfig) {
+    constructor(iconLibrary: FaIconLibrary) {
         registerLocaleData(locale);
         iconLibrary.addIconPacks(fas);
         iconLibrary.addIcons(...fontAwesomeIcons);
-        this.dpConfig.minDate = {year: moment().year() - 100, month: 1, day: 1};
     }
 }
diff --git a/generators/client/templates/angular/src/main/webapp/app/shared/shared-libs.module.ts.ejs b/generators/client/templates/angular/src/main/webapp/app/shared/shared-libs.module.ts.ejs
index 195c3fd416..52f0d3bc10 100644
--- a/generators/client/templates/angular/src/main/webapp/app/shared/shared-libs.module.ts.ejs
+++ b/generators/client/templates/angular/src/main/webapp/app/shared/shared-libs.module.ts.ejs
@@ -22,12 +22,20 @@ import { FormsModule, ReactiveFormsModule } from '@angular/forms';
 import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
 import { NgJhipsterModule } from 'ng-jhipster';
 import { InfiniteScrollModule } from 'ngx-infinite-scroll';
+import { CookieModule } from 'ngx-cookie';
 import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
 <%_ if (enableTranslation) { _%>
 import { TranslateModule } from '@ngx-translate/core';
 <%_ } _%>
 
 @NgModule({
+    imports: [
+        NgbModule,
+        InfiniteScrollModule,
+        CookieModule.forRoot(),
+        FontAwesomeModule,
+        ReactiveFormsModule
+    ],
     exports: [
         FormsModule,
         CommonModule,
diff --git a/generators/client/templates/react/package.json.ejs b/generators/client/templates/react/package.json.ejs
index 7dff3d5dfc..daad7a7838 100644
--- a/generators/client/templates/react/package.json.ejs
+++ b/generators/client/templates/react/package.json.ejs
@@ -177,8 +177,7 @@ limitations under the License.
   },
 <%_ if (clientPackageManager === 'yarn') { _%>
   "resolutions": {
-    "@types/react": "16.8.10",
-    "redux": "4.0.1"
+    "@types/react": "16.8.10"
   },
 <%_ } _%>
   "engines": {
diff --git a/generators/docker-compose/index.js b/generators/docker-compose/index.js
index 381f33747f..fe44c9ff9c 100644
--- a/generators/docker-compose/index.js
+++ b/generators/docker-compose/index.js
@@ -67,6 +67,7 @@ module.exports = class extends BaseDockerGenerator {
     }
 
     get prompting() {
+        if (this.abort) return undefined;
         return super.prompting;
     }
 
diff --git a/generators/generator-base-private.js b/generators/generator-base-private.js
index 77c2af433e..35edb92891 100644
--- a/generators/generator-base-private.js
+++ b/generators/generator-base-private.js
@@ -832,7 +832,7 @@ module.exports = class extends Generator {
         }
 
         // Path to the yo cli script in generator-jhipster's node_modules
-        const yoInternalCliPath = require.resolve('yo/lib/cli.js');
+        const yoInternalCliPath = path.join(__dirname, '../node_modules/yo/lib/cli.js');
 
         shelljs.exec(`node ${yoInternalCliPath} --generators`, { silent: true }, (err, stdout, stderr) => {
             if (!stdout.includes(` ${blueprint}\n`) && !stdout.includes(` ${generatorName}\n`)) {
diff --git a/generators/server/files.js b/generators/server/files.js
index 6218a1428e..1f5d0fe7d6 100644
--- a/generators/server/files.js
+++ b/generators/server/files.js
@@ -1701,10 +1701,6 @@ const serverFiles = {
                 {
                     file: 'package/web/rest/AuditResourceIT.java',
                     renameTo: generator => `${generator.testDir}web/rest/AuditResourceIT.java`
-                },
-                {
-                    file: 'package/service/AuditEventServiceIT.java',
-                    renameTo: generator => `${generator.testDir}service/AuditEventServiceIT.java`
                 }
             ]
         },
diff --git a/generators/server/templates/gradle.properties.ejs b/generators/server/templates/gradle.properties.ejs
index adf1b5f1b3..58f70970d2 100644
--- a/generators/server/templates/gradle.properties.ejs
+++ b/generators/server/templates/gradle.properties.ejs
@@ -28,10 +28,10 @@ yarn_version=<%= YARN_VERSION %>
 jhipster_dependencies_version=3.0.5-SNAPSHOT
 # The spring-boot version should match the one managed by
 # https://mvnrepository.com/artifact/io.github.jhipster/jhipster-dependencies/${jhipster_dependencies_version}
-spring_boot_version=2.1.8.RELEASE
+spring_boot_version=2.1.7.RELEASE
 # The hibernate version should match the one managed by
 # https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-dependencies/${spring-boot.version} -->
-hibernate_version=5.3.11.Final
+hibernate_version=5.3.10.Final
 mapstruct_version=1.3.0.Final
 
 liquibase_hibernate5_version=3.7
diff --git a/generators/server/templates/pom.xml.ejs b/generators/server/templates/pom.xml.ejs
index 1f503c130c..1cd48cd922 100644
--- a/generators/server/templates/pom.xml.ejs
+++ b/generators/server/templates/pom.xml.ejs
@@ -94,14 +94,14 @@
         <jhipster-dependencies.version>3.0.5-SNAPSHOT</jhipster-dependencies.version>
         <!-- The spring-boot version should match the one managed by
         https://mvnrepository.com/artifact/io.github.jhipster/jhipster-dependencies/${jhipster-dependencies.version} -->
-        <spring-boot.version>2.1.8.RELEASE</spring-boot.version>
+        <spring-boot.version>2.1.7.RELEASE</spring-boot.version>
 <%_ if (databaseType === 'sql') { _%>
         <!-- The spring framework version should match the one managed by
         https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-dependencies/${spring-boot.version} -->
         <spring.version>5.1.9.RELEASE</spring.version>
         <!-- The hibernate version should match the one managed by
         https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-dependencies/${spring-boot.version} -->
-        <hibernate.version>5.3.11.Final</hibernate.version>
+        <hibernate.version>5.3.10.Final</hibernate.version>
         <!-- The javassist version should match the one managed by
         https://mvnrepository.com/artifact/org.hibernate/hibernate-core/${hibernate.version} -->
         <javassist.version>3.23.1-GA</javassist.version>
diff --git a/generators/server/templates/src/main/java/package/config/ApplicationProperties.java.ejs b/generators/server/templates/src/main/java/package/config/ApplicationProperties.java.ejs
index 60458bd32a..21ce0c13c5 100644
--- a/generators/server/templates/src/main/java/package/config/ApplicationProperties.java.ejs
+++ b/generators/server/templates/src/main/java/package/config/ApplicationProperties.java.ejs
@@ -28,4 +28,5 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
  */
 @ConfigurationProperties(prefix = "application", ignoreUnknownFields = false)
 public class ApplicationProperties {
+
 }
diff --git a/generators/server/templates/src/main/java/package/repository/PersistenceAuditEventRepository.java.ejs b/generators/server/templates/src/main/java/package/repository/PersistenceAuditEventRepository.java.ejs
index 3884d5adbd..6ecb4b809c 100644
--- a/generators/server/templates/src/main/java/package/repository/PersistenceAuditEventRepository.java.ejs
+++ b/generators/server/templates/src/main/java/package/repository/PersistenceAuditEventRepository.java.ejs
@@ -20,14 +20,9 @@ package <%=packageName%>.repository;
 
 import <%=packageName%>.domain.PersistentAuditEvent;
 import org.springframework.data.domain.Page;
-import org.springframework.data.domain.Pageable;
-
-<% if (databaseType === 'sql') { %>
-import org.springframework.data.jpa.repository.JpaRepository;
-<% } %>
-<% if (databaseType === 'mongodb') { %>
-import org.springframework.data.mongodb.repository.MongoRepository;
-<% } %>
+import org.springframework.data.domain.Pageable;<% if (databaseType === 'sql') { %>
+import org.springframework.data.jpa.repository.JpaRepository;<% } %><% if (databaseType === 'mongodb') { %>
+import org.springframework.data.mongodb.repository.MongoRepository;<% } %>
 
 import java.time.Instant;
 import java.util.List;
@@ -51,6 +46,4 @@ public interface PersistenceAuditEventRepository extends <% if (databaseType ===
     List<PersistentAuditEvent> findByPrincipalAndAuditEventDateAfterAndAuditEventType(String principal, Instant after, String type);
 
     Page<PersistentAuditEvent> findAllByAuditEventDateBetween(Instant fromDate, Instant toDate, Pageable pageable);
-
-    List<PersistentAuditEvent> findByAuditEventDateBefore(Instant before);
 }
diff --git a/generators/server/templates/src/main/java/package/service/AuditEventService.java.ejs b/generators/server/templates/src/main/java/package/service/AuditEventService.java.ejs
index 7d8b2433be..74dbe2ef93 100644
--- a/generators/server/templates/src/main/java/package/service/AuditEventService.java.ejs
+++ b/generators/server/templates/src/main/java/package/service/AuditEventService.java.ejs
@@ -18,22 +18,15 @@
 -%>
 package <%=packageName%>.service;
 
-import io.github.jhipster.config.JHipsterProperties;
 import <%=packageName%>.config.audit.AuditEventConverter;
 import <%=packageName%>.repository.PersistenceAuditEventRepository;
 import org.springframework.boot.actuate.audit.AuditEvent;
 import org.springframework.data.domain.Page;
 import org.springframework.data.domain.Pageable;
-import org.springframework.stereotype.Service;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.scheduling.annotation.Scheduled;
-<% if (databaseType === 'sql') { %>
-import org.springframework.transaction.annotation.Transactional;
-<% } %>
+import org.springframework.stereotype.Service;<% if (databaseType === 'sql') { %>
+import org.springframework.transaction.annotation.Transactional;<% } %>
 
 import java.time.Instant;
-import java.time.temporal.ChronoUnit;
 import java.util.Optional;
 
 /**
@@ -45,36 +38,16 @@ import java.util.Optional;
 @Transactional<% } %>
 public class AuditEventService {
 
-    private final Logger log = LoggerFactory.getLogger(AuditEventService.class);
-
-    private final JHipsterProperties jHipsterProperties;
-
     private final PersistenceAuditEventRepository persistenceAuditEventRepository;
 
     private final AuditEventConverter auditEventConverter;
 
     public AuditEventService(
         PersistenceAuditEventRepository persistenceAuditEventRepository,
-        AuditEventConverter auditEventConverter, JHipsterProperties jhipsterProperties) {
+        AuditEventConverter auditEventConverter) {
 
         this.persistenceAuditEventRepository = persistenceAuditEventRepository;
         this.auditEventConverter = auditEventConverter;
-        this.jHipsterProperties = jhipsterProperties;
-    }
-
-    /**
-    * Old audit events should be automatically deleted after 30 days.
-    *
-    * This is scheduled to get fired at 12:00 (am).
-    */
-    @Scheduled(cron = "0 0 12 * * ?")
-    public void removeOldAuditEvents() {
-        persistenceAuditEventRepository
-            .findByAuditEventDateBefore(Instant.now().minus(jHipsterProperties.getAuditEvents().getRetentionPeriod(), ChronoUnit.DAYS))
-            .forEach(auditEvent -> {
-                log.debug("Deleting audit data {}", auditEvent.toString());
-                persistenceAuditEventRepository.delete(auditEvent);
-        });
     }
 
     public Page<AuditEvent> findAll(Pageable pageable) {
diff --git a/generators/server/templates/src/main/java/package/service/UserService.java.ejs b/generators/server/templates/src/main/java/package/service/UserService.java.ejs
index aa255a3b83..a0c3a2606c 100644
--- a/generators/server/templates/src/main/java/package/service/UserService.java.ejs
+++ b/generators/server/templates/src/main/java/package/service/UserService.java.ejs
@@ -796,7 +796,7 @@ public class UserService {
         <%= databaseType === 'no' ? asDto('User') : asEntity('User') %> user = getUser(attributes);
         user.setAuthorities(authToken.getAuthorities().stream()
             .map(GrantedAuthority::getAuthority)
-            <%_ if (databaseType === 'sql' || databaseType === 'mongodb') { _%>
+            <%_ if (databaseType !== 'no') { _%>
             .map(authority -> {
                 Authority auth = new Authority();
                 auth.setName(authority);
diff --git a/generators/server/templates/src/main/resources/config/application-dev.yml.ejs b/generators/server/templates/src/main/resources/config/application-dev.yml.ejs
index 1459859167..611f72195b 100644
--- a/generators/server/templates/src/main/resources/config/application-dev.yml.ejs
+++ b/generators/server/templates/src/main/resources/config/application-dev.yml.ejs
@@ -367,10 +367,6 @@ jhipster:
             host: localhost
             port: 5000
             queue-size: 512
-    <%_ if (databaseType === 'sql' || databaseType === 'mongodb' || databaseType === 'couchbase') { _%>
-    audit-events:
-        retention-period: 30 # Number of days before audit events are deleted.
-    <%_ } _%>
 <%_ if (applicationType === 'uaa') { _%>
 uaa:
     key-store:
diff --git a/generators/server/templates/src/main/resources/config/application-prod.yml.ejs b/generators/server/templates/src/main/resources/config/application-prod.yml.ejs
index 8d63fb751a..96ddb57083 100644
--- a/generators/server/templates/src/main/resources/config/application-prod.yml.ejs
+++ b/generators/server/templates/src/main/resources/config/application-prod.yml.ejs
@@ -351,10 +351,6 @@ jhipster:
             host: localhost
             port: 5000
             queue-size: 512
-    <%_ if (databaseType === 'sql' || databaseType === 'mongodb' || databaseType === 'couchbase') { _%>
-    audit-events:
-        retention-period: 30 # Number of days before audit events are deleted.
-    <%_ } _%>
 <%_ if (applicationType === 'uaa') { _%>
 uaa:
     #be sure to to change to a different keystore in production!


Test patch:
diff --git a/generators/server/templates/src/test/java/package/service/AuditEventServiceIT.java.ejs b/generators/server/templates/src/test/java/package/service/AuditEventServiceIT.java.ejs
deleted file mode 100644
index e1241af357..0000000000
--- a/generators/server/templates/src/test/java/package/service/AuditEventServiceIT.java.ejs
+++ /dev/null
@@ -1,118 +0,0 @@
-<%#
- Copyright 2013-2019 the original author or authors from the JHipster project.
-
- This file is part of the JHipster project, see https://www.jhipster.tech/
- for more information.
-
- Licensed 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.
--%>
-package <%= packageName %>.service;
-
-import <%= packageName %>.domain.PersistentAuditEvent;
-import <%= packageName %>.repository.PersistenceAuditEventRepository;
-import <%=packageName%>.<%= mainClass %>;
-import io.github.jhipster.config.JHipsterProperties;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-<%_ if (databaseType === 'sql') { _%>
-import org.springframework.transaction.annotation.Transactional;
-<%_ } _%>
-<%_ if (databaseType === 'couchbase') { _%>
-import static <%= packageName %>.web.rest.TestUtil.mockAuthentication;
-<%_ } _%>
-<%_ if (messageBroker === 'kafka') { _%>
-import org.springframework.kafka.test.context.EmbeddedKafka;
-<%_ } _%>
-<%_ if (authenticationType === 'oauth2') { _%>
-import <%= packageName %>.config.TestSecurityConfiguration;
-<%_ } _%>
-import java.time.Instant;
-import java.time.temporal.ChronoUnit;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-/**
- * Integration tests for {@link AuditEventService}.
- */
-<%_ if (messageBroker === 'kafka') { _%>
-@EmbeddedKafka
-<%_ } _%>
-<%_ if (authenticationType === 'oauth2') { _%>
-@SpringBootTest(classes = {<%= mainClass %>.class, TestSecurityConfiguration.class})
-<%_ } else { _%>
-@SpringBootTest(classes = <%= mainClass %>.class)
-<%_ } _%>
-<%_ if (databaseType === 'sql') { _%>
-@Transactional
-<%_ } _%>
-public class AuditEventServiceIT {
-    @Autowired
-    private AuditEventService auditEventService;
-
-    @Autowired
-    private PersistenceAuditEventRepository persistenceAuditEventRepository;
-
-    @Autowired
-    private JHipsterProperties jHipsterProperties;
-
-    private PersistentAuditEvent auditEventOld;
-
-    private PersistentAuditEvent auditEventWithinRetention;
-
-    private PersistentAuditEvent auditEventNew;
-
-    @BeforeEach
-    public void init() {
-        <%_ if (databaseType === 'couchbase') { _%>
-        mockAuthentication();
-        <%_ } _%>
-        auditEventOld = new PersistentAuditEvent();
-        auditEventOld.setAuditEventDate(Instant.now().minus(jHipsterProperties.getAuditEvents().getRetentionPeriod() + 1, ChronoUnit.DAYS));
-        auditEventOld.setPrincipal("test-user-old");
-        auditEventOld.setAuditEventType("test-type");
-
-        auditEventWithinRetention = new PersistentAuditEvent();
-        auditEventWithinRetention.setAuditEventDate(Instant.now().minus(jHipsterProperties.getAuditEvents().getRetentionPeriod() - 1, ChronoUnit.DAYS));
-        auditEventWithinRetention.setPrincipal("test-user-retention");
-        auditEventWithinRetention.setAuditEventType("test-type");;
-
-        auditEventNew = new PersistentAuditEvent();
-        auditEventNew.setAuditEventDate(Instant.now());
-        auditEventNew.setPrincipal("test-user-new");
-        auditEventNew.setAuditEventType("test-type");
-    }
-
-    @Test
-    <%_ if (databaseType === 'sql') { _%>
-    @Transactional
-    <%_ } _%>
-    public void verifyOldAuditEventsAreDeleted() {
-        persistenceAuditEventRepository.deleteAll();
-        persistenceAuditEventRepository.save(auditEventOld);
-        persistenceAuditEventRepository.save(auditEventWithinRetention);
-        persistenceAuditEventRepository.save(auditEventNew);
-        <% if (databaseType === 'sql') { %>
-        persistenceAuditEventRepository.flush();
-        <% } %>
-        auditEventService.removeOldAuditEvents();
-        <% if (databaseType === 'sql') { %>
-        persistenceAuditEventRepository.flush();
-        <% } %>
-        assertThat(persistenceAuditEventRepository.findAll().size()).isEqualTo(2);
-        assertThat(persistenceAuditEventRepository.findByPrincipal("test-user-old")).isEmpty();
-        assertThat(persistenceAuditEventRepository.findByPrincipal("test-user-retention")).isNotEmpty();
-        assertThat(persistenceAuditEventRepository.findByPrincipal("test-user-new")).isNotEmpty();
-    }
-}
diff --git a/generators/server/templates/src/test/java/package/web/rest/AuditResourceIT.java.ejs b/generators/server/templates/src/test/java/package/web/rest/AuditResourceIT.java.ejs
index d20887abb9..e5d9001c0e 100644
--- a/generators/server/templates/src/test/java/package/web/rest/AuditResourceIT.java.ejs
+++ b/generators/server/templates/src/test/java/package/web/rest/AuditResourceIT.java.ejs
@@ -22,7 +22,6 @@ import <%=packageName%>.<%= mainClass %>;
 <%_ if (authenticationType === 'oauth2') { _%>
 import <%=packageName%>.config.TestSecurityConfiguration;
 <%_ } _%>
-import io.github.jhipster.config.JHipsterProperties;
 import <%=packageName%>.config.audit.AuditEventConverter;
 import <%=packageName%>.domain.PersistentAuditEvent;
 import <%=packageName%>.repository.PersistenceAuditEventRepository;
@@ -82,9 +81,6 @@ public class AuditResourceIT {
     @Autowired
     private AuditEventConverter auditEventConverter;
 
-    @Autowired
-    private JHipsterProperties jhipsterProperties;
-
     @Autowired
     private MappingJackson2HttpMessageConverter jacksonMessageConverter;
 
@@ -103,7 +99,7 @@ public class AuditResourceIT {
     public void setup() {
         MockitoAnnotations.initMocks(this);
         AuditEventService auditEventService =
-            new AuditEventService(auditEventRepository, auditEventConverter, jhipsterProperties);
+            new AuditEventService(auditEventRepository, auditEventConverter);
         AuditResource auditResource = new AuditResource(auditEventService);
         this.restAuditMockMvc = MockMvcBuilders.standaloneSetup(auditResource)
             .setCustomArgumentResolvers(pageableArgumentResolver)
diff --git a/test-integration/scripts/23-package.sh b/test-integration/scripts/23-package.sh
index 3030c04bd3..90cc1fb646 100755
--- a/test-integration/scripts/23-package.sh
+++ b/test-integration/scripts/23-package.sh
@@ -16,10 +16,10 @@ fi
 # Decrease Angular timeout for Protractor tests
 #-------------------------------------------------------------------------------
 cd "$JHI_FOLDER_APP"
-if [ "$JHI_PROTRACTOR" == 1 ] && [ -e "src/main/webapp/app/core/core.module.ts" ]; then
-    sed -e 's/alertTimeout: 5000/alertTimeout: 1/1;' src/main/webapp/app/core/core.module.ts > src/main/webapp/app/core/core.module.ts.sed
-    mv -f src/main/webapp/app/core/core.module.ts.sed src/main/webapp/app/core/core.module.ts
-    cat src/main/webapp/app/core/core.module.ts | grep alertTimeout
+if [ "$JHI_PROTRACTOR" == 1 ] && [ -e "src/main/webapp/app/app.module.ts" ]; then
+    sed -e 's/alertTimeout: 5000/alertTimeout: 1/1;' src/main/webapp/app/app.module.ts > src/main/webapp/app/app.module.ts.sed
+    mv -f src/main/webapp/app/app.module.ts.sed src/main/webapp/app/app.module.ts
+    cat src/main/webapp/app/app.module.ts | grep alertTimeout
 fi
 
 #-------------------------------------------------------------------------------
@@ -58,4 +58,4 @@ if [ "$JHI_WAR" == 1 ]; then
         echo "*** error when packaging"
         exit 1
     fi
-fi
+fi
\ No newline at end of file
diff --git a/test/utils/expected-files.js b/test/utils/expected-files.js
index b04fcf05fd..c6a91ef765 100644
--- a/test/utils/expected-files.js
+++ b/test/utils/expected-files.js
@@ -237,7 +237,6 @@ const expectedFiles = {
         `${SERVER_TEST_SRC_DIR}com/mycompany/myapp/web/rest/UserResourceIT.java`,
         `${SERVER_TEST_SRC_DIR}com/mycompany/myapp/service/UserServiceIT.java`,
         `${SERVER_TEST_SRC_DIR}com/mycompany/myapp/service/MailServiceIT.java`,
-        `${SERVER_TEST_SRC_DIR}com/mycompany/myapp/service/AuditEventServiceIT.java`,
         `${SERVER_TEST_SRC_DIR}com/mycompany/myapp/service/mapper/UserMapperIT.java`,
         `${SERVER_TEST_SRC_DIR}com/mycompany/myapp/repository/CustomAuditEventRepositoryIT.java`
     ],