Repository: jhipster/generator-jhipster
Pull request #10812 (2019-11-20 22:42:03)

Remove SpringBootTest from UserMapper test
-   Please make sure the below checklist is followed for Pull Requests.

-   [x] [All continuous integration tests](https://github.com/jhipster/generator-jhipster/actions) 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
-->
Make it a fast unit test

pascalgrimaud: FYI, there is some conflict, probably because I merged the other PR.
cbornet: Yes I was expecting that. Because of the upgrade cleanup.

Patch:
diff --git a/.github/workflows/applications.yml b/.github/workflows/applications.yml
index 6c917dd640..b09e1ee712 100644
--- a/.github/workflows/applications.yml
+++ b/.github/workflows/applications.yml
@@ -1,4 +1,4 @@
-name: Applications
+name: Generated Applications CI
 on: [push, pull_request]
 env:
     JHI_RUN_APP: 1
@@ -17,13 +17,13 @@ env:
     JHI_GITHUB_CI: true
 jobs:
     applications:
-        name: ${{ matrix.app-type }}
+        name: ${{ matrix.app-type }} application test suite
         runs-on: ${{ matrix.os }}
         timeout-minutes: 40
         strategy:
             fail-fast: false
             matrix:
-                node_version: [12.13.1]
+                node_version: [12.x]
                 os: [ubuntu-latest]
                 app-type: [ngx-session-cassandra-fr, ngx-mongodb-kafka-cucumber, ngx-couchbase]
                 include:
diff --git a/.github/workflows/generator.yml b/.github/workflows/generator.yml
index 7eb41a01bd..5a4df34d96 100644
--- a/.github/workflows/generator.yml
+++ b/.github/workflows/generator.yml
@@ -1,14 +1,14 @@
-name: Generator
+name: Generator CI
 on: [push, pull_request]
 jobs:
     generator-jhipster:
-        name: npm test
+        name: JHipster generator unit test suite
         runs-on: ${{ matrix.os }}
         timeout-minutes: 20
         strategy:
             fail-fast: false
             matrix:
-                node_version: [12.13.1]
+                node_version: [10.x, 12.x]
                 os: [ubuntu-latest]
         steps:
             - uses: actions/checkout@v1
diff --git a/README.md b/README.md
index fa59ff81e3..78e5647d05 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,6 @@
 [![Logo][jhipster-image]][jhipster-url]
 
-[![NPM version][npm-image]][npm-url] [![Dependency Status][daviddm-image]][daviddm-url] [![Downloads][npmcharts-image]][npmcharts-url]
-[![Generator Build Status][github-actions-generator-image]][github-actions-url] [![Applications Build Status][github-actions-applications-image]][github-actions-url] [![Travis Build Status][travis-image]][travis-url-main] [![Azure DevOps Build Status][azure-devops-image]][azure-devops-url-main]
+[![NPM version][npm-image]][npm-url] [![Travis Build Status][travis-image]][travis-url-main] [![Azure DevOps Build Status][azure-devops-image]][azure-devops-url-main] [![Dependency Status][daviddm-image]][daviddm-url] [![Downloads][npmcharts-image]][npmcharts-url]
 
 Greetings, Java Hipster!
 
@@ -208,9 +207,6 @@ Additional builds at [hipster-labs/jhipster-daily-builds](https://github.com/hip
 [azure-devops-image]: https://dev.azure.com/jhipster/generator-jhipster/_apis/build/status/jhipster.generator-jhipster?branchName=master
 [travis-url-main]: https://travis-ci.org/jhipster/generator-jhipster
 [azure-devops-url-main]: https://dev.azure.com/jhipster/generator-jhipster/_build
-[github-actions-generator-image]: https://github.com/jhipster/generator-jhipster/workflows/Generator/badge.svg
-[github-actions-applications-image]: https://github.com/jhipster/generator-jhipster/workflows/Applications/badge.svg
-[github-actions-url]: https://github.com/jhipster/generator-jhipster/actions
 [daviddm-image]: https://david-dm.org/jhipster/generator-jhipster.svg?theme=shields.io
 [daviddm-url]: https://david-dm.org/jhipster/generator-jhipster
 [backers-image]: https://opencollective.com/generator-jhipster/tiers/backer.svg?avatarHeight=40&width=890
diff --git a/cli/cli.js b/cli/cli.js
index ab019d2cc0..900405bd40 100644
--- a/cli/cli.js
+++ b/cli/cli.js
@@ -20,18 +20,7 @@ const program = require('commander');
 const chalk = require('chalk');
 
 const packageJson = require('../package.json');
-const {
-    CLI_NAME,
-    initHelp,
-    logger,
-    createYeomanEnv,
-    toString,
-    getCommand,
-    getCommandOptions,
-    getArgs,
-    done,
-    getExitCode
-} = require('./utils');
+const { CLI_NAME, initHelp, logger, createYeomanEnv, toString, getCommand, getCommandOptions, getArgs, done } = require('./utils');
 const initAutoCompletion = require('./completion').init;
 const SUB_GENERATORS = require('./commands');
 
@@ -42,10 +31,6 @@ const env = createYeomanEnv();
 /* setup debugging */
 logger.init(program);
 
-process.on('exit', code => {
-    process.exit(code || getExitCode());
-});
-
 /**
  *  Run a yeoman command
  */
diff --git a/cli/import-jdl.js b/cli/import-jdl.js
index 47400c2ba3..2b1f4e2bed 100644
--- a/cli/import-jdl.js
+++ b/cli/import-jdl.js
@@ -26,7 +26,7 @@ const pluralize = require('pluralize');
 const { fork } = require('child_process');
 
 const waitUntil = require('./wait-until');
-const { CLI_NAME, GENERATOR_NAME, logger, toString, getOptionsFromArgs, done, getOptionAsArgs, setExitCode } = require('./utils');
+const { CLI_NAME, GENERATOR_NAME, logger, toString, getOptionsFromArgs, done, getOptionAsArgs } = require('./utils');
 const jhipsterUtils = require('../generators/utils');
 
 const packagejs = require('../package.json');
@@ -128,7 +128,6 @@ const generateDeploymentFiles = ({ generator, deployment, inFolder }, forkProces
         }
     );
     childProc.on('exit', code => {
-        setExitCode(code);
         logger.info(`Deployment: child process exited with code ${code}`);
         generationCompletionState.exportedDeployments[deploymentType] = true;
     });
@@ -157,7 +156,6 @@ const generateApplicationFiles = ({ generator, application, withEntities, inFold
         }
     );
     childProc.on('exit', code => {
-        setExitCode(code);
         logger.info(`App: child process exited with code ${code}`);
         generationCompletionState.exportedApplications[baseName] = true;
     });
@@ -196,7 +194,6 @@ const generateEntityFiles = (generator, entity, inFolder, env, shouldTriggerInst
 
             const childProc = forkProcess(runYeomanProcess, [command, ...getOptionAsArgs(options, false, !options.interactive)], { cwd });
             childProc.on('exit', code => {
-                setExitCode(code);
                 logger.info(`Entity: child process exited with code ${code}`);
                 generationCompletionState.exportedEntities[entity.name] = true;
             });
diff --git a/cli/utils.js b/cli/utils.js
index 0abf1104c8..a5d579404f 100644
--- a/cli/utils.js
+++ b/cli/utils.js
@@ -27,9 +27,6 @@ const SUB_GENERATORS = require('./commands');
 
 const CLI_NAME = 'jhipster';
 const GENERATOR_NAME = 'generator-jhipster';
-
-let exitCode = 0;
-
 const debug = function(msg) {
     if (this.debugEnabled) {
         console.log(`${chalk.blue('DEBUG!')}  ${msg}`);
@@ -50,7 +47,6 @@ const error = function(msg, trace) {
         console.log(trace);
     }
     process.exit(1);
-    exitCode = 1;
 };
 
 const init = function(program) {
@@ -220,15 +216,5 @@ module.exports = {
     getCommandOptions,
     done,
     createYeomanEnv,
-    getOptionAsArgs,
-
-    getExitCode() {
-        return exitCode;
-    },
-
-    setExitCode(code) {
-        if (code !== 0) {
-            exitCode = code;
-        }
-    }
+    getOptionAsArgs
 };
diff --git a/generators/azure-spring-cloud/templates/github/workflows/azure-spring-cloud.yml.ejs b/generators/azure-spring-cloud/templates/github/workflows/azure-spring-cloud.yml.ejs
index eb94b6133f..1cbbe6286a 100644
--- a/generators/azure-spring-cloud/templates/github/workflows/azure-spring-cloud.yml.ejs
+++ b/generators/azure-spring-cloud/templates/github/workflows/azure-spring-cloud.yml.ejs
@@ -18,8 +18,8 @@ jobs:
       run: mvn test
     - name: Build with Maven
       run: mvn package -DskipTests -Pprod,azure
-    - name: Login to Azure
-      uses: azure/login@v1
+    - name: Login to Azure Spring Cloud
+      uses: azure/actions/login@v1
       with:
         creds: ${{ secrets.AZURE_CREDENTIALS }}
     - name: Install Azure Spring Cloud extension
diff --git a/generators/cleanup.js b/generators/cleanup.js
index 691440720b..a30129a984 100644
--- a/generators/cleanup.js
+++ b/generators/cleanup.js
@@ -213,6 +213,7 @@ function cleanupOldServerFiles(generator, javaDir, testDir, mainResourceDir, tes
         generator.config.delete('blueprintVersion');
     }
     if (generator.isJhipsterVersionLessThan('6.5.2')) {
+        generator.removeFile(`${testDir}service/mapper/UserMapperIT.java`);
         generator.removeFile(`${testDir}web/rest/ClientForwardControllerIT.java`);
     }
 }
diff --git a/generators/client/templates/angular/src/main/webapp/content/scss/_bootstrap-variables.scss.ejs b/generators/client/templates/angular/src/main/webapp/content/scss/_bootstrap-variables.scss.ejs
index f576c25b01..8bebb8ccb1 100644
--- a/generators/client/templates/angular/src/main/webapp/content/scss/_bootstrap-variables.scss.ejs
+++ b/generators/client/templates/angular/src/main/webapp/content/scss/_bootstrap-variables.scss.ejs
@@ -41,7 +41,4 @@ $body-bg: #e4e5e6;
 // Font, line-height, and color for body text, headings, and more.
 
 $font-size-base: 1rem;
-
-$dropdown-link-hover-color: white;
-$dropdown-link-hover-bg: #343a40;
 <%_ } _%>
diff --git a/generators/client/templates/angular/src/main/webapp/content/scss/global.scss.ejs b/generators/client/templates/angular/src/main/webapp/content/scss/global.scss.ejs
index b1322e2ce5..893d944abb 100644
--- a/generators/client/templates/angular/src/main/webapp/content/scss/global.scss.ejs
+++ b/generators/client/templates/angular/src/main/webapp/content/scss/global.scss.ejs
@@ -33,24 +33,10 @@ h4 {
 
 <%_ if (clientTheme === 'none') { _%>
 /* Increase contrast of links to get 100% on Lighthouse Accessability Audit. Override this color if you want to change the link color, or use a Bootswatch theme */
-a {
+a, a:hover {
     color: #533f03;
     font-weight: bold;
 }
-
-a:hover {
-    color: #533f03;
-}
-
-/* override hover color for dropdown-item forced by bootstrap to all a:not([href]):not([tabindex]) elements in _reboot.scss */
-a:not([href]):not([tabindex]):hover.dropdown-item {
-    color: $dropdown-link-hover-color;
-}
-
-/* override .dropdown-item.active background-color on hover */
-.dropdown-item.active:hover {
-    background-color: mix($dropdown-link-hover-bg, $dropdown-link-active-bg, 50%);
-}
 <%_ } _%>
 
 a:hover {
diff --git a/generators/server/files.js b/generators/server/files.js
index 2cac1790aa..42d662b5c9 100644
--- a/generators/server/files.js
+++ b/generators/server/files.js
@@ -1503,8 +1503,8 @@ const serverFiles = {
             path: SERVER_TEST_SRC_DIR,
             templates: [
                 {
-                    file: 'package/service/mapper/UserMapperIT.java',
-                    renameTo: generator => `${generator.testDir}service/mapper/UserMapperIT.java`
+                    file: 'package/service/mapper/UserMapperTest.java',
+                    renameTo: generator => `${generator.testDir}service/mapper/UserMapperTest.java`
                 },
                 {
                     file: 'package/web/rest/UserResourceIT.java',
@@ -1794,8 +1794,8 @@ const serverFiles = {
                     renameTo: generator => `${generator.testDir}service/UserServiceIT.java`
                 },
                 {
-                    file: 'package/service/mapper/UserMapperIT.java',
-                    renameTo: generator => `${generator.testDir}service/mapper/UserMapperIT.java`
+                    file: 'package/service/mapper/UserMapperTest.java',
+                    renameTo: generator => `${generator.testDir}service/mapper/UserMapperTest.java`
                 },
                 {
                     file: 'package/web/rest/AccountResourceIT.java',
diff --git a/generators/server/prompts.js b/generators/server/prompts.js
index aa931c1139..1917643678 100644
--- a/generators/server/prompts.js
+++ b/generators/server/prompts.js
@@ -181,7 +181,7 @@ function askForServerSideOpts(meta) {
                     value: 'couchbase',
                     name: 'Couchbase'
                 });
-                if (!reactive && applicationType !== 'uaa') {
+                if (!reactive) {
                     opts.push({
                         value: 'no',
                         name: 'No database'
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 c1d03f2de9..7b5245afd9 100644
--- a/generators/server/templates/src/main/resources/swagger/api.yml.ejs
+++ b/generators/server/templates/src/main/resources/swagger/api.yml.ejs
@@ -23,9 +23,9 @@ info:
     title: "<%= baseName %>"
     version: 0.0.1
 servers:
-    - url: http://localhost:<%= serverPort %>/api
+    - url: http://localhost:<%= serverPort %>
       description: Development server
-    - url: https://localhost:<%= serverPort %>/api
+    - url: https://localhost:<%= serverPort %>
       description: Development server with TLS Profile
 paths: {}
 <% if(authenticationType === 'jwt') { %>


Test patch:
diff --git a/generators/client/templates/angular/src/test/javascript/protractor.conf.js.ejs b/generators/client/templates/angular/src/test/javascript/protractor.conf.js.ejs
index c4fa8facf4..816033f5ed 100644
--- a/generators/client/templates/angular/src/test/javascript/protractor.conf.js.ejs
+++ b/generators/client/templates/angular/src/test/javascript/protractor.conf.js.ejs
@@ -57,7 +57,7 @@ exports.config = {
     },
 
     onPrepare: function() {
-        browser.driver.manage().window().setSize(1280, 1024);
+        browser.driver.manage().window().setSize(1280, 10240);
         // Disable animations
         // @ts-ignore
         browser.executeScript('document.body.className += " notransition";');
diff --git a/generators/server/templates/src/test/java/package/service/mapper/UserMapperIT.java.ejs b/generators/server/templates/src/test/java/package/service/mapper/UserMapperTest.java.ejs
similarity index 85%
rename from generators/server/templates/src/test/java/package/service/mapper/UserMapperIT.java.ejs
rename to generators/server/templates/src/test/java/package/service/mapper/UserMapperTest.java.ejs
index db5a579962..cda367a944 100644
--- a/generators/server/templates/src/test/java/package/service/mapper/UserMapperIT.java.ejs
+++ b/generators/server/templates/src/test/java/package/service/mapper/UserMapperTest.java.ejs
@@ -18,16 +18,6 @@
 -%>
 package <%= packageName %>.service.mapper;
 
-<% if (databaseType === 'cassandra') { %>
-import <%=packageName%>.AbstractCassandraTest;
-<% } _%>
-<%_ if (cacheProvider === 'redis') { _%>
-import <%=packageName%>.RedisTestContainerExtension;
-<%_ } _%>
-import <%= packageName %>.<%= mainClass %>;
-<%_ if (authenticationType === 'oauth2') { _%>
-import <%=packageName%>.config.TestSecurityConfiguration;
-<%_ } _%>
 import <%= packageName %>.domain.<%= asEntity('User') %>;
 import <%= packageName %>.service.dto.<%= asDto('User') %>;
 <%_ if (authenticationType !== 'oauth2') { _%>
@@ -35,11 +25,6 @@ import org.apache.commons.lang3.RandomStringUtils;
 <%_ } _%>
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
-<%_ if (cacheProvider === 'redis') { _%>
-import org.junit.jupiter.api.extension.ExtendWith;
-<%_ } _%>
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
 
 import java.util.ArrayList;
 import java.util.HashSet;
@@ -49,17 +34,9 @@ import java.util.Set;
 import static org.assertj.core.api.Assertions.assertThat;
 
 /**
- * Integration tests for {@link UserMapper}.
+ * Unit tests for {@link UserMapper}.
  */
-<%_ if (authenticationType === 'oauth2') { _%>
-@SpringBootTest(classes = {<%= mainClass %>.class, TestSecurityConfiguration.class})
-<%_ } else { _%>
-@SpringBootTest(classes = <%= mainClass %>.class)
-<%_ } _%>
-<%_ if (cacheProvider === 'redis') { _%>
-@ExtendWith(RedisTestContainerExtension.class)
-<%_ } _%>
-public class UserMapperIT <% if (databaseType === 'cassandra') { %>extends AbstractCassandraTest <% } %>{
+public class UserMapperTest {
 
     private static final String DEFAULT_LOGIN = "johndoe";
     <%_ if (databaseType === 'sql' && authenticationType !== 'oauth2') { _%>
@@ -70,14 +47,13 @@ public class UserMapperIT <% if (databaseType === 'cassandra') { %>extends Abstr
     private static final String DEFAULT_ID = "id1";
     <%_ } _%>
 
-    @Autowired
     private UserMapper userMapper;
-
     private <%= asEntity('User') %> user;
     private <%= asDto('User') %> userDto;
 
     @BeforeEach
     public void init() {
+        userMapper = new UserMapper();
         user = new <%= asEntity('User') %>();
         user.setLogin(DEFAULT_LOGIN);
         <%_ if (authenticationType !== 'oauth2') { _%>
diff --git a/test/utils/expected-files.js b/test/utils/expected-files.js
index 8016d8c08f..df5adc316d 100644
--- a/test/utils/expected-files.js
+++ b/test/utils/expected-files.js
@@ -240,7 +240,7 @@ const expectedFiles = {
         `${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/service/mapper/UserMapperTest.java`,
         `${SERVER_TEST_SRC_DIR}com/mycompany/myapp/repository/CustomAuditEventRepositoryIT.java`
     ],