From 34f12b14229418620bc27bdf769ba682c02b383e Mon Sep 17 00:00:00 2001 From: SujitMBRDI Date: Mon, 11 Sep 2023 18:19:20 +0530 Subject: [PATCH] Refactor: Remove common values in Pool test data --- .../tractusx/bpdm/gate/util/ResponseValues.kt | 32 +- .../opensearch/InvalidIndexStartupIT.kt | 2 +- .../opensearch/ValidIndexStartupIT.kt | 6 +- .../controller/OpenSearchControllerIT.kt | 12 +- .../pool/controller/AddressControllerIT.kt | 160 ++++---- .../controller/AddressControllerSearchIT.kt | 16 +- .../bpdm/pool/controller/BpnControllerIT.kt | 14 +- .../pool/controller/ChangelogControllerIT.kt | 50 +-- .../controller/LegalEntityControllerIT.kt | 132 +++---- .../LegalEntityControllerSearchIT.kt | 16 +- .../pool/controller/MetadataControllerIT.kt | 42 +- .../bpdm/pool/controller/SiteControllerIT.kt | 192 ++++----- .../util/BusinessPartnerNonVerboseValues.kt | 373 ++++++++++++++++++ ...ues.kt => BusinessPartnerVerboseValues.kt} | 291 +++++++------- .../tractusx/bpdm/pool/util/CommonValues.kt | 226 ----------- .../tractusx/bpdm/pool/util/RequestValues.kt | 339 ---------------- .../tractusx/bpdm/pool/util/TestHelpers.kt | 14 +- 17 files changed, 867 insertions(+), 1050 deletions(-) create mode 100644 bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/util/BusinessPartnerNonVerboseValues.kt rename bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/util/{ResponseValues.kt => BusinessPartnerVerboseValues.kt} (54%) delete mode 100644 bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/util/CommonValues.kt delete mode 100644 bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/util/RequestValues.kt 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 82bee540e..d3266db59 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 @@ -220,25 +220,25 @@ object ResponseValues { ) val legalEntityResponseGate1 = LegalEntityVerboseDto( - bpnl = CommonValues.bpn1, - legalShortName = CommonValues.shortName1, - legalForm = legalForm1, - states = listOf(leBusinessStatus1), - classifications = listOf(classification1, classification2), - currentness = CommonValues.now, - createdAt = CommonValues.now, - updatedAt = CommonValues.now, + bpnl = CommonValues.bpn1, + legalShortName = CommonValues.shortName1, + legalForm = legalForm1, + states = listOf(leBusinessStatus1), + classifications = listOf(classification1, classification2), + currentness = CommonValues.now, + createdAt = CommonValues.now, + updatedAt = CommonValues.now, ) val legalEntityResponseGate2 = LegalEntityVerboseDto( - bpnl = CommonValues.bpn2, - legalShortName = CommonValues.shortName3, - legalForm = legalForm2, - states = listOf(leBusinessStatus2), - classifications = listOf(classification3, classification4), - currentness = CommonValues.now, - createdAt = CommonValues.now, - updatedAt = CommonValues.now, + bpnl = CommonValues.bpn2, + legalShortName = CommonValues.shortName3, + legalForm = legalForm2, + states = listOf(leBusinessStatus2), + classifications = listOf(classification3, classification4), + currentness = CommonValues.now, + createdAt = CommonValues.now, + updatedAt = CommonValues.now, ) //Response values for Site and LegalEntity created Addresses (Input) diff --git a/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/component/opensearch/InvalidIndexStartupIT.kt b/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/component/opensearch/InvalidIndexStartupIT.kt index d1124135b..14aa33163 100644 --- a/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/component/opensearch/InvalidIndexStartupIT.kt +++ b/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/component/opensearch/InvalidIndexStartupIT.kt @@ -106,7 +106,7 @@ class InvalidIndexStartupIT @Autowired constructor( testHelpers.createBusinessPartnerStructure( listOf( LegalEntityStructureRequest( - legalEntity = RequestValues.legalEntityCreate1, + legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate1, ) ) ) diff --git a/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/component/opensearch/ValidIndexStartupIT.kt b/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/component/opensearch/ValidIndexStartupIT.kt index 162de8ef3..f0a824fd1 100644 --- a/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/component/opensearch/ValidIndexStartupIT.kt +++ b/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/component/opensearch/ValidIndexStartupIT.kt @@ -67,13 +67,13 @@ class ValidIndexStartupIT @Autowired constructor( testHelpers.createBusinessPartnerStructure( listOf( LegalEntityStructureRequest( - legalEntity = RequestValues.legalEntityCreate1, + legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate1, ), LegalEntityStructureRequest( - legalEntity = RequestValues.legalEntityCreate2, + legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate2, ), LegalEntityStructureRequest( - legalEntity = RequestValues.legalEntityCreate3, + legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate3, ) ) ) diff --git a/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/component/opensearch/controller/OpenSearchControllerIT.kt b/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/component/opensearch/controller/OpenSearchControllerIT.kt index 1fbfbfac4..ac597bf4c 100644 --- a/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/component/opensearch/controller/OpenSearchControllerIT.kt +++ b/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/component/opensearch/controller/OpenSearchControllerIT.kt @@ -59,9 +59,9 @@ class OpenSearchControllerIT @Autowired constructor( // We import 3 legal entities which result in 6 OpenSearch records: 3 for the LEs itself and 3 for the corresponding legal addresses. val partnerDocs = listOf( - RequestValues.legalEntityCreate1, - RequestValues.legalEntityCreate2, - RequestValues.legalEntityCreate3 + BusinessPartnerNonVerboseValues.legalEntityCreate1, + BusinessPartnerNonVerboseValues.legalEntityCreate2, + BusinessPartnerNonVerboseValues.legalEntityCreate3 ) @BeforeEach @@ -81,13 +81,13 @@ class OpenSearchControllerIT @Autowired constructor( testHelpers.createBusinessPartnerStructure( listOf( LegalEntityStructureRequest( - legalEntity = RequestValues.legalEntityCreate1, + legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate1, ), LegalEntityStructureRequest( - legalEntity = RequestValues.legalEntityCreate2, + legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate2, ), LegalEntityStructureRequest( - legalEntity = RequestValues.legalEntityCreate3, + legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate3, ) ) ) diff --git a/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/controller/AddressControllerIT.kt b/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/controller/AddressControllerIT.kt index e4d3b5b90..395468d7e 100644 --- a/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/controller/AddressControllerIT.kt +++ b/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/controller/AddressControllerIT.kt @@ -29,7 +29,7 @@ import org.eclipse.tractusx.bpdm.pool.Application import org.eclipse.tractusx.bpdm.pool.api.client.PoolApiClient import org.eclipse.tractusx.bpdm.pool.api.model.response.* import org.eclipse.tractusx.bpdm.pool.util.* -import org.eclipse.tractusx.bpdm.pool.util.RequestValues.addressIdentifier +import org.eclipse.tractusx.bpdm.pool.util.BusinessPartnerNonVerboseValues.addressIdentifier import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test import org.springframework.beans.factory.annotation.Autowired @@ -61,8 +61,8 @@ class AddressControllerIT @Autowired constructor( val createdStructures = testHelpers.createBusinessPartnerStructure( listOf( LegalEntityStructureRequest( - legalEntity = RequestValues.legalEntityCreate1, - addresses = listOf(RequestValues.addressPartnerCreate2) + legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate1, + addresses = listOf(BusinessPartnerNonVerboseValues.addressPartnerCreate2) ) ) ) @@ -93,8 +93,8 @@ class AddressControllerIT @Autowired constructor( testHelpers.createBusinessPartnerStructure( listOf( LegalEntityStructureRequest( - legalEntity = RequestValues.legalEntityCreate1, - addresses = listOf(RequestValues.addressPartnerCreate1) + legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate1, + addresses = listOf(BusinessPartnerNonVerboseValues.addressPartnerCreate1) ) ) ) @@ -114,8 +114,8 @@ class AddressControllerIT @Autowired constructor( val createdStructures = testHelpers.createBusinessPartnerStructure( listOf( LegalEntityStructureRequest( - legalEntity = RequestValues.legalEntityCreate1, - addresses = listOf(RequestValues.addressPartnerCreate1, RequestValues.addressPartnerCreate2, RequestValues.addressPartnerCreate3) + legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate1, + addresses = listOf(BusinessPartnerNonVerboseValues.addressPartnerCreate1, BusinessPartnerNonVerboseValues.addressPartnerCreate2, BusinessPartnerNonVerboseValues.addressPartnerCreate3) ) ) ) @@ -128,8 +128,8 @@ class AddressControllerIT @Autowired constructor( poolClient.addresses.searchAddresses(searchRequest, PaginationRequest()) val expected = listOf( - ResponseValues.addressPartner1, - ResponseValues.addressPartner2 + BusinessPartnerVerboseValues.addressPartner1, + BusinessPartnerVerboseValues.addressPartner2 ) assertAddressesAreEqual(searchResult.content, expected) @@ -145,12 +145,12 @@ class AddressControllerIT @Autowired constructor( val createdStructures = testHelpers.createBusinessPartnerStructure( listOf( LegalEntityStructureRequest( - legalEntity = RequestValues.legalEntityCreate1, + legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate1, // no additional addresses ), LegalEntityStructureRequest( - legalEntity = RequestValues.legalEntityCreate2, - addresses = listOf(RequestValues.addressPartnerCreate3) + legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate2, + addresses = listOf(BusinessPartnerNonVerboseValues.addressPartnerCreate3) ) ) ) @@ -161,8 +161,8 @@ class AddressControllerIT @Autowired constructor( val searchResult = poolClient.addresses.searchAddresses(searchRequest, PaginationRequest()) val expected = listOf( - ResponseValues.addressPartner2.copy(isLegalAddress = true), - ResponseValues.addressPartner3 + BusinessPartnerVerboseValues.addressPartner2.copy(isLegalAddress = true), + BusinessPartnerVerboseValues.addressPartner3 ) assertAddressesAreEqual(searchResult.content, expected) @@ -178,20 +178,20 @@ class AddressControllerIT @Autowired constructor( val createdStructures = testHelpers.createBusinessPartnerStructure( listOf( LegalEntityStructureRequest( - legalEntity = RequestValues.legalEntityCreate1, + legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate1, siteStructures = listOf( SiteStructureRequest( - site = RequestValues.siteCreate1, - addresses = listOf(RequestValues.addressPartnerCreate1, RequestValues.addressPartnerCreate2) + site = BusinessPartnerNonVerboseValues.siteCreate1, + addresses = listOf(BusinessPartnerNonVerboseValues.addressPartnerCreate1, BusinessPartnerNonVerboseValues.addressPartnerCreate2) ) ) ), LegalEntityStructureRequest( - legalEntity = RequestValues.legalEntityCreate2, + legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate2, siteStructures = listOf( SiteStructureRequest( - site = RequestValues.siteCreate2, - addresses = listOf(RequestValues.addressPartnerCreate3) + site = BusinessPartnerNonVerboseValues.siteCreate2, + addresses = listOf(BusinessPartnerNonVerboseValues.addressPartnerCreate3) ) ) ) @@ -207,9 +207,9 @@ class AddressControllerIT @Autowired constructor( .let { assertAddressesAreEqual( it.content, listOf( - ResponseValues.addressPartner1.copy(isMainAddress = true), - ResponseValues.addressPartner1, - ResponseValues.addressPartner2, + BusinessPartnerVerboseValues.addressPartner1.copy(isMainAddress = true), + BusinessPartnerVerboseValues.addressPartner1, + BusinessPartnerVerboseValues.addressPartner2, ) ) } @@ -220,8 +220,8 @@ class AddressControllerIT @Autowired constructor( .let { assertAddressesAreEqual( it.content, listOf( - ResponseValues.addressPartner2.copy(isMainAddress = true), - ResponseValues.addressPartner3, + BusinessPartnerVerboseValues.addressPartner2.copy(isMainAddress = true), + BusinessPartnerVerboseValues.addressPartner3, ) ) } @@ -233,12 +233,12 @@ class AddressControllerIT @Autowired constructor( assertAddressesAreEqual( it.content, listOf( // site1 - ResponseValues.addressPartner1.copy(isMainAddress = true), - ResponseValues.addressPartner1, - ResponseValues.addressPartner2, + BusinessPartnerVerboseValues.addressPartner1.copy(isMainAddress = true), + BusinessPartnerVerboseValues.addressPartner1, + BusinessPartnerVerboseValues.addressPartner2, // site2 - ResponseValues.addressPartner2.copy(isMainAddress = true), - ResponseValues.addressPartner3, + BusinessPartnerVerboseValues.addressPartner2.copy(isMainAddress = true), + BusinessPartnerVerboseValues.addressPartner3, ) ) } @@ -255,8 +255,8 @@ class AddressControllerIT @Autowired constructor( val givenStructure = testHelpers.createBusinessPartnerStructure( listOf( LegalEntityStructureRequest( - legalEntity = RequestValues.legalEntityCreate1, - siteStructures = listOf(SiteStructureRequest(RequestValues.siteCreate1)) + legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate1, + siteStructures = listOf(SiteStructureRequest(BusinessPartnerNonVerboseValues.siteCreate1)) ), ) ) @@ -265,15 +265,15 @@ class AddressControllerIT @Autowired constructor( val bpnS = givenStructure[0].siteStructures[0].site.site.bpns val expected = listOf( - ResponseValues.addressPartnerCreate1, - ResponseValues.addressPartnerCreate2, - ResponseValues.addressPartnerCreate3 + BusinessPartnerVerboseValues.addressPartnerCreate1, + BusinessPartnerVerboseValues.addressPartnerCreate2, + BusinessPartnerVerboseValues.addressPartnerCreate3 ) val toCreate = listOf( - RequestValues.addressPartnerCreate1.copy(bpnParent = bpnL), - RequestValues.addressPartnerCreate2.copy(bpnParent = bpnL), - RequestValues.addressPartnerCreate3.copy(bpnParent = bpnS) + BusinessPartnerNonVerboseValues.addressPartnerCreate1.copy(bpnParent = bpnL), + BusinessPartnerNonVerboseValues.addressPartnerCreate2.copy(bpnParent = bpnL), + BusinessPartnerNonVerboseValues.addressPartnerCreate3.copy(bpnParent = bpnS) ) val response = poolClient.addresses.createAddresses(toCreate) @@ -304,8 +304,8 @@ class AddressControllerIT @Autowired constructor( val givenStructure = testHelpers.createBusinessPartnerStructure( listOf( LegalEntityStructureRequest( - legalEntity = RequestValues.legalEntityCreate1, - siteStructures = listOf(SiteStructureRequest(RequestValues.siteCreate1)) + legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate1, + siteStructures = listOf(SiteStructureRequest(BusinessPartnerNonVerboseValues.siteCreate1)) ), ) ) @@ -313,8 +313,8 @@ class AddressControllerIT @Autowired constructor( val bpnL = givenStructure[0].legalEntity.legalEntity.bpnl - val toCreate = RequestValues.addressPartnerCreate5.copy(bpnParent = bpnL) - val secondCreate = RequestValues.addressPartnerCreate5.copy(bpnParent = bpnL, index = CommonValues.index4) + val toCreate = BusinessPartnerNonVerboseValues.addressPartnerCreate5.copy(bpnParent = bpnL) + val secondCreate = BusinessPartnerNonVerboseValues.addressPartnerCreate5.copy(bpnParent = bpnL, index = BusinessPartnerNonVerboseValues.addressPartnerCreate4.index) val response = poolClient.addresses.createAddresses(listOf(toCreate, secondCreate)) @@ -345,17 +345,17 @@ class AddressControllerIT @Autowired constructor( val givenStructure = testHelpers.createBusinessPartnerStructure( listOf( LegalEntityStructureRequest( - legalEntity = RequestValues.legalEntityCreate1, + legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate1, siteStructures = listOf( SiteStructureRequest( - site = RequestValues.siteCreate1, - addresses = listOf(RequestValues.addressPartnerCreate1, RequestValues.addressPartnerCreate2) + site = BusinessPartnerNonVerboseValues.siteCreate1, + addresses = listOf(BusinessPartnerNonVerboseValues.addressPartnerCreate1, BusinessPartnerNonVerboseValues.addressPartnerCreate2) ) ) ), LegalEntityStructureRequest( - legalEntity = RequestValues.legalEntityCreate2, - addresses = listOf(RequestValues.addressPartnerCreate3) + legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate2, + addresses = listOf(BusinessPartnerNonVerboseValues.addressPartnerCreate3) ) ) ) @@ -365,15 +365,15 @@ class AddressControllerIT @Autowired constructor( val bpnA3 = givenStructure[1].addresses[0].address.bpna val expected = listOf( - ResponseValues.addressPartner1.copy(bpna = bpnA2), - ResponseValues.addressPartner2.copy(bpna = bpnA3), - ResponseValues.addressPartner3.copy(bpna = bpnA1) + BusinessPartnerVerboseValues.addressPartner1.copy(bpna = bpnA2), + BusinessPartnerVerboseValues.addressPartner2.copy(bpna = bpnA3), + BusinessPartnerVerboseValues.addressPartner3.copy(bpna = bpnA1) ) val toUpdate = listOf( - RequestValues.addressPartnerUpdate1.copy(bpna = bpnA2, address = RequestValues.logisticAddress5), - RequestValues.addressPartnerUpdate2.copy(bpna = bpnA3, address = RequestValues.logisticAddress5), - RequestValues.addressPartnerUpdate3.copy(bpna = bpnA1, address = RequestValues.logisticAddress5) + BusinessPartnerNonVerboseValues.addressPartnerUpdate1.copy(bpna = bpnA2, address = BusinessPartnerNonVerboseValues.logisticAddress5), + BusinessPartnerNonVerboseValues.addressPartnerUpdate2.copy(bpna = bpnA3, address = BusinessPartnerNonVerboseValues.logisticAddress5), + BusinessPartnerNonVerboseValues.addressPartnerUpdate3.copy(bpna = bpnA1, address = BusinessPartnerNonVerboseValues.logisticAddress5) ) val response = poolClient.addresses.updateAddresses(toUpdate) @@ -393,26 +393,26 @@ class AddressControllerIT @Autowired constructor( */ @Test fun `don't create addresses with non-existent parent`() { - val bpnL = poolClient.legalEntities.createBusinessPartners(listOf(RequestValues.legalEntityCreate1)) + val bpnL = poolClient.legalEntities.createBusinessPartners(listOf(BusinessPartnerNonVerboseValues.legalEntityCreate1)) .entities.single().legalEntity.bpnl val expected = listOf( - ResponseValues.addressPartnerCreate1, + BusinessPartnerVerboseValues.addressPartnerCreate1, ) val expectedErrors = listOf( - ErrorInfo(AddressCreateError.BpnNotValid, "message ignored", CommonValues.index3), - ErrorInfo(AddressCreateError.SiteNotFound, "message ignored", CommonValues.index1), - ErrorInfo(AddressCreateError.LegalEntityNotFound, "message ignored ", CommonValues.index2) + ErrorInfo(AddressCreateError.BpnNotValid, "message ignored", BusinessPartnerNonVerboseValues.addressPartnerCreate3.index), + ErrorInfo(AddressCreateError.SiteNotFound, "message ignored", BusinessPartnerNonVerboseValues.addressPartnerCreate1.index), + ErrorInfo(AddressCreateError.LegalEntityNotFound, "message ignored ", BusinessPartnerNonVerboseValues.addressPartnerCreate2.index) ) val invalidSiteBpn = "BPNSXXXXXXXXXX" val invalidLegalEntityBpn = "BPNLXXXXXXXXXX" val completelyInvalidBpn = "XYZ" val toCreate = listOf( - RequestValues.addressPartnerCreate1.copy(bpnParent = bpnL), - RequestValues.addressPartnerCreate1.copy(bpnParent = invalidSiteBpn), - RequestValues.addressPartnerCreate2.copy(bpnParent = invalidLegalEntityBpn), - RequestValues.addressPartnerCreate3.copy(bpnParent = completelyInvalidBpn), + BusinessPartnerNonVerboseValues.addressPartnerCreate1.copy(bpnParent = bpnL), + BusinessPartnerNonVerboseValues.addressPartnerCreate1.copy(bpnParent = invalidSiteBpn), + BusinessPartnerNonVerboseValues.addressPartnerCreate2.copy(bpnParent = invalidLegalEntityBpn), + BusinessPartnerNonVerboseValues.addressPartnerCreate3.copy(bpnParent = completelyInvalidBpn), ) val response = poolClient.addresses.createAddresses(toCreate) @@ -436,17 +436,17 @@ class AddressControllerIT @Autowired constructor( val givenStructure = testHelpers.createBusinessPartnerStructure( listOf( LegalEntityStructureRequest( - legalEntity = RequestValues.legalEntityCreate1, + legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate1, siteStructures = listOf( SiteStructureRequest( - site = RequestValues.siteCreate1, - addresses = listOf(RequestValues.addressPartnerCreate1, RequestValues.addressPartnerCreate2) + site = BusinessPartnerNonVerboseValues.siteCreate1, + addresses = listOf(BusinessPartnerNonVerboseValues.addressPartnerCreate1, BusinessPartnerNonVerboseValues.addressPartnerCreate2) ) ) ), LegalEntityStructureRequest( - legalEntity = RequestValues.legalEntityCreate2, - addresses = listOf(RequestValues.addressPartnerCreate3) + legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate2, + addresses = listOf(BusinessPartnerNonVerboseValues.addressPartnerCreate3) ) ) ) @@ -456,15 +456,15 @@ class AddressControllerIT @Autowired constructor( val bpnA3 = givenStructure[1].addresses[0].address.bpna val expected = listOf( - ResponseValues.addressPartner1.copy(bpna = bpnA2), - ResponseValues.addressPartner2.copy(bpna = bpnA3), - ResponseValues.addressPartner3.copy(bpna = bpnA1) + BusinessPartnerVerboseValues.addressPartner1.copy(bpna = bpnA2), + BusinessPartnerVerboseValues.addressPartner2.copy(bpna = bpnA3), + BusinessPartnerVerboseValues.addressPartner3.copy(bpna = bpnA1) ) val toUpdate = listOf( - RequestValues.addressPartnerUpdate1.copy(bpna = bpnA2), - RequestValues.addressPartnerUpdate2.copy(bpna = bpnA3), - RequestValues.addressPartnerUpdate3.copy(bpna = bpnA1) + BusinessPartnerNonVerboseValues.addressPartnerUpdate1.copy(bpna = bpnA2), + BusinessPartnerNonVerboseValues.addressPartnerUpdate2.copy(bpna = bpnA3), + BusinessPartnerNonVerboseValues.addressPartnerUpdate3.copy(bpna = bpnA1) ) val response = poolClient.addresses.updateAddresses(toUpdate) @@ -483,11 +483,11 @@ class AddressControllerIT @Autowired constructor( val givenStructure = testHelpers.createBusinessPartnerStructure( listOf( LegalEntityStructureRequest( - legalEntity = RequestValues.legalEntityCreate1, + legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate1, siteStructures = listOf( SiteStructureRequest( - site = RequestValues.siteCreate1, - addresses = listOf(RequestValues.addressPartnerCreate1) + site = BusinessPartnerNonVerboseValues.siteCreate1, + addresses = listOf(BusinessPartnerNonVerboseValues.addressPartnerCreate1) ) ) ) @@ -497,15 +497,15 @@ class AddressControllerIT @Autowired constructor( val bpnA1 = givenStructure[0].siteStructures[0].addresses[0].address.bpna val expected = listOf( - ResponseValues.addressPartner2.copy(bpna = bpnA1) + BusinessPartnerVerboseValues.addressPartner2.copy(bpna = bpnA1) ) val firstInvalidBpn = "BPNLXXXXXXXX" val secondInvalidBpn = "BPNAXXXXXXXX" val toUpdate = listOf( - RequestValues.addressPartnerUpdate2.copy(bpna = bpnA1), - RequestValues.addressPartnerUpdate2.copy(bpna = firstInvalidBpn), - RequestValues.addressPartnerUpdate3.copy(bpna = secondInvalidBpn) + BusinessPartnerNonVerboseValues.addressPartnerUpdate2.copy(bpna = bpnA1), + BusinessPartnerNonVerboseValues.addressPartnerUpdate2.copy(bpna = firstInvalidBpn), + BusinessPartnerNonVerboseValues.addressPartnerUpdate3.copy(bpna = secondInvalidBpn) ) val response = poolClient.addresses.updateAddresses(toUpdate) diff --git a/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/controller/AddressControllerSearchIT.kt b/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/controller/AddressControllerSearchIT.kt index ad863dc58..1b59385b8 100644 --- a/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/controller/AddressControllerSearchIT.kt +++ b/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/controller/AddressControllerSearchIT.kt @@ -56,24 +56,24 @@ class AddressControllerSearchIT @Autowired constructor( // the expected result, ideally with minimal effort utilizing helper functions or probably Kotlin's powerful builders. val partnerStructure1 = LegalEntityStructureRequest( - legalEntity = RequestValues.legalEntityCreate1, - addresses = listOf(RequestValues.addressPartnerCreate1, RequestValues.addressPartnerCreate3) + legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate1, + addresses = listOf(BusinessPartnerNonVerboseValues.addressPartnerCreate1, BusinessPartnerNonVerboseValues.addressPartnerCreate3) ) val partnerStructure2 = LegalEntityStructureRequest( - legalEntity = RequestValues.legalEntityCreate2, + legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate2, siteStructures = listOf( SiteStructureRequest( - site = RequestValues.siteCreate1, - addresses = listOf(RequestValues.addressPartnerCreate2) + site = BusinessPartnerNonVerboseValues.siteCreate1, + addresses = listOf(BusinessPartnerNonVerboseValues.addressPartnerCreate2) ) ) ) val partnerStructure3 = LegalEntityStructureRequest( - legalEntity = RequestValues.legalEntityCreate1, - addresses = listOf(RequestValues.addressPartnerCreate4) + legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate1, + addresses = listOf(BusinessPartnerNonVerboseValues.addressPartnerCreate4) ) private lateinit var givenAddress1: LogisticAddressVerboseDto @@ -109,7 +109,7 @@ class AddressControllerSearchIT @Autowired constructor( val addressSearchRequest = AddressPartnerSearchRequest() - addressSearchRequest.name = RequestValues.addressPartnerCreate4.address.name + addressSearchRequest.name = BusinessPartnerNonVerboseValues.addressPartnerCreate4.address.name val pageResponse = poolClient.addresses.getAddresses(addressSearchRequest, PaginationRequest()) diff --git a/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/controller/BpnControllerIT.kt b/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/controller/BpnControllerIT.kt index fe3fda045..c21fff09e 100644 --- a/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/controller/BpnControllerIT.kt +++ b/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/controller/BpnControllerIT.kt @@ -44,25 +44,25 @@ class BpnControllerIT @Autowired constructor( val poolClient: PoolClientImpl ) { - val identifierType = RequestValues.legalEntityCreate1.legalEntity.identifiers.first().type - val identifierValue1 = RequestValues.legalEntityCreate1.legalEntity.identifiers.first().value - val identifierValue2 = RequestValues.legalEntityCreate2.legalEntity.identifiers.first().value - val identifierValue3 = RequestValues.legalEntityCreate3.legalEntity.identifiers.first().value + val identifierType = BusinessPartnerNonVerboseValues.legalEntityCreate1.legalEntity.identifiers.first().type + val identifierValue1 = BusinessPartnerNonVerboseValues.legalEntityCreate1.legalEntity.identifiers.first().value + val identifierValue2 = BusinessPartnerNonVerboseValues.legalEntityCreate2.legalEntity.identifiers.first().value + val identifierValue3 = BusinessPartnerNonVerboseValues.legalEntityCreate3.legalEntity.identifiers.first().value @BeforeEach fun beforeEach() { // ensure LE1 and 2 have same identifierType - val legalEntityCreate1 = with(RequestValues.legalEntityCreate1) { copy( + val legalEntityCreate1 = with(BusinessPartnerNonVerboseValues.legalEntityCreate1) { copy( legalEntity = legalEntity.copy( identifiers = listOf(LegalEntityIdentifierDto(identifierValue1, identifierType, null)) ) ) } - val legalEntityCreate2 = with(RequestValues.legalEntityCreate2) { copy( + val legalEntityCreate2 = with(BusinessPartnerNonVerboseValues.legalEntityCreate2) { copy( legalEntity = legalEntity.copy( identifiers = listOf(LegalEntityIdentifierDto(identifierValue2, identifierType, null)) ) ) } - val legalEntityCreate3 = RequestValues.legalEntityCreate3 + val legalEntityCreate3 = BusinessPartnerNonVerboseValues.legalEntityCreate3 testHelpers.truncateDbTables() testHelpers.createTestMetadata() diff --git a/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/controller/ChangelogControllerIT.kt b/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/controller/ChangelogControllerIT.kt index 661bc5568..1ced5aad4 100644 --- a/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/controller/ChangelogControllerIT.kt +++ b/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/controller/ChangelogControllerIT.kt @@ -67,8 +67,8 @@ class ChangelogControllerIT @Autowired constructor( val createdStructures = testHelpers.createBusinessPartnerStructure( listOf( - LegalEntityStructureRequest(legalEntity = RequestValues.legalEntityCreate1), - LegalEntityStructureRequest(legalEntity = RequestValues.legalEntityCreate2) + LegalEntityStructureRequest(legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate1), + LegalEntityStructureRequest(legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate2) ) ) val bpnL1 = createdStructures[0].legalEntity.legalEntity.bpnl @@ -80,8 +80,8 @@ class ChangelogControllerIT @Autowired constructor( poolClient.legalEntities.updateBusinessPartners( listOf( - RequestValues.legalEntityUpdate1.copy(bpnl = bpnL1), - RequestValues.legalEntityUpdate2.copy(bpnl = bpnL2) + BusinessPartnerNonVerboseValues.legalEntityUpdate1.copy(bpnl = bpnL1), + BusinessPartnerNonVerboseValues.legalEntityUpdate2.copy(bpnl = bpnL2) ) ) @@ -122,10 +122,10 @@ class ChangelogControllerIT @Autowired constructor( val createdStructures = testHelpers.createBusinessPartnerStructure( listOf( LegalEntityStructureRequest( - legalEntity = RequestValues.legalEntityCreate1, + legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate1, siteStructures = listOf( - SiteStructureRequest(site = RequestValues.siteCreate1), - SiteStructureRequest(site = RequestValues.siteCreate2), + SiteStructureRequest(site = BusinessPartnerNonVerboseValues.siteCreate1), + SiteStructureRequest(site = BusinessPartnerNonVerboseValues.siteCreate2), ) ) ) @@ -139,8 +139,8 @@ class ChangelogControllerIT @Autowired constructor( poolClient.sites.updateSite( listOf( - RequestValues.siteUpdate1.copy(bpns = bpnS1), - RequestValues.siteUpdate2.copy(bpns = bpnS2) + BusinessPartnerNonVerboseValues.siteUpdate1.copy(bpns = bpnS1), + BusinessPartnerNonVerboseValues.siteUpdate2.copy(bpns = bpnS2) ) ) @@ -183,9 +183,9 @@ class ChangelogControllerIT @Autowired constructor( val createdStructures = testHelpers.createBusinessPartnerStructure( listOf( LegalEntityStructureRequest( - legalEntity = RequestValues.legalEntityCreate1, - addresses = listOf(RequestValues.addressPartnerCreate1), - siteStructures = listOf(SiteStructureRequest(site = RequestValues.siteCreate1, addresses = listOf(RequestValues.addressPartnerCreate2))) + legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate1, + addresses = listOf(BusinessPartnerNonVerboseValues.addressPartnerCreate1), + siteStructures = listOf(SiteStructureRequest(site = BusinessPartnerNonVerboseValues.siteCreate1, addresses = listOf(BusinessPartnerNonVerboseValues.addressPartnerCreate2))) ) ) ) @@ -198,8 +198,8 @@ class ChangelogControllerIT @Autowired constructor( poolClient.addresses.updateAddresses( listOf( - RequestValues.addressPartnerUpdate1.copy(bpna = bpnA1), - RequestValues.addressPartnerUpdate2.copy(bpna = bpnA2) + BusinessPartnerNonVerboseValues.addressPartnerUpdate1.copy(bpna = bpnA1), + BusinessPartnerNonVerboseValues.addressPartnerUpdate2.copy(bpna = bpnA2) ) ) @@ -241,9 +241,9 @@ class ChangelogControllerIT @Autowired constructor( val createdStructures = testHelpers.createBusinessPartnerStructure( listOf( - LegalEntityStructureRequest(legalEntity = RequestValues.legalEntityCreate1), - LegalEntityStructureRequest(legalEntity = RequestValues.legalEntityCreate2), - LegalEntityStructureRequest(legalEntity = RequestValues.legalEntityCreate3), + LegalEntityStructureRequest(legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate1), + LegalEntityStructureRequest(legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate2), + LegalEntityStructureRequest(legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate3), ) ) val bpnL1 = createdStructures[0].legalEntity.legalEntity.bpnl @@ -293,8 +293,8 @@ class ChangelogControllerIT @Autowired constructor( val createdStructures = testHelpers.createBusinessPartnerStructure( listOf( LegalEntityStructureRequest( - legalEntity = RequestValues.legalEntityCreate1, - siteStructures = listOf(SiteStructureRequest(site = RequestValues.siteCreate1)) + legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate1, + siteStructures = listOf(SiteStructureRequest(site = BusinessPartnerNonVerboseValues.siteCreate1)) ) ) ) @@ -355,9 +355,9 @@ class ChangelogControllerIT @Autowired constructor( val createdStructures = testHelpers.createBusinessPartnerStructure( listOf( - LegalEntityStructureRequest(legalEntity = RequestValues.legalEntityCreate1), - LegalEntityStructureRequest(legalEntity = RequestValues.legalEntityCreate2), - LegalEntityStructureRequest(legalEntity = RequestValues.legalEntityCreate3) + LegalEntityStructureRequest(legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate1), + LegalEntityStructureRequest(legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate2), + LegalEntityStructureRequest(legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate3) ) ) val bpnL1 = createdStructures[0].legalEntity.legalEntity.bpnl @@ -392,7 +392,7 @@ class ChangelogControllerIT @Autowired constructor( testHelpers.createBusinessPartnerStructure( listOf( - LegalEntityStructureRequest(legalEntity = RequestValues.legalEntityCreate1) + LegalEntityStructureRequest(legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate1) ) ) @@ -401,8 +401,8 @@ class ChangelogControllerIT @Autowired constructor( val createdStructures = testHelpers.createBusinessPartnerStructure( listOf( - LegalEntityStructureRequest(legalEntity = RequestValues.legalEntityCreate2), - LegalEntityStructureRequest(legalEntity = RequestValues.legalEntityCreate3) + LegalEntityStructureRequest(legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate2), + LegalEntityStructureRequest(legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate3) ) ) 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 b637ca33c..d32c07db2 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 @@ -29,8 +29,8 @@ 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.* import org.eclipse.tractusx.bpdm.pool.util.* -import org.eclipse.tractusx.bpdm.pool.util.RequestValues.addressIdentifier -import org.eclipse.tractusx.bpdm.pool.util.RequestValues.logisticAddress3 +import org.eclipse.tractusx.bpdm.pool.util.BusinessPartnerNonVerboseValues.addressIdentifier +import org.eclipse.tractusx.bpdm.pool.util.BusinessPartnerNonVerboseValues.logisticAddress3 import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Test @@ -66,8 +66,8 @@ class LegalEntityControllerIT @Autowired constructor( */ @Test fun `create new legal entity`() { - val expectedBpn = CommonValues.bpnL1 - val expected = with(ResponseValues.legalEntityUpsert1) { + val expectedBpn = BusinessPartnerVerboseValues.legalEntityUpsert1.legalEntity.bpnl + val expected = with(BusinessPartnerVerboseValues.legalEntityUpsert1) { copy( legalEntity = legalEntity.copy( bpnl = expectedBpn @@ -75,7 +75,7 @@ class LegalEntityControllerIT @Autowired constructor( ) } - val toCreate = RequestValues.legalEntityCreate1 + val toCreate = BusinessPartnerNonVerboseValues.legalEntityCreate1 val response = poolClient.legalEntities.createBusinessPartners(listOf(toCreate)) assertThat(response.entities.size).isEqualTo(1) @@ -97,40 +97,40 @@ class LegalEntityControllerIT @Autowired constructor( fun `create legal entities and get duplicate identifier error`() { // 3 equivalent identifiers (in regard to fields type and value) - val referenceIdentifier = RequestValues.identifier1.copy( - issuingBody = CommonValues.issuingBody1 + val referenceIdentifier = BusinessPartnerNonVerboseValues.identifier1.copy( + issuingBody = BusinessPartnerNonVerboseValues.identifier1.issuingBody ) - val identicalIdentifier = RequestValues.identifier1.copy() + val identicalIdentifier = BusinessPartnerNonVerboseValues.identifier1.copy() val equivalentIdentifier = referenceIdentifier.copy( - issuingBody = CommonValues.issuingBody2 + issuingBody = BusinessPartnerNonVerboseValues.identifier2.issuingBody ) // 3 requests using these equivalent identifiers & 1 different request - val request1 = with(RequestValues.legalEntityCreate1) { + val request1 = with(BusinessPartnerNonVerboseValues.legalEntityCreate1) { copy( - index = CommonValues.index1, + index = BusinessPartnerNonVerboseValues.legalEntityCreate1.index, legalEntity = legalEntity.copy( ) ) } - val request2 = with(RequestValues.legalEntityCreate1) { + val request2 = with(BusinessPartnerNonVerboseValues.legalEntityCreate1) { copy( - index = CommonValues.index2, + index = BusinessPartnerNonVerboseValues.legalEntityCreate2.index, legalEntity = legalEntity.copy( identifiers = listOf(identicalIdentifier) ) ) } - val request3 = with(RequestValues.legalEntityCreate1) { + val request3 = with(BusinessPartnerNonVerboseValues.legalEntityCreate1) { copy( - index = CommonValues.index3, + index = BusinessPartnerNonVerboseValues.legalEntityCreate3.index, legalEntity = legalEntity.copy( identifiers = listOf(equivalentIdentifier) ) ) } - val requestOkay = RequestValues.legalEntityCreate3 + val requestOkay = BusinessPartnerNonVerboseValues.legalEntityCreate3 val response = poolClient.legalEntities.createBusinessPartners( listOf(request1, request2, request3, requestOkay) @@ -159,18 +159,18 @@ class LegalEntityControllerIT @Autowired constructor( ) ) - val request1 = with(RequestValues.legalEntityCreate1) { + val request1 = with(BusinessPartnerNonVerboseValues.legalEntityCreate1) { copy( - index = CommonValues.index1, + index = BusinessPartnerNonVerboseValues.legalEntityCreate1.index, legalEntity = legalEntity.copy( identifiers = listOf() ), legalAddress = logisticAddress3.copy(identifiers = listOf(addressIdentifier)) ) } - val request2 = with(RequestValues.legalEntityCreate1) { + val request2 = with(BusinessPartnerNonVerboseValues.legalEntityCreate1) { copy( - index = CommonValues.index2, + index = BusinessPartnerNonVerboseValues.legalEntityCreate2.index, legalEntity = legalEntity.copy( identifiers = listOf() ), @@ -198,22 +198,22 @@ class LegalEntityControllerIT @Autowired constructor( @Test fun `update legal entities and get duplicate identifier error`() { - val toCreate1 = listOf(RequestValues.legalEntityCreate1, RequestValues.legalEntityCreate2) + val toCreate1 = listOf(BusinessPartnerNonVerboseValues.legalEntityCreate1, BusinessPartnerNonVerboseValues.legalEntityCreate2) val response1 = poolClient.legalEntities.createBusinessPartners(toCreate1) assertThat(response1.errorCount).isEqualTo(0) val bpnList = response1.entities.map { it.legalEntity.bpnl } // 2 equivalent identifiers (in regard to fields type and value) but different from the identifiers in the DB - val referenceIdentifier = RequestValues.identifier3.copy( - issuingBody = CommonValues.issuingBody1 + val referenceIdentifier = BusinessPartnerNonVerboseValues.identifier3.copy( + issuingBody = BusinessPartnerNonVerboseValues.identifier1.issuingBody ) val equivalentIdentifier = referenceIdentifier.copy( - issuingBody = CommonValues.issuingBody2 + issuingBody = BusinessPartnerNonVerboseValues.identifier2.issuingBody ) // 3 requests using these equivalent identifiers & 1 different request - val toUpdate1 = with(RequestValues.legalEntityUpdate1) { + val toUpdate1 = with(BusinessPartnerNonVerboseValues.legalEntityUpdate1) { copy( bpnl = bpnList[0], legalEntity = legalEntity.copy( @@ -221,7 +221,7 @@ class LegalEntityControllerIT @Autowired constructor( ) ) } - val toUpdate2 = with(RequestValues.legalEntityUpdate2) { + val toUpdate2 = with(BusinessPartnerNonVerboseValues.legalEntityUpdate2) { copy( bpnl = bpnList[1], legalEntity = legalEntity.copy( @@ -248,9 +248,9 @@ class LegalEntityControllerIT @Autowired constructor( */ @Test fun `create new legal entities`() { - val expected = listOf(ResponseValues.legalEntityUpsert1, ResponseValues.legalEntityUpsert2, ResponseValues.legalEntityUpsert3) + val expected = listOf(BusinessPartnerVerboseValues.legalEntityUpsert1, BusinessPartnerVerboseValues.legalEntityUpsert2, BusinessPartnerVerboseValues.legalEntityUpsert3) - val toCreate = listOf(RequestValues.legalEntityCreate1, RequestValues.legalEntityCreate2, RequestValues.legalEntityCreate3) + val toCreate = listOf(BusinessPartnerNonVerboseValues.legalEntityCreate1, BusinessPartnerNonVerboseValues.legalEntityCreate2, BusinessPartnerNonVerboseValues.legalEntityCreate3) val response = poolClient.legalEntities.createBusinessPartners(toCreate) assertThatCreatedLegalEntitiesEqual(response.entities, expected) @@ -264,11 +264,11 @@ class LegalEntityControllerIT @Autowired constructor( */ @Test fun `don't create legal entity with same identifier`() { - val given = with(RequestValues.legalEntityCreate1) { copy(legalEntity = legalEntity.copy(identifiers = listOf(RequestValues.identifier1))) } + val given = with(BusinessPartnerNonVerboseValues.legalEntityCreate1) { copy(legalEntity = legalEntity.copy(identifiers = listOf(BusinessPartnerNonVerboseValues.identifier1))) } poolClient.legalEntities.createBusinessPartners(listOf(given)) - val expected = listOf(ResponseValues.legalEntityUpsert2, ResponseValues.legalEntityUpsert3) + val expected = listOf(BusinessPartnerVerboseValues.legalEntityUpsert2, BusinessPartnerVerboseValues.legalEntityUpsert3) - val toCreate = listOf(given, RequestValues.legalEntityCreate2, RequestValues.legalEntityCreate3) + val toCreate = listOf(given, BusinessPartnerNonVerboseValues.legalEntityCreate2, BusinessPartnerNonVerboseValues.legalEntityCreate3) val response = poolClient.legalEntities.createBusinessPartners(toCreate) // 2 entities created @@ -292,7 +292,7 @@ class LegalEntityControllerIT @Autowired constructor( ) ) - val given = with(RequestValues.legalEntityCreate1) { + val given = with(BusinessPartnerNonVerboseValues.legalEntityCreate1) { copy( legalEntity = legalEntity.copy( identifiers = listOf() @@ -303,9 +303,9 @@ class LegalEntityControllerIT @Autowired constructor( ) } poolClient.legalEntities.createBusinessPartners(listOf(given)) - val expected = listOf(ResponseValues.legalEntityUpsert2, ResponseValues.legalEntityUpsert3) + val expected = listOf(BusinessPartnerVerboseValues.legalEntityUpsert2, BusinessPartnerVerboseValues.legalEntityUpsert3) - val toCreate = listOf(given, RequestValues.legalEntityCreate2, RequestValues.legalEntityCreate3) + val toCreate = listOf(given, BusinessPartnerNonVerboseValues.legalEntityCreate2, BusinessPartnerNonVerboseValues.legalEntityCreate3) val response = poolClient.legalEntities.createBusinessPartners(toCreate) // 2 entities created @@ -322,14 +322,14 @@ class LegalEntityControllerIT @Autowired constructor( */ @Test fun `update existing legal entities`() { - val given = listOf(RequestValues.legalEntityCreate1) + val given = listOf(BusinessPartnerNonVerboseValues.legalEntityCreate1) val createResponse = poolClient.legalEntities.createBusinessPartners(given) .entities.single() val givenBpnL = createResponse.legalEntity.bpnl val givenBpnA = createResponse.legalAddress.bpna - val expected = with(ResponseValues.legalEntityUpsert3) { + val expected = with(BusinessPartnerVerboseValues.legalEntityUpsert3) { copy( legalAddress = legalAddress.copy( bpna = givenBpnA, @@ -341,7 +341,7 @@ class LegalEntityControllerIT @Autowired constructor( ) } - val toUpdate = RequestValues.legalEntityUpdate3.copy( + val toUpdate = BusinessPartnerNonVerboseValues.legalEntityUpdate3.copy( bpnl = givenBpnL ) val response = poolClient.legalEntities.updateBusinessPartners(listOf(toUpdate)) @@ -358,20 +358,20 @@ class LegalEntityControllerIT @Autowired constructor( @Disabled("Fix insert with same identifiers") @Test fun `update existing legal entities multiple identifier`() { - val given = listOf(RequestValues.legalEntityCreateMultipleIdentifier, RequestValues.legalEntityCreate2, RequestValues.legalEntityCreate3) + val given = listOf(BusinessPartnerNonVerboseValues.legalEntityCreateMultipleIdentifier, BusinessPartnerNonVerboseValues.legalEntityCreate2, BusinessPartnerNonVerboseValues.legalEntityCreate3) val createResponses = poolClient.legalEntities.createBusinessPartners(given) .entities val createResponse = createResponses.filter { response -> - response.index.equals(RequestValues.legalEntityCreateMultipleIdentifier.index) + response.index.equals(BusinessPartnerNonVerboseValues.legalEntityCreateMultipleIdentifier.index) }[0] val givenBpnL = createResponse.legalEntity.bpnl - val toUpdate = RequestValues.legalEntityUpdateMultipleIdentifier.copy( + val toUpdate = BusinessPartnerNonVerboseValues.legalEntityUpdateMultipleIdentifier.copy( bpnl = givenBpnL, - legalEntity = RequestValues.legalEntityCreateMultipleIdentifier.legalEntity.copy(legalShortName = "ChangedShortNam"), + legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreateMultipleIdentifier.legalEntity.copy(legalShortName = "ChangedShortNam"), ) val response = poolClient.legalEntities.updateBusinessPartners(listOf(toUpdate)) @@ -385,7 +385,7 @@ class LegalEntityControllerIT @Autowired constructor( */ @Test fun `ignore invalid legal entity update`() { - val given = listOf(RequestValues.legalEntityCreate1, RequestValues.legalEntityCreate2) + val given = listOf(BusinessPartnerNonVerboseValues.legalEntityCreate1, BusinessPartnerNonVerboseValues.legalEntityCreate2) val createResponse = poolClient.legalEntities.createBusinessPartners(given) val createdEntity = createResponse.entities.toList()[1] @@ -393,13 +393,13 @@ class LegalEntityControllerIT @Autowired constructor( val bpnA = createdEntity.legalAddress.bpna val toUpdate1 = - RequestValues.legalEntityUpdate3.copy(bpnl = "NONEXISTENT", legalEntity = RequestValues.legalEntityCreate1.legalEntity.copy(identifiers = listOf())) + BusinessPartnerNonVerboseValues.legalEntityUpdate3.copy(bpnl = "NONEXISTENT", legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate1.legalEntity.copy(identifiers = listOf())) val toUpdate2 = - RequestValues.legalEntityUpdate3.copy(bpnl = bpnL, legalEntity = RequestValues.legalEntityCreate3.legalEntity.copy(identifiers = listOf())) + BusinessPartnerNonVerboseValues.legalEntityUpdate3.copy(bpnl = bpnL, legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate3.legalEntity.copy(identifiers = listOf())) val toUpdate = listOf(toUpdate1, toUpdate2) - val expected = with(ResponseValues.legalEntityUpsert3) { + val expected = with(BusinessPartnerVerboseValues.legalEntityUpsert3) { copy( legalAddress = legalAddress.copy( bpna = bpnA, @@ -431,9 +431,9 @@ class LegalEntityControllerIT @Autowired constructor( @Test fun `find legal addresses by BPN`() { val givenStructures = listOf( - LegalEntityStructureRequest(RequestValues.legalEntityCreate1), - LegalEntityStructureRequest(RequestValues.legalEntityCreate2), - LegalEntityStructureRequest(RequestValues.legalEntityCreate3) + LegalEntityStructureRequest(BusinessPartnerNonVerboseValues.legalEntityCreate1), + LegalEntityStructureRequest(BusinessPartnerNonVerboseValues.legalEntityCreate2), + LegalEntityStructureRequest(BusinessPartnerNonVerboseValues.legalEntityCreate3) ) val givenLegalEntities = testHelpers.createBusinessPartnerStructure(givenStructures).map { it.legalEntity } @@ -459,9 +459,9 @@ class LegalEntityControllerIT @Autowired constructor( @Test fun `only find legal addresses with matching BPNLs`() { val givenStructures = listOf( - LegalEntityStructureRequest(RequestValues.legalEntityCreate1), - LegalEntityStructureRequest(RequestValues.legalEntityCreate2), - LegalEntityStructureRequest(RequestValues.legalEntityCreate3) + LegalEntityStructureRequest(BusinessPartnerNonVerboseValues.legalEntityCreate1), + LegalEntityStructureRequest(BusinessPartnerNonVerboseValues.legalEntityCreate2), + LegalEntityStructureRequest(BusinessPartnerNonVerboseValues.legalEntityCreate3) ) val givenLegalEntities = testHelpers.createBusinessPartnerStructure(givenStructures).map { it.legalEntity } @@ -488,9 +488,9 @@ class LegalEntityControllerIT @Autowired constructor( @Test fun `find legal entities by BPN`() { val givenStructures = listOf( - LegalEntityStructureRequest(RequestValues.legalEntityCreate1), - LegalEntityStructureRequest(RequestValues.legalEntityCreate2), - LegalEntityStructureRequest(RequestValues.legalEntityCreate3) + LegalEntityStructureRequest(BusinessPartnerNonVerboseValues.legalEntityCreate1), + LegalEntityStructureRequest(BusinessPartnerNonVerboseValues.legalEntityCreate2), + LegalEntityStructureRequest(BusinessPartnerNonVerboseValues.legalEntityCreate3) ) val givenLegalEntities = testHelpers.createBusinessPartnerStructure(givenStructures).map { it.legalEntity } @@ -517,8 +517,8 @@ class LegalEntityControllerIT @Autowired constructor( @Test fun `find legal entities by identifier`() { val givenStructures = listOf( - LegalEntityStructureRequest(RequestValues.legalEntityCreate1), - LegalEntityStructureRequest(RequestValues.legalEntityCreate2) + LegalEntityStructureRequest(BusinessPartnerNonVerboseValues.legalEntityCreate1), + LegalEntityStructureRequest(BusinessPartnerNonVerboseValues.legalEntityCreate2) ) val givenLegalEntities = testHelpers.createBusinessPartnerStructure(givenStructures).map { it.legalEntity } @@ -545,8 +545,8 @@ class LegalEntityControllerIT @Autowired constructor( @Test fun `find legal entities by identifier case insensitive`() { val givenStructures = listOf( - LegalEntityStructureRequest(RequestValues.legalEntityCreate1), - LegalEntityStructureRequest(RequestValues.legalEntityCreate2) + LegalEntityStructureRequest(BusinessPartnerNonVerboseValues.legalEntityCreate1), + LegalEntityStructureRequest(BusinessPartnerNonVerboseValues.legalEntityCreate2) ) val givenLegalEntities = testHelpers.createBusinessPartnerStructure(givenStructures).map { it.legalEntity } @@ -575,8 +575,8 @@ class LegalEntityControllerIT @Autowired constructor( @Test fun `find legal entities by bpn identifier`() { val givenStructures = listOf( - LegalEntityStructureRequest(RequestValues.legalEntityCreate1), - LegalEntityStructureRequest(RequestValues.legalEntityCreate2) + LegalEntityStructureRequest(BusinessPartnerNonVerboseValues.legalEntityCreate1), + LegalEntityStructureRequest(BusinessPartnerNonVerboseValues.legalEntityCreate2) ) val givenLegalEntities = testHelpers.createBusinessPartnerStructure(givenStructures).map { it.legalEntity } @@ -604,8 +604,8 @@ class LegalEntityControllerIT @Autowired constructor( @Test fun `find legal entities by bpn identifier case insensitive`() { val givenStructures = listOf( - LegalEntityStructureRequest(RequestValues.legalEntityCreate1), - LegalEntityStructureRequest(RequestValues.legalEntityCreate2) + LegalEntityStructureRequest(BusinessPartnerNonVerboseValues.legalEntityCreate1), + LegalEntityStructureRequest(BusinessPartnerNonVerboseValues.legalEntityCreate2) ) val givenLegalEntities = testHelpers.createBusinessPartnerStructure(givenStructures).map { it.legalEntity } @@ -632,9 +632,9 @@ class LegalEntityControllerIT @Autowired constructor( @Test fun `find legal entities by BPN, some BPNs not found`() { val givenStructures = listOf( - LegalEntityStructureRequest(RequestValues.legalEntityCreate1), - LegalEntityStructureRequest(RequestValues.legalEntityCreate2), - LegalEntityStructureRequest(RequestValues.legalEntityCreate3) + LegalEntityStructureRequest(BusinessPartnerNonVerboseValues.legalEntityCreate1), + LegalEntityStructureRequest(BusinessPartnerNonVerboseValues.legalEntityCreate2), + LegalEntityStructureRequest(BusinessPartnerNonVerboseValues.legalEntityCreate3) ) val givenLegalEntities = testHelpers.createBusinessPartnerStructure(givenStructures).map { it.legalEntity } @@ -660,7 +660,7 @@ class LegalEntityControllerIT @Autowired constructor( */ @Test fun `set business partner currentness`() { - val given = listOf(RequestValues.legalEntityCreate1) + val given = listOf(BusinessPartnerNonVerboseValues.legalEntityCreate1) val bpnL = poolClient.legalEntities.createBusinessPartners(given) .entities.single().legalEntity.bpnl val initialCurrentness = retrieveCurrentness(bpnL) 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 a469ad47f..7f751a06e 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 @@ -52,16 +52,16 @@ class LegalEntityControllerSearchIT @Autowired constructor( ) { private val partnerStructure1 = LegalEntityStructureRequest( - legalEntity = RequestValues.legalEntityCreate1, + legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate1, siteStructures = listOf( - SiteStructureRequest(RequestValues.siteCreate1) + SiteStructureRequest(BusinessPartnerNonVerboseValues.siteCreate1) ) ) private val partnerStructure2 = LegalEntityStructureRequest( - legalEntity = RequestValues.legalEntityCreate2, + legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate2, siteStructures = listOf( - SiteStructureRequest(RequestValues.siteCreate2), - SiteStructureRequest(RequestValues.siteCreate1) //same site here to attain multiple results when needed + SiteStructureRequest(BusinessPartnerNonVerboseValues.siteCreate2), + SiteStructureRequest(BusinessPartnerNonVerboseValues.siteCreate1) //same site here to attain multiple results when needed ) ) @@ -104,7 +104,7 @@ class LegalEntityControllerSearchIT @Autowired constructor( ) ) - val pageResponse = searchBusinessPartnerBySiteName(RequestValues.siteCreate1.site.name, page = 0, size = 100) + val pageResponse = searchBusinessPartnerBySiteName(BusinessPartnerNonVerboseValues.siteCreate1.site.name, page = 0, size = 100) assertPageEquals(pageResponse, expected) } @@ -128,8 +128,8 @@ class LegalEntityControllerSearchIT @Autowired constructor( ) ) - val firstPage = searchBusinessPartnerBySiteName(RequestValues.siteCreate1.site.name, page = 0, size = 1) - val secondPage = searchBusinessPartnerBySiteName(RequestValues.siteCreate1.site.name, page = 1, size = 1) + val firstPage = searchBusinessPartnerBySiteName(BusinessPartnerNonVerboseValues.siteCreate1.site.name, page = 0, size = 1) + val secondPage = searchBusinessPartnerBySiteName(BusinessPartnerNonVerboseValues.siteCreate1.site.name, page = 1, size = 1) assertPageEquals(firstPage, expectedFirstPage) assertPageEquals(secondPage, expectedSecondPage) diff --git a/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/controller/MetadataControllerIT.kt b/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/controller/MetadataControllerIT.kt index 1aa88eca2..e4f1950b9 100644 --- a/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/controller/MetadataControllerIT.kt +++ b/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/controller/MetadataControllerIT.kt @@ -71,17 +71,17 @@ class MetadataControllerIT @Autowired constructor( ) { companion object { - private val identifierTypeDtos = listOf(RequestValues.identifierTypeDto1, RequestValues.identifierTypeDto2, RequestValues.identifierTypeDto3) + private val identifierTypeDtos = listOf(BusinessPartnerNonVerboseValues.identifierTypeDto1, BusinessPartnerNonVerboseValues.identifierTypeDto2, BusinessPartnerNonVerboseValues.identifierTypeDto3) private val legalFormRequests = listOf( - RequestValues.legalForm1, - RequestValues.legalForm2, - RequestValues.legalForm3 + BusinessPartnerNonVerboseValues.legalForm1, + BusinessPartnerNonVerboseValues.legalForm2, + BusinessPartnerNonVerboseValues.legalForm3 ) private val legalFormExpected = listOf( - ResponseValues.legalForm1, - ResponseValues.legalForm2, - ResponseValues.legalForm3 + BusinessPartnerVerboseValues.legalForm1, + BusinessPartnerVerboseValues.legalForm2, + BusinessPartnerVerboseValues.legalForm3 ) private fun postIdentifierType(client: WebTestClient, type: IdentifierTypeDto) = @@ -132,13 +132,13 @@ class MetadataControllerIT @Autowired constructor( fun creationTestArguments(): Stream = Stream.of( Arguments.of( - RequestValues.identifierTypeDto1, - RequestValues.identifierTypeDto1, + BusinessPartnerNonVerboseValues.identifierTypeDto1, + BusinessPartnerNonVerboseValues.identifierTypeDto1, ::postIdentifierType ), Arguments.of( - RequestValues.legalForm1, - ResponseValues.legalForm1, + BusinessPartnerNonVerboseValues.legalForm1, + BusinessPartnerVerboseValues.legalForm1, ::postLegalForm ) ) @@ -147,14 +147,14 @@ class MetadataControllerIT @Autowired constructor( fun conflictTestArguments(): Stream = Stream.of( Arguments.of( - RequestValues.identifierTypeDto1, - RequestValues.identifierTypeDto1, + BusinessPartnerNonVerboseValues.identifierTypeDto1, + BusinessPartnerNonVerboseValues.identifierTypeDto1, ::postIdentifierTypeWithoutExpectation, ::getIdentifierTypes ), Arguments.of( - RequestValues.legalForm1, - ResponseValues.legalForm1, + BusinessPartnerNonVerboseValues.legalForm1, + BusinessPartnerVerboseValues.legalForm1, ::postLegalFormWithoutExpectation, ::getLegalForms ) @@ -311,23 +311,23 @@ class MetadataControllerIT @Autowired constructor( @Test fun getValidIdentifiersForCountry() { val identifierType1 = IdentifierType( - technicalKey = CommonValues.identifierTypeTechnicalKey1, + technicalKey = BusinessPartnerNonVerboseValues.identifierType1.technicalKey, businessPartnerType = IdentifierBusinessPartnerType.LEGAL_ENTITY, - name = CommonValues.identifierTypeName1, + name = BusinessPartnerNonVerboseValues.identifierType1.name, ) identifierType1.details.add(IdentifierTypeDetail(identifierType1, null, true)) val identifierType2 = IdentifierType( - technicalKey = CommonValues.identifierTypeTechnicalKey2, + technicalKey = BusinessPartnerNonVerboseValues.identifierType2.technicalKey, businessPartnerType = IdentifierBusinessPartnerType.LEGAL_ENTITY, - name = CommonValues.identifierTypeName2 + name = BusinessPartnerNonVerboseValues.identifierType2.name ) identifierType2.details.add(IdentifierTypeDetail(identifierType2, CountryCode.UK, false)) val identifierType3 = IdentifierType( - technicalKey = CommonValues.identifierTypeTechnicalKey3, + technicalKey = BusinessPartnerNonVerboseValues.identifierType3.technicalKey, businessPartnerType = IdentifierBusinessPartnerType.LEGAL_ENTITY, - name = CommonValues.identifierTypeName3 + name = BusinessPartnerNonVerboseValues.identifierType3.name ) identifierType3.details.add(IdentifierTypeDetail(identifierType3, CountryCode.PL, false)) diff --git a/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/controller/SiteControllerIT.kt b/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/controller/SiteControllerIT.kt index 87964ba4b..bcb3a6cf3 100644 --- a/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/controller/SiteControllerIT.kt +++ b/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/controller/SiteControllerIT.kt @@ -58,7 +58,7 @@ class SiteControllerIT @Autowired constructor( */ @Test fun `get site by bpn-s`() { - val createdStructures = testHelpers.createBusinessPartnerStructure(listOf(RequestValues.partnerStructure1)) + val createdStructures = testHelpers.createBusinessPartnerStructure(listOf(BusinessPartnerNonVerboseValues.partnerStructure1)) val importedPartner = createdStructures.single().legalEntity importedPartner.legalEntity.bpnl @@ -76,7 +76,7 @@ class SiteControllerIT @Autowired constructor( */ @Test fun `get site by bpn-s, not found`() { - testHelpers.createBusinessPartnerStructure(listOf(RequestValues.partnerStructure1)) + testHelpers.createBusinessPartnerStructure(listOf(BusinessPartnerNonVerboseValues.partnerStructure1)) testHelpers.`get site by bpn-s, not found`("NONEXISTENT_BPN") } @@ -90,11 +90,11 @@ class SiteControllerIT @Autowired constructor( val createdStructures = testHelpers.createBusinessPartnerStructure( listOf( LegalEntityStructureRequest( - legalEntity = RequestValues.legalEntityCreate1, + legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate1, siteStructures = listOf( - SiteStructureRequest(site = RequestValues.siteCreate1), - SiteStructureRequest(site = RequestValues.siteCreate2), - SiteStructureRequest(site = RequestValues.siteCreate3) + SiteStructureRequest(site = BusinessPartnerNonVerboseValues.siteCreate1), + SiteStructureRequest(site = BusinessPartnerNonVerboseValues.siteCreate2), + SiteStructureRequest(site = BusinessPartnerNonVerboseValues.siteCreate3) ) ) ) @@ -108,12 +108,12 @@ class SiteControllerIT @Autowired constructor( val searchResult = poolClient.sites.searchSites(siteSearchRequest, PaginationRequest()) val expectedSiteWithReference1 = SitePoolVerboseDto( - site = ResponseValues.site1.copy(bpnLegalEntity = bpnL), - mainAddress = ResponseValues.addressPartner1.copy(isMainAddress = true, bpnSite = CommonValues.bpnS1) + site = BusinessPartnerVerboseValues.site1.copy(bpnLegalEntity = bpnL), + mainAddress = BusinessPartnerVerboseValues.addressPartner1.copy(isMainAddress = true, bpnSite = BusinessPartnerVerboseValues.site1.bpns) ) val expectedSiteWithReference2 = SitePoolVerboseDto( - site = ResponseValues.site2.copy(bpnLegalEntity = bpnL), - mainAddress = ResponseValues.addressPartner2.copy(isMainAddress = true, bpnSite = CommonValues.bpnS2) + site = BusinessPartnerVerboseValues.site2.copy(bpnLegalEntity = bpnL), + mainAddress = BusinessPartnerVerboseValues.addressPartner2.copy(isMainAddress = true, bpnSite = BusinessPartnerVerboseValues.site2.bpns) ) testHelpers.assertRecursively(searchResult.content) @@ -134,15 +134,15 @@ class SiteControllerIT @Autowired constructor( val createdStructures = testHelpers.createBusinessPartnerStructure( listOf( LegalEntityStructureRequest( - legalEntity = RequestValues.legalEntityCreate1, + legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate1, siteStructures = listOf( - SiteStructureRequest(site = RequestValues.siteCreate1), - SiteStructureRequest(site = RequestValues.siteCreate2), + SiteStructureRequest(site = BusinessPartnerNonVerboseValues.siteCreate1), + SiteStructureRequest(site = BusinessPartnerNonVerboseValues.siteCreate2), ) ), LegalEntityStructureRequest( - legalEntity = RequestValues.legalEntityCreate2, - siteStructures = listOf(SiteStructureRequest(site = RequestValues.siteCreate3)) + legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate2, + siteStructures = listOf(SiteStructureRequest(site = BusinessPartnerNonVerboseValues.siteCreate3)) ) ) ) @@ -155,18 +155,18 @@ class SiteControllerIT @Autowired constructor( val expectedSiteWithReference1 = SitePoolVerboseDto( - site = ResponseValues.site1.copy(bpnLegalEntity = bpnL1), - mainAddress = ResponseValues.addressPartner1.copy(isMainAddress = true, bpnSite = CommonValues.bpnS1) + site = BusinessPartnerVerboseValues.site1.copy(bpnLegalEntity = bpnL1), + mainAddress = BusinessPartnerVerboseValues.addressPartner1.copy(isMainAddress = true, bpnSite = BusinessPartnerVerboseValues.site1.bpns) ) val expectedSiteWithReference2 = SitePoolVerboseDto( - site = ResponseValues.site2.copy(bpnLegalEntity = bpnL1), - mainAddress = ResponseValues.addressPartner2.copy(isMainAddress = true, bpnSite = CommonValues.bpnS2) + site = BusinessPartnerVerboseValues.site2.copy(bpnLegalEntity = bpnL1), + mainAddress = BusinessPartnerVerboseValues.addressPartner2.copy(isMainAddress = true, bpnSite = BusinessPartnerVerboseValues.site2.bpns) ) val expectedSiteWithReference3 = SitePoolVerboseDto( - site = ResponseValues.site3.copy(bpnLegalEntity = bpnL2), - mainAddress = ResponseValues.addressPartner3.copy(isMainAddress = true, bpnSite = CommonValues.bpnS3) + site = BusinessPartnerVerboseValues.site3.copy(bpnLegalEntity = bpnL2), + mainAddress = BusinessPartnerVerboseValues.addressPartner3.copy(isMainAddress = true, bpnSite = BusinessPartnerVerboseValues.site3.bpns) ) testHelpers.assertRecursively(searchResult.content) @@ -187,17 +187,17 @@ class SiteControllerIT @Autowired constructor( fun `create new sites`() { val givenLegalEntities = - poolClient.legalEntities.createBusinessPartners(listOf(RequestValues.legalEntityCreate1, RequestValues.legalEntityCreate2)).entities + poolClient.legalEntities.createBusinessPartners(listOf(BusinessPartnerNonVerboseValues.legalEntityCreate1, BusinessPartnerNonVerboseValues.legalEntityCreate2)).entities val bpnL1 = givenLegalEntities.first().legalEntity.bpnl val bpnL2 = givenLegalEntities.last().legalEntity.bpnl - val expected = listOf(ResponseValues.siteUpsert1, ResponseValues.siteUpsert2, ResponseValues.siteUpsert3) + val expected = listOf(BusinessPartnerVerboseValues.siteUpsert1, BusinessPartnerVerboseValues.siteUpsert2, BusinessPartnerVerboseValues.siteUpsert3) val toCreate = listOf( - RequestValues.siteCreate1.copy(bpnlParent = bpnL1), - RequestValues.siteCreate2.copy(bpnlParent = bpnL2), - RequestValues.siteCreate3.copy(bpnlParent = bpnL2) + BusinessPartnerNonVerboseValues.siteCreate1.copy(bpnlParent = bpnL1), + BusinessPartnerNonVerboseValues.siteCreate2.copy(bpnlParent = bpnL2), + BusinessPartnerNonVerboseValues.siteCreate3.copy(bpnlParent = bpnL2) ) val response = poolClient.sites.createSite(toCreate) @@ -216,34 +216,34 @@ class SiteControllerIT @Autowired constructor( fun `create sites entities and get duplicate identifier error on address`() { poolClient.metadata.createIdentifierType( IdentifierTypeDto( - technicalKey = RequestValues.addressIdentifier.type, - businessPartnerType = IdentifierBusinessPartnerType.ADDRESS, name = RequestValues.addressIdentifier.value + technicalKey = BusinessPartnerNonVerboseValues.addressIdentifier.type, + businessPartnerType = IdentifierBusinessPartnerType.ADDRESS, name = BusinessPartnerNonVerboseValues.addressIdentifier.value ) ) val givenLegalEntities = - poolClient.legalEntities.createBusinessPartners(listOf(RequestValues.legalEntityCreate1, RequestValues.legalEntityCreate2)).entities + poolClient.legalEntities.createBusinessPartners(listOf(BusinessPartnerNonVerboseValues.legalEntityCreate1, BusinessPartnerNonVerboseValues.legalEntityCreate2)).entities - val request1 = with(RequestValues.siteCreate1) { + val request1 = with(BusinessPartnerNonVerboseValues.siteCreate1) { copy( - index = CommonValues.index1, + index = BusinessPartnerNonVerboseValues.siteCreate1.index, site = SiteDto( - name = CommonValues.siteName1, - states = listOf(RequestValues.siteStatus1), - mainAddress = RequestValues.logisticAddress3.copy( - identifiers = listOf(RequestValues.addressIdentifier) + name = BusinessPartnerNonVerboseValues.siteCreate1.site.name, + states = listOf(BusinessPartnerNonVerboseValues.siteStatus1), + mainAddress = BusinessPartnerNonVerboseValues.logisticAddress3.copy( + identifiers = listOf(BusinessPartnerNonVerboseValues.addressIdentifier) ) ) ) } - val request2 = with(RequestValues.siteCreate2) { + val request2 = with(BusinessPartnerNonVerboseValues.siteCreate2) { copy( - index = CommonValues.index1, + index = BusinessPartnerNonVerboseValues.siteCreate1.index, site = SiteDto( - name = CommonValues.siteName1, - states = listOf(RequestValues.siteStatus1), - mainAddress = RequestValues.logisticAddress2.copy( - identifiers = listOf(RequestValues.addressIdentifier) + name = BusinessPartnerNonVerboseValues.siteCreate1.site.name, + states = listOf(BusinessPartnerNonVerboseValues.siteStatus1), + mainAddress = BusinessPartnerNonVerboseValues.logisticAddress2.copy( + identifiers = listOf(BusinessPartnerNonVerboseValues.addressIdentifier) ) ) ) @@ -271,15 +271,15 @@ class SiteControllerIT @Autowired constructor( poolClient.metadata.createIdentifierType( IdentifierTypeDto( - technicalKey = RequestValues.addressIdentifier.type, - businessPartnerType = IdentifierBusinessPartnerType.ADDRESS, name = RequestValues.addressIdentifier.value + technicalKey = BusinessPartnerNonVerboseValues.addressIdentifier.type, + businessPartnerType = IdentifierBusinessPartnerType.ADDRESS, name = BusinessPartnerNonVerboseValues.addressIdentifier.value ) ) val givenLegalEntities = - poolClient.legalEntities.createBusinessPartners(listOf(RequestValues.legalEntityCreate1, RequestValues.legalEntityCreate2)).entities + poolClient.legalEntities.createBusinessPartners(listOf(BusinessPartnerNonVerboseValues.legalEntityCreate1, BusinessPartnerNonVerboseValues.legalEntityCreate2)).entities - val toCreate1 = listOf(RequestValues.siteCreate1, RequestValues.siteCreate2) + val toCreate1 = listOf(BusinessPartnerNonVerboseValues.siteCreate1, BusinessPartnerNonVerboseValues.siteCreate2) val response1 = poolClient.sites.createSite(toCreate1) @@ -287,34 +287,34 @@ class SiteControllerIT @Autowired constructor( val bpnList = response1.entities.map { it.site.bpns } // 2 equivalent identifiers (in regard to fields type and value) but different from the identifiers in the DB - val referenceIdentifier = RequestValues.identifier3.copy( - issuingBody = CommonValues.issuingBody1 + val referenceIdentifier = BusinessPartnerNonVerboseValues.identifier3.copy( + issuingBody = BusinessPartnerNonVerboseValues.identifier1.issuingBody ) val equivalentIdentifier = referenceIdentifier.copy( - issuingBody = CommonValues.issuingBody2 + issuingBody = BusinessPartnerNonVerboseValues.identifier2.issuingBody ) // 3 requests using these equivalent identifiers & 1 different request - val toUpdate1 = with(RequestValues.siteUpdate1) { + val toUpdate1 = with(BusinessPartnerNonVerboseValues.siteUpdate1) { copy( bpns = bpnList[0], site = SiteDto( - name = CommonValues.siteName1, - states = listOf(RequestValues.siteStatus1), - mainAddress = RequestValues.logisticAddress3.copy( - identifiers = listOf(RequestValues.addressIdentifier) + name = BusinessPartnerNonVerboseValues.siteUpdate1.site.name, + states = listOf(BusinessPartnerNonVerboseValues.siteStatus1), + mainAddress = BusinessPartnerNonVerboseValues.logisticAddress3.copy( + identifiers = listOf(BusinessPartnerNonVerboseValues.addressIdentifier) ) ) ) } - val toUpdate2 = with(RequestValues.siteUpdate2) { + val toUpdate2 = with(BusinessPartnerNonVerboseValues.siteUpdate2) { copy( bpns = bpnList[1], site = SiteDto( - name = CommonValues.siteName1, - states = listOf(RequestValues.siteStatus1), - mainAddress = RequestValues.logisticAddress2.copy( - identifiers = listOf(RequestValues.addressIdentifier) + name = BusinessPartnerNonVerboseValues.siteUpdate1.site.name, + states = listOf(BusinessPartnerNonVerboseValues.siteStatus1), + mainAddress = BusinessPartnerNonVerboseValues.logisticAddress2.copy( + identifiers = listOf(BusinessPartnerNonVerboseValues.addressIdentifier) ) ) ) @@ -341,18 +341,18 @@ class SiteControllerIT @Autowired constructor( val givenLegalEntities = - poolClient.legalEntities.createBusinessPartners(listOf(RequestValues.legalEntityCreate1, RequestValues.legalEntityCreate2)).entities + poolClient.legalEntities.createBusinessPartners(listOf(BusinessPartnerNonVerboseValues.legalEntityCreate1, BusinessPartnerNonVerboseValues.legalEntityCreate2)).entities val bpnL1 = givenLegalEntities.first().legalEntity.bpnl val bpnL2 = givenLegalEntities.last().legalEntity.bpnl - val expected = listOf(ResponseValues.siteUpsert1, ResponseValues.siteUpsert2) + val expected = listOf(BusinessPartnerVerboseValues.siteUpsert1, BusinessPartnerVerboseValues.siteUpsert2) val toCreate = listOf( - RequestValues.siteCreate1.copy(bpnlParent = bpnL1), - RequestValues.siteCreate2.copy(bpnlParent = bpnL2), - RequestValues.siteCreate3.copy(bpnlParent = "NONEXISTENT") + BusinessPartnerNonVerboseValues.siteCreate1.copy(bpnlParent = bpnL1), + BusinessPartnerNonVerboseValues.siteCreate2.copy(bpnlParent = bpnL2), + BusinessPartnerNonVerboseValues.siteCreate3.copy(bpnlParent = "NONEXISTENT") ) val response = poolClient.sites.createSite(toCreate) @@ -360,7 +360,7 @@ class SiteControllerIT @Autowired constructor( assertThatCreatedSitesEqual(response.entities, expected) // 1 error assertThat(response.errorCount).isEqualTo(1) - testHelpers.assertErrorResponse(response.errors.first(), SiteCreateError.LegalEntityNotFound, CommonValues.index3) + testHelpers.assertErrorResponse(response.errors.first(), SiteCreateError.LegalEntityNotFound, BusinessPartnerVerboseValues.siteUpsert3.index!!) } /** @@ -373,12 +373,12 @@ class SiteControllerIT @Autowired constructor( val givenStructure = testHelpers.createBusinessPartnerStructure( listOf( LegalEntityStructureRequest( - legalEntity = RequestValues.legalEntityCreate1, - siteStructures = listOf(SiteStructureRequest(RequestValues.siteCreate1)) + legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate1, + siteStructures = listOf(SiteStructureRequest(BusinessPartnerNonVerboseValues.siteCreate1)) ), LegalEntityStructureRequest( - legalEntity = RequestValues.legalEntityCreate2, - siteStructures = listOf(SiteStructureRequest(RequestValues.siteCreate2), SiteStructureRequest(RequestValues.siteCreate3)) + legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate2, + siteStructures = listOf(SiteStructureRequest(BusinessPartnerNonVerboseValues.siteCreate2), SiteStructureRequest(BusinessPartnerNonVerboseValues.siteCreate3)) ) ) ) @@ -388,15 +388,15 @@ class SiteControllerIT @Autowired constructor( val bpnS3 = givenStructure[1].siteStructures[1].site.site.bpns val expected = listOf( - ResponseValues.siteUpsert1.run { copy(site = site.copy(bpns = bpnS3), index = null) }, - ResponseValues.siteUpsert2.run { copy(site = site.copy(bpns = bpnS1), index = null) }, - ResponseValues.siteUpsert3.run { copy(site = site.copy(bpns = bpnS2), index = null) }, + BusinessPartnerVerboseValues.siteUpsert1.run { copy(site = site.copy(bpns = bpnS3), index = null) }, + BusinessPartnerVerboseValues.siteUpsert2.run { copy(site = site.copy(bpns = bpnS1), index = null) }, + BusinessPartnerVerboseValues.siteUpsert3.run { copy(site = site.copy(bpns = bpnS2), index = null) }, ) val toUpdate = listOf( - RequestValues.siteUpdate1.copy(bpns = bpnS3), - RequestValues.siteUpdate2.copy(bpns = bpnS1), - RequestValues.siteUpdate3.copy(bpns = bpnS2) + BusinessPartnerNonVerboseValues.siteUpdate1.copy(bpns = bpnS3), + BusinessPartnerNonVerboseValues.siteUpdate2.copy(bpns = bpnS1), + BusinessPartnerNonVerboseValues.siteUpdate3.copy(bpns = bpnS2) ) val response = poolClient.sites.updateSite(toUpdate) @@ -415,8 +415,8 @@ class SiteControllerIT @Autowired constructor( val givenStructure = testHelpers.createBusinessPartnerStructure( listOf( LegalEntityStructureRequest( - legalEntity = RequestValues.legalEntityCreate1, - siteStructures = listOf(SiteStructureRequest(RequestValues.siteCreate1), SiteStructureRequest(RequestValues.siteCreate2)) + legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate1, + siteStructures = listOf(SiteStructureRequest(BusinessPartnerNonVerboseValues.siteCreate1), SiteStructureRequest(BusinessPartnerNonVerboseValues.siteCreate2)) ) ) ) @@ -425,14 +425,14 @@ class SiteControllerIT @Autowired constructor( val bpnS2 = givenStructure[0].siteStructures[1].site.site.bpns val expected = listOf( - ResponseValues.siteUpsert1.run { copy(site = site.copy(bpns = bpnS2), index = null) }, - ResponseValues.siteUpsert2.run { copy(site = site.copy(bpns = bpnS1), index = null) }, + BusinessPartnerVerboseValues.siteUpsert1.run { copy(site = site.copy(bpns = bpnS2), index = null) }, + BusinessPartnerVerboseValues.siteUpsert2.run { copy(site = site.copy(bpns = bpnS1), index = null) }, ) val toUpdate = listOf( - RequestValues.siteUpdate1.copy(bpns = bpnS2), - RequestValues.siteUpdate2.copy(bpns = bpnS1), - RequestValues.siteUpdate3.copy(bpns = "NONEXISTENT"), + BusinessPartnerNonVerboseValues.siteUpdate1.copy(bpns = bpnS2), + BusinessPartnerNonVerboseValues.siteUpdate2.copy(bpns = bpnS1), + BusinessPartnerNonVerboseValues.siteUpdate3.copy(bpns = "NONEXISTENT"), ) val response = poolClient.sites.updateSite(toUpdate) @@ -453,12 +453,12 @@ class SiteControllerIT @Autowired constructor( val givenStructure = testHelpers.createBusinessPartnerStructure( listOf( LegalEntityStructureRequest( - legalEntity = RequestValues.legalEntityCreate1, - siteStructures = listOf(SiteStructureRequest(RequestValues.siteCreate1)) + legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate1, + siteStructures = listOf(SiteStructureRequest(BusinessPartnerNonVerboseValues.siteCreate1)) ), LegalEntityStructureRequest( - legalEntity = RequestValues.legalEntityCreate2, - siteStructures = listOf(SiteStructureRequest(RequestValues.siteCreate2), SiteStructureRequest(RequestValues.siteCreate3)) + legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate2, + siteStructures = listOf(SiteStructureRequest(BusinessPartnerNonVerboseValues.siteCreate2), SiteStructureRequest(BusinessPartnerNonVerboseValues.siteCreate3)) ) ) ) @@ -481,12 +481,12 @@ class SiteControllerIT @Autowired constructor( val givenStructure = testHelpers.createBusinessPartnerStructure( listOf( LegalEntityStructureRequest( - legalEntity = RequestValues.legalEntityCreate1, - siteStructures = listOf(SiteStructureRequest(RequestValues.siteCreate1)) + legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate1, + siteStructures = listOf(SiteStructureRequest(BusinessPartnerNonVerboseValues.siteCreate1)) ), LegalEntityStructureRequest( - legalEntity = RequestValues.legalEntityCreate2, - siteStructures = listOf(SiteStructureRequest(RequestValues.siteCreate2), SiteStructureRequest(RequestValues.siteCreate3)) + legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate2, + siteStructures = listOf(SiteStructureRequest(BusinessPartnerNonVerboseValues.siteCreate2), SiteStructureRequest(BusinessPartnerNonVerboseValues.siteCreate3)) ) ) ) @@ -505,10 +505,10 @@ class SiteControllerIT @Autowired constructor( val createdStructures = testHelpers.createBusinessPartnerStructure( listOf( LegalEntityStructureRequest( - legalEntity = RequestValues.legalEntityCreate1, + legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate1, siteStructures = listOf( - SiteStructureRequest(site = RequestValues.siteCreate1), - SiteStructureRequest(site = RequestValues.siteCreate2) + SiteStructureRequest(site = BusinessPartnerNonVerboseValues.siteCreate1), + SiteStructureRequest(site = BusinessPartnerNonVerboseValues.siteCreate2) ) ) ) @@ -517,12 +517,12 @@ class SiteControllerIT @Autowired constructor( val bpnL1 = createdStructures[0].legalEntity.legalEntity.bpnl val legalAddress1: LogisticAddressVerboseDto = - ResponseValues.addressPartner1.copy(isMainAddress = true, bpnSite = CommonValues.bpnS1, bpna = "BPNA0000000001YN") - val site1 = ResponseValues.site1.copy(bpnLegalEntity = bpnL1) + BusinessPartnerVerboseValues.addressPartner1.copy(isMainAddress = true, bpnSite = BusinessPartnerVerboseValues.site1.bpns, bpna = "BPNA0000000001YN") + val site1 = BusinessPartnerVerboseValues.site1.copy(bpnLegalEntity = bpnL1) val legalAddress2: LogisticAddressVerboseDto = - ResponseValues.addressPartner2.copy(isMainAddress = true, bpnSite = CommonValues.bpnS2, bpna = "BPNA0000000002XY") - val site2 = ResponseValues.site2.copy(bpnLegalEntity = bpnL1) + BusinessPartnerVerboseValues.addressPartner2.copy(isMainAddress = true, bpnSite = BusinessPartnerVerboseValues.site2.bpns, bpna = "BPNA0000000002XY") + val site2 = BusinessPartnerVerboseValues.site2.copy(bpnLegalEntity = bpnL1) val expectedFirstPage = PageDto( 2, 1, 0, 2, listOf( diff --git a/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/util/BusinessPartnerNonVerboseValues.kt b/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/util/BusinessPartnerNonVerboseValues.kt new file mode 100644 index 000000000..fa58580bf --- /dev/null +++ b/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/util/BusinessPartnerNonVerboseValues.kt @@ -0,0 +1,373 @@ +/******************************************************************************* + * 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.pool.util + +import org.eclipse.tractusx.bpdm.common.dto.* +import org.eclipse.tractusx.bpdm.pool.api.model.request.* + +object BusinessPartnerNonVerboseValues { + + val identifierType1 = BusinessPartnerVerboseValues.identifierType1 + val identifierType2 = BusinessPartnerVerboseValues.identifierType2 + val identifierType3 = BusinessPartnerVerboseValues.identifierType3 + + val identifierTypeDto1 = + IdentifierTypeDto(BusinessPartnerVerboseValues.identifierType1.technicalKey, IdentifierBusinessPartnerType.LEGAL_ENTITY, BusinessPartnerVerboseValues.identifierType1.name) + val identifierTypeDto2 = + IdentifierTypeDto(BusinessPartnerVerboseValues.identifierType2.technicalKey, IdentifierBusinessPartnerType.LEGAL_ENTITY, BusinessPartnerVerboseValues.identifierType2.name) + val identifierTypeDto3 = + IdentifierTypeDto(BusinessPartnerVerboseValues.identifierType3.technicalKey, IdentifierBusinessPartnerType.LEGAL_ENTITY, BusinessPartnerVerboseValues.identifierType3.name) + + val identifier1 = LegalEntityIdentifierDto( + value = BusinessPartnerVerboseValues.identifier1.value, + type = BusinessPartnerVerboseValues.identifierType1.technicalKey, + issuingBody = BusinessPartnerVerboseValues.identifier1.issuingBody, + ) + + val identifier2 = LegalEntityIdentifierDto( + value = BusinessPartnerVerboseValues.identifier2.value, + type = BusinessPartnerVerboseValues.identifierType2.technicalKey, + issuingBody = BusinessPartnerVerboseValues.identifier2.issuingBody, + ) + + val identifier3 = LegalEntityIdentifierDto( + value = BusinessPartnerVerboseValues.identifier3.value, + type = BusinessPartnerVerboseValues.identifierType3.technicalKey, + issuingBody = BusinessPartnerVerboseValues.identifier3.issuingBody, + ) + + val addressIdentifier = AddressIdentifierDto( + value = BusinessPartnerVerboseValues.identifier3.value, + type = BusinessPartnerVerboseValues.identifierType3.technicalKey, + ) + + val legalForm1 = LegalFormRequest( + technicalKey = BusinessPartnerVerboseValues.legalForm1.technicalKey, + name = BusinessPartnerVerboseValues.legalForm1.name, + abbreviation = BusinessPartnerVerboseValues.legalForm1.abbreviation, + ) + val legalForm2 = LegalFormRequest( + technicalKey = BusinessPartnerVerboseValues.legalForm2.technicalKey, + name = BusinessPartnerVerboseValues.legalForm2.name, + abbreviation = BusinessPartnerVerboseValues.legalForm2.abbreviation, + ) + val legalForm3 = LegalFormRequest( + technicalKey = BusinessPartnerVerboseValues.legalForm3.technicalKey, + name = BusinessPartnerVerboseValues.legalForm3.name, + abbreviation = BusinessPartnerVerboseValues.legalForm3.abbreviation, + ) + + private val leStatus1 = LegalEntityStateDto( + BusinessPartnerVerboseValues.leStatus1.description, + BusinessPartnerVerboseValues.leStatus1.validFrom, + BusinessPartnerVerboseValues.leStatus1.validTo, + BusinessPartnerVerboseValues.statusType1.technicalKey + ) + private val leStatus2 = LegalEntityStateDto( + BusinessPartnerVerboseValues.leStatus2.description, + BusinessPartnerVerboseValues.leStatus2.validFrom, + BusinessPartnerVerboseValues.leStatus2.validTo, + BusinessPartnerVerboseValues.statusType2.technicalKey + ) + private val leStatus3 = LegalEntityStateDto( + BusinessPartnerVerboseValues.leStatus3.description, + BusinessPartnerVerboseValues.leStatus3.validFrom, + BusinessPartnerVerboseValues.leStatus3.validTo, + BusinessPartnerVerboseValues.statusType3.technicalKey + ) + + val siteStatus1 = SiteStateDto( + BusinessPartnerVerboseValues.siteStatus1.description, + BusinessPartnerVerboseValues.siteStatus1.validFrom, + BusinessPartnerVerboseValues.siteStatus1.validTo, + BusinessPartnerVerboseValues.statusType1.technicalKey + ) + private val siteStatus2 = SiteStateDto( + BusinessPartnerVerboseValues.siteStatus2.description, + BusinessPartnerVerboseValues.siteStatus2.validFrom, + BusinessPartnerVerboseValues.siteStatus2.validTo, + BusinessPartnerVerboseValues.statusType2.technicalKey + ) + private val siteStatus3 = SiteStateDto( + BusinessPartnerVerboseValues.siteStatus3.description, + BusinessPartnerVerboseValues.siteStatus3.validFrom, + BusinessPartnerVerboseValues.siteStatus3.validTo, + BusinessPartnerVerboseValues.statusType3.technicalKey + ) + + private val classification1 = + ClassificationDto(BusinessPartnerVerboseValues.classificationType.technicalKey, BusinessPartnerVerboseValues.classification1.code, BusinessPartnerVerboseValues.classification1.value) + private val classification2 = + ClassificationDto(BusinessPartnerVerboseValues.classificationType.technicalKey, BusinessPartnerVerboseValues.classification2.code, BusinessPartnerVerboseValues.classification2.value) + private val classification3 = + ClassificationDto(BusinessPartnerVerboseValues.classificationType.technicalKey, BusinessPartnerVerboseValues.classification3.code, BusinessPartnerVerboseValues.classification3.value) + private val classification4 = + ClassificationDto(BusinessPartnerVerboseValues.classificationType.technicalKey, BusinessPartnerVerboseValues.classification4.code, BusinessPartnerVerboseValues.classification4.value) + private val classification5 = + ClassificationDto(BusinessPartnerVerboseValues.classificationType.technicalKey, BusinessPartnerVerboseValues.classification5.code, BusinessPartnerVerboseValues.classification5.value) + + + private val postalAddress1 = PhysicalPostalAddressDto( + geographicCoordinates = BusinessPartnerVerboseValues.address1.geographicCoordinates, + country = BusinessPartnerVerboseValues.address1.country.technicalKey, + postalCode = BusinessPartnerVerboseValues.address1.postalCode, + city = BusinessPartnerVerboseValues.address1.city, + administrativeAreaLevel1 = BusinessPartnerVerboseValues.address1.administrativeAreaLevel1?.toString(), + administrativeAreaLevel2 = BusinessPartnerVerboseValues.address1.administrativeAreaLevel2, + administrativeAreaLevel3 = BusinessPartnerVerboseValues.address1.administrativeAreaLevel3, + district = BusinessPartnerVerboseValues.address1.district, + companyPostalCode = BusinessPartnerVerboseValues.address1.companyPostalCode, + industrialZone = BusinessPartnerVerboseValues.address1.industrialZone, + building = BusinessPartnerVerboseValues.address1.building, + floor = BusinessPartnerVerboseValues.address1.floor, + door = BusinessPartnerVerboseValues.address1.door, + street = BusinessPartnerVerboseValues.address1.street, + ) + + private val postalAddress2 = PhysicalPostalAddressDto( + geographicCoordinates = BusinessPartnerVerboseValues.address2.geographicCoordinates, + country = BusinessPartnerVerboseValues.address2.country.technicalKey, + postalCode = BusinessPartnerVerboseValues.address2.postalCode, + city = BusinessPartnerVerboseValues.address2.city, + administrativeAreaLevel1 = BusinessPartnerVerboseValues.address2.administrativeAreaLevel1?.toString(), + administrativeAreaLevel2 = BusinessPartnerVerboseValues.address2.administrativeAreaLevel2, + administrativeAreaLevel3 = BusinessPartnerVerboseValues.address2.administrativeAreaLevel3, + district = BusinessPartnerVerboseValues.address2.district, + companyPostalCode = BusinessPartnerVerboseValues.address2.companyPostalCode, + industrialZone = BusinessPartnerVerboseValues.address2.industrialZone, + building = BusinessPartnerVerboseValues.address2.building, + floor = BusinessPartnerVerboseValues.address2.floor, + door = BusinessPartnerVerboseValues.address2.door, + street = BusinessPartnerVerboseValues.address2.street, + ) + + private val postalAddress3 = PhysicalPostalAddressDto( + geographicCoordinates = BusinessPartnerVerboseValues.address3.geographicCoordinates, + country = BusinessPartnerVerboseValues.address3.country.technicalKey, + postalCode = BusinessPartnerVerboseValues.address3.postalCode, + city = BusinessPartnerVerboseValues.address3.city, + administrativeAreaLevel1 = BusinessPartnerVerboseValues.address3.administrativeAreaLevel1?.toString(), + administrativeAreaLevel2 = BusinessPartnerVerboseValues.address3.administrativeAreaLevel2, + administrativeAreaLevel3 = BusinessPartnerVerboseValues.address3.administrativeAreaLevel3, + district = BusinessPartnerVerboseValues.address3.district, + companyPostalCode = BusinessPartnerVerboseValues.address3.companyPostalCode, + industrialZone = BusinessPartnerVerboseValues.address3.industrialZone, + building = BusinessPartnerVerboseValues.address3.building, + floor = BusinessPartnerVerboseValues.address3.floor, + door = BusinessPartnerVerboseValues.address3.door, + street = BusinessPartnerVerboseValues.address3.street, + ) + + private val logisticAddress1 = LogisticAddressDto( + physicalPostalAddress = postalAddress1 + ) + + val logisticAddress2 = LogisticAddressDto( + physicalPostalAddress = postalAddress2, + ) + + val logisticAddress3 = LogisticAddressDto( + physicalPostalAddress = postalAddress3, + ) + private val logisticAddress4 = LogisticAddressDto( + physicalPostalAddress = postalAddress1, name = BusinessPartnerVerboseValues.legalEntityUpsert1.legalName + ) + + val logisticAddress5 = LogisticAddressDto( + physicalPostalAddress = postalAddress1, identifiers = listOf(addressIdentifier) + ) + + val legalEntityCreate1 = LegalEntityPartnerCreateRequest( + legalEntity = LegalEntityDto( + legalShortName = null, + identifiers = listOf(identifier1), + legalForm = BusinessPartnerVerboseValues.legalForm1.technicalKey, + states = listOf(leStatus1), + classifications = listOf(classification1, classification2), + ), + legalAddress = logisticAddress1, + legalName = BusinessPartnerVerboseValues.legalEntityUpsert1.legalName, + index = BusinessPartnerVerboseValues.legalEntityUpsert1.index + ) + + val legalEntityCreate2 = LegalEntityPartnerCreateRequest( + legalEntity = LegalEntityDto( + legalShortName = null, + identifiers = listOf(identifier2), + legalForm = BusinessPartnerVerboseValues.legalForm2.technicalKey, + states = listOf(leStatus2), + classifications = listOf(classification3, classification4), + ), + legalAddress = logisticAddress2, + legalName = BusinessPartnerVerboseValues.legalEntityUpsert2.legalName, + index = BusinessPartnerVerboseValues.legalEntityUpsert2.index + ) + + val legalEntityCreate3 = LegalEntityPartnerCreateRequest( + legalEntity = LegalEntityDto( + legalShortName = null, + identifiers = listOf(identifier3), + legalForm = BusinessPartnerVerboseValues.legalForm3.technicalKey, + states = listOf(leStatus3), + classifications = listOf(classification5), + ), + legalAddress = logisticAddress3, + legalName = BusinessPartnerVerboseValues.legalEntityUpsert3.legalName, + index = BusinessPartnerVerboseValues.legalEntityUpsert3.index + ) + + val legalEntityCreateMultipleIdentifier = LegalEntityPartnerCreateRequest( + legalEntity = LegalEntityDto( + legalShortName = null, + identifiers = listOf(identifier1, identifier2), + legalForm = BusinessPartnerVerboseValues.legalForm1.technicalKey, + states = listOf(leStatus1), + classifications = listOf(classification1, classification2), + ), + legalAddress = logisticAddress1, + legalName = BusinessPartnerVerboseValues.legalEntityUpsertMultipleIdentifier.legalName, + index = BusinessPartnerVerboseValues.legalEntityUpsertMultipleIdentifier.index + ) + + + val legalEntityUpdate1 = LegalEntityPartnerUpdateRequest( + bpnl = BusinessPartnerVerboseValues.legalEntityUpsert1.legalEntity.bpnl, + legalName = legalEntityCreate1.legalName, + legalEntity = legalEntityCreate1.legalEntity, + legalAddress = legalEntityCreate1.legalAddress, + ) + + val legalEntityUpdate2 = LegalEntityPartnerUpdateRequest( + bpnl = BusinessPartnerVerboseValues.legalEntityUpsert2.legalEntity.bpnl, + legalName = legalEntityCreate2.legalName, + legalEntity = legalEntityCreate2.legalEntity, + legalAddress = legalEntityCreate2.legalAddress, + ) + + val legalEntityUpdate3 = LegalEntityPartnerUpdateRequest( + bpnl = BusinessPartnerVerboseValues.legalEntityUpsert3.legalEntity.bpnl, + legalName = legalEntityCreate3.legalName, + legalEntity = legalEntityCreate3.legalEntity, + legalAddress = legalEntityCreate3.legalAddress, + ) + + val legalEntityUpdateMultipleIdentifier = LegalEntityPartnerUpdateRequest( + bpnl = BusinessPartnerVerboseValues.legalEntityUpsertMultipleIdentifier.legalEntity.bpnl, + legalName = legalEntityCreateMultipleIdentifier.legalName, + legalEntity = legalEntityCreateMultipleIdentifier.legalEntity, + legalAddress = legalEntityCreateMultipleIdentifier.legalAddress, + ) + + val siteCreate1 = SitePartnerCreateRequest( + site = SiteDto( + name = BusinessPartnerVerboseValues.siteUpsert1.site.name, + states = listOf(siteStatus1), + mainAddress = logisticAddress1 + ), + index = BusinessPartnerVerboseValues.siteUpsert1.index, + bpnlParent = legalEntityUpdate1.bpnl + ) + + val siteCreate2 = SitePartnerCreateRequest( + site = SiteDto( + name = BusinessPartnerVerboseValues.siteUpsert2.site.name, + states = listOf(siteStatus2), + mainAddress = logisticAddress2 + ), + index = BusinessPartnerVerboseValues.siteUpsert2.index, + bpnlParent = legalEntityUpdate2.bpnl + ) + + val siteCreate3 = SitePartnerCreateRequest( + site = SiteDto( + name = BusinessPartnerVerboseValues.siteUpsert3.site.name, + states = listOf(siteStatus3), + mainAddress = logisticAddress3 + ), + index = BusinessPartnerVerboseValues.siteUpsert3.index, + bpnlParent = legalEntityUpdate3.bpnl + ) + + val siteUpdate1 = SitePartnerUpdateRequest( + bpns = BusinessPartnerVerboseValues.siteUpsert1.site.bpns, + site = siteCreate1.site + ) + + val siteUpdate2 = SitePartnerUpdateRequest( + bpns = BusinessPartnerVerboseValues.siteUpsert2.site.bpns, + site = siteCreate2.site + ) + + val siteUpdate3 = SitePartnerUpdateRequest( + bpns = BusinessPartnerVerboseValues.siteUpsert3.site.bpns, + site = siteCreate3.site + ) + + val addressPartnerCreate1 = AddressPartnerCreateRequest( + address = logisticAddress1, + bpnParent = legalEntityUpdate1.bpnl, + index = BusinessPartnerVerboseValues.addressPartnerCreate1.index + ) + + val addressPartnerCreate2 = AddressPartnerCreateRequest( + address = logisticAddress2, + bpnParent = legalEntityUpdate2.bpnl, + index = BusinessPartnerVerboseValues.addressPartnerCreate2.index + ) + + val addressPartnerCreate3 = AddressPartnerCreateRequest( + address = logisticAddress3, + bpnParent = legalEntityUpdate3.bpnl, + index = BusinessPartnerVerboseValues.addressPartnerCreate3.index + ) + + val addressPartnerCreate4 = AddressPartnerCreateRequest( + address = logisticAddress4, + bpnParent = legalEntityUpdate3.bpnl, + index = BusinessPartnerVerboseValues.addressPartnerCreate3.index + ) + + val addressPartnerCreate5 = AddressPartnerCreateRequest( + address = logisticAddress5, + bpnParent = legalEntityUpdate3.bpnl, + index = BusinessPartnerVerboseValues.addressPartnerCreate3.index + ) + + + val addressPartnerUpdate1 = AddressPartnerUpdateRequest( + bpna = BusinessPartnerVerboseValues.addressPartner1.bpna, + address = logisticAddress1 + ) + + val addressPartnerUpdate2 = AddressPartnerUpdateRequest( + bpna = BusinessPartnerVerboseValues.addressPartner2.bpna, + address = logisticAddress2 + ) + + val addressPartnerUpdate3 = AddressPartnerUpdateRequest( + bpna = BusinessPartnerVerboseValues.addressPartner3.bpna, + address = logisticAddress3 + ) + + val partnerStructure1 = LegalEntityStructureRequest( + legalEntityCreate1, + listOf(SiteStructureRequest(siteCreate1, listOf(addressPartnerCreate1))) + ) +} \ No newline at end of file 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/BusinessPartnerVerboseValues.kt similarity index 54% rename from bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/util/ResponseValues.kt rename to bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/util/BusinessPartnerVerboseValues.kt index df3e21dc2..e1c85096b 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/BusinessPartnerVerboseValues.kt @@ -19,9 +19,13 @@ package org.eclipse.tractusx.bpdm.pool.util +import com.neovisionaries.i18n.CountryCode +import com.neovisionaries.i18n.LanguageCode import org.eclipse.tractusx.bpdm.common.dto.StreetDto import org.eclipse.tractusx.bpdm.common.dto.response.* import org.eclipse.tractusx.bpdm.common.dto.response.type.TypeKeyNameVerboseDto +import org.eclipse.tractusx.bpdm.common.model.BusinessStateType +import org.eclipse.tractusx.bpdm.common.model.ClassificationType import org.eclipse.tractusx.bpdm.common.service.toDto import org.eclipse.tractusx.bpdm.pool.api.model.response.AddressPartnerCreateVerboseDto import org.eclipse.tractusx.bpdm.pool.api.model.response.LegalEntityPartnerCreateVerboseDto @@ -34,113 +38,118 @@ import java.time.ZoneOffset * Test values for response DTOs * Numbered values should match with @see SaasValues numbered values for easier testing */ -object ResponseValues { +object BusinessPartnerVerboseValues { + val createdTime1 = LocalDateTime.of(2020, 1, 1, 1, 1) - val language0 = TypeKeyNameVerboseDto(CommonValues.language0, CommonValues.language0.getName()) - val language1 = TypeKeyNameVerboseDto(CommonValues.language1, CommonValues.language1.getName()) - val language2 = TypeKeyNameVerboseDto(CommonValues.language2, CommonValues.language2.getName()) - val language3 = TypeKeyNameVerboseDto(CommonValues.language3, CommonValues.language3.getName()) - - private val country1 = TypeKeyNameVerboseDto(CommonValues.country1, CommonValues.country1.getName()) - private val country2 = TypeKeyNameVerboseDto(CommonValues.country2, CommonValues.country2.getName()) - private val country3 = TypeKeyNameVerboseDto(CommonValues.country3, CommonValues.country3.getName()) - - private val identifier1 = - LegalEntityIdentifierVerboseDto(CommonValues.identifierValue1, RequestValues.identifierType1, CommonValues.issuingBody1) - private val identifier2 = - LegalEntityIdentifierVerboseDto(CommonValues.identifierValue2, RequestValues.identifierType2, CommonValues.issuingBody2) - private val identifier3 = - LegalEntityIdentifierVerboseDto(CommonValues.identifierValue3, RequestValues.identifierType3, CommonValues.issuingBody3) + val language0 = TypeKeyNameVerboseDto(LanguageCode.undefined, LanguageCode.undefined.getName()) + val language1 = TypeKeyNameVerboseDto(LanguageCode.en, LanguageCode.en.getName()) + val language2 = TypeKeyNameVerboseDto(LanguageCode.de, LanguageCode.de.getName()) + val language3 = TypeKeyNameVerboseDto(LanguageCode.zh, LanguageCode.zh.getName()) + + private val country1 = TypeKeyNameVerboseDto(CountryCode.DE, CountryCode.DE.getName()) + private val country2 = TypeKeyNameVerboseDto(CountryCode.FR, CountryCode.FR.getName()) + private val country3 = TypeKeyNameVerboseDto(CountryCode.PL, CountryCode.PL.getName()) + + val identifierType1 = TypeKeyNameVerboseDto("VAT_DE", "Steuernummer") + val identifierType2 = TypeKeyNameVerboseDto("VAT_US", "VAT USA") + val identifierType3 = TypeKeyNameVerboseDto("VAT_FR", "VAT France") + + val identifier1 = + LegalEntityIdentifierVerboseDto("ID-XYZ", identifierType1, "Agency X") + val identifier2 = + LegalEntityIdentifierVerboseDto("Another ID Value", identifierType2, "Body Y") + val identifier3 = + LegalEntityIdentifierVerboseDto("An ID Value", identifierType3, "Official Z") val legalForm1 = LegalFormDto( - technicalKey = CommonValues.legalFormTechnicalKey1, - name = CommonValues.legalFormName1, - abbreviation = CommonValues.legalFormAbbreviation1, + technicalKey = "LF1", + name = "Limited Liability Company", + abbreviation = "LLC", ) val legalForm2 = LegalFormDto( - technicalKey = CommonValues.legalFormTechnicalKey2, - name = CommonValues.legalFormName2, - abbreviation = CommonValues.legalFormAbbreviation2, + technicalKey = "LF2", + name = "Gemeinschaft mit beschränkter Haftung", + abbreviation = "GmbH", ) val legalForm3 = LegalFormDto( - technicalKey = CommonValues.legalFormTechnicalKey3, - name = CommonValues.legalFormName3, - abbreviation = CommonValues.legalFormAbbreviation3, + technicalKey = "LF3", + name = "股份有限公司", + abbreviation = "股份有限", ) - private val statusType1 = TypeKeyNameVerboseDto(CommonValues.statusType1, CommonValues.statusType1.getTypeName()) - private val statusType2 = TypeKeyNameVerboseDto(CommonValues.statusType2, CommonValues.statusType2.getTypeName()) - private val statusType3 = TypeKeyNameVerboseDto(CommonValues.statusType3, CommonValues.statusType3.getTypeName()) + val statusType1 = TypeKeyNameVerboseDto(BusinessStateType.ACTIVE, BusinessStateType.ACTIVE.getTypeName()) + val statusType2 = TypeKeyNameVerboseDto(BusinessStateType.INACTIVE, BusinessStateType.INACTIVE.getTypeName()) + val statusType3 = TypeKeyNameVerboseDto(BusinessStateType.ACTIVE, BusinessStateType.ACTIVE.getTypeName()) - private val leStatus1 = LegalEntityStateVerboseDto(CommonValues.statusDenotation1, CommonValues.statusValidFrom1, null, statusType1) - private val leStatus2 = LegalEntityStateVerboseDto(CommonValues.statusDenotation2, CommonValues.statusValidFrom2, null, statusType2) - private val leStatus3 = LegalEntityStateVerboseDto(CommonValues.statusDenotation3, CommonValues.statusValidFrom3, null, statusType3) + val leStatus1 = LegalEntityStateVerboseDto("Active", LocalDateTime.of(2020, 1, 1, 0, 0), null, statusType1) + val leStatus2 = LegalEntityStateVerboseDto("Dissolved", LocalDateTime.of(2019, 1, 1, 0, 0), null, statusType2) + val leStatus3 = LegalEntityStateVerboseDto("Insolvent", LocalDateTime.of(2018, 1, 1, 0, 0), null, statusType3) - private val siteStatus1 = SiteStateVerboseDto(CommonValues.statusDenotation1, CommonValues.statusValidFrom1, null, CommonValues.statusType1.toDto()) - private val siteStatus2 = SiteStateVerboseDto(CommonValues.statusDenotation2, CommonValues.statusValidFrom2, null, CommonValues.statusType2.toDto()) - private val siteStatus3 = SiteStateVerboseDto(CommonValues.statusDenotation3, CommonValues.statusValidFrom3, null, CommonValues.statusType3.toDto()) + val siteStatus1 = SiteStateVerboseDto("Active", LocalDateTime.of(2020, 1, 1, 0, 0), null, BusinessStateType.ACTIVE.toDto()) + val siteStatus2 = SiteStateVerboseDto("Dissolved", LocalDateTime.of(2019, 1, 1, 0, 0), null, BusinessStateType.INACTIVE.toDto()) + val siteStatus3 = SiteStateVerboseDto("Insolvent", LocalDateTime.of(2018, 1, 1, 0, 0), null, BusinessStateType.ACTIVE.toDto()) - private val classificationType = TypeKeyNameVerboseDto(CommonValues.classificationType, CommonValues.classificationType.name) + val classificationType = TypeKeyNameVerboseDto(ClassificationType.NACE, ClassificationType.NACE.name) - private val classification1 = ClassificationVerboseDto(CommonValues.classification1, null, classificationType) - private val classification2 = ClassificationVerboseDto(CommonValues.classification2, null, classificationType) - private val classification3 = ClassificationVerboseDto(CommonValues.classification3, null, classificationType) - private val classification4 = ClassificationVerboseDto(CommonValues.classification4, null, classificationType) - private val classification5 = ClassificationVerboseDto(CommonValues.classification5, null, classificationType) + val classification1 = ClassificationVerboseDto("Sale of motor vehicles", null, classificationType) + val classification2 = ClassificationVerboseDto("Data processing, hosting and related activities", null, classificationType) + val classification3 = ClassificationVerboseDto("Other information service activities", null, classificationType) + val classification4 = ClassificationVerboseDto("Financial and insurance activities", null, classificationType) + val classification5 = ClassificationVerboseDto("Accounting, bookkeeping and auditing activities; tax consultancy", null, classificationType) - private val address1 = PhysicalPostalAddressVerboseDto( + val address1 = PhysicalPostalAddressVerboseDto( geographicCoordinates = null, country = country1, - postalCode = CommonValues.postCode1, - city = CommonValues.city1, - administrativeAreaLevel1 = CommonValues.adminAreaLevel1Region1, - administrativeAreaLevel2 = CommonValues.county1, + postalCode = "71059 ", + city = "Böblingen", + administrativeAreaLevel1 = null, + administrativeAreaLevel2 = "Böblingen", administrativeAreaLevel3 = null, - district = CommonValues.district1, - companyPostalCode = CommonValues.postCode2, - industrialZone = CommonValues.industrialZone1, - building = CommonValues.building1, - floor = CommonValues.floor1, - door = CommonValues.door1, - street = StreetDto(CommonValues.street1, CommonValues.houseNumber1), + district = "Sindelfingen-Ost", + companyPostalCode = "70547", + industrialZone = "Industrial Zone One", + building = "Gebäude eins", + floor = "Stockerk eins", + door = "Raum eins", + street = StreetDto("Bela-Barenyi-Straße", ""), ) - private val address2 = PhysicalPostalAddressVerboseDto( + val address2 = PhysicalPostalAddressVerboseDto( geographicCoordinates = null, country = country2, - postalCode = CommonValues.postCode2, - city = CommonValues.city2, - administrativeAreaLevel1 = CommonValues.adminAreaLevel1Region2, - administrativeAreaLevel2 = CommonValues.county2, + postalCode = "70547", + city = "Atlanta", + administrativeAreaLevel1 = null, + administrativeAreaLevel2 = " Fulton County", administrativeAreaLevel3 = null, - district = CommonValues.district2, + district = "District Level 1", companyPostalCode = null, - industrialZone = CommonValues.industrialZone2, - building = CommonValues.building2, - floor = CommonValues.floor2, - door = CommonValues.door2, - street = StreetDto(CommonValues.street2, CommonValues.houseNumber2), + industrialZone = "Industrial Zone Two", + building = "Building Two", + floor = "Floor Two", + door = "Door Two", + street = StreetDto("", ""), ) - private val address3 = PhysicalPostalAddressVerboseDto( + val address3 = PhysicalPostalAddressVerboseDto( geographicCoordinates = null, country = country3, - postalCode = CommonValues.postCode3, - city = CommonValues.city3, - administrativeAreaLevel1 = CommonValues.adminAreaLevel1Region3, - administrativeAreaLevel2 = CommonValues.county3, + postalCode = "30346", + city = "Atlanta", + administrativeAreaLevel1 = null, + administrativeAreaLevel2 = " Fulton County", administrativeAreaLevel3 = null, - district = CommonValues.district3, + district = "DL 1", companyPostalCode = null, - industrialZone = CommonValues.industrialZone3, - building = CommonValues.building3, - floor = CommonValues.floor3, - door = CommonValues.door3, - street = StreetDto(CommonValues.street3, CommonValues.houseNumber3), + industrialZone = "Industrial Zone Three", + building = "tedifício três", + floor = "piso três", + door = "peça três", + street = StreetDto("", ""), ) val addressPartner1 = LogisticAddressVerboseDto( - bpna = CommonValues.bpnA1, + bpna = "BPNA000000000001", physicalPostalAddress = address1, bpnLegalEntity = null, bpnSite = null, @@ -149,7 +158,7 @@ object ResponseValues { ) val addressPartner2 = LogisticAddressVerboseDto( - bpna = CommonValues.bpnA2, + bpna = "BPNA0000000001YN", physicalPostalAddress = address2, bpnLegalEntity = null, bpnSite = null, @@ -158,7 +167,7 @@ object ResponseValues { ) val addressPartner3 = LogisticAddressVerboseDto( - bpna = CommonValues.bpnA3, + bpna = "BPNA0000000002XY", physicalPostalAddress = address3, bpnLegalEntity = null, bpnSite = null, @@ -168,44 +177,44 @@ object ResponseValues { val addressPartnerCreate1 = AddressPartnerCreateVerboseDto( address = addressPartner1, - index = CommonValues.index1 + index = "1" ) val addressPartnerCreate2 = AddressPartnerCreateVerboseDto( address = addressPartner2, - index = CommonValues.index2 + index = "2" ) val addressPartnerCreate3 = AddressPartnerCreateVerboseDto( address = addressPartner3, - index = CommonValues.index3 + index = "3" ) val site1 = SiteVerboseDto( - bpns = CommonValues.bpnS1, - name = CommonValues.siteName1, + bpns = "BPNS000000000001", + name = "Stammwerk A", states = listOf(siteStatus1), - bpnLegalEntity = CommonValues.bpnL1, - createdAt = CommonValues.now, - updatedAt = CommonValues.now, + bpnLegalEntity = "BPNL000000000001", + createdAt = Instant.now(), + updatedAt = Instant.now(), ) val site2 = SiteVerboseDto( - bpns = CommonValues.bpnS2, - name = CommonValues.siteName2, + bpns = "BPNS0000000001YN", + name = "Halle B1", states = listOf(siteStatus2), - bpnLegalEntity = CommonValues.bpnL2, - createdAt = CommonValues.now, - updatedAt = CommonValues.now, + bpnLegalEntity = "BPNL0000000001YN", + createdAt = Instant.now(), + updatedAt = Instant.now(), ) val site3 = SiteVerboseDto( - bpns = CommonValues.bpnS3, - name = CommonValues.siteName3, + bpns = "BPNS0000000002XY", + name = "主厂房 C", states = listOf(siteStatus3), - bpnLegalEntity = CommonValues.bpnL3, - createdAt = CommonValues.now, - updatedAt = CommonValues.now, + bpnLegalEntity = "BPNL0000000002XY", + createdAt = Instant.now(), + updatedAt = Instant.now(), ) val siteUpsert1 = SitePartnerCreateVerboseDto( @@ -214,7 +223,7 @@ object ResponseValues { bpnSite = site1.bpns, isMainAddress = true ), - index = CommonValues.index1 + index = "1" ) val siteUpsert2 = SitePartnerCreateVerboseDto( @@ -223,7 +232,7 @@ object ResponseValues { bpnSite = site2.bpns, isMainAddress = true ), - index = CommonValues.index2 + index = "2" ) val siteUpsert3 = SitePartnerCreateVerboseDto( @@ -232,29 +241,29 @@ object ResponseValues { bpnSite = site3.bpns, isMainAddress = true ), - index = CommonValues.index3 + index = "3" ) val legalEntity1 = PoolLegalEntityVerboseDto( - legalName = CommonValues.name1, + legalName = "Business Partner Name", LegalEntityVerboseDto( - bpnl = CommonValues.bpnL1, + bpnl = "BPNL000000000001", identifiers = listOf(identifier1), legalForm = legalForm1, states = listOf(leStatus1), classifications = listOf(classification1, classification2), currentness = createdTime1.toInstant(ZoneOffset.UTC), - createdAt = CommonValues.now, - updatedAt = CommonValues.now, + createdAt = Instant.now(), + updatedAt = Instant.now(), ), legalAddress = LogisticAddressVerboseDto( - bpna = CommonValues.bpnA1, + bpna = "BPNA000000000001", physicalPostalAddress = PhysicalPostalAddressVerboseDto( geographicCoordinates = null, country = country1, postalCode = null, - city = CommonValues.locality1, + city = "Stuttgart", administrativeAreaLevel1 = null, administrativeAreaLevel2 = null, administrativeAreaLevel3 = null, @@ -274,24 +283,24 @@ object ResponseValues { ) val legalEntity2 = PoolLegalEntityVerboseDto( - legalName = CommonValues.name3, + legalName = "Another Organisation Corp", LegalEntityVerboseDto( - bpnl = CommonValues.bpnL2, + bpnl = "BPNL0000000001YN", identifiers = listOf(identifier2), legalForm = legalForm2, states = listOf(leStatus2), classifications = listOf(classification3, classification4), currentness = createdTime1.toInstant(ZoneOffset.UTC), - createdAt = CommonValues.now, - updatedAt = CommonValues.now, + createdAt = Instant.now(), + updatedAt = Instant.now(), ), legalAddress = LogisticAddressVerboseDto( - bpna = CommonValues.bpnA1, + bpna = "BPNA000000000001", physicalPostalAddress = PhysicalPostalAddressVerboseDto( geographicCoordinates = null, country = country2, postalCode = null, - city = CommonValues.locality3, + city = "5th Congressional District", administrativeAreaLevel1 = null, administrativeAreaLevel2 = null, administrativeAreaLevel3 = null, @@ -311,24 +320,24 @@ object ResponseValues { ) val legalEntity3 = PoolLegalEntityVerboseDto( - legalName = CommonValues.name5, + legalName = "好公司 合伙制企业", LegalEntityVerboseDto( - bpnl = CommonValues.bpnL3, + bpnl = "BPNL0000000002XY", identifiers = listOf(identifier3), legalForm = legalForm3, states = listOf(leStatus3), classifications = listOf(classification5), currentness = createdTime1.toInstant(ZoneOffset.UTC), - createdAt = CommonValues.now, - updatedAt = CommonValues.now, + createdAt = Instant.now(), + updatedAt = Instant.now(), ), legalAddress = LogisticAddressVerboseDto( - bpna = CommonValues.bpnA1, + bpna = "BPNA000000000001", physicalPostalAddress = PhysicalPostalAddressVerboseDto( geographicCoordinates = null, country = country3, postalCode = null, - city = CommonValues.locality5, + city = "北京市", administrativeAreaLevel1 = null, administrativeAreaLevel2 = null, administrativeAreaLevel3 = null, @@ -348,84 +357,84 @@ object ResponseValues { ) val legalEntityUpsert1 = LegalEntityPartnerCreateVerboseDto( - legalName = CommonValues.name1, + legalName = "Business Partner Name", legalEntity = LegalEntityVerboseDto( - bpnl = CommonValues.bpnL1, - identifiers = listOf(LegalEntityIdentifierVerboseDto(CommonValues.identifierValue1, RequestValues.identifierType1, CommonValues.issuingBody1)), + bpnl = "BPNL000000000001", + identifiers = listOf(LegalEntityIdentifierVerboseDto("ID-XYZ", identifierType1, "Agency X")), legalForm = legalForm1, states = listOf(leStatus1), classifications = listOf(classification1, classification2), currentness = createdTime1.toInstant(ZoneOffset.UTC), - createdAt = CommonValues.now, - updatedAt = CommonValues.now, + createdAt = Instant.now(), + updatedAt = Instant.now(), ), legalAddress = addressPartner1.copy( bpnLegalEntity = legalEntity1.legalEntity.bpnl, isLegalAddress = true ), - index = CommonValues.index1 + index = "1" ) val legalEntityUpsert2 = LegalEntityPartnerCreateVerboseDto( - legalName = CommonValues.name3, + legalName = "Another Organisation Corp", legalEntity = LegalEntityVerboseDto( - bpnl = CommonValues.bpnL2, - identifiers = listOf(LegalEntityIdentifierVerboseDto(CommonValues.identifierValue2, RequestValues.identifierType2, CommonValues.issuingBody2)), + bpnl = "BPNL0000000001YN", + identifiers = listOf(LegalEntityIdentifierVerboseDto("Another ID Value", identifierType2, "Body Y")), legalForm = legalForm2, states = listOf(leStatus2), classifications = listOf(classification3, classification4), currentness = createdTime1.toInstant(ZoneOffset.UTC), - createdAt = CommonValues.now, - updatedAt = CommonValues.now, + createdAt = Instant.now(), + updatedAt = Instant.now(), ), legalAddress = addressPartner2.copy( bpnLegalEntity = legalEntity2.legalEntity.bpnl, isLegalAddress = true ), - index = CommonValues.index2 + index = "2" ) val legalEntityUpsert3 = LegalEntityPartnerCreateVerboseDto( - legalName = CommonValues.name5, + legalName = "好公司 合伙制企业", legalEntity = LegalEntityVerboseDto( - bpnl = CommonValues.bpnL3, - identifiers = listOf(LegalEntityIdentifierVerboseDto(CommonValues.identifierValue3, RequestValues.identifierType3, CommonValues.issuingBody3)), + bpnl = "BPNL0000000002XY", + identifiers = listOf(LegalEntityIdentifierVerboseDto("An ID Value", identifierType3, "Official Z")), legalForm = legalForm3, states = listOf(leStatus3), classifications = listOf(classification5), currentness = createdTime1.toInstant(ZoneOffset.UTC), - createdAt = CommonValues.now, - updatedAt = CommonValues.now, + createdAt = Instant.now(), + updatedAt = Instant.now(), ), legalAddress = addressPartner3.copy( bpnLegalEntity = legalEntity3.legalEntity.bpnl, isLegalAddress = true ), - index = CommonValues.index3 + index = "3" ) val legalEntityUpsertMultipleIdentifier = LegalEntityPartnerCreateVerboseDto( - legalName = CommonValues.name1, + legalName = "Business Partner Name", legalEntity = LegalEntityVerboseDto( - bpnl = CommonValues.bpnL1, + bpnl = "BPNL000000000001", identifiers = listOf( - LegalEntityIdentifierVerboseDto(CommonValues.identifierValue1, RequestValues.identifierType1, CommonValues.issuingBody1), - LegalEntityIdentifierVerboseDto(CommonValues.identifierValue2, RequestValues.identifierType2, CommonValues.issuingBody2) + LegalEntityIdentifierVerboseDto("ID-XYZ", identifierType1, "Agency X"), + LegalEntityIdentifierVerboseDto("Another ID Value", identifierType2, "Body Y") ), legalForm = legalForm1, states = listOf(leStatus1), classifications = listOf(classification1, classification2), currentness = createdTime1.toInstant(ZoneOffset.UTC), - createdAt = CommonValues.now, - updatedAt = CommonValues.now, + createdAt = Instant.now(), + updatedAt = Instant.now(), ), legalAddress = addressPartner1.copy( bpnLegalEntity = legalEntity1.legalEntity.bpnl, isLegalAddress = true ), - index = CommonValues.index1 + index = "1" ) } \ No newline at end of file diff --git a/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/util/CommonValues.kt b/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/util/CommonValues.kt deleted file mode 100644 index ebb80f259..000000000 --- a/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/util/CommonValues.kt +++ /dev/null @@ -1,226 +0,0 @@ -/******************************************************************************* - * 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.pool.util - -import com.neovisionaries.i18n.CountryCode -import com.neovisionaries.i18n.LanguageCode -import org.eclipse.tractusx.bpdm.common.dto.response.RegionDto -import org.eclipse.tractusx.bpdm.common.model.BusinessStateType -import org.eclipse.tractusx.bpdm.common.model.CharacterSet -import org.eclipse.tractusx.bpdm.common.model.ClassificationType -import java.time.Instant -import java.time.LocalDateTime -import java.util.* - -/** - * Contains simple test values used to create more complex test values such as DTOs - */ -object CommonValues { - - val now = Instant.now() - - //The BPNs should match the first generated BPNs from the Issuer in order - val bpnL1 = "BPNL000000000001" - val bpnL2 = "BPNL0000000001YN" - val bpnL3 = "BPNL0000000002XY" - - val bpnA1 = "BPNA000000000001" - val bpnA2 = "BPNA0000000001YN" - val bpnA3 = "BPNA0000000002XY" - - val bpnS1 = "BPNS000000000001" - val bpnS2 = "BPNS0000000001YN" - val bpnS3 = "BPNS0000000002XY" - - val index1 = "1" - val index2 = "2" - val index3 = "3" - val index4 = "4" - - val uuid1 = UUID.fromString("e9975a48-b190-4bf1-a7e6-73c6a1744de8") - - val language0 = LanguageCode.undefined - val language1 = LanguageCode.en - val language2 = LanguageCode.de - val language3 = LanguageCode.zh - - val characterSet1 = CharacterSet.UNDEFINED - - val country1 = CountryCode.DE - val country2 = CountryCode.FR - val country3 = CountryCode.PL - - val name1 = "Business Partner Name" - val name2 = "Company ABC AG" - val name3 = "Another Organisation Corp" - val name4 = "Catena Test Name" - val name5 = "好公司 合伙制企业" - val name6 = "Something Ltd." - val name7 = "Gmbh XY" - val name8 = "XX LLC" - - val siteName1 = "Stammwerk A" - val siteName2 = "Halle B1" - val siteName3 = "主厂房 C" - - val legalFormTechnicalKey1 = "LF1" - val legalFormTechnicalKey2 = "LF2" - val legalFormTechnicalKey3 = "LF3" - - val legalFormName1 = "Limited Liability Company" - val legalFormName2 = "Gemeinschaft mit beschränkter Haftung" - val legalFormName3 = "股份有限公司" - - val legalFormAbbreviation1 = "LLC" - val legalFormAbbreviation2 = "GmbH" - val legalFormAbbreviation3 = "股份有限" - - val legalFormCategoryName1 = "Limited Company" - val legalFormCategoryName2 = "Stock Company" - val legalFormCategoryName3 = "Private Foundation" - - val legalFormCategoryUrl1 = "http://catenax-host/legal-category1" - val legalFormCategoryUrl2 = "http://catenax-host/legal-category2" - val legalFormCategoryUrl3 = "http://catenax-host/legal-category3" - - val identifierTypeTechnicalKey1 = "VAT_DE" - val identifierTypeTechnicalKey2 = "VAT_US" - val identifierTypeTechnicalKey3 = "VAT_FR" - - val identifierTypeName1 = "Steuernummer" - val identifierTypeName2 = "VAT USA" - val identifierTypeName3 = "VAT France" - - val issuingBody1 = "Agency X" - val issuingBody2 = "Body Y" - val issuingBody3 = "Official Z" - - val identifierValue1 = "ID-XYZ" - val identifierValue2 = "Another ID Value" - val identifierValue3 = "An ID Value" - - val statusType1 = BusinessStateType.ACTIVE - val statusType2 = BusinessStateType.INACTIVE - val statusType3 = BusinessStateType.ACTIVE // TODO unknown? - - val statusDenotation1 = "Active" - val statusDenotation2 = "Dissolved" - val statusDenotation3 = "Insolvent" - - val statusValidFrom1 = LocalDateTime.of(2020, 1, 1, 0, 0) - val statusValidFrom2 = LocalDateTime.of(2019, 1, 1, 0, 0) - val statusValidFrom3 = LocalDateTime.of(2018, 1, 1, 0, 0) - - val classificationType = ClassificationType.NACE - - val classification1 = "Sale of motor vehicles" - val classification2 = "Data processing, hosting and related activities" - val classification3 = "Other information service activities" - val classification4 = "Financial and insurance activities" - val classification5 = "Accounting, bookkeeping and auditing activities; tax consultancy" - - // TODO enable regionCodes later -// val adminAreaLevel1RegionCode_1 = "BW" -// val adminAreaLevel1Region1 = NameRegioncodeDto(adminAreaLevel1RegionCode_1, "Baden-Württemberg") -// val adminAreaLevel1RegionCode_2 = "GA" -// val adminAreaLevel1Region2 = NameRegioncodeDto(adminAreaLevel1RegionCode_2, "Georgia") -// val adminAreaLevel1RegionCode_3 = "GA" -// val adminAreaLevel1Region3 = NameRegioncodeDto(adminAreaLevel1RegionCode_3, "Georgia") - - val adminAreaLevel1RegionCode_1: String? = null - val adminAreaLevel1Region1: RegionDto? = null - val adminAreaLevel1RegionCode_2: String? = null - val adminAreaLevel1Region2: RegionDto? = null - val adminAreaLevel1RegionCode_3: String? = null - val adminAreaLevel1Region3: RegionDto? = null - - val county1 = "Böblingen" - val county2 = " Fulton County" - val county3 = " Fulton County" - - val city1 = "Böblingen" - val city2 = "Atlanta" - val city3 = "Atlanta" - - val district1 = "Sindelfingen-Ost" - val district2 = "District Level 1" - val district3 = "DL 1" - - val street1 = "Bela-Barenyi-Straße" - val street2 = "" - val street3 = "" - - val houseNumber1 = "" - val houseNumber2 = "" - val houseNumber3 = "" - - val industrialZone1 = "Industrial Zone One" - val industrialZone2 = "Industrial Zone Two" - val industrialZone3 = "Industrial Zone Three" - - val building1 = "Gebäude eins" - val building2 = "Building Two" - val building3 = "tedifício três" - - val floor1 = "Stockerk eins" - val floor2 = "Floor Two" - val floor3 = "piso três" - - val door1 = "Raum eins" - val door2 = "Door Two" - val door3 = "peça três" - - val postCode1 = "71059 " - val postCode2 = "70547" - val postCode3 = "30346" - val postCode4 = "07677-7731" - val postCode5 = "511464" - - val adminArea1 = "Stuttgart" - val adminArea2 = "Stuttgart" - val adminArea3 = "Georgia" - val adminArea4 = "South Carolina" - val adminArea5 = "河北省" - - val locality1 = "Stuttgart" - val locality2 = "Vaihingen" - val locality3 = "5th Congressional District" - val locality4 = "Woodcliff Lake" - val locality5 = "北京市" - - val thoroughfare1 = "Mercedesstraße 120" - val thoroughfare2 = "Werk 1" - val thoroughfare3 = "300 Chestnut Ridge Road" - val thoroughfare4 = "Factory 1" - val thoroughfare5 = "工人体育场东路" - - val premise1 = "Bauteil A" - val premise2 = "Etage 1" - val premise3 = "Building 1" - val premise4 = "First Floor" - val premise5 = "主楼" - val premise6 = "Komplex X" - - val postalDeliveryPoint1 = "Postal Delivery point" - val postalDeliveryPoint2 = "Mailbox Premise Street" - val postalDeliveryPoint3 = "Mail Station A" - val postalDeliveryPoint4 = "Post Office Box 1" - val postalDeliveryPoint5 = "邮政投递点" -} \ No newline at end of file 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 deleted file mode 100644 index 1fd22c70e..000000000 --- a/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/util/RequestValues.kt +++ /dev/null @@ -1,339 +0,0 @@ -/******************************************************************************* - * 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.pool.util - -import org.eclipse.tractusx.bpdm.common.dto.* -import org.eclipse.tractusx.bpdm.common.dto.response.type.TypeKeyNameVerboseDto -import org.eclipse.tractusx.bpdm.pool.api.model.request.* - -object RequestValues { - - val identifierType1 = TypeKeyNameVerboseDto(CommonValues.identifierTypeTechnicalKey1, CommonValues.identifierTypeName1) - val identifierType2 = TypeKeyNameVerboseDto(CommonValues.identifierTypeTechnicalKey2, CommonValues.identifierTypeName2) - val identifierType3 = TypeKeyNameVerboseDto(CommonValues.identifierTypeTechnicalKey3, CommonValues.identifierTypeName3) - - val identifierTypeDto1 = - IdentifierTypeDto(CommonValues.identifierTypeTechnicalKey1, IdentifierBusinessPartnerType.LEGAL_ENTITY, CommonValues.identifierTypeName1) - val identifierTypeDto2 = - IdentifierTypeDto(CommonValues.identifierTypeTechnicalKey2, IdentifierBusinessPartnerType.LEGAL_ENTITY, CommonValues.identifierTypeName2) - val identifierTypeDto3 = - IdentifierTypeDto(CommonValues.identifierTypeTechnicalKey3, IdentifierBusinessPartnerType.LEGAL_ENTITY, CommonValues.identifierTypeName3) - - val identifier1 = LegalEntityIdentifierDto( - value = CommonValues.identifierValue1, - type = CommonValues.identifierTypeTechnicalKey1, - issuingBody = CommonValues.issuingBody1, - ) - - val identifier2 = LegalEntityIdentifierDto( - value = CommonValues.identifierValue2, - type = CommonValues.identifierTypeTechnicalKey2, - issuingBody = CommonValues.issuingBody2, - ) - - val identifier3 = LegalEntityIdentifierDto( - value = CommonValues.identifierValue3, - type = CommonValues.identifierTypeTechnicalKey3, - issuingBody = CommonValues.issuingBody3, - ) - - val addressIdentifier = AddressIdentifierDto( - value = CommonValues.identifierValue3, - type = CommonValues.identifierTypeTechnicalKey3, - ) - - val legalForm1 = LegalFormRequest( - technicalKey = CommonValues.legalFormTechnicalKey1, - name = CommonValues.legalFormName1, - abbreviation = CommonValues.legalFormAbbreviation1, - ) - val legalForm2 = LegalFormRequest( - technicalKey = CommonValues.legalFormTechnicalKey2, - name = CommonValues.legalFormName2, - abbreviation = CommonValues.legalFormAbbreviation2, - ) - val legalForm3 = LegalFormRequest( - technicalKey = CommonValues.legalFormTechnicalKey3, - name = CommonValues.legalFormName3, - abbreviation = CommonValues.legalFormAbbreviation3, - ) - - val leStatus1 = LegalEntityStateDto(CommonValues.statusDenotation1, CommonValues.statusValidFrom1, null, CommonValues.statusType1) - val leStatus2 = LegalEntityStateDto(CommonValues.statusDenotation2, CommonValues.statusValidFrom2, null, CommonValues.statusType2) - val leStatus3 = LegalEntityStateDto(CommonValues.statusDenotation3, CommonValues.statusValidFrom3, null, CommonValues.statusType3) - - val siteStatus1 = SiteStateDto(CommonValues.statusDenotation1, CommonValues.statusValidFrom1, null, CommonValues.statusType1) - val siteStatus2 = SiteStateDto(CommonValues.statusDenotation2, CommonValues.statusValidFrom2, null, CommonValues.statusType2) - val siteStatus3 = SiteStateDto(CommonValues.statusDenotation3, CommonValues.statusValidFrom3, null, CommonValues.statusType3) - - val classification1 = ClassificationDto(CommonValues.classificationType, null, CommonValues.classification1) - val classification2 = ClassificationDto(CommonValues.classificationType, null, CommonValues.classification2) - val classification3 = ClassificationDto(CommonValues.classificationType, null, CommonValues.classification3) - val classification4 = ClassificationDto(CommonValues.classificationType, null, CommonValues.classification4) - val classification5 = ClassificationDto(CommonValues.classificationType, null, CommonValues.classification5) - - - val postalAddress1 = PhysicalPostalAddressDto( - geographicCoordinates = null, - country = CommonValues.country1, - postalCode = CommonValues.postCode1, - city = CommonValues.city1, - administrativeAreaLevel1 = CommonValues.adminAreaLevel1RegionCode_1, - administrativeAreaLevel2 = CommonValues.county1, - administrativeAreaLevel3 = null, - district = CommonValues.district1, - companyPostalCode = CommonValues.postCode2, - industrialZone = CommonValues.industrialZone1, - building = CommonValues.building1, - floor = CommonValues.floor1, - door = CommonValues.door1, - street = StreetDto(CommonValues.street1, CommonValues.houseNumber1), - ) - - val postalAddress2 = PhysicalPostalAddressDto( - geographicCoordinates = null, - country = CommonValues.country2, - postalCode = CommonValues.postCode2, - city = CommonValues.city2, - administrativeAreaLevel1 = CommonValues.adminAreaLevel1RegionCode_2, - administrativeAreaLevel2 = CommonValues.county2, - administrativeAreaLevel3 = null, - district = CommonValues.district2, - companyPostalCode = null, - industrialZone = CommonValues.industrialZone2, - building = CommonValues.building2, - floor = CommonValues.floor2, - door = CommonValues.door2, - street = StreetDto(CommonValues.street2, CommonValues.houseNumber2), - ) - - val postalAddress3 = PhysicalPostalAddressDto( - geographicCoordinates = null, - country = CommonValues.country3, - postalCode = CommonValues.postCode3, - city = CommonValues.city3, - administrativeAreaLevel1 = CommonValues.adminAreaLevel1RegionCode_3, - administrativeAreaLevel2 = CommonValues.county3, - administrativeAreaLevel3 = null, - district = CommonValues.district3, - companyPostalCode = null, - industrialZone = CommonValues.industrialZone3, - building = CommonValues.building3, - floor = CommonValues.floor3, - door = CommonValues.door3, - street = StreetDto(CommonValues.street3, CommonValues.houseNumber3), - ) - - val logisticAddress1 = LogisticAddressDto( - physicalPostalAddress = postalAddress1 - ) - - val logisticAddress2 = LogisticAddressDto( - physicalPostalAddress = postalAddress2, - ) - - val logisticAddress3 = LogisticAddressDto( - physicalPostalAddress = postalAddress3, - ) - val logisticAddress4 = LogisticAddressDto( - physicalPostalAddress = postalAddress1, name = CommonValues.name1 - ) - - val logisticAddress5 = LogisticAddressDto( - physicalPostalAddress = postalAddress1, identifiers = listOf(addressIdentifier) - ) - - val legalEntityCreate1 = LegalEntityPartnerCreateRequest( - legalEntity = LegalEntityDto( - legalShortName = null, - identifiers = listOf(identifier1), - legalForm = CommonValues.legalFormTechnicalKey1, - states = listOf(leStatus1), - classifications = listOf(classification1, classification2), - ), - legalAddress = logisticAddress1, - legalName = CommonValues.name1, - index = CommonValues.index1 - ) - - val legalEntityCreate2 = LegalEntityPartnerCreateRequest( - legalEntity = LegalEntityDto( - legalShortName = null, - identifiers = listOf(identifier2), - legalForm = CommonValues.legalFormTechnicalKey2, - states = listOf(leStatus2), - classifications = listOf(classification3, classification4), - ), - legalAddress = logisticAddress2, - legalName = CommonValues.name3, - index = CommonValues.index2 - ) - - val legalEntityCreate3 = LegalEntityPartnerCreateRequest( - legalEntity = LegalEntityDto( - legalShortName = null, - identifiers = listOf(identifier3), - legalForm = CommonValues.legalFormTechnicalKey3, - states = listOf(leStatus3), - classifications = listOf(classification5), - ), - legalAddress = logisticAddress3, - legalName = CommonValues.name5, - index = CommonValues.index3 - ) - - val legalEntityCreateMultipleIdentifier = LegalEntityPartnerCreateRequest( - legalEntity = LegalEntityDto( - legalShortName = null, - identifiers = listOf(identifier1, identifier2), - legalForm = CommonValues.legalFormTechnicalKey1, - states = listOf(leStatus1), - classifications = listOf(classification1, classification2), - ), - legalAddress = logisticAddress1, - legalName = CommonValues.name1, - index = CommonValues.index1 - ) - - - val legalEntityUpdate1 = LegalEntityPartnerUpdateRequest( - bpnl = CommonValues.bpnL1, - legalName = legalEntityCreate1.legalName, - legalEntity = legalEntityCreate1.legalEntity, - legalAddress = legalEntityCreate1.legalAddress, - ) - - val legalEntityUpdate2 = LegalEntityPartnerUpdateRequest( - bpnl = CommonValues.bpnL2, - legalName = legalEntityCreate2.legalName, - legalEntity = legalEntityCreate2.legalEntity, - legalAddress = legalEntityCreate2.legalAddress, - ) - - val legalEntityUpdate3 = LegalEntityPartnerUpdateRequest( - bpnl = CommonValues.bpnL3, - legalName = legalEntityCreate3.legalName, - legalEntity = legalEntityCreate3.legalEntity, - legalAddress = legalEntityCreate3.legalAddress, - ) - - val legalEntityUpdateMultipleIdentifier = LegalEntityPartnerUpdateRequest( - bpnl = CommonValues.bpnL1, - legalName = legalEntityCreateMultipleIdentifier.legalName, - legalEntity = legalEntityCreateMultipleIdentifier.legalEntity, - legalAddress = legalEntityCreateMultipleIdentifier.legalAddress, - ) - - val siteCreate1 = SitePartnerCreateRequest( - site = SiteDto( - name = CommonValues.siteName1, - states = listOf(siteStatus1), - mainAddress = logisticAddress1 - ), - index = CommonValues.index1, - bpnlParent = legalEntityUpdate1.bpnl - ) - - val siteCreate2 = SitePartnerCreateRequest( - site = SiteDto( - name = CommonValues.siteName2, - states = listOf(siteStatus2), - mainAddress = logisticAddress2 - ), - index = CommonValues.index2, - bpnlParent = legalEntityUpdate2.bpnl - ) - - val siteCreate3 = SitePartnerCreateRequest( - site = SiteDto( - name = CommonValues.siteName3, - states = listOf(siteStatus3), - mainAddress = logisticAddress3 - ), - index = CommonValues.index3, - bpnlParent = legalEntityUpdate3.bpnl - ) - - val siteUpdate1 = SitePartnerUpdateRequest( - bpns = CommonValues.bpnS1, - site = siteCreate1.site - ) - - val siteUpdate2 = SitePartnerUpdateRequest( - bpns = CommonValues.bpnS2, - site = siteCreate2.site - ) - - val siteUpdate3 = SitePartnerUpdateRequest( - bpns = CommonValues.bpnS3, - site = siteCreate3.site - ) - - val addressPartnerCreate1 = AddressPartnerCreateRequest( - address = logisticAddress1, - bpnParent = legalEntityUpdate1.bpnl, - index = CommonValues.index1 - ) - - val addressPartnerCreate2 = AddressPartnerCreateRequest( - address = logisticAddress2, - bpnParent = legalEntityUpdate2.bpnl, - index = CommonValues.index2 - ) - - val addressPartnerCreate3 = AddressPartnerCreateRequest( - address = logisticAddress3, - bpnParent = legalEntityUpdate3.bpnl, - index = CommonValues.index3 - ) - - val addressPartnerCreate4 = AddressPartnerCreateRequest( - address = logisticAddress4, - bpnParent = legalEntityUpdate3.bpnl, - index = CommonValues.index3 - ) - - val addressPartnerCreate5 = AddressPartnerCreateRequest( - address = logisticAddress5, - bpnParent = legalEntityUpdate3.bpnl, - index = CommonValues.index3 - ) - - - val addressPartnerUpdate1 = AddressPartnerUpdateRequest( - bpna = CommonValues.bpnA1, - address = logisticAddress1 - ) - - val addressPartnerUpdate2 = AddressPartnerUpdateRequest( - bpna = CommonValues.bpnA2, - address = logisticAddress2 - ) - - val addressPartnerUpdate3 = AddressPartnerUpdateRequest( - bpna = CommonValues.bpnA3, - address = logisticAddress3 - ) - - val partnerStructure1 = LegalEntityStructureRequest( - legalEntityCreate1, - listOf(SiteStructureRequest(siteCreate1, listOf(addressPartnerCreate1))) - ) -} \ No newline at end of file diff --git a/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/util/TestHelpers.kt b/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/util/TestHelpers.kt index ba3ca8148..7de739b25 100644 --- a/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/util/TestHelpers.kt +++ b/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/util/TestHelpers.kt @@ -180,17 +180,17 @@ class TestHelpers( /** - * Creates metadata needed for test data defined in the [RequestValues] + * Creates metadata needed for test data defined in the [BusinessPartnerNonVerboseValues] */ fun createTestMetadata() { - poolClient.metadata.createLegalForm(RequestValues.legalForm1) - poolClient.metadata.createLegalForm(RequestValues.legalForm2) - poolClient.metadata.createLegalForm(RequestValues.legalForm3) + poolClient.metadata.createLegalForm(BusinessPartnerNonVerboseValues.legalForm1) + poolClient.metadata.createLegalForm(BusinessPartnerNonVerboseValues.legalForm2) + poolClient.metadata.createLegalForm(BusinessPartnerNonVerboseValues.legalForm3) - poolClient.metadata.createIdentifierType(RequestValues.identifierTypeDto1) - poolClient.metadata.createIdentifierType(RequestValues.identifierTypeDto2) - poolClient.metadata.createIdentifierType(RequestValues.identifierTypeDto3) + poolClient.metadata.createIdentifierType(BusinessPartnerNonVerboseValues.identifierTypeDto1) + poolClient.metadata.createIdentifierType(BusinessPartnerNonVerboseValues.identifierTypeDto2) + poolClient.metadata.createIdentifierType(BusinessPartnerNonVerboseValues.identifierTypeDto3) }