From 5cb6780bbebd463d25667d5cb9a38890a523c92c Mon Sep 17 00:00:00 2001 From: rschneider <97682836+rainer-exxcellent@users.noreply.github.com> Date: Thu, 25 May 2023 13:21:23 +0200 Subject: [PATCH 1/7] feat(api): #172 Rename BPN fields --- .../org/eclipse/tractusx/bpdm/pool/util/ResponseValues.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/util/ResponseValues.kt b/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/util/ResponseValues.kt index a2e93d588..235462c18 100644 --- a/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/util/ResponseValues.kt +++ b/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/util/ResponseValues.kt @@ -50,7 +50,7 @@ object ResponseValues { LegalEntityIdentifierResponse(CommonValues.identifierValue2, RequestValues.identifierType2, CommonValues.issuingBody2) private val identifier3 = LegalEntityIdentifierResponse(CommonValues.identifierValue3, RequestValues.identifierType3, CommonValues.issuingBody3) - + val legalForm1 = LegalFormResponse( technicalKey = CommonValues.legalFormTechnicalKey1, name = CommonValues.legalFormName1, @@ -244,7 +244,7 @@ object ResponseValues { val legalEntity1 = LegalEntityResponse( bpnl = CommonValues.bpnL1, - legalName = CommonValues.name1, + legalName = name1, identifiers = listOf(identifier1), legalForm = legalForm1, states = listOf(leStatus1), From 3e23529bea3cac2a54f2116ffd792d77aca6378e Mon Sep 17 00:00:00 2001 From: rschneider <97682836+rainer-exxcellent@users.noreply.github.com> Date: Thu, 25 May 2023 16:34:22 +0200 Subject: [PATCH 2/7] feat(api): #172 Unwrap name schema #180 --- .../org/eclipse/tractusx/bpdm/pool/util/ResponseValues.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/util/ResponseValues.kt b/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/util/ResponseValues.kt index 235462c18..6a9840f04 100644 --- a/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/util/ResponseValues.kt +++ b/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/util/ResponseValues.kt @@ -244,7 +244,7 @@ object ResponseValues { val legalEntity1 = LegalEntityResponse( bpnl = CommonValues.bpnL1, - legalName = name1, + legalName = CommonValues.name1, identifiers = listOf(identifier1), legalForm = legalForm1, states = listOf(leStatus1), From ed28243217eb4575b88101e001b3bc03a2b21b34 Mon Sep 17 00:00:00 2001 From: rschneider <97682836+rainer-exxcellent@users.noreply.github.com> Date: Tue, 30 May 2023 08:38:26 +0200 Subject: [PATCH 3/7] feat(api): #181 Gate API: Nameparts add legalNameParts to Gate --- .../bpdm/gate/api/model/LegalEntityGateInputRequest.kt | 3 +++ .../bpdm/gate/api/model/LegalEntityGateInputResponse.kt | 3 +++ .../tractusx/bpdm/gate/api/model/LegalEntityGateOutput.kt | 3 +++ 3 files changed, 9 insertions(+) diff --git a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/LegalEntityGateInputRequest.kt b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/LegalEntityGateInputRequest.kt index 50ccc5749..214da1c51 100644 --- a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/LegalEntityGateInputRequest.kt +++ b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/LegalEntityGateInputRequest.kt @@ -28,6 +28,9 @@ import org.eclipse.tractusx.bpdm.common.service.DataClassUnwrappedJsonDeserializ @JsonDeserialize(using = DataClassUnwrappedJsonDeserializer::class) @Schema(name = "LegalEntityGateInputRequest", description = "Legal entity with external id") data class LegalEntityGateInputRequest( + + val legalNameParts: Array = emptyArray(), + @field:JsonUnwrapped val legalEntity: LegalEntityDto, diff --git a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/LegalEntityGateInputResponse.kt b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/LegalEntityGateInputResponse.kt index 8625580a7..3afee8394 100644 --- a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/LegalEntityGateInputResponse.kt +++ b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/LegalEntityGateInputResponse.kt @@ -29,6 +29,9 @@ import java.time.LocalDateTime @JsonDeserialize(using = DataClassUnwrappedJsonDeserializer::class) @Schema(name = "LegalEntityGateInputResponse", description = "Legal entity with external id") data class LegalEntityGateInputResponse( + + val legalNameParts: Array = emptyArray(), + @field:JsonUnwrapped val legalEntity: LegalEntityDto, diff --git a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/LegalEntityGateOutput.kt b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/LegalEntityGateOutput.kt index b3ffa96e6..1c53115ba 100644 --- a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/LegalEntityGateOutput.kt +++ b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/LegalEntityGateOutput.kt @@ -30,6 +30,9 @@ import org.eclipse.tractusx.bpdm.common.service.DataClassUnwrappedJsonDeserializ @JsonDeserialize(using = DataClassUnwrappedJsonDeserializer::class) @Schema(name = "LegalEntityGateOutput", description = "Legal entity with references") data class LegalEntityGateOutput( + + val legalNameParts: Array = emptyArray(), + @field:JsonUnwrapped val legalEntity: LegalEntityResponse, From 03effc84ecd8f505bf92168095302e39ab7612e9 Mon Sep 17 00:00:00 2001 From: rschneider <97682836+rainer-exxcellent@users.noreply.github.com> Date: Tue, 30 May 2023 13:51:02 +0200 Subject: [PATCH 4/7] feat(api): #181 Gate API: Nameparts add PoolLegalEntityResponse --- .../bpdm/common/dto/LegalEntityDto.kt | 3 - .../dto/response/LegalEntityResponse.kt | 5 +- .../dto/response/PoolLegalEntityResponse.kt | 60 +++++++++++++++++++ .../bpdm/common/service/SaasMappings.kt | 5 +- .../service/LegalEntityPersistenceService.kt | 2 +- .../bpdm/gate/service/LegalEntityService.kt | 20 ++++++- .../tractusx/bpdm/gate/service/PoolClient.kt | 4 +- .../bpdm/gate/service/ResponseMappings.kt | 2 +- .../gate/service/SaasRequestMappingService.kt | 2 +- .../LegalEntityControllerOutputIT.kt | 8 +-- .../tractusx/bpdm/gate/util/RequestValues.kt | 4 +- .../tractusx/bpdm/gate/util/ResponseValues.kt | 37 ++++++++++-- .../bpdm/pool/api/PoolLegalEntityApi.kt | 4 +- .../LegalEntityPartnerCreateRequest.kt | 6 +- .../LegalEntityPartnerUpdateRequest.kt | 4 ++ .../model/response/BusinessPartnerResponse.kt | 4 +- .../response/LegalEntityMatchResponse.kt | 4 +- .../LegalEntityPartnerCreateResponse.kt | 4 +- .../pool/controller/LegalEntityController.kt | 6 +- .../service/BusinessPartnerBuildService.kt | 12 ++-- .../service/BusinessPartnerFetchService.kt | 7 ++- .../bpdm/pool/service/ResponseMappings.kt | 4 +- .../BusinessPartnerLegacyControllerIT.kt | 4 +- .../LegalEntityControllerSearchIT.kt | 17 +++--- .../tractusx/bpdm/pool/util/RequestValues.kt | 9 ++- .../tractusx/bpdm/pool/util/ResponseValues.kt | 12 ++-- 26 files changed, 178 insertions(+), 71 deletions(-) create mode 100644 bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/PoolLegalEntityResponse.kt diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/LegalEntityDto.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/LegalEntityDto.kt index 6ba6712e4..352d1cfb5 100644 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/LegalEntityDto.kt +++ b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/LegalEntityDto.kt @@ -27,9 +27,6 @@ data class LegalEntityDto( @ArraySchema(arraySchema = Schema(description = "Additional identifiers (except BPN)", required = false)) val identifiers: Collection = emptyList(), - @get:Schema(description = "Legal name the partner goes by") - val legalName: String, - @get:Schema(description = "Abbreviated name or shorthand") val legalShortName: String?, diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/LegalEntityResponse.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/LegalEntityResponse.kt index 9ff99f5fc..8565e6070 100644 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/LegalEntityResponse.kt +++ b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/LegalEntityResponse.kt @@ -23,7 +23,7 @@ import io.swagger.v3.oas.annotations.media.ArraySchema import io.swagger.v3.oas.annotations.media.Schema import java.time.Instant -// TODO probably rename to LegalEntityDetailedDto + @Schema(name = "LegalEntityResponse", description = "Legal entity record") data class LegalEntityResponse( @get:Schema(description = "Business Partner Number of this legal entity") @@ -32,9 +32,6 @@ data class LegalEntityResponse( @ArraySchema(arraySchema = Schema(description = "All identifiers of the business partner, including BPN information")) val identifiers: Collection = emptyList(), - @get:Schema(description = "Legal name the partner goes by") - val legalName: String, - @get:Schema(description = "Abbreviated name or shorthand") val legalShortName: String? = null, diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/PoolLegalEntityResponse.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/PoolLegalEntityResponse.kt new file mode 100644 index 000000000..1ea822a02 --- /dev/null +++ b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/PoolLegalEntityResponse.kt @@ -0,0 +1,60 @@ +/******************************************************************************* + * Copyright (c) 2021,2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ******************************************************************************/ + +package org.eclipse.tractusx.bpdm.common.dto.response + +import io.swagger.v3.oas.annotations.media.ArraySchema +import io.swagger.v3.oas.annotations.media.Schema +import java.time.Instant + +@Schema(name = "LegalEntityResponse", description = "Legal entity record") +data class PoolLegalEntityResponse( + @get:Schema(description = "Business Partner Number of this legal entity") + val bpnl: String, + + @ArraySchema(arraySchema = Schema(description = "All identifiers of the business partner, including BPN information")) + val identifiers: Collection = emptyList(), + + @get:Schema(description = "Legal name the partner goes by") + val legalName: String, + + @get:Schema(description = "Abbreviated name or shorthand") + val legalShortName: String? = null, + + @get:Schema(description = "Legal form of the business partner") + val legalForm: LegalFormResponse? = null, + + @ArraySchema(arraySchema = Schema(description = "Business status")) + val states: Collection = emptyList(), + + @ArraySchema(arraySchema = Schema(description = "Classifications")) + val classifications: Collection = emptyList(), + + @ArraySchema(arraySchema = Schema(description = "Relations to other business partners")) + val relations: Collection = emptyList(), + + @get:Schema(description = "The timestamp the business partner data was last indicated to be still current") + val currentness: Instant, + + @get:Schema(description = "The timestamp the business partner data was created") + val createdAt: Instant, + + @get:Schema(description = "The timestamp the business partner data was last updated") + val updatedAt: Instant +) diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/service/SaasMappings.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/service/SaasMappings.kt index 9cc6f71e1..a16b97675 100644 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/service/SaasMappings.kt +++ b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/service/SaasMappings.kt @@ -70,7 +70,6 @@ object SaasMappings { ?: throw BpdmMappingException(this::class, LegalEntityDto::class, "No legal name", externalId ?: "Unknown") return LegalEntityDto( identifiers = identifiers.filter { it.type?.technicalKey != BPN_TECHNICAL_KEY }.map { toLegalEntityIdentifierDto(it) }, - legalName = legalName.value, legalShortName = legalName.shortName, legalForm = toOptionalReference(legalForm), states = toLegalEntityStatesDtos(status), @@ -101,7 +100,7 @@ object SaasMappings { ) } - private fun BusinessPartnerSaas.toNameDto(): SassNameDto? { + fun BusinessPartnerSaas.toNameDto(): SassNameDto? { if (names.size > 1) { logger.warn { "Business Partner with ID $externalId has more than one name" } } @@ -293,7 +292,7 @@ object SaasMappings { ) } - private data class SassNameDto( + data class SassNameDto( val value: String, val shortName: String? ) { diff --git a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/LegalEntityPersistenceService.kt b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/LegalEntityPersistenceService.kt index 83394f5f0..59ea7c114 100644 --- a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/LegalEntityPersistenceService.kt +++ b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/LegalEntityPersistenceService.kt @@ -70,7 +70,7 @@ class LegalEntityPersistenceService( legalEntity.bpn = legalEntityRequest.bpn legalEntity.externalId = legalEntityRequest.externalId legalEntity.legalForm = legalEntityRequest.legalEntity.legalForm - legalEntity.legalName = Name(value = legalEntityRequest.legalEntity.legalName, shortName = legalEntityRequest.legalEntity.legalShortName) + legalEntity.legalName = Name(value = legalEntityRequest.legalNameParts[0], shortName = legalEntityRequest.legalEntity.legalShortName) legalEntity.identifiers.replace(legalEntityRequest.legalEntity.identifiers.map { toEntityIdentifier(it, legalEntity) }) legalEntity.states.replace(legalEntityRequest.legalEntity.states.map { toEntityState(it, legalEntity) }) legalEntity.classifications.replace(legalEntityRequest.legalEntity.classifications.map { toEntityClassification(it, legalEntity) }) diff --git a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/LegalEntityService.kt b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/LegalEntityService.kt index 4892b9cd3..fe1dbc3f1 100644 --- a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/LegalEntityService.kt +++ b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/LegalEntityService.kt @@ -22,6 +22,10 @@ package org.eclipse.tractusx.bpdm.gate.service import mu.KotlinLogging import org.eclipse.tractusx.bpdm.common.dto.response.LegalEntityResponse import org.eclipse.tractusx.bpdm.common.dto.response.LogisticAddressResponse +import org.eclipse.tractusx.bpdm.common.dto.response.PoolLegalEntityResponse +import org.eclipse.tractusx.bpdm.common.dto.saas.BusinessPartnerSaas +import org.eclipse.tractusx.bpdm.common.dto.saas.FetchResponse +import org.eclipse.tractusx.bpdm.common.exception.BpdmMappingException import org.eclipse.tractusx.bpdm.common.dto.response.PageResponse import org.eclipse.tractusx.bpdm.common.exception.BpdmNotFoundException import org.eclipse.tractusx.bpdm.gate.api.model.LegalEntityGateInputRequest @@ -129,9 +133,21 @@ class LegalEntityService( ) } - fun toLegalEntityOutput(externalId: String, legalEntity: LegalEntityResponse, legalAddress: LogisticAddressResponse): LegalEntityGateOutput = + fun toLegalEntityOutput(externalId: String, legalEntityPool: PoolLegalEntityResponse, legalAddress: LogisticAddressResponse): LegalEntityGateOutput = LegalEntityGateOutput( - legalEntity = legalEntity, + legalEntity = LegalEntityResponse( + bpnl = legalEntityPool.bpnl, + identifiers = legalEntityPool.identifiers, + legalShortName = legalEntityPool.legalShortName, + legalForm = legalEntityPool.legalForm, + states = legalEntityPool.states, + classifications = legalEntityPool.classifications, + relations = legalEntityPool.relations, + currentness = legalEntityPool.currentness, + createdAt = legalEntityPool.createdAt, + updatedAt = legalEntityPool.updatedAt, + ), + legalNameParts = arrayOf(legalEntityPool.legalName), legalAddress = legalAddress, externalId = externalId ) diff --git a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/PoolClient.kt b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/PoolClient.kt index 0fe890e0b..572dbd82b 100644 --- a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/PoolClient.kt +++ b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/PoolClient.kt @@ -35,7 +35,7 @@ class PoolClient( private val webClient: WebClient, private val objectMapper: ObjectMapper ) { - fun searchLegalEntities(bpnLs: Collection): Collection { + fun searchLegalEntities(bpnLs: Collection): Collection { if (bpnLs.isEmpty()) return emptyList() val legalEntities = try { @@ -44,7 +44,7 @@ class PoolClient( .uri("/legal-entities/search") .bodyValue(objectMapper.writeValueAsString(bpnLs)) .retrieve() - .bodyToMono>() + .bodyToMono>() .block()!! } catch (e: Exception) { throw PoolRequestException("Request to search legal entities failed.", e) diff --git a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/ResponseMappings.kt b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/ResponseMappings.kt index 47613ff7b..087423449 100644 --- a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/ResponseMappings.kt +++ b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/ResponseMappings.kt @@ -154,7 +154,7 @@ fun LegalEntityGateInputRequest.toLegalEntity(): LegalEntity { externalId = externalId, currentness = createCurrentnessTimestamp(), legalForm = legalEntity.legalForm, - legalName = Name(legalEntity.legalName, legalEntity.legalShortName) + legalName = Name(legalNameParts[0], legalEntity.legalShortName) ) legalEntity.identifiers.addAll(this.legalEntity.identifiers.map { toEntityIdentifier(it, legalEntity) }) legalEntity.states.addAll(this.legalEntity.states.map { toEntityState(it, legalEntity) }) diff --git a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/SaasRequestMappingService.kt b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/SaasRequestMappingService.kt index ded9a5339..5b386acf0 100644 --- a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/SaasRequestMappingService.kt +++ b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/SaasRequestMappingService.kt @@ -43,7 +43,7 @@ class SaasRequestMappingService( dataSource = saasConfigProperties.datasource, types = listOf(TypeKeyNameUrlSaas(BusinessPartnerTypeSaas.LEGAL_ENTITY.name)), identifiers = toLegalEntityIdentifiersSaas(legalEntity.identifiers, request.bpn), - names = toNamesSaas(legalEntity.legalName), + names = toNamesSaas(request.legalNameParts[0]), // TODO Only the first state is passed to SaaS, any others are ignored status = legalEntity.states.map { it.toSaasModel() }.firstOrNull(), legalForm = toLegalFormSaas(legalEntity.legalForm), diff --git a/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/controller/LegalEntityControllerOutputIT.kt b/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/controller/LegalEntityControllerOutputIT.kt index 3cd3d6a0c..79ffff74d 100644 --- a/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/controller/LegalEntityControllerOutputIT.kt +++ b/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/controller/LegalEntityControllerOutputIT.kt @@ -105,8 +105,8 @@ internal class LegalEntityControllerOutputIT @Autowired constructor( ) val legalEntitiesPool = listOf( - ResponseValues.legalEntityResponse1, - ResponseValues.legalEntityResponse2 + ResponseValues.legalEntityResponsePool1, + ResponseValues.legalEntityResponsePool2 ) val legalAddressesPool = listOf( ResponseValues.logisticAddress1, @@ -209,8 +209,8 @@ internal class LegalEntityControllerOutputIT @Autowired constructor( ) val legalEntitiesPool = listOf( - ResponseValues.legalEntityResponse1, - ResponseValues.legalEntityResponse2 + ResponseValues.legalEntityResponsePool1, + ResponseValues.legalEntityResponsePool2 ) val legalAddressesPool = listOf( ResponseValues.logisticAddress1, diff --git a/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/util/RequestValues.kt b/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/util/RequestValues.kt index e7b28b05a..1b18a771c 100644 --- a/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/util/RequestValues.kt +++ b/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/util/RequestValues.kt @@ -232,7 +232,6 @@ object RequestValues { val legalEntity1 = LegalEntityDto( identifiers = listOf(identifier1, identifier2), - legalName = CommonValues.name1, legalShortName = CommonValues.shortName1, legalForm = CommonValues.legalFormTechnicalKey1, states = listOf(leBusinessStatus1), @@ -242,7 +241,6 @@ object RequestValues { val legalEntity2 = LegalEntityDto( identifiers = listOf(identifier3, identifier4), - legalName = CommonValues.name3, legalShortName = CommonValues.shortName3, legalForm = CommonValues.legalFormTechnicalKey2, states = listOf(leBusinessStatus2), @@ -262,12 +260,14 @@ object RequestValues { val legalEntityGateInputRequest1 = LegalEntityGateInputRequest( legalEntity = legalEntity1, + legalNameParts = arrayOf(CommonValues.name1), externalId = CommonValues.externalId1, bpn = CommonValues.bpn1 ) val legalEntityGateInputRequest2 = LegalEntityGateInputRequest( legalEntity = legalEntity2, + legalNameParts = arrayOf(CommonValues.name3), externalId = CommonValues.externalId2, bpn = CommonValues.bpn2 ) diff --git a/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/util/ResponseValues.kt b/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/util/ResponseValues.kt index 41b37111d..bc9bef591 100644 --- a/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/util/ResponseValues.kt +++ b/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/util/ResponseValues.kt @@ -200,12 +200,11 @@ object ResponseValues { updatedAt = Instant.now() ) - - val legalEntityResponse1 = LegalEntityResponse( + val legalEntityResponsePool1 = PoolLegalEntityResponse( bpnl = CommonValues.bpn1, identifiers = listOf(identifier1, identifier2), - legalName = CommonValues.name1, legalShortName = CommonValues.shortName1, + legalName = CommonValues.name1, legalForm = legalForm1, states = listOf(leBusinessStatus1), classifications = listOf(classification1, classification2), @@ -214,10 +213,34 @@ object ResponseValues { updatedAt = CommonValues.now ) - val legalEntityResponse2 = LegalEntityResponse( + val legalEntityResponsePool2 = PoolLegalEntityResponse( bpnl = CommonValues.bpn2, identifiers = listOf(identifier3, identifier4), + legalShortName = CommonValues.shortName3, legalName = CommonValues.name3, + legalForm = legalForm2, + states = listOf(leBusinessStatus2), + classifications = listOf(classification3, classification4), + currentness = CommonValues.now, + createdAt = CommonValues.now, + updatedAt = CommonValues.now + ) + + val legalEntityResponseGate1 = LegalEntityResponse( + bpnl = CommonValues.bpn1, + identifiers = listOf(identifier1, identifier2), + legalShortName = CommonValues.shortName1, + legalForm = legalForm1, + states = listOf(leBusinessStatus1), + classifications = listOf(classification1, classification2), + currentness = CommonValues.now, + createdAt = CommonValues.now, + updatedAt = CommonValues.now + ) + + val legalEntityResponseGate2 = LegalEntityResponse( + bpnl = CommonValues.bpn2, + identifiers = listOf(identifier3, identifier4), legalShortName = CommonValues.shortName3, legalForm = legalForm2, states = listOf(leBusinessStatus2), @@ -263,13 +286,15 @@ object ResponseValues { ) val legalEntityGateOutput1 = LegalEntityGateOutput( - legalEntity = legalEntityResponse1, + legalEntity = legalEntityResponseGate1, + legalNameParts = arrayOf(CommonValues.name1), legalAddress = logisticAddress1, externalId = CommonValues.externalId1 ) val legalEntityGateOutput2 = LegalEntityGateOutput( - legalEntity = legalEntityResponse2, + legalEntity = legalEntityResponseGate2, + legalNameParts = arrayOf(CommonValues.name3), legalAddress = logisticAddress2, externalId = CommonValues.externalId2 ) diff --git a/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/PoolLegalEntityApi.kt b/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/PoolLegalEntityApi.kt index 826b8bb17..1bf9d34c1 100644 --- a/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/PoolLegalEntityApi.kt +++ b/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/PoolLegalEntityApi.kt @@ -90,7 +90,7 @@ interface PoolLegalEntityApi { @Parameter(description = "Identifier value") @PathVariable idValue: String, @Parameter(description = "Type of identifier to use, defaults to BPN when omitted", schema = Schema(defaultValue = "BPN")) @RequestParam idType: String? = "BPN" - ): LegalEntityResponse + ): PoolLegalEntityResponse @Operation( summary = "Confirms that the data of a legal entity business partner is still up to date.", @@ -130,7 +130,7 @@ interface PoolLegalEntityApi { @PostExchange("/search") fun searchSites( @RequestBody bpnLs: Collection - ): ResponseEntity> + ): ResponseEntity> @Operation( summary = "Get site partners of a legal entity", diff --git a/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/model/request/LegalEntityPartnerCreateRequest.kt b/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/model/request/LegalEntityPartnerCreateRequest.kt index c0ce6808f..f1c478d59 100644 --- a/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/model/request/LegalEntityPartnerCreateRequest.kt +++ b/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/model/request/LegalEntityPartnerCreateRequest.kt @@ -28,9 +28,13 @@ import org.eclipse.tractusx.bpdm.common.service.DataClassUnwrappedJsonDeserializ @JsonDeserialize(using = DataClassUnwrappedJsonDeserializer::class) @Schema(name = "LegalEntityPartnerCreateRequest", description = "Request for creating new business partner record of type legal entity") data class LegalEntityPartnerCreateRequest( + + @get:Schema(description = "Legal name the partner goes by") + val legalName: String, + @field:JsonUnwrapped val legalEntity: LegalEntityDto, @Schema(description = "User defined index to conveniently match this entry to the corresponding entry in the response") val index: String? - ) +) diff --git a/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/model/request/LegalEntityPartnerUpdateRequest.kt b/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/model/request/LegalEntityPartnerUpdateRequest.kt index 12595b58b..c31930cab 100644 --- a/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/model/request/LegalEntityPartnerUpdateRequest.kt +++ b/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/model/request/LegalEntityPartnerUpdateRequest.kt @@ -25,12 +25,16 @@ import io.swagger.v3.oas.annotations.media.Schema import org.eclipse.tractusx.bpdm.common.dto.LegalEntityDto import org.eclipse.tractusx.bpdm.common.service.DataClassUnwrappedJsonDeserializer + @JsonDeserialize(using = DataClassUnwrappedJsonDeserializer::class) @Schema(name = "LegalEntityUpdateRequest", description = "Request for updating a business partner record of type legal entity") data class LegalEntityPartnerUpdateRequest( @Schema(description = "Business Partner Number") val bpnl: String, + @get:Schema(description = "Legal name the partner goes by") + val legalName: String, + @field:JsonUnwrapped val legalEntity: LegalEntityDto ) diff --git a/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/model/response/BusinessPartnerResponse.kt b/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/model/response/BusinessPartnerResponse.kt index 494ed4ee1..94e6f6324 100644 --- a/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/model/response/BusinessPartnerResponse.kt +++ b/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/model/response/BusinessPartnerResponse.kt @@ -23,7 +23,7 @@ import com.fasterxml.jackson.annotation.JsonUnwrapped import com.fasterxml.jackson.databind.annotation.JsonDeserialize import io.swagger.v3.oas.annotations.media.Schema import org.eclipse.tractusx.bpdm.common.dto.response.LogisticAddressResponse -import org.eclipse.tractusx.bpdm.common.dto.response.LegalEntityResponse +import org.eclipse.tractusx.bpdm.common.dto.response.PoolLegalEntityResponse import org.eclipse.tractusx.bpdm.common.dto.response.SiteResponse import org.eclipse.tractusx.bpdm.common.service.DataClassUnwrappedJsonDeserializer @@ -33,7 +33,7 @@ data class BusinessPartnerResponse( val uuid: String, @field:JsonUnwrapped - val legalEntity: LegalEntityResponse, + val legalEntity: PoolLegalEntityResponse, val addresses: Collection, diff --git a/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/model/response/LegalEntityMatchResponse.kt b/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/model/response/LegalEntityMatchResponse.kt index c9e60bb0d..2f92ce040 100644 --- a/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/model/response/LegalEntityMatchResponse.kt +++ b/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/model/response/LegalEntityMatchResponse.kt @@ -20,7 +20,7 @@ package org.eclipse.tractusx.bpdm.pool.api.model.response import io.swagger.v3.oas.annotations.media.Schema -import org.eclipse.tractusx.bpdm.common.dto.response.LegalEntityResponse +import org.eclipse.tractusx.bpdm.common.dto.response.PoolLegalEntityResponse @Schema(name = "LegalEntityMatchResponse", description = "Match with score for a business partner record of type legal entity") data class LegalEntityMatchResponse( @@ -28,5 +28,5 @@ data class LegalEntityMatchResponse( val score: Float, @Schema(description = "Matched legal entity business partner record") - val legalEntity: LegalEntityResponse + val legalEntity: PoolLegalEntityResponse ) diff --git a/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/model/response/LegalEntityPartnerCreateResponse.kt b/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/model/response/LegalEntityPartnerCreateResponse.kt index 961f5075d..1ffecbfd5 100644 --- a/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/model/response/LegalEntityPartnerCreateResponse.kt +++ b/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/model/response/LegalEntityPartnerCreateResponse.kt @@ -22,15 +22,15 @@ package org.eclipse.tractusx.bpdm.pool.api.model.response import com.fasterxml.jackson.annotation.JsonUnwrapped import com.fasterxml.jackson.databind.annotation.JsonDeserialize import io.swagger.v3.oas.annotations.media.Schema -import org.eclipse.tractusx.bpdm.common.dto.response.LegalEntityResponse import org.eclipse.tractusx.bpdm.common.dto.response.LogisticAddressResponse +import org.eclipse.tractusx.bpdm.common.dto.response.PoolLegalEntityResponse import org.eclipse.tractusx.bpdm.common.service.DataClassUnwrappedJsonDeserializer @JsonDeserialize(using = DataClassUnwrappedJsonDeserializer::class) @Schema(name = "LegalEntityPartnerCreateResponse", description = "Created business partner of type legal entity") data class LegalEntityPartnerCreateResponse( @field:JsonUnwrapped - val legalEntity: LegalEntityResponse, + val legalEntity: PoolLegalEntityResponse, @Schema(description = "Address of the official seat of this of the legal entity") val legalAddress: LogisticAddressResponse, diff --git a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/controller/LegalEntityController.kt b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/controller/LegalEntityController.kt index d45367950..de9f2abdd 100644 --- a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/controller/LegalEntityController.kt +++ b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/controller/LegalEntityController.kt @@ -20,9 +20,9 @@ package org.eclipse.tractusx.bpdm.pool.controller import org.eclipse.tractusx.bpdm.common.dto.request.PaginationRequest -import org.eclipse.tractusx.bpdm.common.dto.response.LegalEntityResponse import org.eclipse.tractusx.bpdm.common.dto.response.LogisticAddressResponse import org.eclipse.tractusx.bpdm.common.dto.response.PageResponse +import org.eclipse.tractusx.bpdm.common.dto.response.PoolLegalEntityResponse import org.eclipse.tractusx.bpdm.common.dto.response.SiteResponse import org.eclipse.tractusx.bpdm.pool.api.PoolLegalEntityApi import org.eclipse.tractusx.bpdm.pool.api.model.request.* @@ -65,7 +65,7 @@ class LegalEntityController( ) } - override fun getLegalEntity(idValue: String, idType: String?): LegalEntityResponse { + override fun getLegalEntity(idValue: String, idType: String?): PoolLegalEntityResponse { val actualType = idType ?: bpnConfigProperties.id return if (actualType == bpnConfigProperties.id) businessPartnerFetchService.findLegalEntityIgnoreCase(idValue.uppercase()) else businessPartnerFetchService.findLegalEntityIgnoreCase(actualType, idValue) @@ -78,7 +78,7 @@ class LegalEntityController( override fun searchSites( bpnLs: Collection - ): ResponseEntity> { + ): ResponseEntity> { if (bpnLs.size > controllerConfigProperties.searchRequestLimit) { return ResponseEntity(HttpStatus.BAD_REQUEST) } diff --git a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/BusinessPartnerBuildService.kt b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/BusinessPartnerBuildService.kt index 89e82649d..06b02a4af 100644 --- a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/BusinessPartnerBuildService.kt +++ b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/BusinessPartnerBuildService.kt @@ -73,7 +73,7 @@ class BusinessPartnerBuildService( val legalEntityWithIndexByBpnMap = validRequests .mapIndexed { i, request -> - val legalEntity = createLegalEntity(request.legalEntity, bpnLs[i], legalEntityMetadataMap) + val legalEntity = createLegalEntity(request.legalEntity, bpnLs[i], request.legalName, legalEntityMetadataMap) legalEntity.legalAddress = createLogisticAddress(request.legalEntity.legalAddress, bpnAs[i], legalEntity, addressMetadataMap) Pair(legalEntity, request.index) } @@ -175,7 +175,7 @@ class BusinessPartnerBuildService( val requestByBpnMap = requests.associateBy { it.bpnl } legalEntities.forEach { val request = requestByBpnMap.get(it.bpn)!! - updateLegalEntity(it, request.legalEntity, legalEntityMetadataMap) + updateLegalEntity(it, request.legalEntity, request.legalName, legalEntityMetadataMap) updateLogisticAddress(it.legalAddress, request.legalEntity.legalAddress, addressMetadataMap) } @@ -307,10 +307,11 @@ class BusinessPartnerBuildService( private fun createLegalEntity( request: LegalEntityDto, bpnL: String, + legalNameValue: String, metadataMap: LegalEntityMetadataMappingDto ): LegalEntity { val legalName = Name( - value = request.legalName, + value = legalNameValue, shortName = request.legalShortName ) val legalForm = request.legalForm?.let { metadataMap.legalForms[it]!! } @@ -322,7 +323,7 @@ class BusinessPartnerBuildService( currentness = Instant.now().truncatedTo(ChronoUnit.MICROS), ) - return updateLegalEntity(partner, request, metadataMap) + return updateLegalEntity(partner, request, legalNameValue, metadataMap) } private fun createSite( @@ -345,13 +346,14 @@ class BusinessPartnerBuildService( private fun updateLegalEntity( partner: LegalEntity, request: LegalEntityDto, + legalName: String, metadataMap: LegalEntityMetadataMappingDto ): LegalEntity { partner.currentness = createCurrentnessTimestamp() partner.legalName = Name( - value = request.legalName, + value = legalName, shortName = request.legalShortName ) diff --git a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/BusinessPartnerFetchService.kt b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/BusinessPartnerFetchService.kt index 56900756a..f93712a6c 100644 --- a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/BusinessPartnerFetchService.kt +++ b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/BusinessPartnerFetchService.kt @@ -21,6 +21,7 @@ package org.eclipse.tractusx.bpdm.pool.service import org.eclipse.tractusx.bpdm.common.dto.IdentifierLsaType import org.eclipse.tractusx.bpdm.common.dto.response.LegalEntityResponse +import org.eclipse.tractusx.bpdm.common.dto.response.PoolLegalEntityResponse import org.eclipse.tractusx.bpdm.common.exception.BpdmNotFoundException import org.eclipse.tractusx.bpdm.pool.api.model.response.BpnIdentifierMappingResponse import org.eclipse.tractusx.bpdm.pool.api.model.response.BusinessPartnerResponse @@ -49,7 +50,7 @@ class BusinessPartnerFetchService( /** * Fetch a business partner by [bpn] and return as [LegalEntityResponse] */ - fun findLegalEntityIgnoreCase(bpn: String): LegalEntityResponse { + fun findLegalEntityIgnoreCase(bpn: String): PoolLegalEntityResponse { return findLegalEntityOrThrow(bpn).toDto() } @@ -62,7 +63,7 @@ class BusinessPartnerFetchService( * Fetch a business partner by [identifierValue] (ignoring case) of [identifierType] and return as [LegalEntityResponse] */ @Transactional - fun findLegalEntityIgnoreCase(identifierType: String, identifierValue: String): LegalEntityResponse { + fun findLegalEntityIgnoreCase(identifierType: String, identifierValue: String): PoolLegalEntityResponse { return findLegalEntityOrThrow(identifierType, identifierValue).toDto() } @@ -84,7 +85,7 @@ class BusinessPartnerFetchService( * Fetch business partners by BPN in [bpns] and map to dtos */ @Transactional - fun fetchDtosByBpns(bpns: Collection): Collection { + fun fetchDtosByBpns(bpns: Collection): Collection { return fetchByBpns(bpns).map { it.toDto() } } diff --git a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/ResponseMappings.kt b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/ResponseMappings.kt index 7ccbb67cf..5097dcfef 100644 --- a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/ResponseMappings.kt +++ b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/ResponseMappings.kt @@ -48,8 +48,8 @@ fun LegalEntity.toUpsertDto(entryId: String?): LegalEntityPartnerCreateResponse ) } -fun LegalEntity.toDto(): LegalEntityResponse { - return LegalEntityResponse( +fun LegalEntity.toDto(): PoolLegalEntityResponse { + return PoolLegalEntityResponse( bpnl = bpn, identifiers = identifiers.map { it.toDto() }, legalName = legalName.value, diff --git a/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/controller/BusinessPartnerLegacyControllerIT.kt b/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/controller/BusinessPartnerLegacyControllerIT.kt index 319d7372b..c5fd62105 100644 --- a/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/controller/BusinessPartnerLegacyControllerIT.kt +++ b/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/controller/BusinessPartnerLegacyControllerIT.kt @@ -52,9 +52,7 @@ class BusinessPartnerLegacyControllerIT @Autowired constructor( val partnerStructures = listOf( LegalEntityStructureRequest(legalEntity = with(RequestValues.legalEntityCreate1) { copy( - legalEntity = legalEntity.copy( - legalName = uniqueName - ) + legalName = uniqueName ) }), LegalEntityStructureRequest(legalEntity = RequestValues.legalEntityCreate2), diff --git a/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/controller/LegalEntityControllerSearchIT.kt b/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/controller/LegalEntityControllerSearchIT.kt index 7d5e205c6..54e2d63bc 100644 --- a/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/controller/LegalEntityControllerSearchIT.kt +++ b/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/controller/LegalEntityControllerSearchIT.kt @@ -21,8 +21,8 @@ package org.eclipse.tractusx.bpdm.pool.controller import org.assertj.core.api.Assertions.assertThat import org.eclipse.tractusx.bpdm.common.dto.request.PaginationRequest -import org.eclipse.tractusx.bpdm.common.dto.response.LegalEntityResponse import org.eclipse.tractusx.bpdm.common.dto.response.PageResponse +import org.eclipse.tractusx.bpdm.common.dto.response.PoolLegalEntityResponse import org.eclipse.tractusx.bpdm.pool.Application import org.eclipse.tractusx.bpdm.pool.api.client.PoolClientImpl import org.eclipse.tractusx.bpdm.pool.api.model.request.AddressPropertiesSearchRequest @@ -66,8 +66,8 @@ class LegalEntityControllerSearchIT @Autowired constructor( ) ) - private lateinit var givenPartner1: LegalEntityResponse - private lateinit var givenPartner2: LegalEntityResponse + private lateinit var givenPartner1: PoolLegalEntityResponse + private lateinit var givenPartner2: PoolLegalEntityResponse @BeforeEach fun beforeEach() { @@ -143,7 +143,7 @@ class LegalEntityControllerSearchIT @Autowired constructor( ) ) - val pageResponse = searchBusinessPartnerBySiteName(RequestValues.siteCreate2.site.name,0,10) + val pageResponse = searchBusinessPartnerBySiteName(RequestValues.siteCreate2.site.name, 0, 10) assertPageEquals(pageResponse, expected) } @@ -155,15 +155,16 @@ class LegalEntityControllerSearchIT @Autowired constructor( */ @Test fun `search business partner by site name, no result found`() { - val foundPartners = searchBusinessPartnerBySiteName("nonexistent name",0,10).content + val foundPartners = searchBusinessPartnerBySiteName("nonexistent name", 0, 10).content assertThat(foundPartners).isEmpty() } - private fun searchBusinessPartnerBySiteName(siteName: String, page: Int , size: Int ): PageResponse { + private fun searchBusinessPartnerBySiteName(siteName: String, page: Int, size: Int): PageResponse { val sitePropertiesSearchRequest = SitePropertiesSearchRequest(siteName) - return poolClient.legalEntities().getLegalEntities(LegalEntityPropertiesSearchRequest.EmptySearchRequest, - AddressPropertiesSearchRequest.EmptySearchRequest,sitePropertiesSearchRequest, PaginationRequest(page, size) + return poolClient.legalEntities().getLegalEntities( + LegalEntityPropertiesSearchRequest.EmptySearchRequest, + AddressPropertiesSearchRequest.EmptySearchRequest, sitePropertiesSearchRequest, PaginationRequest(page, size) ) diff --git a/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/util/RequestValues.kt b/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/util/RequestValues.kt index 68be9d43d..c7c499465 100644 --- a/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/util/RequestValues.kt +++ b/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/util/RequestValues.kt @@ -157,7 +157,6 @@ object RequestValues { val legalEntityCreate1 = LegalEntityPartnerCreateRequest( legalEntity = LegalEntityDto( - legalName = CommonValues.name1, legalShortName = null, identifiers = listOf(identifier1), legalForm = CommonValues.legalFormTechnicalKey1, @@ -165,12 +164,12 @@ object RequestValues { classifications = listOf(classification1, classification2), legalAddress = logisticAddress1 ), + legalName = CommonValues.name1, index = CommonValues.index1 ) val legalEntityCreate2 = LegalEntityPartnerCreateRequest( legalEntity = LegalEntityDto( - legalName = CommonValues.name3, legalShortName = null, identifiers = listOf(identifier2), legalForm = CommonValues.legalFormTechnicalKey2, @@ -178,12 +177,12 @@ object RequestValues { classifications = listOf(classification3, classification4), legalAddress = logisticAddress2 ), + legalName = CommonValues.name3, index = CommonValues.index2 ) val legalEntityCreate3 = LegalEntityPartnerCreateRequest( legalEntity = LegalEntityDto( - legalName = CommonValues.name5, legalShortName = null, identifiers = listOf(identifier3), legalForm = CommonValues.legalFormTechnicalKey3, @@ -191,21 +190,25 @@ object RequestValues { classifications = listOf(classification5), legalAddress = logisticAddress3 ), + legalName = CommonValues.name5, index = CommonValues.index3 ) val legalEntityUpdate1 = LegalEntityPartnerUpdateRequest( bpnl = CommonValues.bpnL1, + legalName = legalEntityCreate1.legalName, legalEntity = legalEntityCreate1.legalEntity ) val legalEntityUpdate2 = LegalEntityPartnerUpdateRequest( bpnl = CommonValues.bpnL2, + legalName = legalEntityCreate2.legalName, legalEntity = legalEntityCreate2.legalEntity ) val legalEntityUpdate3 = LegalEntityPartnerUpdateRequest( bpnl = CommonValues.bpnL3, + legalName = legalEntityCreate3.legalName, legalEntity = legalEntityCreate3.legalEntity ) diff --git a/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/util/ResponseValues.kt b/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/util/ResponseValues.kt index 6a9840f04..f2d29739e 100644 --- a/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/util/ResponseValues.kt +++ b/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/util/ResponseValues.kt @@ -242,7 +242,7 @@ object ResponseValues { ) - val legalEntity1 = LegalEntityResponse( + val legalEntity1 = PoolLegalEntityResponse( bpnl = CommonValues.bpnL1, legalName = CommonValues.name1, identifiers = listOf(identifier1), @@ -254,7 +254,7 @@ object ResponseValues { updatedAt = CommonValues.now ) - val legalEntity2 = LegalEntityResponse( + val legalEntity2 = PoolLegalEntityResponse( bpnl = CommonValues.bpnL2, legalName = CommonValues.name3, identifiers = listOf(identifier2), @@ -266,7 +266,7 @@ object ResponseValues { updatedAt = CommonValues.now ) - val legalEntity3 = LegalEntityResponse( + val legalEntity3 = PoolLegalEntityResponse( bpnl = CommonValues.bpnL3, legalName = CommonValues.name5, identifiers = listOf(identifier3), @@ -279,7 +279,7 @@ object ResponseValues { ) val legalEntityUpsert1 = LegalEntityPartnerCreateResponse( - legalEntity = LegalEntityResponse( + legalEntity = PoolLegalEntityResponse( bpnl = CommonValues.bpnL1, legalName = CommonValues.name1, identifiers = listOf(LegalEntityIdentifierResponse(CommonValues.identifierValue1, RequestValues.identifierType1, CommonValues.issuingBody1)), @@ -298,7 +298,7 @@ object ResponseValues { ) val legalEntityUpsert2 = LegalEntityPartnerCreateResponse( - legalEntity = LegalEntityResponse( + legalEntity = PoolLegalEntityResponse( bpnl = CommonValues.bpnL2, legalName = CommonValues.name3, identifiers = listOf(LegalEntityIdentifierResponse(CommonValues.identifierValue2, RequestValues.identifierType2, CommonValues.issuingBody2)), @@ -317,7 +317,7 @@ object ResponseValues { ) val legalEntityUpsert3 = LegalEntityPartnerCreateResponse( - legalEntity = LegalEntityResponse( + legalEntity = PoolLegalEntityResponse( bpnl = CommonValues.bpnL3, legalName = CommonValues.name5, identifiers = listOf(LegalEntityIdentifierResponse(CommonValues.identifierValue3, RequestValues.identifierType3, CommonValues.issuingBody3)), From dca1f47a3571f53d78553c6b9d47db34f93f7e32 Mon Sep 17 00:00:00 2001 From: rschneider <97682836+rainer-exxcellent@users.noreply.github.com> Date: Tue, 30 May 2023 17:23:41 +0200 Subject: [PATCH 5/7] feat(api): #181 Gate API: Nameparts fix tests --- .../LegalEntityControllerInputIT.kt | 5 ++- .../LegalEntityControllerOutputIT.kt | 42 +++++++++---------- .../tractusx/bpdm/gate/util/DbTestHelpers.kt | 13 +++++- 3 files changed, 36 insertions(+), 24 deletions(-) diff --git a/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/controller/LegalEntityControllerInputIT.kt b/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/controller/LegalEntityControllerInputIT.kt index 8a1a855a6..da0f52c00 100644 --- a/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/controller/LegalEntityControllerInputIT.kt +++ b/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/controller/LegalEntityControllerInputIT.kt @@ -61,7 +61,8 @@ internal class LegalEntityControllerInputIT @Autowired constructor( private val webTestClient: WebTestClient, private val objectMapper: ObjectMapper, val gateClient: GateClient, - private val legalEntityRepository: LegalEntityRepository + private val legalEntityRepository: LegalEntityRepository, + private val testHelpers: DbTestHelpers ) { companion object { @RegisterExtension @@ -244,6 +245,8 @@ internal class LegalEntityControllerInputIT @Autowired constructor( .ignoringFieldsMatchingRegexes(".*processStartedAt*", ".*administrativeAreaLevel1*").isEqualTo( expectedPage ) + + testHelpers.assertRecursively(pageResponse).isEqualTo(expectedResponse) } diff --git a/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/controller/LegalEntityControllerOutputIT.kt b/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/controller/LegalEntityControllerOutputIT.kt index 79ffff74d..031d6bd8c 100644 --- a/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/controller/LegalEntityControllerOutputIT.kt +++ b/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/controller/LegalEntityControllerOutputIT.kt @@ -23,7 +23,6 @@ import com.fasterxml.jackson.databind.ObjectMapper import com.github.tomakehurst.wiremock.client.WireMock.* import com.github.tomakehurst.wiremock.core.WireMockConfiguration import com.github.tomakehurst.wiremock.junit5.WireMockExtension -import org.assertj.core.api.Assertions.assertThat import org.eclipse.tractusx.bpdm.common.dto.saas.AugmentedBusinessPartnerResponseSaas import org.eclipse.tractusx.bpdm.common.dto.saas.PagedResponseSaas import org.eclipse.tractusx.bpdm.gate.api.client.GateClient @@ -50,7 +49,8 @@ import org.springframework.test.context.DynamicPropertySource @ContextConfiguration(initializers = [PostgreSQLContextInitializer::class]) internal class LegalEntityControllerOutputIT @Autowired constructor( private val objectMapper: ObjectMapper, - val gateClient: GateClient + val gateClient: GateClient, + private val testHelpers: DbTestHelpers ) { companion object { @RegisterExtension @@ -178,17 +178,17 @@ internal class LegalEntityControllerOutputIT @Autowired constructor( val paginationValue = PaginationStartAfterRequest(startAfter, limit) val pageResponse = gateClient.legalEntities().getLegalEntitiesOutput(paginationValue, emptyList()) - - assertThat(pageResponse).isEqualTo( - PageOutputResponse( - total = total, - nextStartAfter = nextStartAfter, - content = expectedLegalEntities, - invalidEntries = expectedPending.size + expectedErrors.size, - pending = expectedPending, - errors = expectedErrors, - ) + val expectedResponse = PageOutputResponse( + total = total, + nextStartAfter = nextStartAfter, + content = expectedLegalEntities, + invalidEntries = expectedPending.size + expectedErrors.size, + pending = expectedPending, + errors = expectedErrors, ) + + + testHelpers.assertRecursively(pageResponse).isEqualTo(expectedResponse) } /** @@ -283,16 +283,14 @@ internal class LegalEntityControllerOutputIT @Autowired constructor( val paginationValue = PaginationStartAfterRequest(startAfter, limit) val pageResponse = gateClient.legalEntities().getLegalEntitiesOutput(paginationValue, listOf(CommonValues.externalId1, CommonValues.externalId2)) - - assertThat(pageResponse).isEqualTo( - PageOutputResponse( - total = total, - nextStartAfter = nextStartAfter, - content = expectedLegalEntities, - invalidEntries = 0, - pending = listOf(), - errors = listOf(), - ) + val expectedResponse = PageOutputResponse( + total = total, + nextStartAfter = nextStartAfter, + content = expectedLegalEntities, + invalidEntries = 0, + pending = listOf(), + errors = listOf(), ) + testHelpers.assertRecursively(pageResponse).isEqualTo(expectedResponse) } } \ No newline at end of file diff --git a/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/util/DbTestHelpers.kt b/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/util/DbTestHelpers.kt index 833fb5482..7a3346694 100644 --- a/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/util/DbTestHelpers.kt +++ b/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/util/DbTestHelpers.kt @@ -21,7 +21,10 @@ package org.eclipse.tractusx.bpdm.gate.util import jakarta.persistence.EntityManager import jakarta.persistence.EntityManagerFactory +import org.assertj.core.api.Assertions +import org.assertj.core.api.RecursiveComparisonAssert import org.springframework.stereotype.Component +import java.time.Instant private const val BPDM_DB_SCHEMA_NAME: String = "bpdmgate" @@ -50,5 +53,13 @@ class DbTestHelpers(entityManagerFactory: EntityManagerFactory) { em.transaction.commit() } - + + fun assertRecursively(actual: T): RecursiveComparisonAssert<*> { + return Assertions.assertThat(actual) + .usingRecursiveComparison() + .ignoringCollectionOrder() + .ignoringAllOverriddenEquals() + .ignoringFieldsOfTypes(Instant::class.java) + } + } \ No newline at end of file From e20714d0ba10ee682c22d30628495746e45e5ab5 Mon Sep 17 00:00:00 2001 From: rschneider <97682836+rainer-exxcellent@users.noreply.github.com> Date: Wed, 31 May 2023 07:39:51 +0200 Subject: [PATCH 6/7] feat(api): #181 Gate API: Nameparts remove LegalEntityResponse from pool --- .../bpdm/common/dto/response/PoolLegalEntityResponse.kt | 2 +- .../bpdm/pool/service/BusinessPartnerFetchService.kt | 5 ++--- .../bpdm/pool/controller/LegalEntityControllerIT.kt | 6 +++--- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/PoolLegalEntityResponse.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/PoolLegalEntityResponse.kt index 1ea822a02..5eee89e06 100644 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/PoolLegalEntityResponse.kt +++ b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/PoolLegalEntityResponse.kt @@ -23,7 +23,7 @@ import io.swagger.v3.oas.annotations.media.ArraySchema import io.swagger.v3.oas.annotations.media.Schema import java.time.Instant -@Schema(name = "LegalEntityResponse", description = "Legal entity record") +@Schema(name = "PoolLegalEntityResponse", description = "Legal entity record") data class PoolLegalEntityResponse( @get:Schema(description = "Business Partner Number of this legal entity") val bpnl: String, diff --git a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/BusinessPartnerFetchService.kt b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/BusinessPartnerFetchService.kt index f93712a6c..825bddf0c 100644 --- a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/BusinessPartnerFetchService.kt +++ b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/BusinessPartnerFetchService.kt @@ -20,7 +20,6 @@ package org.eclipse.tractusx.bpdm.pool.service import org.eclipse.tractusx.bpdm.common.dto.IdentifierLsaType -import org.eclipse.tractusx.bpdm.common.dto.response.LegalEntityResponse import org.eclipse.tractusx.bpdm.common.dto.response.PoolLegalEntityResponse import org.eclipse.tractusx.bpdm.common.exception.BpdmNotFoundException import org.eclipse.tractusx.bpdm.pool.api.model.response.BpnIdentifierMappingResponse @@ -48,7 +47,7 @@ class BusinessPartnerFetchService( ) { /** - * Fetch a business partner by [bpn] and return as [LegalEntityResponse] + * Fetch a business partner by [bpn] and return as [PoolLegalEntityResponse] */ fun findLegalEntityIgnoreCase(bpn: String): PoolLegalEntityResponse { return findLegalEntityOrThrow(bpn).toDto() @@ -60,7 +59,7 @@ class BusinessPartnerFetchService( /** - * Fetch a business partner by [identifierValue] (ignoring case) of [identifierType] and return as [LegalEntityResponse] + * Fetch a business partner by [identifierValue] (ignoring case) of [identifierType] and return as [PoolLegalEntityResponse] */ @Transactional fun findLegalEntityIgnoreCase(identifierType: String, identifierValue: String): PoolLegalEntityResponse { diff --git a/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/controller/LegalEntityControllerIT.kt b/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/controller/LegalEntityControllerIT.kt index e5b9ac768..db7d4dc01 100644 --- a/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/controller/LegalEntityControllerIT.kt +++ b/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/controller/LegalEntityControllerIT.kt @@ -22,8 +22,8 @@ package org.eclipse.tractusx.bpdm.pool.controller import com.github.tomakehurst.wiremock.core.WireMockConfiguration import com.github.tomakehurst.wiremock.junit5.WireMockExtension import org.assertj.core.api.Assertions.assertThat -import org.eclipse.tractusx.bpdm.common.dto.response.LegalEntityResponse import org.eclipse.tractusx.bpdm.common.dto.response.LogisticAddressResponse +import org.eclipse.tractusx.bpdm.common.dto.response.PoolLegalEntityResponse import org.eclipse.tractusx.bpdm.pool.Application import org.eclipse.tractusx.bpdm.pool.api.client.PoolClientImpl import org.eclipse.tractusx.bpdm.pool.api.model.response.LegalAddressResponse @@ -488,7 +488,7 @@ class LegalEntityControllerIT @Autowired constructor( testHelpers.assertRecursively(actuals) .ignoringFieldsOfTypes(Instant::class.java) - .ignoringFieldsMatchingRegexes(".*${LegalEntityResponse::bpnl.name}") + .ignoringFieldsMatchingRegexes(".*${PoolLegalEntityResponse::bpnl.name}") .isEqualTo(expected) } @@ -507,7 +507,7 @@ class LegalEntityControllerIT @Autowired constructor( .get() .uri(EndpointValues.CATENA_LEGAL_ENTITY_PATH + "/${bpn}") .exchange().expectStatus().isOk - .returnResult() + .returnResult() .responseBody .blockFirst()!!.currentness From f10b6239b14d7daff68f7185e7a31285c0a96149 Mon Sep 17 00:00:00 2001 From: rschneider <97682836+rainer-exxcellent@users.noreply.github.com> Date: Thu, 1 Jun 2023 08:13:09 +0200 Subject: [PATCH 7/7] feat(api): #181 Gate API: Nameparts fix after merge --- .../bpdm/bridge/dummy/dto/GateLegalEntityInfo.kt | 1 + .../bpdm/bridge/dummy/service/PoolUpdateService.kt | 6 ++++-- .../tractusx/bpdm/common/dto/LegalEntityDto.kt | 2 +- .../tractusx/bpdm/common/service/SaasMappings.kt | 4 ++-- .../tractusx/bpdm/gate/service/ResponseMappings.kt | 1 - .../controller/LegalEntityControllerInputIT.kt | 14 ++++++-------- .../tractusx/bpdm/gate/util/RequestValues.kt | 2 +- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/bpdm-bridge-dummy/src/main/kotlin/com/catenax/bpdm/bridge/dummy/dto/GateLegalEntityInfo.kt b/bpdm-bridge-dummy/src/main/kotlin/com/catenax/bpdm/bridge/dummy/dto/GateLegalEntityInfo.kt index 13c52d44c..84f3cc1d4 100644 --- a/bpdm-bridge-dummy/src/main/kotlin/com/catenax/bpdm/bridge/dummy/dto/GateLegalEntityInfo.kt +++ b/bpdm-bridge-dummy/src/main/kotlin/com/catenax/bpdm/bridge/dummy/dto/GateLegalEntityInfo.kt @@ -22,6 +22,7 @@ package com.catenax.bpdm.bridge.dummy.dto import org.eclipse.tractusx.bpdm.common.dto.LegalEntityDto data class GateLegalEntityInfo( + val legalNameParts: Array = emptyArray(), val legalEntity: LegalEntityDto, val externalId: String, val bpn: String? diff --git a/bpdm-bridge-dummy/src/main/kotlin/com/catenax/bpdm/bridge/dummy/service/PoolUpdateService.kt b/bpdm-bridge-dummy/src/main/kotlin/com/catenax/bpdm/bridge/dummy/service/PoolUpdateService.kt index c9241e1a9..7d442ac85 100644 --- a/bpdm-bridge-dummy/src/main/kotlin/com/catenax/bpdm/bridge/dummy/service/PoolUpdateService.kt +++ b/bpdm-bridge-dummy/src/main/kotlin/com/catenax/bpdm/bridge/dummy/service/PoolUpdateService.kt @@ -41,7 +41,8 @@ class PoolUpdateService( val createRequests = entriesToCreate.map { LegalEntityPartnerCreateRequest( legalEntity = it.legalEntity, - index = it.externalId + index = it.externalId, + legalName = it.legalNameParts[0] ) } @@ -53,7 +54,8 @@ class PoolUpdateService( val updateRequests = entriesToUpdate.map { LegalEntityPartnerUpdateRequest( legalEntity = it.legalEntity, - bpnl = it.bpn!! + bpnl = it.bpn!!, + legalName = it.legalNameParts[0] ) } diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/LegalEntityDto.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/LegalEntityDto.kt index 352d1cfb5..794bd3c8b 100644 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/LegalEntityDto.kt +++ b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/LegalEntityDto.kt @@ -26,7 +26,7 @@ import io.swagger.v3.oas.annotations.media.Schema data class LegalEntityDto( @ArraySchema(arraySchema = Schema(description = "Additional identifiers (except BPN)", required = false)) val identifiers: Collection = emptyList(), - + @get:Schema(description = "Abbreviated name or shorthand") val legalShortName: String?, diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/service/SaasMappings.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/service/SaasMappings.kt index a16b97675..8c8ce8b80 100644 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/service/SaasMappings.kt +++ b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/service/SaasMappings.kt @@ -100,7 +100,7 @@ object SaasMappings { ) } - fun BusinessPartnerSaas.toNameDto(): SassNameDto? { + private fun BusinessPartnerSaas.toNameDto(): SassNameDto? { if (names.size > 1) { logger.warn { "Business Partner with ID $externalId has more than one name" } } @@ -292,7 +292,7 @@ object SaasMappings { ) } - data class SassNameDto( + private data class SassNameDto( val value: String, val shortName: String? ) { diff --git a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/ResponseMappings.kt b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/ResponseMappings.kt index 087423449..b8ef2eba9 100644 --- a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/ResponseMappings.kt +++ b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/ResponseMappings.kt @@ -293,7 +293,6 @@ private fun Street.toStreetDto(): StreetDto { fun LegalEntity.toLegalEntityDto(): LegalEntityDto { return LegalEntityDto( - legalName = legalName.value, legalForm = legalForm, legalShortName = legalName.shortName, legalAddress = legalAddress.toLogisticAddressDto(), diff --git a/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/controller/LegalEntityControllerInputIT.kt b/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/controller/LegalEntityControllerInputIT.kt index da0f52c00..262c01a21 100644 --- a/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/controller/LegalEntityControllerInputIT.kt +++ b/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/controller/LegalEntityControllerInputIT.kt @@ -61,8 +61,7 @@ internal class LegalEntityControllerInputIT @Autowired constructor( private val webTestClient: WebTestClient, private val objectMapper: ObjectMapper, val gateClient: GateClient, - private val legalEntityRepository: LegalEntityRepository, - private val testHelpers: DbTestHelpers + private val legalEntityRepository: LegalEntityRepository ) { companion object { @RegisterExtension @@ -241,12 +240,11 @@ internal class LegalEntityControllerInputIT @Autowired constructor( content = expectedLegalEntities ) + // TODO check administrativeAreaLevel1 assertThat(pageResponse).usingRecursiveComparison().ignoringCollectionOrder().ignoringAllOverriddenEquals() .ignoringFieldsMatchingRegexes(".*processStartedAt*", ".*administrativeAreaLevel1*").isEqualTo( - expectedPage - ) - - testHelpers.assertRecursively(pageResponse).isEqualTo(expectedResponse) + expectedPage + ) } @@ -289,8 +287,8 @@ internal class LegalEntityControllerInputIT @Autowired constructor( assertThat(pageResponse).usingRecursiveComparison().ignoringCollectionOrder().ignoringAllOverriddenEquals() .ignoringFieldsMatchingRegexes(".*processStartedAt*", ".*administrativeAreaLevel1*").isEqualTo( - expectedPage - ) + expectedPage + ) } /** diff --git a/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/util/RequestValues.kt b/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/util/RequestValues.kt index 1b18a771c..1a3348d4f 100644 --- a/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/util/RequestValues.kt +++ b/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/util/RequestValues.kt @@ -250,7 +250,6 @@ object RequestValues { val legalEntity3 = LegalEntityDto( identifiers = listOf(identifier1, identifier2), - legalName = CommonValues.name1, legalShortName = CommonValues.shortName1, legalForm = CommonValues.legalFormTechnicalKey1, states = listOf(leBusinessStatus1), @@ -274,6 +273,7 @@ object RequestValues { val legalEntityGateInputRequest3 = LegalEntityGateInputRequest( legalEntity = legalEntity3, + legalNameParts = arrayOf(CommonValues.name1), externalId = CommonValues.externalId3, bpn = CommonValues.bpn3 )