From e2ae79dbc8b0e4741702fab11d9f745c6b66d719 Mon Sep 17 00:00:00 2001 From: Marcelo Shima Date: Mon, 5 Aug 2024 17:45:33 -0300 Subject: [PATCH] templates adjusts --- generators/spring-boot-v2/generator.js | 2 + .../LocaleConfiguration_reactive.kt.ejs | 2 +- generators/spring-boot/generator.js | 3 -- generators/spring-boot/templates.spec.js | 8 ++-- .../field_validators.ejs | 0 .../it_patch_update.partial.kt.ejs | 0 .../save_template.ejs | 0 .../update_template.ejs | 0 .../field_validators.ejs | 0 ...ersistClass_.kt.jhi.jakarta_validation.ejs | 2 +- .../domain/_persistClass_Test.kt.ejs | 2 +- .../client/AuthorizedFeignClient.kt.ejs | 3 +- .../filter/ModifyServersOpenApiFilter.kt.ejs | 2 +- .../config/KafkaTestContainer.kt.ejs | 2 +- .../rest/KafkaResourceIT_imperative.kt.ejs | 42 +++++++++---------- .../save_template.ejs | 0 .../update_template.ejs | 0 .../config/CacheConfiguration.kt.ejs | 12 +++--- ...istClass_.kt.jhi.spring_data_couchbase.ejs | 2 +- .../repository/_entityClass_Repository.kt.ejs | 2 +- .../CouchbaseSearchRepository.kt.ejs | 2 +- ...PersistentTokenRepository_couchbase.kt.ejs | 2 +- .../search/UserSearchRepository.kt.ejs | 2 +- .../dbmigrations/InitialSetupMigration.kt.ejs | 6 +-- ...ass_RepositoryInternalImpl_reactive.kt.ejs | 10 ++--- .../repository/EntityManager_reactive.kt.ejs | 8 ++-- .../rowmapper/UserRowMapper_reactive.kt.ejs | 2 +- .../config/MariadbTestContainer.kt.ejs | 2 +- .../config/MysqlTestContainer.kt.ejs | 2 +- .../config/application-testdev.yml.ejs | 2 +- .../config/application-testprod.yml.ejs | 2 +- .../main/kotlin/_package_/Application.kt.ejs | 7 ++-- .../delete_template.ejs | 0 .../get_all_stream_template.ejs | 0 .../get_all_template.ejs | 0 .../get_filtered_template.ejs | 0 .../get_template.ejs | 0 .../inject_template.ejs | 0 .../patch_template.ejs | 0 .../search_stream_template.ejs | 0 .../search_template.ejs | 0 .../repository/UserRepository.kt.ejs | 10 ++--- .../service/UserService.kt.ejs | 2 +- .../service/_entityClass_QueryService.kt.ejs | 4 +- .../service/dto/_dtoClass_.kt.ejs | 2 +- .../impl/_entityClass_ServiceImpl.kt.ejs | 16 +++---- .../web/rest/UserResource.kt.ejs | 8 ++-- .../web/rest/_entityClass_Resource.kt.ejs | 16 +++---- .../_package_/config/CRLFLogConverter.kt.ejs | 13 +++++- .../EurekaWorkaroundConfiguration.kt.ejs | 2 +- .../config/OAuth2Configuration.kt.ejs | 1 - .../PersistentTokenRepository.kt.ejs | 4 +- .../security/DomainUserDetailsService.kt.ejs | 2 +- .../PersistentTokenRememberMeServices.kt.ejs | 2 +- .../_package_/service/MailService.kt.ejs | 2 +- .../_package_/service/dto/AdminUserDTO.kt.ejs | 2 +- .../_package_/service/dto/UserDTO.kt.ejs | 6 +-- .../service/mapper/UserMapper.kt.ejs | 30 ++++++------- .../web/rest/AuthenticateController.kt.ejs} | 0 .../web/rest/LogoutResource_reactive.kt.ejs | 3 +- .../service/UserServiceIT.kt.ejs | 2 +- .../service/dto/_dtoClass_Test.kt.ejs | 2 +- .../mapper/_entityClass_MapperTest.kt.ejs | 2 +- .../web/rest/PublicUserResourceIT.kt.ejs | 9 ++-- .../web/rest/UserResourceIT.kt.ejs | 2 +- .../web/rest/_entityClass_ResourceIT.kt.ejs | 4 +- .../JHipsterBlockHoundIntegration.kt.ejs | 8 ++-- .../DomainUserDetailsServiceIT.kt.ejs | 2 +- ...okenAuthenticationSecurityMetersIT.kt.ejs} | 0 .../oauth2/CustomClaimConverterIT.kt.ejs | 8 ++-- .../_package_/service/MailServiceIT.kt.ejs | 2 +- .../service/mapper/UserMapperTest.kt.ejs | 4 +- .../web/rest/AccountResourceIT.kt.ejs | 2 +- .../web/rest/AuthenticateControllerIT.kt.ejs} | 2 +- .../kotlin/_package_/web/rest/TestUtil.kt.ejs | 11 ++--- 75 files changed, 162 insertions(+), 154 deletions(-) rename generators/spring-boot/templates/{domain/src/main/kotlin/_package_/_entityPackage_/common => _global_partials_entity_}/field_validators.ejs (100%) rename generators/spring-boot/templates/{partials => _global_partials_entity_}/it_patch_update.partial.kt.ejs (100%) rename generators/spring-boot/templates/{partials => _global_partials_entity_}/save_template.ejs (100%) rename generators/spring-boot/templates/{partials => _global_partials_entity_}/update_template.ejs (100%) rename generators/spring-boot/templates/{src/main/kotlin/_package_/_entityPackage_/common => domain/_global_partials_entity_}/field_validators.ejs (100%) rename generators/spring-boot/templates/reactive/{partials => _global_partials_entity_}/save_template.ejs (100%) rename generators/spring-boot/templates/reactive/{partials => _global_partials_entity_}/update_template.ejs (100%) rename generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/{common => _partials_entity_}/delete_template.ejs (100%) rename generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/{common => _partials_entity_}/get_all_stream_template.ejs (100%) rename generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/{common => _partials_entity_}/get_all_template.ejs (100%) rename generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/{common => _partials_entity_}/get_filtered_template.ejs (100%) rename generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/{common => _partials_entity_}/get_template.ejs (100%) rename generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/{common => _partials_entity_}/inject_template.ejs (100%) rename generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/{common => _partials_entity_}/patch_template.ejs (100%) rename generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/{common => _partials_entity_}/search_stream_template.ejs (100%) rename generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/{common => _partials_entity_}/search_template.ejs (100%) rename generators/{spring-boot-v2/templates/src/main/kotlin/_package_/web/rest/UserJWTController.kt.ejs => spring-boot/templates/src/main/kotlin/_package_/web/rest/AuthenticateController.kt.ejs} (100%) rename generators/{spring-boot-v2/templates/src/test/kotlin/_package_/security/jwt/TokenProviderSecurityMetersTests.kt.ejs => spring-boot/templates/src/test/kotlin/_package_/security/jwt/TokenAuthenticationSecurityMetersIT.kt.ejs} (100%) rename generators/{spring-boot-v2/templates/src/test/kotlin/_package_/web/rest/UserJWTControllerIT.kt.ejs => spring-boot/templates/src/test/kotlin/_package_/web/rest/AuthenticateControllerIT.kt.ejs} (99%) diff --git a/generators/spring-boot-v2/generator.js b/generators/spring-boot-v2/generator.js index 38c643582..c91d8c69b 100644 --- a/generators/spring-boot-v2/generator.js +++ b/generators/spring-boot-v2/generator.js @@ -100,6 +100,8 @@ export default class extends BaseApplicationGenerator { ['JWT_UserFeignClientInterceptor.', 'UserFeignClientInterceptor_jwt.'], ['OAuth2UserClientFeignConfiguration.', 'OAuth2InterceptedFeignConfiguration.'], ['OAuth2_UserFeignClientInterceptor.', 'TokenRelayRequestInterceptor.'], + ['UserJWTController', 'AuthenticateController'], + ['TokenProviderSecurityMetersTests', 'TokenAuthenticationSecurityMetersIT'], ]) { // Files renamed in v8 sourceFile = sourceFile.replace(...fileMap); diff --git a/generators/spring-boot-v2/templates/src/main/kotlin/_package_/config/LocaleConfiguration_reactive.kt.ejs b/generators/spring-boot-v2/templates/src/main/kotlin/_package_/config/LocaleConfiguration_reactive.kt.ejs index 38cfdab63..7b3c3f2ac 100644 --- a/generators/spring-boot-v2/templates/src/main/kotlin/_package_/config/LocaleConfiguration_reactive.kt.ejs +++ b/generators/spring-boot-v2/templates/src/main/kotlin/_package_/config/LocaleConfiguration_reactive.kt.ejs @@ -135,7 +135,7 @@ class LocaleConfiguration { } } if (locale != null) { - exchange.attributes[LOCALE_REQUEST_ATTRIBUTE_NAME] = locale + exchange.attributes[LOCALE_REQUEST_ATTRIBUTE_NAME] = locale } if (timeZone != null) { exchange.attributes[TIME_ZONE_REQUEST_ATTRIBUTE_NAME] = timeZone diff --git a/generators/spring-boot/generator.js b/generators/spring-boot/generator.js index 5b07f96a0..3b87fdc06 100644 --- a/generators/spring-boot/generator.js +++ b/generators/spring-boot/generator.js @@ -77,10 +77,7 @@ export default class extends BaseApplicationGenerator { 'JwtAuthenticationTestUtils.java', 'AuthenticationIntegrationTest.java', 'SecurityInMemoryConfiguration.java', - 'TokenAuthenticationSecurityMetersIT.java', 'TokenAuthenticationIT.java', - 'AuthenticateController.java', - 'AuthenticateControllerIT.java', 'CRLFLogConverterTest.java', 'SpaWebFilterIT_reactive.java', 'SpaWebFilterTestController_reactive.java', diff --git a/generators/spring-boot/templates.spec.js b/generators/spring-boot/templates.spec.js index dd6663233..9636a9c1c 100644 --- a/generators/spring-boot/templates.spec.js +++ b/generators/spring-boot/templates.spec.js @@ -17,9 +17,9 @@ describe('test if kotlin templates has a matching java template', async () => { for (const file of files.filter( file => // Partials reworked - !file.includes('/common/') && - // Partials reworked - !file.includes('/partials/') && + !file.includes('field_validators.ejs') && + // Removed partial + !file.includes('update_template.ejs') && // Partials reworked !file.includes('relationship_validators.ejs') && // Modularized file in JHipster 8 @@ -30,7 +30,7 @@ describe('test if kotlin templates has a matching java template', async () => { const javaTemplate = file.replace('.kt', '.java').replace('kotlin/_package_', 'java/_package_'); const possibleTemplates = []; let javaTemplateRelativePath; - if (['src', 'partials', 'reactive'].includes(folder)) { + if (['src', '_global_partials_entity_', 'reactive'].includes(folder)) { javaTemplateRelativePath = relative(join(__dirname, 'templates'), javaTemplate); possibleTemplates.push( join(jhipster8Generators, 'server/templates', javaTemplateRelativePath), diff --git a/generators/spring-boot/templates/domain/src/main/kotlin/_package_/_entityPackage_/common/field_validators.ejs b/generators/spring-boot/templates/_global_partials_entity_/field_validators.ejs similarity index 100% rename from generators/spring-boot/templates/domain/src/main/kotlin/_package_/_entityPackage_/common/field_validators.ejs rename to generators/spring-boot/templates/_global_partials_entity_/field_validators.ejs diff --git a/generators/spring-boot/templates/partials/it_patch_update.partial.kt.ejs b/generators/spring-boot/templates/_global_partials_entity_/it_patch_update.partial.kt.ejs similarity index 100% rename from generators/spring-boot/templates/partials/it_patch_update.partial.kt.ejs rename to generators/spring-boot/templates/_global_partials_entity_/it_patch_update.partial.kt.ejs diff --git a/generators/spring-boot/templates/partials/save_template.ejs b/generators/spring-boot/templates/_global_partials_entity_/save_template.ejs similarity index 100% rename from generators/spring-boot/templates/partials/save_template.ejs rename to generators/spring-boot/templates/_global_partials_entity_/save_template.ejs diff --git a/generators/spring-boot/templates/partials/update_template.ejs b/generators/spring-boot/templates/_global_partials_entity_/update_template.ejs similarity index 100% rename from generators/spring-boot/templates/partials/update_template.ejs rename to generators/spring-boot/templates/_global_partials_entity_/update_template.ejs diff --git a/generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/common/field_validators.ejs b/generators/spring-boot/templates/domain/_global_partials_entity_/field_validators.ejs similarity index 100% rename from generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/common/field_validators.ejs rename to generators/spring-boot/templates/domain/_global_partials_entity_/field_validators.ejs diff --git a/generators/spring-boot/templates/domain/src/main/kotlin/_package_/_entityPackage_/domain/_persistClass_.kt.jhi.jakarta_validation.ejs b/generators/spring-boot/templates/domain/src/main/kotlin/_package_/_entityPackage_/domain/_persistClass_.kt.jhi.jakarta_validation.ejs index cf7e17da9..fe151134c 100644 --- a/generators/spring-boot/templates/domain/src/main/kotlin/_package_/_entityPackage_/domain/_persistClass_.kt.jhi.jakarta_validation.ejs +++ b/generators/spring-boot/templates/domain/src/main/kotlin/_package_/_entityPackage_/domain/_persistClass_.kt.jhi.jakarta_validation.ejs @@ -32,7 +32,7 @@ import javax.validation.constraints.* <%_ for (const field of fields) { _%> <&_ if (fragment.field<%- field.fieldNameCapitalized %>AnnotationSection) { -&> <%_ if (field.fieldValidate === true) { -%> - <%- include('../common/field_validators', {field, reactive}); -%> + <%- include('../../../../../../_global_partials_entity_/field_validators', {field, reactive}); -%> <%_ } _%> <&_ } -&> <%_ } -%> diff --git a/generators/spring-boot/templates/domain/src/test/kotlin/_package_/_entityPackage_/domain/_persistClass_Test.kt.ejs b/generators/spring-boot/templates/domain/src/test/kotlin/_package_/_entityPackage_/domain/_persistClass_Test.kt.ejs index 4365837d5..b559ce13d 100644 --- a/generators/spring-boot/templates/domain/src/test/kotlin/_package_/_entityPackage_/domain/_persistClass_Test.kt.ejs +++ b/generators/spring-boot/templates/domain/src/test/kotlin/_package_/_entityPackage_/domain/_persistClass_Test.kt.ejs @@ -1,5 +1,5 @@ <%# - Copyright 2013-2019 the original author or authors from the JHipster project. + Copyright 2013-2024 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. diff --git a/generators/spring-boot/templates/feign-client/src/main/kotlin/_package_/client/AuthorizedFeignClient.kt.ejs b/generators/spring-boot/templates/feign-client/src/main/kotlin/_package_/client/AuthorizedFeignClient.kt.ejs index 881865d63..430b1a753 100644 --- a/generators/spring-boot/templates/feign-client/src/main/kotlin/_package_/client/AuthorizedFeignClient.kt.ejs +++ b/generators/spring-boot/templates/feign-client/src/main/kotlin/_package_/client/AuthorizedFeignClient.kt.ejs @@ -19,7 +19,6 @@ package <%= packageName %>.client import org.springframework.cloud.openfeign.FeignClient -import org.springframework.cloud.openfeign.FeignClientsConfiguration import org.springframework.core.annotation.AliasFor import kotlin.reflect.KClass @@ -40,7 +39,7 @@ annotation class AuthorizedFeignClient( * [feign.codec.Encoder], [feign.Contract]. * * @return the custom `@Configuration` for the feign client. - * @see FeignClientsConfiguration for the defaults. + * @see org.springframework.cloud.openfeign.FeignClientsConfiguration for the defaults. */ @get:AliasFor(annotation = FeignClient::class, attribute = "configuration") val configuration: Array> = [OAuth2InterceptedFeignConfiguration::class], diff --git a/generators/spring-boot/templates/gateway/src/main/kotlin/_package_/web/filter/ModifyServersOpenApiFilter.kt.ejs b/generators/spring-boot/templates/gateway/src/main/kotlin/_package_/web/filter/ModifyServersOpenApiFilter.kt.ejs index 9a663c166..7ce8e4464 100644 --- a/generators/spring-boot/templates/gateway/src/main/kotlin/_package_/web/filter/ModifyServersOpenApiFilter.kt.ejs +++ b/generators/spring-boot/templates/gateway/src/main/kotlin/_package_/web/filter/ModifyServersOpenApiFilter.kt.ejs @@ -65,7 +65,7 @@ class ModifyServersOpenApiFilter: GlobalFilter, Ordered { private val log = LoggerFactory.getLogger(javaClass) private var rewritedBody = "" - + fun getRewritedBody() = rewritedBody override fun writeWith(body: Publisher): Mono { diff --git a/generators/spring-boot/templates/kafka/src/test/kotlin/_package_/config/KafkaTestContainer.kt.ejs b/generators/spring-boot/templates/kafka/src/test/kotlin/_package_/config/KafkaTestContainer.kt.ejs index e3192e2d9..0fff0f9ac 100644 --- a/generators/spring-boot/templates/kafka/src/test/kotlin/_package_/config/KafkaTestContainer.kt.ejs +++ b/generators/spring-boot/templates/kafka/src/test/kotlin/_package_/config/KafkaTestContainer.kt.ejs @@ -36,7 +36,7 @@ class KafkaTestContainer: InitializingBean, DisposableBean { .withLogConsumer(Slf4jLogConsumer(log)) .withReuse(true) } - + override fun destroy() { if (null != kafkaContainer && kafkaContainer.isRunning) { kafkaContainer.close() diff --git a/generators/spring-boot/templates/kafka/src/test/kotlin/_package_/web/rest/KafkaResourceIT_imperative.kt.ejs b/generators/spring-boot/templates/kafka/src/test/kotlin/_package_/web/rest/KafkaResourceIT_imperative.kt.ejs index 0d9e9dbac..aa805a9fd 100644 --- a/generators/spring-boot/templates/kafka/src/test/kotlin/_package_/web/rest/KafkaResourceIT_imperative.kt.ejs +++ b/generators/spring-boot/templates/kafka/src/test/kotlin/_package_/web/rest/KafkaResourceIT_imperative.kt.ejs @@ -26,27 +26,27 @@ import org.springframework.test.web.servlet.result.MockMvcResultMatchers.content import org.springframework.test.web.servlet.result.MockMvcResultMatchers.request import org.springframework.test.web.servlet.result.MockMvcResultMatchers.status -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.BlockingQueue; - -import org.junit.jupiter.api.Test; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; -import org.springframework.cloud.stream.test.binder.MessageCollector; -import org.springframework.messaging.Message; -import org.springframework.messaging.MessageChannel; -import org.springframework.messaging.MessageHeaders; -import org.springframework.messaging.support.GenericMessage; -import org.springframework.security.test.context.support.WithMockUser; -import org.springframework.test.web.servlet.MockMvc; -import org.springframework.test.web.servlet.MvcResult; -import org.springframework.util.MimeTypeUtils; -import <%= packageName %>.IntegrationTest; -import <%= packageName %>.config.EmbeddedKafka; -import <%= packageName %>.config.KafkaSseConsumer; -import <%= packageName %>.config.KafkaSseProducer; +import java.util.HashMap +import java.util.Map +import java.util.concurrent.BlockingQueue + +import org.junit.jupiter.api.Test +import org.springframework.beans.factory.annotation.Autowired +import org.springframework.beans.factory.annotation.Qualifier +import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc +import org.springframework.cloud.stream.test.binder.MessageCollector +import org.springframework.messaging.Message +import org.springframework.messaging.MessageChannel +import org.springframework.messaging.MessageHeaders +import org.springframework.messaging.support.GenericMessage +import org.springframework.security.test.context.support.WithMockUser +import org.springframework.test.web.servlet.MockMvc +import org.springframework.test.web.servlet.MvcResult +import org.springframework.util.MimeTypeUtils +import <%= packageName %>.IntegrationTest +import <%= packageName %>.config.EmbeddedKafka +import <%= packageName %>.config.KafkaSseConsumer +import <%= packageName %>.config.KafkaSseProducer @IntegrationTest @AutoConfigureMockMvc diff --git a/generators/spring-boot/templates/reactive/partials/save_template.ejs b/generators/spring-boot/templates/reactive/_global_partials_entity_/save_template.ejs similarity index 100% rename from generators/spring-boot/templates/reactive/partials/save_template.ejs rename to generators/spring-boot/templates/reactive/_global_partials_entity_/save_template.ejs diff --git a/generators/spring-boot/templates/reactive/partials/update_template.ejs b/generators/spring-boot/templates/reactive/_global_partials_entity_/update_template.ejs similarity index 100% rename from generators/spring-boot/templates/reactive/partials/update_template.ejs rename to generators/spring-boot/templates/reactive/_global_partials_entity_/update_template.ejs diff --git a/generators/spring-boot/templates/spring-cache/src/main/kotlin/_package_/config/CacheConfiguration.kt.ejs b/generators/spring-boot/templates/spring-cache/src/main/kotlin/_package_/config/CacheConfiguration.kt.ejs index 65d9c42b9..e47873bd8 100644 --- a/generators/spring-boot/templates/spring-cache/src/main/kotlin/_package_/config/CacheConfiguration.kt.ejs +++ b/generators/spring-boot/templates/spring-cache/src/main/kotlin/_package_/config/CacheConfiguration.kt.ejs @@ -222,12 +222,12 @@ class CacheConfiguration(<%_ if (!cacheProviderNo) { _%> createCache(cm, <%= packageName %>.repository.UserRepository.USERS_BY_LOGIN_CACHE) createCache(cm, <%= packageName %>.repository.UserRepository.USERS_BY_EMAIL_CACHE) <%_ if (enableHibernateCache) { _%> - createCache(cm, <%= packageName %>.domain.<%= user.persistClass %>::class.java.name) + createCache(cm, <%= user.entityAbsoluteClass %>::class.java.name) createCache(cm, <%= packageName %>.domain.Authority::class.java.name) - createCache(cm, <%= packageName %>.domain.<%= user.persistClass %>::class.java.name + ".authorities") + createCache(cm, <%= user.entityAbsoluteClass %>::class.java.name + ".authorities") <%_ if (authenticationTypeSession) { _%> createCache(cm, <%= packageName %>.domain.PersistentToken::class.java.name) - createCache(cm, <%= packageName %>.domain.<%= user.persistClass %>::class.java.name + ".persistentTokens") + createCache(cm, <%= user.entityAbsoluteClass %>::class.java.name + ".persistentTokens") <%_ } _%> <%_ } _%> <%_ } _%> @@ -731,12 +731,12 @@ class CacheConfiguration(<%_ if (!cacheProviderNo) { _%> createCache(it, <%= packageName %>.repository.UserRepository.USERS_BY_LOGIN_CACHE, jcacheConfiguration) createCache(it, <%= packageName %>.repository.UserRepository.USERS_BY_EMAIL_CACHE, jcacheConfiguration) <%_ if (enableHibernateCache) { _%> - createCache(it, <%= packageName %>.domain.<%= user.persistClass %>::class.java.name, jcacheConfiguration) + createCache(it, <%= user.entityAbsoluteClass %>::class.java.name, jcacheConfiguration) createCache(it, <%= packageName %>.domain.Authority::class.java.name, jcacheConfiguration) - createCache(it, <%= packageName %>.domain.<%= user.persistClass %>::class.java.name + ".authorities", jcacheConfiguration) + createCache(it, <%= user.entityAbsoluteClass %>::class.java.name + ".authorities", jcacheConfiguration) <%_ if (authenticationTypeSession) { _%> createCache(it, <%= packageName %>.domain.PersistentToken::class.java.name, jcacheConfiguration) - createCache(it, <%= packageName %>.domain.<%= user.persistClass %>::class.java.name + ".persistentTokens", jcacheConfiguration) + createCache(it, <%= user.entityAbsoluteClass %>::class.java.name + ".persistentTokens", jcacheConfiguration) <%_ } _%> <%_ } _%> <%_ } _%> diff --git a/generators/spring-boot/templates/spring-data-couchbase/src/main/kotlin/_package_/_entityPackage_/domain/_persistClass_.kt.jhi.spring_data_couchbase.ejs b/generators/spring-boot/templates/spring-data-couchbase/src/main/kotlin/_package_/_entityPackage_/domain/_persistClass_.kt.jhi.spring_data_couchbase.ejs index beb9f833f..e4a7b4c63 100644 --- a/generators/spring-boot/templates/spring-data-couchbase/src/main/kotlin/_package_/_entityPackage_/domain/_persistClass_.kt.jhi.spring_data_couchbase.ejs +++ b/generators/spring-boot/templates/spring-data-couchbase/src/main/kotlin/_package_/_entityPackage_/domain/_persistClass_.kt.jhi.spring_data_couchbase.ejs @@ -24,7 +24,7 @@ EJS fragments will process % delimiter tags in template and & delimiter tags in <&_ if (fragment.importSection) { -&> <%_ if (!embedded) { _%> import <%= packageName %>.config.ID_DELIMITER -import <%= packageName %>.domain.<%= persistClass %>.Companion.TYPE_NAME +import <%= entityAbsoluteClass %>.Companion.TYPE_NAME import org.springframework.data.couchbase.core.mapping.id.GenerationStrategy import org.springframework.data.annotation.Id import org.springframework.data.couchbase.core.mapping.id.GeneratedValue diff --git a/generators/spring-boot/templates/spring-data-couchbase/src/main/kotlin/_package_/_entityPackage_/repository/_entityClass_Repository.kt.ejs b/generators/spring-boot/templates/spring-data-couchbase/src/main/kotlin/_package_/_entityPackage_/repository/_entityClass_Repository.kt.ejs index f1e833eed..d1d36f4fd 100644 --- a/generators/spring-boot/templates/spring-data-couchbase/src/main/kotlin/_package_/_entityPackage_/repository/_entityClass_Repository.kt.ejs +++ b/generators/spring-boot/templates/spring-data-couchbase/src/main/kotlin/_package_/_entityPackage_/repository/_entityClass_Repository.kt.ejs @@ -49,7 +49,7 @@ import java.util.UUID import <%= packageName %>.repository.CouchbaseSearchRepository.Companion.SEARCH_CONDITION <%_ } _%> -import <%= packageName %>.domain.<%= persistClass %>.Companion.TYPE_NAME +import <%= entityAbsoluteClass %>.Companion.TYPE_NAME /** * Spring Data Couchbase repository for the <%= persistClass %> entity. diff --git a/generators/spring-boot/templates/spring-data-couchbase/src/main/kotlin/_package_/repository/CouchbaseSearchRepository.kt.ejs b/generators/spring-boot/templates/spring-data-couchbase/src/main/kotlin/_package_/repository/CouchbaseSearchRepository.kt.ejs index 75bb73c2e..18b1c3ddc 100644 --- a/generators/spring-boot/templates/spring-data-couchbase/src/main/kotlin/_package_/repository/CouchbaseSearchRepository.kt.ejs +++ b/generators/spring-boot/templates/spring-data-couchbase/src/main/kotlin/_package_/repository/CouchbaseSearchRepository.kt.ejs @@ -88,7 +88,7 @@ interface CouchbaseSearchRepository: JHipsterCouchbaseRepository { @Query(FIND_IDS_QUERY + " AND " + SEARCH_CONDITION) @ScanConsistency(query = QueryScanConsistency.NOT_BOUNDED) - fun searchIds(queryString: String): <%= listOrFlux %> + fun searchIds(queryString: String): <%= listOrFlux %> @Query(FIND_IDS_QUERY + " AND " + SEARCH_CONDITION) @ScanConsistency(query = QueryScanConsistency.NOT_BOUNDED) diff --git a/generators/spring-boot/templates/spring-data-couchbase/src/main/kotlin/_package_/repository/PersistentTokenRepository_couchbase.kt.ejs b/generators/spring-boot/templates/spring-data-couchbase/src/main/kotlin/_package_/repository/PersistentTokenRepository_couchbase.kt.ejs index be5964e62..daf970014 100644 --- a/generators/spring-boot/templates/spring-data-couchbase/src/main/kotlin/_package_/repository/PersistentTokenRepository_couchbase.kt.ejs +++ b/generators/spring-boot/templates/spring-data-couchbase/src/main/kotlin/_package_/repository/PersistentTokenRepository_couchbase.kt.ejs @@ -19,7 +19,7 @@ package <%= packageName %>.repository import <%= packageName %>.domain.PersistentToken -import <%= packageName %>.domain.<%= user.persistClass %> +import <%= user.entityAbsoluteClass %> import org.springframework.data.couchbase.repository.CouchbaseRepository import java.util.List import java.util.Optional diff --git a/generators/spring-boot/templates/spring-data-elasticsearch/src/main/kotlin/_package_/repository/search/UserSearchRepository.kt.ejs b/generators/spring-boot/templates/spring-data-elasticsearch/src/main/kotlin/_package_/repository/search/UserSearchRepository.kt.ejs index 0d6e503ff..280f7688a 100644 --- a/generators/spring-boot/templates/spring-data-elasticsearch/src/main/kotlin/_package_/repository/search/UserSearchRepository.kt.ejs +++ b/generators/spring-boot/templates/spring-data-elasticsearch/src/main/kotlin/_package_/repository/search/UserSearchRepository.kt.ejs @@ -18,7 +18,7 @@ -%> package <%= packageName %>.repository.search -import <%= packageName %>.domain.<%= user.persistClass %> +import <%= user.entityAbsoluteClass %> <%_ if (reactive) { _%> import org.springframework.data.elasticsearch.core.ReactiveElasticsearchTemplate <%_ } else { _%> diff --git a/generators/spring-boot/templates/spring-data-mongodb/src/main/kotlin/_package_/config/dbmigrations/InitialSetupMigration.kt.ejs b/generators/spring-boot/templates/spring-data-mongodb/src/main/kotlin/_package_/config/dbmigrations/InitialSetupMigration.kt.ejs index 8e83ceeb0..267d1400e 100644 --- a/generators/spring-boot/templates/spring-data-mongodb/src/main/kotlin/_package_/config/dbmigrations/InitialSetupMigration.kt.ejs +++ b/generators/spring-boot/templates/spring-data-mongodb/src/main/kotlin/_package_/config/dbmigrations/InitialSetupMigration.kt.ejs @@ -19,7 +19,7 @@ package <%= packageName %>.config.dbmigrations import <%= packageName %>.domain.Authority -import <%= packageName %>.domain.<%= user.persistClass %> +import <%= user.entityAbsoluteClass %> import <%= packageName %>.security.ADMIN import <%= packageName %>.security.USER import <%= packageName %>.config.SYSTEM_ACCOUNT @@ -44,7 +44,7 @@ class InitialSetupMigration(private val template: MongoTemplate) { var adminAuthority = createAdminAuthority() adminAuthority = template.save(adminAuthority) <%_ if (!authenticationTypeOauth2) { _%> - addUsers(userAuthority, adminAuthority); + addUsers(userAuthority, adminAuthority) <%_ } _%> } @@ -84,7 +84,7 @@ class InitialSetupMigration(private val template: MongoTemplate) { createdDate = Instant.now(), authorities = mutableSetOf(userAuthority) ) - return userUser; + return userUser } private fun createAdmin(adminAuthority: Authority, userAuthority: Authority): <%= user.persistClass %> { diff --git a/generators/spring-boot/templates/spring-data-relational/src/main/kotlin/_package_/_entityPackage_/repository/_entityClass_RepositoryInternalImpl_reactive.kt.ejs b/generators/spring-boot/templates/spring-data-relational/src/main/kotlin/_package_/_entityPackage_/repository/_entityClass_RepositoryInternalImpl_reactive.kt.ejs index bee3781cb..7c12b5d76 100644 --- a/generators/spring-boot/templates/spring-data-relational/src/main/kotlin/_package_/_entityPackage_/repository/_entityClass_RepositoryInternalImpl_reactive.kt.ejs +++ b/generators/spring-boot/templates/spring-data-relational/src/main/kotlin/_package_/_entityPackage_/repository/_entityClass_RepositoryInternalImpl_reactive.kt.ejs @@ -111,7 +111,7 @@ class <%= entityClass %>RepositoryInternalImpl( converter ), <%= entityClass %>RepositoryInternal { - private val db: DatabaseClient = template.databaseClient; + private val db: DatabaseClient = template.databaseClient companion object { private val entityTable = Table.aliased("<%= entityTableName %>", EntityManager.ENTITY_ALIAS) @@ -152,11 +152,11 @@ class <%= entityClass %>RepositoryInternalImpl( override fun findById(id: <%= primaryKey.type %>?): Mono<<%= persistClass %>> { <%_ if (primaryKey.type != 'Long') { _%> - val whereClause = Conditions.isEqual(entityTable.column("<%= primaryKey.fields[0].columnName %>"), Conditions.just(StringUtils.wrap(id.toString(), "'"))); + val whereClause = Conditions.isEqual(entityTable.column("<%= primaryKey.fields[0].columnName %>"), Conditions.just(StringUtils.wrap(id.toString(), "'"))) <%_ } else { _%> - val whereClause = Conditions.isEqual(entityTable.column("<%= primaryKey.fields[0].columnName %>"), Conditions.just(id.toString())); + val whereClause = Conditions.isEqual(entityTable.column("<%= primaryKey.fields[0].columnName %>"), Conditions.just(id.toString())) <%_ }_%> - return createQuery(null, whereClause).one(); + return createQuery(null, whereClause).one() } <%_ if (implementsEagerLoadApis) { _%> @@ -212,7 +212,7 @@ class <%= entityClass %>RepositoryInternalImpl( protected fun deleteRelations(entityId: <%= primaryKey.type %>?): Mono { <%_ relationships.filter(function(rel) { - return (rel.relationshipManyToMany && rel.ownerSide); + return (rel.relationshipManyToMany && rel.ownerSide) }).forEach(function(rel, idx) { _%> <%_ if (idx === 0) { _%> return entityManager.deleteFromLinkTable(<%= rel.relationshipName %>Link, entityId) diff --git a/generators/spring-boot/templates/spring-data-relational/src/main/kotlin/_package_/repository/EntityManager_reactive.kt.ejs b/generators/spring-boot/templates/spring-data-relational/src/main/kotlin/_package_/repository/EntityManager_reactive.kt.ejs index a9dbd193c..a25035aa5 100644 --- a/generators/spring-boot/templates/spring-data-relational/src/main/kotlin/_package_/repository/EntityManager_reactive.kt.ejs +++ b/generators/spring-boot/templates/spring-data-relational/src/main/kotlin/_package_/repository/EntityManager_reactive.kt.ejs @@ -127,15 +127,15 @@ class EntityManager( fun createSelect(selectFrom: SelectFromAndJoin, entityType: Class<*>, pageable: Pageable?, where: Condition?): String { if (pageable != null) { if (where != null) { - return createSelectImpl(selectFrom.limitOffset(pageable.pageSize.toLong(), pageable.offset).where(where), entityType, pageable.sort); + return createSelectImpl(selectFrom.limitOffset(pageable.pageSize.toLong(), pageable.offset).where(where), entityType, pageable.sort) } else { - return createSelectImpl(selectFrom.limitOffset(pageable.pageSize.toLong(), pageable.offset), entityType, pageable.sort); + return createSelectImpl(selectFrom.limitOffset(pageable.pageSize.toLong(), pageable.offset), entityType, pageable.sort) } } else { if (where != null) { - return createSelectImpl(selectFrom.where(where), entityType, null); + return createSelectImpl(selectFrom.where(where), entityType, null) } else { - return createSelectImpl(selectFrom, entityType, null); + return createSelectImpl(selectFrom, entityType, null) } } } diff --git a/generators/spring-boot/templates/spring-data-relational/src/main/kotlin/_package_/repository/rowmapper/UserRowMapper_reactive.kt.ejs b/generators/spring-boot/templates/spring-data-relational/src/main/kotlin/_package_/repository/rowmapper/UserRowMapper_reactive.kt.ejs index 7c074ed3d..db3378330 100644 --- a/generators/spring-boot/templates/spring-data-relational/src/main/kotlin/_package_/repository/rowmapper/UserRowMapper_reactive.kt.ejs +++ b/generators/spring-boot/templates/spring-data-relational/src/main/kotlin/_package_/repository/rowmapper/UserRowMapper_reactive.kt.ejs @@ -24,7 +24,7 @@ import java.util.function.BiFunction import org.springframework.stereotype.Service -import <%= packageName %>.domain.<%= user.persistClass %> +import <%= user.entityAbsoluteClass %> import io.r2dbc.spi.Row diff --git a/generators/spring-boot/templates/spring-data-relational/src/test/kotlin/_package_/config/MariadbTestContainer.kt.ejs b/generators/spring-boot/templates/spring-data-relational/src/test/kotlin/_package_/config/MariadbTestContainer.kt.ejs index 9227133a4..2c9b336a1 100644 --- a/generators/spring-boot/templates/spring-data-relational/src/test/kotlin/_package_/config/MariadbTestContainer.kt.ejs +++ b/generators/spring-boot/templates/spring-data-relational/src/test/kotlin/_package_/config/MariadbTestContainer.kt.ejs @@ -51,6 +51,6 @@ class MariadbTestContainer: SqlTestContainer { mariaDBContainer?.start() } } - + override fun getTestContainer() = mariaDBContainer as JdbcDatabaseContainer<*> } diff --git a/generators/spring-boot/templates/spring-data-relational/src/test/kotlin/_package_/config/MysqlTestContainer.kt.ejs b/generators/spring-boot/templates/spring-data-relational/src/test/kotlin/_package_/config/MysqlTestContainer.kt.ejs index e94f4cb4a..e93508e72 100644 --- a/generators/spring-boot/templates/spring-data-relational/src/test/kotlin/_package_/config/MysqlTestContainer.kt.ejs +++ b/generators/spring-boot/templates/spring-data-relational/src/test/kotlin/_package_/config/MysqlTestContainer.kt.ejs @@ -37,7 +37,7 @@ class MysqlTestContainer : SqlTestContainer { mysqlContainer?.stop() } } - + override fun afterPropertiesSet() { if (null == mysqlContainer) { mysqlContainer = MySQLContainer("<%= DOCKER_MYSQL %>-debian") diff --git a/generators/spring-boot/templates/spring-data-relational/src/test/resources/config/application-testdev.yml.ejs b/generators/spring-boot/templates/spring-data-relational/src/test/resources/config/application-testdev.yml.ejs index 901759903..f3a65e522 100644 --- a/generators/spring-boot/templates/spring-data-relational/src/test/resources/config/application-testdev.yml.ejs +++ b/generators/spring-boot/templates/spring-data-relational/src/test/resources/config/application-testdev.yml.ejs @@ -1,5 +1,5 @@ <%# - Copyright 2013-2022 the original author or authors from the JHipster project. + Copyright 2013-2024 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. diff --git a/generators/spring-boot/templates/spring-data-relational/src/test/resources/config/application-testprod.yml.ejs b/generators/spring-boot/templates/spring-data-relational/src/test/resources/config/application-testprod.yml.ejs index 74da4ed50..53a34570b 100644 --- a/generators/spring-boot/templates/spring-data-relational/src/test/resources/config/application-testprod.yml.ejs +++ b/generators/spring-boot/templates/spring-data-relational/src/test/resources/config/application-testprod.yml.ejs @@ -1,5 +1,5 @@ <%# - Copyright 2013-2022 the original author or authors from the JHipster project. + Copyright 2013-2024 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. diff --git a/generators/spring-boot/templates/src/main/kotlin/_package_/Application.kt.ejs b/generators/spring-boot/templates/src/main/kotlin/_package_/Application.kt.ejs index 3526e54e7..88d677c5d 100644 --- a/generators/spring-boot/templates/src/main/kotlin/_package_/Application.kt.ejs +++ b/generators/spring-boot/templates/src/main/kotlin/_package_/Application.kt.ejs @@ -27,7 +27,7 @@ import tech.jhipster.config.JHipsterConstants import org.slf4j.LoggerFactory import org.springframework.boot.runApplication import org.springframework.boot.autoconfigure.SpringBootApplication -<%_ if (databaseTypeSql) { _%> +<%_ if (databaseMigrationLiquibase) { _%> import org.springframework.boot.autoconfigure.liquibase.LiquibaseProperties <%_ } _%> import org.springframework.boot.context.properties.EnableConfigurationProperties @@ -38,7 +38,7 @@ import java.net.InetAddress import java.net.UnknownHostException @SpringBootApplication -@EnableConfigurationProperties(<% if (databaseTypeSql) { %>LiquibaseProperties::class, <% } %>ApplicationProperties::class) +@EnableConfigurationProperties(<% if (databaseMigrationLiquibase) { %>LiquibaseProperties::class, <% } %>ApplicationProperties::class) class <%= mainClass %>(private val env: Environment) { private val log = LoggerFactory.getLogger(javaClass) @@ -90,6 +90,7 @@ class <%= mainClass %>(private val env: Environment) { val protocol = if (env.getProperty("server.ssl.key-store") != null) { "https" } else "http" + val applicationName = env.getProperty("spring.application.name") val serverPort = env.getProperty("server.port") val contextPath = env.getProperty("server.servlet.context-path") ?: "/" var hostAddress = "localhost" @@ -103,7 +104,7 @@ class <%= mainClass %>(private val env: Environment) { """ ---------------------------------------------------------- - Application '${env.getProperty("spring.application.name")}' is running! Access URLs: + Application '$applicationName' is running! Access URLs: Local: $protocol://localhost:$serverPort$contextPath External: $protocol://$hostAddress:$serverPort$contextPath Profile(s): ${env.activeProfiles.joinToString(",")} diff --git a/generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/common/delete_template.ejs b/generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/_partials_entity_/delete_template.ejs similarity index 100% rename from generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/common/delete_template.ejs rename to generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/_partials_entity_/delete_template.ejs diff --git a/generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/common/get_all_stream_template.ejs b/generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/_partials_entity_/get_all_stream_template.ejs similarity index 100% rename from generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/common/get_all_stream_template.ejs rename to generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/_partials_entity_/get_all_stream_template.ejs diff --git a/generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/common/get_all_template.ejs b/generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/_partials_entity_/get_all_template.ejs similarity index 100% rename from generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/common/get_all_template.ejs rename to generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/_partials_entity_/get_all_template.ejs diff --git a/generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/common/get_filtered_template.ejs b/generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/_partials_entity_/get_filtered_template.ejs similarity index 100% rename from generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/common/get_filtered_template.ejs rename to generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/_partials_entity_/get_filtered_template.ejs diff --git a/generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/common/get_template.ejs b/generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/_partials_entity_/get_template.ejs similarity index 100% rename from generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/common/get_template.ejs rename to generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/_partials_entity_/get_template.ejs diff --git a/generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/common/inject_template.ejs b/generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/_partials_entity_/inject_template.ejs similarity index 100% rename from generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/common/inject_template.ejs rename to generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/_partials_entity_/inject_template.ejs diff --git a/generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/common/patch_template.ejs b/generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/_partials_entity_/patch_template.ejs similarity index 100% rename from generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/common/patch_template.ejs rename to generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/_partials_entity_/patch_template.ejs diff --git a/generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/common/search_stream_template.ejs b/generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/_partials_entity_/search_stream_template.ejs similarity index 100% rename from generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/common/search_stream_template.ejs rename to generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/_partials_entity_/search_stream_template.ejs diff --git a/generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/common/search_template.ejs b/generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/_partials_entity_/search_template.ejs similarity index 100% rename from generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/common/search_template.ejs rename to generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/_partials_entity_/search_template.ejs diff --git a/generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/repository/UserRepository.kt.ejs b/generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/repository/UserRepository.kt.ejs index c5e8d0984..589ec9ec7 100644 --- a/generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/repository/UserRepository.kt.ejs +++ b/generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/repository/UserRepository.kt.ejs @@ -21,7 +21,7 @@ package <%= packageName %>.repository <%_ if (databaseTypeSql && reactive) { _%> import <%= packageName %>.domain.Authority <%_ } _%> -import <%= packageName %>.domain.<%= user.persistClass %> +import <%= user.entityAbsoluteClass %> <%_ if (databaseTypeCassandra) { _%> import com.datastax.oss.driver.api.core.CqlIdentifier @@ -155,7 +155,7 @@ interface UserRepository : <% if (databaseTypeSql) { %>JpaRepository<<%= user.pe fun findOneByActivationKey(activationKey: String): <%= optionalOrMono %><<%= user.persistClass %>><% if (databaseTypeCouchbase) { %> { return findIdByActivationKey(activationKey) .map(User::id) - .flatMap(this::findById); + .flatMap(this::findById) } @Query(FIND_IDS_QUERY + " AND activationKey = $1") fun findIdByActivationKey(activationKey: String): <%= optionalOrMono %> @@ -195,7 +195,7 @@ interface UserRepository : <% if (databaseTypeSql) { %>JpaRepository<<%= user.pe fun findOneByEmailIgnoreCase(email: String?): <%= optionalOrMono %><<%= user.persistClass %>><% if (databaseTypeCouchbase) { %> { return findIdByEmailIgnoreCase(email!!) .map(User::id) - .flatMap(this::findById); + .flatMap(this::findById) } @Query(FIND_IDS_QUERY + " AND LOWER(email) = LOWER($1)") @@ -260,7 +260,7 @@ interface UserRepository : <% if (databaseTypeSql) { %>JpaRepository<<%= user.pe <% } else { %> <%_ if (databaseTypeCouchbase) { _%> fun findAllByActivatedIsTrue(pageable: Pageable): Page<<%= user.persistClass %>> { - val page = findAllIdsByActivatedIsTrue(pageable); + val page = findAllIdsByActivatedIsTrue(pageable) return PageImpl<<%= user.persistClass %>>(findAllById(toIds(page.content)), pageable, page.totalElements) } @@ -416,7 +416,7 @@ class UserRepositoryInternalImpl(val db: DatabaseClient, val r2dbcEntityTemplate user.authorities = tuples.filter { it.t2.isPresent } .map { val authority = Authority() - authority.name = it.t2.get() + authority.name = it.t2.orElseThrow() authority }.toMutableSet() return user diff --git a/generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/service/UserService.kt.ejs b/generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/service/UserService.kt.ejs index 46d3ceff1..cb11874ab 100644 --- a/generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/service/UserService.kt.ejs +++ b/generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/service/UserService.kt.ejs @@ -25,7 +25,7 @@ import <%= packageName %>.domain.Authority <%_ } _%> <%_ if (!databaseTypeNo) { _%> import <%= packageName %>.service.dto.<%= user.adminUserDto %> -import <%= packageName %>.domain.<%= user.persistClass %> +import <%= user.entityAbsoluteClass %> <%_ if (databaseTypeSql || databaseTypeMongodb || databaseTypeNeo4j || databaseTypeCouchbase) { _%> import <%= packageName %>.repository.AuthorityRepository <%_ if (authenticationTypeSession && !reactive) { _%> diff --git a/generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/service/_entityClass_QueryService.kt.ejs b/generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/service/_entityClass_QueryService.kt.ejs index e4e45ffda..826d2476f 100644 --- a/generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/service/_entityClass_QueryService.kt.ejs +++ b/generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/service/_entityClass_QueryService.kt.ejs @@ -42,7 +42,7 @@ import org.springframework.transaction.annotation.Transactional import tech.jhipster.service.QueryService import tech.jhipster.service.filter.Filter -import <%= packageName %>.domain.<%= persistClass %> +import <%= entityAbsoluteClass %> import <%= entityAbsolutePackage %>.domain.* // for static metamodels import <%= entityAbsolutePackage %>.repository.<%= entityClass %>Repository <%_ if (searchEngineElasticsearch) { _%> @@ -64,7 +64,7 @@ import java.util.UUID @Service<% if (databaseTypeSql) { %> @Transactional(readOnly = true)<% } %> class <%= serviceClassName %>( -<%- include('../common/inject_template', {viaService: false, constructorName: serviceClassName, queryService: false, isUsingMapsId: false, mapsIdAssoc: null, isController: false}); -%> +<%- include('../_partials_entity_/inject_template', {viaService: false, constructorName: serviceClassName, queryService: false, isUsingMapsId: false, mapsIdAssoc: null, isController: false}); -%> ) : QueryService<<%= persistClass %>>() { private val log = LoggerFactory.getLogger(javaClass) diff --git a/generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/service/dto/_dtoClass_.kt.ejs b/generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/service/dto/_dtoClass_.kt.ejs index d1f663606..46ebe10e9 100644 --- a/generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/service/dto/_dtoClass_.kt.ejs +++ b/generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/service/dto/_dtoClass_.kt.ejs @@ -77,7 +77,7 @@ data class <%= dtoClass %>( const required = field && field.fieldValidate && field.fieldValidationRequired; if (field) { if (field.fieldValidate) { - classProperty.push(include('../../common/field_validators', {field, reactive})); + classProperty.push(include('/_global_partials_entity_/field_validators', {field, reactive})); } } if (reference.doc) { diff --git a/generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/service/impl/_entityClass_ServiceImpl.kt.ejs b/generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/service/impl/_entityClass_ServiceImpl.kt.ejs index 370a8a135..3bbe643c5 100644 --- a/generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/service/impl/_entityClass_ServiceImpl.kt.ejs +++ b/generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/service/impl/_entityClass_ServiceImpl.kt.ejs @@ -86,7 +86,7 @@ import org.elasticsearch.index.query.QueryBuilders.queryStringQuery @Service<% if (databaseTypeSql) { %> @Transactional<% } %> class <%= serviceClassName %>( - <%- include('../../common/inject_template', {asEntity, asDto, viaService: false, constructorName: serviceClassName, queryService: false, isUsingMapsId: isUsingMapsId, mapsIdAssoc: mapsIdAssoc, isController: false, noReturn: false}); -%> + <%- include('../../_partials_entity_/inject_template', {asEntity, asDto, viaService: false, constructorName: serviceClassName, queryService: false, isUsingMapsId: isUsingMapsId, mapsIdAssoc: mapsIdAssoc, isController: false, noReturn: false}); -%> )<% if (serviceImpl) { %> : <%= entityClass %>Service<% } %> { private val log = LoggerFactory.getLogger(javaClass) @@ -101,7 +101,7 @@ class <%= serviceClassName %>( <%_ } _%> <% if (serviceImpl) { _%>override <% } %>fun save(<%= instanceName %>: <%= instanceType %>): <% if (reactive) { %>Mono<<% } %><%= instanceType %><% if (reactive) { %>><% } %> { log.debug("Request to save <%= entityClass %> : $<%= instanceName %>") -<%- include('/partials/save_template', {asEntity, asDto, viaService: false, returnDirectly: true, isUsingMapsId: isUsingMapsId, mapsIdAssoc: mapsIdAssoc, isController: false, isPersisted: false, noReturn: false}); -%> +<%- include('/_global_partials_entity_/save_template', {asEntity, asDto, viaService: false, returnDirectly: true, isUsingMapsId: isUsingMapsId, mapsIdAssoc: mapsIdAssoc, isController: false, isPersisted: false, noReturn: false}); -%> } <%_ if (!serviceImpl) { _%> @@ -114,7 +114,7 @@ class <%= serviceClassName %>( <%_ } _%> <% if (serviceImpl) { %>override<% } %> fun update(<%= instanceName %>: <%= instanceType %>): <% if (reactive) { %>Mono<<% } %><%= instanceType %><% if (reactive) { %>><% } %>{ log.debug("Request to update <%= entityClass %> : {}", <%= instanceName %>); - <%- include('/partials/update_template', {updatableEntity, viaService: false, returnDirectly: true, isUsingMapsId: isUsingMapsId, mapsIdAssoc: mapsIdAssoc, isController: false, isPersisted: requiresPersistableImplementation, noReturn: false}); -%> + <%- include('/_global_partials_entity_/update_template', {updatableEntity, viaService: false, returnDirectly: true, isUsingMapsId: isUsingMapsId, mapsIdAssoc: mapsIdAssoc, isController: false, isPersisted: requiresPersistableImplementation, noReturn: false}); -%> } <%_ if (!serviceImpl) { _%> @@ -127,7 +127,7 @@ class <%= serviceClassName %>( <%_ } _%> <% if (serviceImpl) { %>override <% } %>fun partialUpdate(<%= instanceName %>: <%= instanceType %>): <% if (reactive) { %>Mono<<% } else { %>Optional<<% } %><%= instanceType %>> { log.debug("Request to partially update <%= entityClass %> : {}", <%= instanceName %>) -<%- include('../../common/patch_template', {asEntity, asDto, isService: true, viaService: false}); -%> +<%- include('../../_partials_entity_/patch_template', {asEntity, asDto, isService: true, viaService: false}); -%> } <%_ if (!serviceImpl) { _%> @@ -165,7 +165,7 @@ class <%= serviceClassName %>( <%= entityInstance %>Repository.findAllWithEagerRelationships(pageable)<% if (!dtoMapstruct) { %><% } else { %>.map(<%= entityToDtoReference %>)<% } %> <%_ } _%> -<%- include('../../common/get_filtered_template', {asEntity, asDto}); -%> +<%- include('../../_partials_entity_/get_filtered_template', {asEntity, asDto}); -%> <%_ if (reactive) { _%> <%_ if (!serviceImpl) { _%> /** @@ -198,7 +198,7 @@ class <%= serviceClassName %>( @Transactional(readOnly = true) <%_ } _%> <% if (serviceImpl) { %>override <% } %>fun findOne(id: <%= primaryKey.type %>): <%= optionalOrMono %><<%= instanceType %>> { - log.debug("Request to get <%= entityClass %> : $id")<%- include('../../common/get_template', {asEntity, asDto, viaService: false, returnDirectly:true, implementsEagerLoadApis}); -%> + log.debug("Request to get <%= entityClass %> : $id")<%- include('../../_partials_entity_/get_template', {asEntity, asDto, viaService: false, returnDirectly:true, implementsEagerLoadApis}); -%> } <%_ if (!serviceImpl) { _%> @@ -213,7 +213,7 @@ class <%= serviceClassName %>( <%_ } _%> <% if (serviceImpl) { %>override <% } %>fun delete(id: <%= primaryKey.type %>): <%- reactive ? 'Mono' : 'Unit' %> { log.debug("Request to delete <%= entityClass %> : $id") -<%- include('../../common/delete_template', {viaService: false, fromResource: false}); -%> +<%- include('../../_partials_entity_/delete_template', {viaService: false, fromResource: false}); -%> } <%_ if (searchEngine !== false ) { _%> @@ -231,7 +231,7 @@ class <%= serviceClassName %>( <%_ } _%> <% if (serviceImpl) { %>override <% } %>fun search(query: String<% if (!paginationNo) { %>, pageable: Pageable<% } %>): <% if (!paginationNo) { %><%= pageOrFlux %><<%= instanceType %><% } else { %><%= listOrFlux %><<%= instanceType %><% } %>> { <%_ if (paginationNo) { _%> - log.debug("Request to search <%= entityClassPlural %> for query $query")<%- include('../../common/search_stream_template', {viaService: false, fromResource: false}); -%> + log.debug("Request to search <%= entityClassPlural %> for query $query")<%- include('../../_partials_entity_/search_stream_template', {viaService: false, fromResource: false}); -%> <%_ } else { _%> log.debug("Request to search for a page of <%= entityClassPlural %> for query $query") return <%= entityInstance %><% if (searchEngineElasticsearch) { %>Search<% } %>Repository.search(query, pageable)<%_ if (!dtoMapstruct) { _%><% } else { %>.map(<%= entityToDtoReference %>)<% } %> diff --git a/generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/web/rest/UserResource.kt.ejs b/generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/web/rest/UserResource.kt.ejs index 480574911..2600db8d8 100644 --- a/generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/web/rest/UserResource.kt.ejs +++ b/generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/web/rest/UserResource.kt.ejs @@ -19,7 +19,7 @@ package <%= packageName %>.web.rest import <%= packageName %>.config.LOGIN_REGEX -import <%= packageName %>.domain.<%= user.persistClass %> +import <%= user.entityAbsoluteClass %> import <%= packageName %>.repository.UserRepository import <%= packageName %>.security.ADMIN import <%= packageName %>.service.MailService @@ -87,7 +87,7 @@ import org.elasticsearch.index.query.QueryBuilders.queryStringQuery /** * REST controller for managing users. * - * This class accesses the {@link <%= packageName %>.domain.<%= user.persistClass %>} entity, and needs to fetch its collection of authorities. + * This class accesses the {@link <%= user.entityAbsoluteClass %>} entity, and needs to fetch its collection of authorities. * * For a normal use-case, it would be better to have an eager relationship between User and Authority, * and send everything to the client side: there would be no View Model and DTO, a lot less code, and an outer-join @@ -230,11 +230,11 @@ class UserResource( fun updateUser(@Valid @RequestBody userDTO: <%= user.adminUserDto %>): ResponseEntity<<%= user.adminUserDto %>> { log.debug("REST request to update User : $userDTO") var existingUser = userRepository.findOneByEmailIgnoreCase(userDTO.email) - if (existingUser.isPresent && existingUser.get().id != userDTO.id) { + if (existingUser.isPresent && existingUser.orElseThrow().id != userDTO.id) { throw EmailAlreadyUsedException() } existingUser = userRepository.findOneByLogin(userDTO.login!!.lowercase()) - if (existingUser.isPresent && existingUser.get().id != userDTO.id) { + if (existingUser.isPresent && existingUser.orElseThrow().id != userDTO.id) { throw LoginAlreadyUsedException() } val updatedUser = userService.updateUser(userDTO) diff --git a/generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/web/rest/_entityClass_Resource.kt.ejs b/generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/web/rest/_entityClass_Resource.kt.ejs index 82821ef12..2246b89f6 100644 --- a/generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/web/rest/_entityClass_Resource.kt.ejs +++ b/generators/spring-boot/templates/src/main/kotlin/_package_/_entityPackage_/web/rest/_entityClass_Resource.kt.ejs @@ -132,7 +132,7 @@ class <%= entityClass %>Resource( const instanceName = restInstance; const mapper = entityInstance + 'Mapper'; const entityToDtoReference = mapper + '::' + 'toDto'; -_%><%- include('../../common/inject_template', {viaService: viaService, constructorName: entityClass + 'Resource', queryService: jpaMetamodelFiltering, isUsingMapsId: isUsingMapsId, mapsIdAssoc: mapsIdAssoc, isController: true}); -%> +_%><%- include('../../_partials_entity_/inject_template', {viaService: viaService, constructorName: entityClass + 'Resource', queryService: jpaMetamodelFiltering, isUsingMapsId: isUsingMapsId, mapsIdAssoc: mapsIdAssoc, isController: true}); -%> ) { private val log = LoggerFactory.getLogger(javaClass) @@ -185,7 +185,7 @@ _%><%- include('../../common/inject_template', {viaService: viaService, construc <%= instanceName %>.<%= field.fieldName %> = UUID.randomUUID() <%_ } _%> <%_ } _%> -<%- include('/partials/save_template', {asEntity, asDto, viaService: viaService, returnDirectly: false, isUsingMapsId: isUsingMapsId, mapsIdAssoc: mapsIdAssoc, isController: true, noReturn: false}); -%> +<%- include('/_global_partials_entity_/save_template', {asEntity, asDto, viaService: viaService, returnDirectly: false, isUsingMapsId: isUsingMapsId, mapsIdAssoc: mapsIdAssoc, isController: true, noReturn: false}); -%> <%_ if (reactive) { _%> .map { result -> try { @@ -254,7 +254,7 @@ _%><%- include('../../common/inject_template', {viaService: viaService, construc <%_ } _%> <% } %> <%_ } _%> -<%- include('/partials/update_template', {updatableEntity, viaService: viaService, returnDirectly: false, isUsingMapsId: false, mapsIdAssoc: mapsIdAssoc, isController: true, isPersisted: requiresPersistableImplementation, noReturn: true}); -%> +<%- include('/_global_partials_entity_/update_template', {updatableEntity, viaService: viaService, returnDirectly: false, isUsingMapsId: false, mapsIdAssoc: mapsIdAssoc, isController: true, isPersisted: requiresPersistableImplementation, noReturn: true}); -%> <%_ if (reactive) { _%> .switchIfEmpty(Mono.error(ResponseStatusException(HttpStatus.NOT_FOUND))) .map { result -> ResponseEntity.ok() @@ -325,7 +325,7 @@ _%><%- include('../../common/inject_template', {viaService: viaService, construc <%_ } _%> <% } %> <%_ } _%> -<%- include('../../common/patch_template', {asEntity, asDto, isService: false, viaService: viaService}); -%> +<%- include('../../_partials_entity_/patch_template', {asEntity, asDto, isService: false, viaService: viaService}); -%> <%_ if (reactive) { _%> result .switchIfEmpty(Mono.error(ResponseStatusException(HttpStatus.NOT_FOUND))) @@ -360,7 +360,7 @@ _%><%- include('../../common/inject_template', {viaService: viaService, construc */ @GetMapping("/<%= entityApiUrl %>")<%_ if (databaseTypeSql && isUsingMapsId&& !viaService) { %> @Transactional(readOnly = true)<%_ } _%> - <%- include('../../common/get_all_template', {asEntity, asDto, viaService}); -%> + <%- include('../../_partials_entity_/get_all_template', {asEntity, asDto, viaService}); -%> <%_ if (reactive && paginationNo) { _%> /** @@ -392,7 +392,7 @@ _%><%- include('../../common/inject_template', {viaService: viaService, construc @Transactional(readOnly = true) <%_ } _%> fun get<%= entityClass %>(@PathVariable id: <%= primaryKey.type %>): <% if (reactive) { %>Mono<<% } %>ResponseEntity<<%= instanceType %>><% if (reactive) { %>><% } %> { - log.debug("REST request to get <%= entityClass %> : $id")<%- include('../../common/get_template', {asEntity, asDto, viaService, returnDirectly:false, implementsEagerLoadApis}); -%> + log.debug("REST request to get <%= entityClass %> : $id")<%- include('../../_partials_entity_/get_template', {asEntity, asDto, viaService, returnDirectly:false, implementsEagerLoadApis}); -%> return ResponseUtil.wrapOrNotFound(<%= instanceName %>) } <%_ if (!readOnly) { _%> @@ -405,7 +405,7 @@ _%><%- include('../../common/inject_template', {viaService: viaService, construc @DeleteMapping("/<%= entityApiUrl %>/{id}") fun delete<%= entityClass %>(@PathVariable id: <%= primaryKey.type %>): <% if (reactive) { %>Mono<<% } %>ResponseEntity<% if (reactive) { %>><% } %> { log.debug("REST request to delete <%= entityClass %> : $id") -<%- include('../../common/delete_template', {viaService: viaService, fromResource: true}); -%> +<%- include('../../_partials_entity_/delete_template', {viaService: viaService, fromResource: true}); -%> <%_ if (reactive) { _%> <%_ if (databaseTypeCouchbase) { _%> .then(Mono.just(ResponseEntity.noContent() @@ -437,6 +437,6 @@ _%><%- include('../../common/inject_template', {viaService: viaService, construc <%_ } _%> * @return the result of the search. */ - @GetMapping("/_search/<%= entityApiUrl %>")<%- include('../../common/search_template', {asEntity, asDto, viaService}); -%> + @GetMapping("/_search/<%= entityApiUrl %>")<%- include('../../_partials_entity_/search_template', {asEntity, asDto, viaService}); -%> <%_ } _%> } diff --git a/generators/spring-boot/templates/src/main/kotlin/_package_/config/CRLFLogConverter.kt.ejs b/generators/spring-boot/templates/src/main/kotlin/_package_/config/CRLFLogConverter.kt.ejs index 02b388de2..abb85335d 100644 --- a/generators/spring-boot/templates/src/main/kotlin/_package_/config/CRLFLogConverter.kt.ejs +++ b/generators/spring-boot/templates/src/main/kotlin/_package_/config/CRLFLogConverter.kt.ejs @@ -10,11 +10,22 @@ import org.springframework.boot.ansi.AnsiElement import org.springframework.boot.ansi.AnsiOutput import org.springframework.boot.ansi.AnsiStyle +/** + * Log filter to prevent attackers from forging log entries by submitting input containing CRLF characters. + * CRLF characters are replaced with a red colored _ character. + * + * @see Log Forging Description + * @see JHipster issue + */ class CRLFLogConverter : CompositeConverter() { companion object { val CRLF_SAFE_MARKER: Marker = MarkerFactory.getMarker("CRLF_SAFE") - private val SAFE_LOGGERS = listOf("org.hibernate") + private val SAFE_LOGGERS = listOf( + "org.hibernate", + "org.springframework.boot.autoconfigure", + "org.springframework.boot.diagnostics", + ) private val ELEMENTS: HashMap = hashMapOf( "faint" to AnsiStyle.FAINT, "red" to AnsiColor.RED, diff --git a/generators/spring-boot/templates/src/main/kotlin/_package_/config/EurekaWorkaroundConfiguration.kt.ejs b/generators/spring-boot/templates/src/main/kotlin/_package_/config/EurekaWorkaroundConfiguration.kt.ejs index 896e585b3..a908c6442 100644 --- a/generators/spring-boot/templates/src/main/kotlin/_package_/config/EurekaWorkaroundConfiguration.kt.ejs +++ b/generators/spring-boot/templates/src/main/kotlin/_package_/config/EurekaWorkaroundConfiguration.kt.ejs @@ -35,7 +35,7 @@ class EurekaWorkaroundConfiguration: HealthIndicator { companion object { private var applicationIsUp = false } - + @EventListener(ApplicationReadyEvent::class) fun onStartup() { applicationIsUp = true diff --git a/generators/spring-boot/templates/src/main/kotlin/_package_/config/OAuth2Configuration.kt.ejs b/generators/spring-boot/templates/src/main/kotlin/_package_/config/OAuth2Configuration.kt.ejs index 8e34ad4de..ddcdb01ca 100644 --- a/generators/spring-boot/templates/src/main/kotlin/_package_/config/OAuth2Configuration.kt.ejs +++ b/generators/spring-boot/templates/src/main/kotlin/_package_/config/OAuth2Configuration.kt.ejs @@ -30,7 +30,6 @@ class OAuth2Configuration { .refreshToken { it.clockSkew(Duration.ofMinutes(1)) } - .password() .build() ) diff --git a/generators/spring-boot/templates/src/main/kotlin/_package_/repository/PersistentTokenRepository.kt.ejs b/generators/spring-boot/templates/src/main/kotlin/_package_/repository/PersistentTokenRepository.kt.ejs index 413cc72fd..586853624 100644 --- a/generators/spring-boot/templates/src/main/kotlin/_package_/repository/PersistentTokenRepository.kt.ejs +++ b/generators/spring-boot/templates/src/main/kotlin/_package_/repository/PersistentTokenRepository.kt.ejs @@ -35,7 +35,7 @@ import com.datastax.oss.driver.api.mapper.annotations.Mapper import com.datastax.oss.driver.api.mapper.annotations.Select <%_ } _%> import <%= packageName %>.domain.PersistentToken -import <%= packageName %>.domain.<%= user.persistClass %> +import <%= user.entityAbsoluteClass %> <%_ if (!databaseTypeCassandra) { _%> import java.time.LocalDate <%_ } _%> @@ -69,7 +69,7 @@ import java.util.Optional */ <%_ if (['sql', 'mongodb', 'neo4j'].includes(databaseType)) { _%> interface PersistentTokenRepository : <% if (databaseTypeSql) { %>JpaRepository<% } %><% if (databaseTypeMongodb) { %>MongoRepository<% } %><% if (databaseTypeNeo4j) { %>Neo4jRepository<% } %><% if (databaseTypeCouchbase) { %>N1qlCouchbaseRepository<% } %> { - fun findByUser(user: User): List + fun findByUser(user: <%= user.persistClass %>): List fun findByTokenDateBefore(localDate: LocalDate): List } diff --git a/generators/spring-boot/templates/src/main/kotlin/_package_/security/DomainUserDetailsService.kt.ejs b/generators/spring-boot/templates/src/main/kotlin/_package_/security/DomainUserDetailsService.kt.ejs index 92cba2976..83b070bec 100644 --- a/generators/spring-boot/templates/src/main/kotlin/_package_/security/DomainUserDetailsService.kt.ejs +++ b/generators/spring-boot/templates/src/main/kotlin/_package_/security/DomainUserDetailsService.kt.ejs @@ -18,7 +18,7 @@ -%> package <%= packageName %>.security -import <%= packageName %>.domain.<%= user.persistClass %> +import <%= user.entityAbsoluteClass %> <%_ if (databaseTypeSql || databaseTypeMongodb || databaseTypeNeo4j) { _%> import <%= packageName %>.domain.Authority <%_ } _%> diff --git a/generators/spring-boot/templates/src/main/kotlin/_package_/security/PersistentTokenRememberMeServices.kt.ejs b/generators/spring-boot/templates/src/main/kotlin/_package_/security/PersistentTokenRememberMeServices.kt.ejs index 6db0719af..05d4d0b54 100644 --- a/generators/spring-boot/templates/src/main/kotlin/_package_/security/PersistentTokenRememberMeServices.kt.ejs +++ b/generators/spring-boot/templates/src/main/kotlin/_package_/security/PersistentTokenRememberMeServices.kt.ejs @@ -247,7 +247,7 @@ class PersistentTokenRememberMeServices( // No series match, so we can't authenticate using this cookie throw RememberMeAuthenticationException("No persistent token found for series id: $presentedSeries") } - val token = optionalToken.get() + val token = optionalToken.orElseThrow() // We have a match for this user/series combination log.info("presentedToken=$presentedToken / tokenValue=${token.tokenValue}") if (presentedToken != token.tokenValue) { diff --git a/generators/spring-boot/templates/src/main/kotlin/_package_/service/MailService.kt.ejs b/generators/spring-boot/templates/src/main/kotlin/_package_/service/MailService.kt.ejs index 392b515de..5fd21eb97 100644 --- a/generators/spring-boot/templates/src/main/kotlin/_package_/service/MailService.kt.ejs +++ b/generators/spring-boot/templates/src/main/kotlin/_package_/service/MailService.kt.ejs @@ -18,7 +18,7 @@ -%> package <%= packageName %>.service -import <%= packageName %>.domain.<%= user.persistClass %> +import <%= user.entityAbsoluteClass %> import tech.jhipster.config.JHipsterProperties diff --git a/generators/spring-boot/templates/src/main/kotlin/_package_/service/dto/AdminUserDTO.kt.ejs b/generators/spring-boot/templates/src/main/kotlin/_package_/service/dto/AdminUserDTO.kt.ejs index d2ffb8e6b..a7089895f 100644 --- a/generators/spring-boot/templates/src/main/kotlin/_package_/service/dto/AdminUserDTO.kt.ejs +++ b/generators/spring-boot/templates/src/main/kotlin/_package_/service/dto/AdminUserDTO.kt.ejs @@ -23,7 +23,7 @@ import <%= packageName %>.config.LOGIN_REGEX import <%= packageName %>.domain.Authority <%_ } _%> <%_ if (!databaseTypeNo) { _%> -import <%= packageName %>.domain.<%= user.persistClass %> +import <%= user.entityAbsoluteClass %> <%_ } _%> import java.io.Serializable diff --git a/generators/spring-boot/templates/src/main/kotlin/_package_/service/dto/UserDTO.kt.ejs b/generators/spring-boot/templates/src/main/kotlin/_package_/service/dto/UserDTO.kt.ejs index 117c29a4a..59df500b4 100644 --- a/generators/spring-boot/templates/src/main/kotlin/_package_/service/dto/UserDTO.kt.ejs +++ b/generators/spring-boot/templates/src/main/kotlin/_package_/service/dto/UserDTO.kt.ejs @@ -19,7 +19,7 @@ package <%= packageName %>.service.dto <%_ if (!databaseTypeNo) { _%> -import <%= packageName %>.domain.<%= user.persistClass %> +import <%= user.entityAbsoluteClass %> <%_ } _%> import java.io.Serializable @@ -29,7 +29,7 @@ import java.util.UUID /** * A DTO representing a user, with only the public attributes. */ -open class <%= user.restClass %>( +open class <%= user.dtoClass %>( var id: <%= user.primaryKey.type %>? = null, var login: String? = null, <%_ for (field of user.fields.filter(field => !field.builtIn && field.relatedByOtherEntity)) { _%> @@ -41,7 +41,7 @@ open class <%= user.restClass %>( constructor(user: <%= user.persistClass %>): this(user.id, user.login) <%_ } _%> - override fun toString() = "<%= user.restClass %>{" + + override fun toString() = "<%= user.dtoClass %>{" + "login='" + login + '\'' + <%_ for (field of user.fields.filter(field => !field.builtIn && field.relatedByOtherEntity)) { _%> ", <%= field.fieldName %>='" + <%= field.fieldName %> + '\'' + diff --git a/generators/spring-boot/templates/src/main/kotlin/_package_/service/mapper/UserMapper.kt.ejs b/generators/spring-boot/templates/src/main/kotlin/_package_/service/mapper/UserMapper.kt.ejs index a2e64bdd2..3e5eda3b9 100644 --- a/generators/spring-boot/templates/src/main/kotlin/_package_/service/mapper/UserMapper.kt.ejs +++ b/generators/spring-boot/templates/src/main/kotlin/_package_/service/mapper/UserMapper.kt.ejs @@ -21,9 +21,9 @@ package <%= packageName %>.service.mapper <%_ if (databaseTypeSql || databaseTypeMongodb || databaseTypeNeo4j) { _%> import <%= packageName %>.domain.Authority <%_ } _%> -import <%= packageName %>.domain.<%= user.persistClass %> +import <%= user.entityAbsoluteClass %> import <%= packageName %>.service.dto.<%= user.adminUserDto %> -import <%= packageName %>.service.dto.<%= user.restClass %> +import <%= packageName %>.service.dto.<%= user.dtoClass %> import org.springframework.stereotype.Service @@ -33,7 +33,7 @@ import org.mapstruct.Mapping import org.mapstruct.Named /** - * Mapper for the entity [<%= user.persistClass %>] and its DTO called [<%= user.restClass %>]. + * Mapper for the entity [<%= user.persistClass %>] and its DTO called [<%= user.dtoClass %>]. * * Normal mappers are generated using MapStruct, this one is hand-coded as MapStruct * support is still in beta, and requires a manual step with an IDE. @@ -41,12 +41,12 @@ import org.mapstruct.Named @Service class UserMapper { - fun usersToUserDTOs(users: List<<%= user.persistClass %>?>): MutableList<<%= user.restClass %>> = + fun usersToUserDTOs(users: List<<%= user.persistClass %>?>): MutableList<<%= user.dtoClass %>> = users.asSequence() .filterNotNull() .mapTo(mutableListOf()) { userToUserDTO(it) } - fun userToUserDTO(user: <%= user.persistClass %>): <%= user.restClass %> = <%= user.restClass %>(user) + fun userToUserDTO(user: <%= user.persistClass %>): <%= user.dtoClass %> = <%= user.dtoClass %>(user) fun usersToAdminUserDTOs(users: List<<%= user.persistClass %>>): MutableList<<%= user.adminUserDto %>> = users.asSequence() @@ -99,11 +99,11 @@ class UserMapper { @Named("id") @BeanMapping(ignoreByDefault = true) @Mapping(target = "id", source = "id") - fun toDtoId(user: <%= user.persistClass %>?): <%= user.restClass %>? { + fun toDtoId(user: <%= user.persistClass %>?): <%= user.dtoClass %>? { if (user == null) { return null } - val userDto = <%= user.restClass %>() + val userDto = <%= user.dtoClass %>() userDto.id = user.id return userDto } @@ -111,12 +111,12 @@ class UserMapper { @Named("idSet") @BeanMapping(ignoreByDefault = true) @Mapping(target = "id", source = "id") - fun toDtoIdSet(users: Set<<%= user.persistClass %>>?): Set<<%= user.restClass %>>? { + fun toDtoIdSet(users: Set<<%= user.persistClass %>>?): Set<<%= user.dtoClass %>>? { if ( users == null ) { - return emptySet<<%= user.restClass %>>() + return emptySet<<%= user.dtoClass %>>() } - val userSet = hashSetOf<<%= user.restClass %>>() + val userSet = hashSetOf<<%= user.dtoClass %>>() users.forEach { this.toDtoId(it)?.let { userSet.add(it) @@ -131,11 +131,11 @@ class UserMapper { Mapping(target = "id", source = "id"), Mapping(target = "login", source = "login") ) - fun toDtoLogin(user: <%= user.persistClass %>?): <%= user.restClass %>? { + fun toDtoLogin(user: <%= user.persistClass %>?): <%= user.dtoClass %>? { if (user == null) { return null } - val userDto = <%= user.restClass %>() + val userDto = <%= user.dtoClass %>() userDto.id = user.id userDto.login = user.login return userDto @@ -147,12 +147,12 @@ class UserMapper { Mapping(target = "id", source = "id"), Mapping(target = "login", source = "login") ) - fun toDtoLoginSet(users: Set<<%= user.persistClass %>>?): Set<<%= user.restClass %>>? { + fun toDtoLoginSet(users: Set<<%= user.persistClass %>>?): Set<<%= user.dtoClass %>>? { if ( users == null ) { - return emptySet<<%= user.restClass %>>() + return emptySet<<%= user.dtoClass %>>() } - val userSet = hashSetOf<<%= user.restClass %>>() + val userSet = hashSetOf<<%= user.dtoClass %>>() users.forEach { this.toDtoLogin(it)?.let { userSet.add(it) diff --git a/generators/spring-boot-v2/templates/src/main/kotlin/_package_/web/rest/UserJWTController.kt.ejs b/generators/spring-boot/templates/src/main/kotlin/_package_/web/rest/AuthenticateController.kt.ejs similarity index 100% rename from generators/spring-boot-v2/templates/src/main/kotlin/_package_/web/rest/UserJWTController.kt.ejs rename to generators/spring-boot/templates/src/main/kotlin/_package_/web/rest/AuthenticateController.kt.ejs diff --git a/generators/spring-boot/templates/src/main/kotlin/_package_/web/rest/LogoutResource_reactive.kt.ejs b/generators/spring-boot/templates/src/main/kotlin/_package_/web/rest/LogoutResource_reactive.kt.ejs index b9c183e20..0c3c54257 100644 --- a/generators/spring-boot/templates/src/main/kotlin/_package_/web/rest/LogoutResource_reactive.kt.ejs +++ b/generators/spring-boot/templates/src/main/kotlin/_package_/web/rest/LogoutResource_reactive.kt.ejs @@ -18,7 +18,6 @@ -%> package <%= packageName %>.web.rest -import org.springframework.http.ResponseEntity import org.springframework.security.core.annotation.AuthenticationPrincipal import org.springframework.security.oauth2.client.registration.ClientRegistration import org.springframework.security.oauth2.client.registration.ReactiveClientRegistrationRepository @@ -45,7 +44,7 @@ class LogoutResource( * @param idToken the ID token. * @param request a {@link ServerHttpRequest} request. * @param session the current {@link WebSession}. - * @return the [ResponseEntity] with status `200 (OK)` and a body with a global logout URL. + * @return status {@code 200 (OK)} and a body with a global logout URL. */ @PostMapping("/api/logout") fun logout(@AuthenticationPrincipal(expression = "idToken") idToken: OidcIdToken, request: ServerHttpRequest, session: WebSession): Mono> { diff --git a/generators/spring-boot/templates/src/test/kotlin/_package_/_entityPackage_/service/UserServiceIT.kt.ejs b/generators/spring-boot/templates/src/test/kotlin/_package_/_entityPackage_/service/UserServiceIT.kt.ejs index 36383c529..91ad37923 100644 --- a/generators/spring-boot/templates/src/test/kotlin/_package_/_entityPackage_/service/UserServiceIT.kt.ejs +++ b/generators/spring-boot/templates/src/test/kotlin/_package_/_entityPackage_/service/UserServiceIT.kt.ejs @@ -27,7 +27,7 @@ import <%= packageName %>.config.DEFAULT_LANGUAGE import <%= packageName %>.domain.PersistentToken <%_ } _%> <%_ if (!databaseTypeNo) { _%> -import <%= packageName %>.domain.<%= user.persistClass %> +import <%= user.entityAbsoluteClass %> <%_ } _%> <%_ if ((databaseTypeSql || databaseTypeMongodb || databaseTypeNeo4j || databaseTypeCouchbase) && authenticationTypeSession && !reactive) { _%> import <%= packageName %>.repository.PersistentTokenRepository diff --git a/generators/spring-boot/templates/src/test/kotlin/_package_/_entityPackage_/service/dto/_dtoClass_Test.kt.ejs b/generators/spring-boot/templates/src/test/kotlin/_package_/_entityPackage_/service/dto/_dtoClass_Test.kt.ejs index 7f5e115fa..5c2bce0e1 100644 --- a/generators/spring-boot/templates/src/test/kotlin/_package_/_entityPackage_/service/dto/_dtoClass_Test.kt.ejs +++ b/generators/spring-boot/templates/src/test/kotlin/_package_/_entityPackage_/service/dto/_dtoClass_Test.kt.ejs @@ -1,5 +1,5 @@ <%# - Copyright 2013-2019 the original author or authors from the JHipster project. + Copyright 2013-2024 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. diff --git a/generators/spring-boot/templates/src/test/kotlin/_package_/_entityPackage_/service/mapper/_entityClass_MapperTest.kt.ejs b/generators/spring-boot/templates/src/test/kotlin/_package_/_entityPackage_/service/mapper/_entityClass_MapperTest.kt.ejs index 70d4f8b4c..7373b3fd3 100644 --- a/generators/spring-boot/templates/src/test/kotlin/_package_/_entityPackage_/service/mapper/_entityClass_MapperTest.kt.ejs +++ b/generators/spring-boot/templates/src/test/kotlin/_package_/_entityPackage_/service/mapper/_entityClass_MapperTest.kt.ejs @@ -1,5 +1,5 @@ <%# - Copyright 2013-2019 the original author or authors from the JHipster project. + Copyright 2013-2024 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. diff --git a/generators/spring-boot/templates/src/test/kotlin/_package_/_entityPackage_/web/rest/PublicUserResourceIT.kt.ejs b/generators/spring-boot/templates/src/test/kotlin/_package_/_entityPackage_/web/rest/PublicUserResourceIT.kt.ejs index 7289d254d..5e40c1c0f 100644 --- a/generators/spring-boot/templates/src/test/kotlin/_package_/_entityPackage_/web/rest/PublicUserResourceIT.kt.ejs +++ b/generators/spring-boot/templates/src/test/kotlin/_package_/_entityPackage_/web/rest/PublicUserResourceIT.kt.ejs @@ -27,7 +27,7 @@ import <%= packageName %>.security.USER <%_ if (authenticationTypeOauth2) { _%> import <%= packageName %>.config.TestSecurityConfiguration <%_ } _%> -import <%= packageName %>.domain.<%= user.persistClass %> +import <%= user.entityAbsoluteClass %> import <%= packageName %>.repository.UserRepository <%_ if (searchEngineElasticsearch) { _%> import <%= packageName %>.repository.search.UserSearchRepository @@ -56,7 +56,7 @@ import org.springframework.security.test.context.TestSecurityContextHolder <%_ } _%> import org.springframework.security.test.context.support.WithMockUser <%_ if (reactive) { _%> -import <%= packageName %>.service.dto.<%= user.restClass %> +import <%= packageName %>.service.dto.<%= user.dtoClass %> import org.springframework.test.web.reactive.server.WebTestClient <%_ } else { _%> import org.springframework.test.web.servlet.MockMvc @@ -72,7 +72,6 @@ import reactor.core.publisher.Mono import javax.persistence.EntityManager <%_ } _%> <%_ if (databaseTypeCassandra || databaseTypeCouchbase) { _%> -import java.util.stream.Collectors import java.util.stream.Stream <%_ } _%> <%_ if (databaseTypeCassandra) { _%> @@ -97,7 +96,7 @@ import org.springframework.test.web.servlet.result.MockMvcResultMatchers.* <%_ } _%> /** - * Integration tests for the {@link UserResource} REST controller. + * Integration tests for the {@link PublicUserResource} REST controller. */ <%_ if (reactive) { _%> @AutoConfigureWebTestClient(timeout = IntegrationTest.DEFAULT_TIMEOUT) @@ -185,7 +184,7 @@ class PublicUserResourceIT { .exchange() .expectStatus().isOk .expectHeader().contentType(MediaType.APPLICATION_JSON) - .returnResult(<%= user.restClass %>::class.java).responseBody.blockFirst() + .returnResult(<%= user.dtoClass %>::class.java).responseBody.blockFirst() assertThat(foundUser.login).isEqualTo(DEFAULT_LOGIN) <%_ for (field of user.fields.filter(field => !field.builtIn && field.relatedByOtherEntity)) { _%> diff --git a/generators/spring-boot/templates/src/test/kotlin/_package_/_entityPackage_/web/rest/UserResourceIT.kt.ejs b/generators/spring-boot/templates/src/test/kotlin/_package_/_entityPackage_/web/rest/UserResourceIT.kt.ejs index 1f5293088..c83880df9 100644 --- a/generators/spring-boot/templates/src/test/kotlin/_package_/_entityPackage_/web/rest/UserResourceIT.kt.ejs +++ b/generators/spring-boot/templates/src/test/kotlin/_package_/_entityPackage_/web/rest/UserResourceIT.kt.ejs @@ -34,7 +34,7 @@ import <%= packageName %>.config.SYSTEM_ACCOUNT <%_ if (!databaseTypeCassandra && !databaseTypeCouchbase) { _%> import <%= packageName %>.domain.Authority <%_ } _%> -import <%= packageName %>.domain.<%= user.persistClass %> +import <%= user.entityAbsoluteClass %> <%_ if (databaseTypeSql && reactive) { _%> import <%= packageName %>.repository.AuthorityRepository <%_ } _%> diff --git a/generators/spring-boot/templates/src/test/kotlin/_package_/_entityPackage_/web/rest/_entityClass_ResourceIT.kt.ejs b/generators/spring-boot/templates/src/test/kotlin/_package_/_entityPackage_/web/rest/_entityClass_ResourceIT.kt.ejs index 7599fedf8..979940546 100644 --- a/generators/spring-boot/templates/src/test/kotlin/_package_/_entityPackage_/web/rest/_entityClass_ResourceIT.kt.ejs +++ b/generators/spring-boot/templates/src/test/kotlin/_package_/_entityPackage_/web/rest/_entityClass_ResourceIT.kt.ejs @@ -1321,7 +1321,7 @@ class <%= entityClass %>ResourceIT { <%_ } _%> <%= entityInstance %>Repository.<%= saveMethod %>(<%= persistInstance %>)<%= callBlock %> <% const fieldsToIncludeInPartialPatchTest = fieldsToTest.map(field => prepareFieldForPatchTest(field, () => faker.datatype.boolean())); %> - <%- include('/partials/it_patch_update.partial.kt.ejs', {fields: fieldsToIncludeInPartialPatchTest, saveMethod, asEntity, callBlock, callListBlock, getPrimaryKeyValue, authenticationUsesCsrf}); -%> + <%- include('/_global_partials_entity_/it_patch_update.partial.kt.ejs', {fields: fieldsToIncludeInPartialPatchTest, saveMethod, asEntity, callBlock, callListBlock, getPrimaryKeyValue, authenticationUsesCsrf}); -%> } @Test<%= transactionalAnnotation %> @@ -1334,7 +1334,7 @@ class <%= entityClass %>ResourceIT { <%_ } _%> <%= entityInstance %>Repository.<%= saveMethod %>(<%= persistInstance %>)<%= callBlock %> <% const fieldsToIncludeInFullPatchTest = fieldsToTest.map(field => prepareFieldForPatchTest(field, () => true)); %> - <%- include('/partials/it_patch_update.partial.kt.ejs', {fields: fieldsToIncludeInFullPatchTest, saveMethod, asEntity, callBlock, callListBlock, getPrimaryKeyValue, authenticationUsesCsrf}); -%> + <%- include('/_global_partials_entity_/it_patch_update.partial.kt.ejs', {fields: fieldsToIncludeInFullPatchTest, saveMethod, asEntity, callBlock, callListBlock, getPrimaryKeyValue, authenticationUsesCsrf}); -%> } @Test<%= transactionalAnnotation %> diff --git a/generators/spring-boot/templates/src/test/kotlin/_package_/config/JHipsterBlockHoundIntegration.kt.ejs b/generators/spring-boot/templates/src/test/kotlin/_package_/config/JHipsterBlockHoundIntegration.kt.ejs index 89be394a2..f34c9fe3b 100644 --- a/generators/spring-boot/templates/src/test/kotlin/_package_/config/JHipsterBlockHoundIntegration.kt.ejs +++ b/generators/spring-boot/templates/src/test/kotlin/_package_/config/JHipsterBlockHoundIntegration.kt.ejs @@ -23,7 +23,7 @@ import reactor.blockhound.integration.BlockHoundIntegration class JHipsterBlockHoundIntegration: BlockHoundIntegration { override fun applyTo(builder: BlockHound.Builder) { - builder.allowBlockingCallsInside("org.springframework.test.web.reactive.server.DefaultWebTestClient\$DefaultRequestBodyUriSpec", "exchange"); + builder.allowBlockingCallsInside("org.springframework.test.web.reactive.server.DefaultWebTestClient\$DefaultRequestBodyUriSpec", "exchange") // Workaround until https://github.com/reactor/reactor-core/issues/2137 is fixed builder.allowBlockingCallsInside("reactor.core.scheduler.BoundedElasticScheduler\$BoundedState", "dispose") @@ -48,9 +48,9 @@ class JHipsterBlockHoundIntegration: BlockHoundIntegration { <%_} _%> // v8 entries - builder.allowBlockingCallsInside("org.springframework.web.reactive.result.method.InvocableHandlerMethod", "invoke"); - builder.allowBlockingCallsInside("org.springdoc.core.service.OpenAPIService", "build"); - builder.allowBlockingCallsInside("org.springdoc.core.service.AbstractRequestService", "build"); + builder.allowBlockingCallsInside("org.springframework.web.reactive.result.method.InvocableHandlerMethod", "invoke") + builder.allowBlockingCallsInside("org.springdoc.core.service.OpenAPIService", "build") + builder.allowBlockingCallsInside("org.springdoc.core.service.AbstractRequestService", "build") // jhipster-needle-blockhound-integration - JHipster will add additional gradle plugins here } diff --git a/generators/spring-boot/templates/src/test/kotlin/_package_/security/DomainUserDetailsServiceIT.kt.ejs b/generators/spring-boot/templates/src/test/kotlin/_package_/security/DomainUserDetailsServiceIT.kt.ejs index 8b76b4c66..f666b4c55 100644 --- a/generators/spring-boot/templates/src/test/kotlin/_package_/security/DomainUserDetailsServiceIT.kt.ejs +++ b/generators/spring-boot/templates/src/test/kotlin/_package_/security/DomainUserDetailsServiceIT.kt.ejs @@ -22,7 +22,7 @@ import <%= packageName %>.IntegrationTest <%_ if (databaseTypeSql && reactive) { _%> import <%= packageName %>.config.SYSTEM_ACCOUNT <%_ } _%> -import <%= packageName %>.domain.<%= user.persistClass %> +import <%= user.entityAbsoluteClass %> import <%= packageName %>.repository.UserRepository import org.apache.commons.lang3.RandomStringUtils diff --git a/generators/spring-boot-v2/templates/src/test/kotlin/_package_/security/jwt/TokenProviderSecurityMetersTests.kt.ejs b/generators/spring-boot/templates/src/test/kotlin/_package_/security/jwt/TokenAuthenticationSecurityMetersIT.kt.ejs similarity index 100% rename from generators/spring-boot-v2/templates/src/test/kotlin/_package_/security/jwt/TokenProviderSecurityMetersTests.kt.ejs rename to generators/spring-boot/templates/src/test/kotlin/_package_/security/jwt/TokenAuthenticationSecurityMetersIT.kt.ejs diff --git a/generators/spring-boot/templates/src/test/kotlin/_package_/security/oauth2/CustomClaimConverterIT.kt.ejs b/generators/spring-boot/templates/src/test/kotlin/_package_/security/oauth2/CustomClaimConverterIT.kt.ejs index bebbb33f2..a583ba30f 100644 --- a/generators/spring-boot/templates/src/test/kotlin/_package_/security/oauth2/CustomClaimConverterIT.kt.ejs +++ b/generators/spring-boot/templates/src/test/kotlin/_package_/security/oauth2/CustomClaimConverterIT.kt.ejs @@ -174,7 +174,7 @@ class CustomClaimConverterIT { assertThat(customClaimConverter.convert(claims)) .containsEntry("preferred_username", USERNAME) .containsEntry("given_name", NAME) - .containsEntry("family_name", FAMILY_NAME); + .containsEntry("family_name", FAMILY_NAME) }.doesNotThrowAnyException() } @@ -193,7 +193,7 @@ class CustomClaimConverterIT { assertThat(customClaimConverter.convert(claims)) .containsEntry("preferred_username", USERNAME) .containsEntry("given_name", NAME) - .containsEntry("family_name", FAMILY_NAME + " " + NAME_SUFFIX); + .containsEntry("family_name", FAMILY_NAME + " " + NAME_SUFFIX) }.doesNotThrowAnyException() } @@ -211,7 +211,7 @@ class CustomClaimConverterIT { assertThatCode { assertThat(customClaimConverter.convert(claims)) .containsEntry("preferred_username", USERNAME) - .containsEntry("email", EMAIL); - }.doesNotThrowAnyException(); + .containsEntry("email", EMAIL) + }.doesNotThrowAnyException() } } diff --git a/generators/spring-boot/templates/src/test/kotlin/_package_/service/MailServiceIT.kt.ejs b/generators/spring-boot/templates/src/test/kotlin/_package_/service/MailServiceIT.kt.ejs index fd57dc376..a5f402447 100644 --- a/generators/spring-boot/templates/src/test/kotlin/_package_/service/MailServiceIT.kt.ejs +++ b/generators/spring-boot/templates/src/test/kotlin/_package_/service/MailServiceIT.kt.ejs @@ -20,7 +20,7 @@ package <%= packageName %>.service import <%= packageName %>.config.DEFAULT_LANGUAGE import <%= packageName %>.IntegrationTest -import <%= packageName %>.domain.<%= user.persistClass %> +import <%= user.entityAbsoluteClass %> import tech.jhipster.config.JHipsterProperties import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test diff --git a/generators/spring-boot/templates/src/test/kotlin/_package_/service/mapper/UserMapperTest.kt.ejs b/generators/spring-boot/templates/src/test/kotlin/_package_/service/mapper/UserMapperTest.kt.ejs index 32e8f0211..bfe2768cc 100644 --- a/generators/spring-boot/templates/src/test/kotlin/_package_/service/mapper/UserMapperTest.kt.ejs +++ b/generators/spring-boot/templates/src/test/kotlin/_package_/service/mapper/UserMapperTest.kt.ejs @@ -18,9 +18,9 @@ -%> package <%= packageName %>.service.mapper -import <%= packageName %>.domain.<%= user.persistClass %> +import <%= user.entityAbsoluteClass %> import <%= packageName %>.service.dto.<%= user.adminUserDto %> -import <%= packageName %>.service.dto.<%= user.restClass %> +import <%= packageName %>.service.dto.<%= user.dtoClass %> <%_ if (!authenticationTypeOauth2) { _%> import org.apache.commons.lang3.RandomStringUtils <%_ } _%> diff --git a/generators/spring-boot/templates/src/test/kotlin/_package_/web/rest/AccountResourceIT.kt.ejs b/generators/spring-boot/templates/src/test/kotlin/_package_/web/rest/AccountResourceIT.kt.ejs index 2786acd5d..747406d79 100644 --- a/generators/spring-boot/templates/src/test/kotlin/_package_/web/rest/AccountResourceIT.kt.ejs +++ b/generators/spring-boot/templates/src/test/kotlin/_package_/web/rest/AccountResourceIT.kt.ejs @@ -26,7 +26,7 @@ import <%= packageName %>.config.DEFAULT_LANGUAGE <%_ if (authenticationTypeSession && !reactive) { _%> import <%= packageName %>.domain.PersistentToken <%_ } _%> -import <%= packageName %>.domain.<%= user.persistClass %> +import <%= user.entityAbsoluteClass %> <%_ if (databaseTypeSql || databaseTypeMongodb || databaseTypeNeo4j) { _%> import <%= packageName %>.repository.AuthorityRepository diff --git a/generators/spring-boot-v2/templates/src/test/kotlin/_package_/web/rest/UserJWTControllerIT.kt.ejs b/generators/spring-boot/templates/src/test/kotlin/_package_/web/rest/AuthenticateControllerIT.kt.ejs similarity index 99% rename from generators/spring-boot-v2/templates/src/test/kotlin/_package_/web/rest/UserJWTControllerIT.kt.ejs rename to generators/spring-boot/templates/src/test/kotlin/_package_/web/rest/AuthenticateControllerIT.kt.ejs index 111f62e18..1a1ad0ba7 100644 --- a/generators/spring-boot-v2/templates/src/test/kotlin/_package_/web/rest/UserJWTControllerIT.kt.ejs +++ b/generators/spring-boot/templates/src/test/kotlin/_package_/web/rest/AuthenticateControllerIT.kt.ejs @@ -23,7 +23,7 @@ import <%= packageName %>.IntegrationTest import <%= packageName %>.config.SYSTEM_ACCOUNT <%_ } _%> <%_ if (!skipUserManagement) { _%> -import <%= packageName %>.domain.<%= user.persistClass %> +import <%= user.entityAbsoluteClass %> import <%= packageName %>.repository.UserRepository <%_ } _%> import <%= packageName %>.web.rest.vm.LoginVM diff --git a/generators/spring-boot/templates/src/test/kotlin/_package_/web/rest/TestUtil.kt.ejs b/generators/spring-boot/templates/src/test/kotlin/_package_/web/rest/TestUtil.kt.ejs index f6e0df6cb..d791af705 100644 --- a/generators/spring-boot/templates/src/test/kotlin/_package_/web/rest/TestUtil.kt.ejs +++ b/generators/spring-boot/templates/src/test/kotlin/_package_/web/rest/TestUtil.kt.ejs @@ -205,11 +205,12 @@ fun createFormattingConversionService(): FormattingConversionService { <%_ } _%> <%_ if (databaseTypeSql) { _%> /** - * Finds stored objects of the specified type. - * @param clazz the class type to be searched. - * @return a list of all found objects. - * @param the type of objects to be searched. - */ +* Executes a query on the EntityManager finding all stored objects. +* @param The type of objects to be searched +* @param em The instance of the EntityManager +* @param clazz The class type to be searched +* @return A list of all found objects +*/ fun findAll(em: EntityManager, clazz: KClass): List { val cb = em.criteriaBuilder val cq = cb.createQuery(clazz.java)