diff --git a/.github/workflows/angular.yml b/.github/workflows/angular.yml index 74348d03c045..4840aaa76283 100644 --- a/.github/workflows/angular.yml +++ b/.github/workflows/angular.yml @@ -136,18 +136,19 @@ jobs: run: npm run ci:backend:test continue-on-error: ${{matrix.continue-on-backend-tests-error || false}} timeout-minutes: 15 + # Run npm install for workspaces only, as it is done in packaging for non-workspaces - name: 'PREPARE: npm install' - if: steps.compare.outputs.equals != 'true' && matrix.skip-frontend-tests != 'true' && (matrix.sonar-analyse == 'true' || needs.build-matrix.outputs.client != 'false') - run: ${{ (matrix.workspaces == 'true' && 'npm') || './npmw' }} install + if: matrix.workspaces == 'true' + run: npm install timeout-minutes: 7 - - name: 'TESTS: frontend' - if: steps.compare.outputs.equals != 'true' && matrix.skip-frontend-tests != 'true' && (matrix.sonar-analyse == 'true' || needs.build-matrix.outputs.client != 'false') - run: npm run ci:frontend:test - timeout-minutes: 15 - name: 'TESTS: packaging' if: steps.compare.outputs.equals != 'true' run: npm run ci:e2e:package timeout-minutes: 12 + - name: 'TESTS: frontend' + if: steps.compare.outputs.equals != 'true' && matrix.skip-frontend-tests != 'true' && (matrix.sonar-analyse == 'true' || needs.build-matrix.outputs.client != 'false') + run: npm run ci:frontend:test + timeout-minutes: 15 - name: 'TESTS: Start docker compose containers for e2e tests' if: steps.compare.outputs.equals != 'true' run: npm run ci:e2e:prepare diff --git a/.github/workflows/react.yml b/.github/workflows/react.yml index 54ffedaeeb56..d8b0dc6d1ee4 100644 --- a/.github/workflows/react.yml +++ b/.github/workflows/react.yml @@ -113,12 +113,12 @@ jobs: #---------------------------------------------------------------------- - uses: jhipster/actions/compare-sample@v0 id: compare - with: - generator-path: generator-jhipster - cmd: jhipster.cjs generate-sample ${{ matrix.name }} --skip-jhipster-dependencies --skip-checks --skip-install --no-insight if: >- github.event.pull_request && !contains(github.event.pull_request.labels.*.name, 'pr: disable-compare') + with: + generator-path: generator-jhipster + cmd: jhipster.cjs generate-sample ${{ matrix.name }} --skip-jhipster-dependencies --skip-checks --skip-install --no-insight env: # generate-sample uses JHI_FOLDER_APP to generate the application. JHI_FOLDER_APP: ${{ github.workspace }}/base/app @@ -136,18 +136,19 @@ jobs: run: npm run ci:backend:test continue-on-error: ${{matrix.continue-on-backend-tests-error || false}} timeout-minutes: 15 + # Run npm install for workspaces only, as it is done in packaging for non-workspaces - name: 'PREPARE: npm install' - if: steps.compare.outputs.equals != 'true' && matrix.skip-frontend-tests != 'true' && needs.build-matrix.outputs.client != 'false' - run: ${{ (matrix.workspaces == 'true' && 'npm') || './npmw' }} install + if: matrix.workspaces == 'true' + run: npm install timeout-minutes: 7 - - name: 'TESTS: frontend' - if: steps.compare.outputs.equals != 'true' && matrix.skip-frontend-tests != 'true' && needs.build-matrix.outputs.client != 'false' - run: npm run ci:frontend:test - timeout-minutes: 15 - name: 'TESTS: packaging' if: steps.compare.outputs.equals != 'true' run: npm run ci:e2e:package timeout-minutes: 12 + - name: 'TESTS: frontend' + if: steps.compare.outputs.equals != 'true' && matrix.skip-frontend-tests != 'true' && needs.build-matrix.outputs.client != 'false' + run: npm run ci:frontend:test + timeout-minutes: 15 - name: 'TESTS: Start docker compose containers for e2e tests' if: steps.compare.outputs.equals != 'true' run: npm run ci:e2e:prepare diff --git a/.github/workflows/vue.yml b/.github/workflows/vue.yml index 2ee0cf26a7ed..f1b897b13fdf 100644 --- a/.github/workflows/vue.yml +++ b/.github/workflows/vue.yml @@ -136,18 +136,19 @@ jobs: run: npm run ci:backend:test continue-on-error: ${{matrix.continue-on-backend-tests-error || false}} timeout-minutes: 15 + # Run npm install for workspaces only, as it is done in packaging for non-workspaces - name: 'PREPARE: npm install' - if: steps.compare.outputs.equals != 'true' && matrix.skip-frontend-tests != 'true' && needs.build-matrix.outputs.client != 'false' - run: ${{ (matrix.workspaces == 'true' && 'npm') || './npmw' }} install + if: matrix.workspaces == 'true' + run: npm install timeout-minutes: 7 - - name: 'TESTS: frontend' - if: steps.compare.outputs.equals != 'true' && matrix.skip-frontend-tests != 'true' && needs.build-matrix.outputs.client != 'false' - run: npm run ci:frontend:test - timeout-minutes: 15 - name: 'TESTS: packaging' if: steps.compare.outputs.equals != 'true' run: npm run ci:e2e:package timeout-minutes: 12 + - name: 'TESTS: frontend' + if: steps.compare.outputs.equals != 'true' && matrix.skip-frontend-tests != 'true' && needs.build-matrix.outputs.client != 'false' + run: npm run ci:frontend:test + timeout-minutes: 15 - name: 'TESTS: Start docker compose containers for e2e tests' if: steps.compare.outputs.equals != 'true' run: npm run ci:e2e:prepare diff --git a/generators/spring-boot/templates/src/main/java/_package_/web/rest/AccountResource.java.ejs b/generators/spring-boot/templates/src/main/java/_package_/web/rest/AccountResource.java.ejs index a99bcaf2365c..0b731c84b1dc 100644 --- a/generators/spring-boot/templates/src/main/java/_package_/web/rest/AccountResource.java.ejs +++ b/generators/spring-boot/templates/src/main/java/_package_/web/rest/AccountResource.java.ejs @@ -40,6 +40,7 @@ import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.*; <%_ if (reactive) { _%> import java.util.Objects; @@ -139,7 +140,7 @@ public class AccountResource { * @param principal the authentication principal. * @return the login if the user is authenticated. */ - @GetMapping("/authenticate") + @GetMapping(value = "/authenticate", produces = MediaType.TEXT_PLAIN_VALUE) public String isAuthenticated(Principal principal) { LOG.debug("REST request to check if the current user is authenticated"); return principal == null ? null : principal.getName(); diff --git a/generators/spring-boot/templates/src/main/java/_package_/web/rest/AccountResource_oauth2.java.ejs b/generators/spring-boot/templates/src/main/java/_package_/web/rest/AccountResource_oauth2.java.ejs index aedc5b3bdb39..3bfead1f79df 100644 --- a/generators/spring-boot/templates/src/main/java/_package_/web/rest/AccountResource_oauth2.java.ejs +++ b/generators/spring-boot/templates/src/main/java/_package_/web/rest/AccountResource_oauth2.java.ejs @@ -24,6 +24,7 @@ import <%= packageName %>.service.dto.<%= user.adminUserDto %>; import java.security.Principal; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.http.MediaType; import org.springframework.security.authentication.AbstractAuthenticationToken; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; @@ -78,7 +79,7 @@ public class AccountResource { * @param principal the authentication principal. * @return the login if the user is authenticated. */ - @GetMapping("/authenticate") + @GetMapping(value = "/authenticate", produces = MediaType.TEXT_PLAIN_VALUE) public String isAuthenticated(Principal principal) { LOG.debug("REST request to check if the current user is authenticated"); return principal == null ? null : principal.getName(); diff --git a/generators/spring-boot/templates/src/main/java/_package_/web/rest/AccountResource_skipUserManagement.java.ejs b/generators/spring-boot/templates/src/main/java/_package_/web/rest/AccountResource_skipUserManagement.java.ejs index 44200f438ec4..a8525ef35ef2 100644 --- a/generators/spring-boot/templates/src/main/java/_package_/web/rest/AccountResource_skipUserManagement.java.ejs +++ b/generators/spring-boot/templates/src/main/java/_package_/web/rest/AccountResource_skipUserManagement.java.ejs @@ -48,6 +48,7 @@ import org.springframework.security.core.context.SecurityContextHolder; import com.fasterxml.jackson.annotation.JsonAnyGetter; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.http.MediaType; import org.springframework.security.core.GrantedAuthority; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; @@ -143,7 +144,7 @@ public class AccountResource { * @param principal the authentication principal. * @return the login if the user is authenticated. */ - @GetMapping("/authenticate") + @GetMapping(value = "/authenticate", produces = MediaType.TEXT_PLAIN_VALUE) public String isAuthenticated(Principal principal) { LOG.debug("REST request to check if the current user is authenticated"); return principal == null ? null : principal.getName(); diff --git a/generators/spring-boot/templates/src/main/java/_package_/web/rest/AuthenticateController.java.ejs b/generators/spring-boot/templates/src/main/java/_package_/web/rest/AuthenticateController.java.ejs index a86701c6b8f0..9c8c94892876 100644 --- a/generators/spring-boot/templates/src/main/java/_package_/web/rest/AuthenticateController.java.ejs +++ b/generators/spring-boot/templates/src/main/java/_package_/web/rest/AuthenticateController.java.ejs @@ -34,6 +34,7 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.Authentication; @@ -121,7 +122,7 @@ public class AuthenticateController { * @param principal the authentication principal. * @return the login if the user is authenticated. */ - @GetMapping("/authenticate") + @GetMapping(value = "/authenticate", produces = MediaType.TEXT_PLAIN_VALUE) public String isAuthenticated(Principal principal) { LOG.debug("REST request to check if the current user is authenticated"); return principal == null ? null : principal.getName(); diff --git a/generators/spring-boot/templates/src/test/java/_package_/security/jwt/TestAuthenticationResource.java.ejs b/generators/spring-boot/templates/src/test/java/_package_/security/jwt/TestAuthenticationResource.java.ejs index c3aed5b1f010..dd79577de29e 100644 --- a/generators/spring-boot/templates/src/test/java/_package_/security/jwt/TestAuthenticationResource.java.ejs +++ b/generators/spring-boot/templates/src/test/java/_package_/security/jwt/TestAuthenticationResource.java.ejs @@ -1,5 +1,6 @@ package <%= packageName %>.security.jwt; +import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.*; /** @@ -14,7 +15,7 @@ public class TestAuthenticationResource { * * @return ok. */ - @GetMapping("/authenticate") + @GetMapping(value = "/authenticate", produces = MediaType.TEXT_PLAIN_VALUE) public String isAuthenticated() { return "ok"; } diff --git a/generators/spring-boot/templates/src/test/java/_package_/web/rest/AccountResourceIT.java.ejs b/generators/spring-boot/templates/src/test/java/_package_/web/rest/AccountResourceIT.java.ejs index 91aab914452c..41a763744ec4 100644 --- a/generators/spring-boot/templates/src/test/java/_package_/web/rest/AccountResourceIT.java.ejs +++ b/generators/spring-boot/templates/src/test/java/_package_/web/rest/AccountResourceIT.java.ejs @@ -174,14 +174,14 @@ class AccountResourceIT { <%_ if (reactive) { _%> void testNonAuthenticatedUser() { accountWebTestClient.get().uri("/api/authenticate") - .accept(MediaType.APPLICATION_JSON) + .accept(MediaType.TEXT_PLAIN) .exchange() .expectStatus().isOk() .expectBody().isEmpty(); <%_ } else { _%> void testNonAuthenticatedUser() throws Exception { restAccountMockMvc - .perform(get("/api/authenticate").accept(MediaType.APPLICATION_JSON)) + .perform(get("/api/authenticate").accept(MediaType.TEXT_PLAIN)) .andExpect(status().isOk()) .andExpect(content().string("")); <%_ } _%> @@ -193,14 +193,14 @@ class AccountResourceIT { void testAuthenticatedUser() { accountWebTestClient .get().uri("/api/authenticate") - .accept(MediaType.APPLICATION_JSON) + .accept(MediaType.TEXT_PLAIN) .exchange() .expectStatus().isOk() .expectBody(String.class).isEqualTo(TEST_USER_LOGIN); <%_ } else { _%> void testAuthenticatedUser() throws Exception { restAccountMockMvc - .perform(get("/api/authenticate").with(request -> request).accept(MediaType.APPLICATION_JSON)) + .perform(get("/api/authenticate").with(request -> request).accept(MediaType.TEXT_PLAIN)) .andExpect(status().isOk()) .andExpect(content().string(TEST_USER_LOGIN)); <%_ } _%> diff --git a/generators/spring-boot/templates/src/test/java/_package_/web/rest/AccountResourceIT_oauth2.java.ejs b/generators/spring-boot/templates/src/test/java/_package_/web/rest/AccountResourceIT_oauth2.java.ejs index acea88f2e112..805b52fcbb30 100644 --- a/generators/spring-boot/templates/src/test/java/_package_/web/rest/AccountResourceIT_oauth2.java.ejs +++ b/generators/spring-boot/templates/src/test/java/_package_/web/rest/AccountResourceIT_oauth2.java.ejs @@ -185,13 +185,13 @@ class AccountResourceIT { void testNonAuthenticatedUser() <% if (!reactive) { %>throws Exception <% } %>{ <%_ if (reactive) { _%> webTestClient.get().uri("/api/authenticate") - .accept(MediaType.APPLICATION_JSON) + .accept(MediaType.TEXT_PLAIN) .exchange() .expectStatus().isOk() .expectBody().isEmpty(); <%_ } else { _%> restAccountMockMvc.perform(get("/api/authenticate") - .accept(MediaType.APPLICATION_JSON)) + .accept(MediaType.TEXT_PLAIN)) .andExpect(status().isOk()) .andExpect(content().string("")); <%_ } _%> @@ -203,14 +203,14 @@ class AccountResourceIT { <%_ if (reactive) { _%> webTestClient .get().uri("/api/authenticate") - .accept(MediaType.APPLICATION_JSON) + .accept(MediaType.TEXT_PLAIN) .exchange() .expectStatus().isOk() .expectBody(String.class).isEqualTo(TEST_USER_LOGIN); <%_ } else { _%> restAccountMockMvc.perform(get("/api/authenticate") .with(request -> request) - .accept(MediaType.APPLICATION_JSON)) + .accept(MediaType.TEXT_PLAIN)) .andExpect(status().isOk()) .andExpect(content().string(TEST_USER_LOGIN)); <%_ } _%> diff --git a/generators/spring-boot/templates/src/test/java/_package_/web/rest/AccountResourceIT_skipUserManagement.java.ejs b/generators/spring-boot/templates/src/test/java/_package_/web/rest/AccountResourceIT_skipUserManagement.java.ejs index c2bcbc27eba1..46ccb1c54867 100644 --- a/generators/spring-boot/templates/src/test/java/_package_/web/rest/AccountResourceIT_skipUserManagement.java.ejs +++ b/generators/spring-boot/templates/src/test/java/_package_/web/rest/AccountResourceIT_skipUserManagement.java.ejs @@ -116,13 +116,13 @@ class AccountResourceIT { void testNonAuthenticatedUser() <% if (!reactive) { %>throws Exception <% } %>{ <%_ if (reactive) { _%> accountWebTestClient.get().uri("/api/authenticate") - .accept(MediaType.APPLICATION_JSON) + .accept(MediaType.TEXT_PLAIN) .exchange() .expectStatus().isOk() .expectBody().isEmpty(); <%_ } else { _%> restAccountMockMvc.perform(get("/api/authenticate") - .accept(MediaType.APPLICATION_JSON)) + .accept(MediaType.TEXT_PLAIN)) .andExpect(status().isOk()) .andExpect(content().string("")); <%_ } _%> @@ -134,14 +134,14 @@ class AccountResourceIT { <%_ if (reactive) { _%> accountWebTestClient .get().uri("/api/authenticate") - .accept(MediaType.APPLICATION_JSON) + .accept(MediaType.TEXT_PLAIN) .exchange() .expectStatus().isOk() .expectBody(String.class).isEqualTo(TEST_USER_LOGIN); <%_ } else { _%> restAccountMockMvc.perform(get("/api/authenticate") .with(request -> request) - .accept(MediaType.APPLICATION_JSON)) + .accept(MediaType.TEXT_PLAIN)) .andExpect(status().isOk()) .andExpect(content().string(TEST_USER_LOGIN)); <%_ } _%>