From 87998d8a4380426c59b2d9abb6ed03e2d2e45e7c Mon Sep 17 00:00:00 2001 From: cezaralexandremorais Date: Mon, 26 Jun 2023 10:00:27 +0100 Subject: [PATCH] fix(pool):delete saas test classes from pool and deleted opensearch classes. bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/component/opensearch/impl/service/AddressToSaasMapping.kt bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/component/opensearch/impl/service/AlternativePostalAddressToSaasMapping.kt bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/component/opensearch/impl/service/PhysicalPostalAddressToSaasMapping.kt --- .../impl/service/AddressToSaasMapping.kt | 33 -- .../AlternativePostalAddressToSaasMapping.kt | 90 ---- .../impl/service/DocumentMappingService.kt | 35 +- .../PhysicalPostalAddressToSaasMapping.kt | 100 ---- .../service/SaasAddressToDtoMappingTest.kt | 112 ---- .../opensearch/InvalidIndexStartupIT.kt | 7 - .../opensearch/ValidIndexStartupIT.kt | 7 - .../controller/OpenSearchControllerIT.kt | 23 +- .../pool/controller/AddressControllerIT.kt | 7 - .../bpdm/pool/controller/BpnControllerIT.kt | 9 +- .../controller/LegalEntityControllerIT.kt | 7 - .../tractusx/bpdm/pool/util/ResponseValues.kt | 15 +- .../tractusx/bpdm/pool/util/SaasValues.kt | 499 ------------------ .../resources/application-test.properties | 5 - 14 files changed, 44 insertions(+), 905 deletions(-) delete mode 100644 bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/component/opensearch/impl/service/AddressToSaasMapping.kt delete mode 100644 bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/component/opensearch/impl/service/AlternativePostalAddressToSaasMapping.kt delete mode 100644 bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/component/opensearch/impl/service/PhysicalPostalAddressToSaasMapping.kt delete mode 100644 bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/common/service/SaasAddressToDtoMappingTest.kt delete mode 100644 bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/util/SaasValues.kt diff --git a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/component/opensearch/impl/service/AddressToSaasMapping.kt b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/component/opensearch/impl/service/AddressToSaasMapping.kt deleted file mode 100644 index f7d6cd916..000000000 --- a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/component/opensearch/impl/service/AddressToSaasMapping.kt +++ /dev/null @@ -1,33 +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.component.opensearch.impl.service - -import org.eclipse.tractusx.bpdm.common.dto.saas.GeoCoordinatesSaas - -interface AddressToSaasMapping { - fun geoCoordinates(): GeoCoordinatesSaas? - fun country(): String - fun administrativeAreas(): Collection - fun postcodes(): Collection - fun localities(): Collection - fun thoroughfares(): Collection - fun premises(): Collection - fun postalDeliveryPoints(): Collection -} \ No newline at end of file diff --git a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/component/opensearch/impl/service/AlternativePostalAddressToSaasMapping.kt b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/component/opensearch/impl/service/AlternativePostalAddressToSaasMapping.kt deleted file mode 100644 index 47a4d99ec..000000000 --- a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/component/opensearch/impl/service/AlternativePostalAddressToSaasMapping.kt +++ /dev/null @@ -1,90 +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.component.opensearch.impl.service - -import org.eclipse.tractusx.bpdm.common.dto.saas.GeoCoordinatesSaas -import org.eclipse.tractusx.bpdm.pool.entity.AlternativePostalAddress - -class AlternativePostalAddressToSaasMapping(private val postalAdress: AlternativePostalAddress) : AddressToSaasMapping { - - override fun geoCoordinates(): GeoCoordinatesSaas? { - - return (postalAdress.geographicCoordinates?.longitude).let { - - GeoCoordinatesSaas( - longitude = postalAdress.geographicCoordinates?.longitude, - latitude = postalAdress.geographicCoordinates?.latitude - ) - } - } - - override fun country(): String { - - return postalAdress.country.alpha2 - } - - override fun administrativeAreas(): Collection { - - return listOfNotNull( - - (postalAdress.administrativeAreaLevel1)?.let { - postalAdress.administrativeAreaLevel1.regionCode - } - ) - } - - override fun postcodes(): Collection { - - return listOfNotNull( - - postalAdress.postCode - ) - } - - override fun localities(): Collection { - - return listOfNotNull( - - postalAdress.city - ) - } - - override fun thoroughfares(): Collection { - - return listOfNotNull( - - ) - } - - - override fun premises(): Collection { - - return listOf() - } - - override fun postalDeliveryPoints(): Collection { - - return listOfNotNull( - - postalAdress.deliveryServiceNumber - ) - } - -} \ No newline at end of file diff --git a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/component/opensearch/impl/service/DocumentMappingService.kt b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/component/opensearch/impl/service/DocumentMappingService.kt index 730c0ae89..0e81d565d 100644 --- a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/component/opensearch/impl/service/DocumentMappingService.kt +++ b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/component/opensearch/impl/service/DocumentMappingService.kt @@ -23,8 +23,10 @@ import org.eclipse.tractusx.bpdm.pool.component.opensearch.impl.doc.AddressDoc import org.eclipse.tractusx.bpdm.pool.component.opensearch.impl.doc.AddressPartnerDoc import org.eclipse.tractusx.bpdm.pool.component.opensearch.impl.doc.LegalEntityDoc import org.eclipse.tractusx.bpdm.pool.component.opensearch.impl.doc.TextDoc +import org.eclipse.tractusx.bpdm.pool.entity.AlternativePostalAddress import org.eclipse.tractusx.bpdm.pool.entity.LegalEntity import org.eclipse.tractusx.bpdm.pool.entity.LogisticAddress +import org.eclipse.tractusx.bpdm.pool.entity.PhysicalPostalAddress import org.springframework.stereotype.Service /** @@ -56,7 +58,7 @@ class DocumentMappingService { val addresses: MutableList = mutableListOf() val list = listOfNotNull(logisticAddress.name) - addresses.add(toAddressPartnerDoc(list,(PhysicalPostalAddressToSaasMapping(logisticAddress.physicalPostalAddress)), logisticAddress.bpn)) + addresses.add(toAddressPartnerDoc(list, (logisticAddress.physicalPostalAddress), logisticAddress.bpn)) // TODO OpenSearch indexing doesn't work as expected when creating two AddressPartnerDocs with the same BPN (which is the ID), only last is indexed! // For now don't index alternativePostalAddress, since this would override (more important) physicalPostalAddress! // if (logisticAddress.alternativePostalAddress != null) { @@ -73,15 +75,15 @@ class DocumentMappingService { val addresses: MutableList = mutableListOf() - addresses.add(toAddressDoc((PhysicalPostalAddressToSaasMapping(logisticAddress.physicalPostalAddress)))) + addresses.add(toAddressDoc(logisticAddress.physicalPostalAddress)) if (logisticAddress.alternativePostalAddress != null) { - addresses.add(toAddressDoc((AlternativePostalAddressToSaasMapping(logisticAddress.alternativePostalAddress!!)))) + addresses.add(toAddressDoc((logisticAddress.alternativePostalAddress!!))) } return addresses } - fun toAddressPartnerDoc(name: List, address: AddressToSaasMapping, bpn: String): AddressPartnerDoc { + fun toAddressPartnerDoc(name: List, address: PhysicalPostalAddress, bpn: String): AddressPartnerDoc { return AddressPartnerDoc( bpn = bpn, name = name @@ -89,14 +91,25 @@ class DocumentMappingService { } - fun toAddressDoc(address: AddressToSaasMapping): AddressDoc { + fun toAddressDoc(address: PhysicalPostalAddress): AddressDoc { return AddressDoc( - administrativeAreas = address.administrativeAreas().map { TextDoc(it) }, - postCodes = address.postcodes().map { TextDoc(it) }, - localities = address.localities().map { TextDoc(it) }, - thoroughfares = address.thoroughfares().map { TextDoc(it) }, - premises = address.premises().map { TextDoc(it) }, - postalDeliveryPoints = address.postalDeliveryPoints().map { TextDoc(it) } + administrativeAreas = setOf(TextDoc(address.administrativeAreaLevel2.toString())), + postCodes = setOf(TextDoc(address.postCode.toString())), + localities = setOf(TextDoc("")), + thoroughfares = setOf(TextDoc("")), + premises = setOf(TextDoc("")), + postalDeliveryPoints = setOf(TextDoc("")) + ) + } + + fun toAddressDoc(address: AlternativePostalAddress): AddressDoc { + return AddressDoc( + administrativeAreas = setOf(TextDoc(address.administrativeAreaLevel1.toString())), + postCodes = setOf(TextDoc(address.postCode.toString())), + localities = setOf(TextDoc("")), + thoroughfares = setOf(TextDoc("")), + premises = setOf(TextDoc("")), + postalDeliveryPoints = setOf(TextDoc("")) ) } diff --git a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/component/opensearch/impl/service/PhysicalPostalAddressToSaasMapping.kt b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/component/opensearch/impl/service/PhysicalPostalAddressToSaasMapping.kt deleted file mode 100644 index 62533b629..000000000 --- a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/component/opensearch/impl/service/PhysicalPostalAddressToSaasMapping.kt +++ /dev/null @@ -1,100 +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.component.opensearch.impl.service - -import org.eclipse.tractusx.bpdm.common.dto.saas.GeoCoordinatesSaas -import org.eclipse.tractusx.bpdm.pool.entity.PhysicalPostalAddress - -class PhysicalPostalAddressToSaasMapping(private val postalAdress: PhysicalPostalAddress) : AddressToSaasMapping { - - override fun geoCoordinates(): GeoCoordinatesSaas? { - - return (postalAdress.geographicCoordinates?.longitude).let { - - GeoCoordinatesSaas( - longitude = postalAdress.geographicCoordinates?.longitude, - latitude = postalAdress.geographicCoordinates?.latitude - ) - } - } - - override fun country(): String { - - return postalAdress.country.alpha2 - } - - override fun administrativeAreas(): Collection { - - return listOfNotNull( - - (postalAdress.administrativeAreaLevel1)?.let { - postalAdress.administrativeAreaLevel1.regionCode - }, - postalAdress.administrativeAreaLevel2 - ) - } - - override fun postcodes(): Collection { - - return listOfNotNull( - - postalAdress.postCode - ) - } - - override fun localities(): Collection { - - return listOfNotNull( - - postalAdress.city, - postalAdress.districtLevel1, - postalAdress.districtLevel2 - ) - } - - override fun thoroughfares(): Collection { - - return listOfNotNull( - - postalAdress.street?.name, - postalAdress.street?.houseNumber, - postalAdress.street?.milestone, - postalAdress.street?.direction, - postalAdress.industrialZone - ) - } - - override fun premises(): Collection { - - return listOfNotNull( - - postalAdress.building, - postalAdress.floor, - postalAdress.door - ) - } - - override fun postalDeliveryPoints(): Collection { - - return listOf() - } - - -} \ No newline at end of file diff --git a/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/common/service/SaasAddressToDtoMappingTest.kt b/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/common/service/SaasAddressToDtoMappingTest.kt deleted file mode 100644 index d94667709..000000000 --- a/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/common/service/SaasAddressToDtoMappingTest.kt +++ /dev/null @@ -1,112 +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.common.service - -import org.assertj.core.api.Assertions -import org.eclipse.tractusx.bpdm.common.dto.PhysicalPostalAddressDto -import org.eclipse.tractusx.bpdm.common.dto.response.PhysicalPostalAddressVerboseDto -import org.eclipse.tractusx.bpdm.common.dto.saas.AddressSaas -import org.eclipse.tractusx.bpdm.common.dto.saas.TypeValueSaas -import org.eclipse.tractusx.bpdm.common.model.* -import org.eclipse.tractusx.bpdm.pool.util.ResponseValues -import org.eclipse.tractusx.bpdm.pool.util.SaasValues -import org.junit.jupiter.api.Test - -class SaasAddressToDtoMappingTest { - - @Test - fun addressPartnerTest() { - - checkMappingResponsePhysicalAddress(ResponseValues.addressPartner1.physicalPostalAddress, SaasValues.addressPartnerSaas1.addresses.first()) - checkMappingResponsePhysicalAddress(ResponseValues.addressPartner2.physicalPostalAddress, SaasValues.addressPartnerSaas2.addresses.first()) - checkMappingResponsePhysicalAddress(ResponseValues.addressPartner3.physicalPostalAddress, SaasValues.addressPartnerSaas3.addresses.first()) - } - - @Test - fun saasPhysicalAddressMappingTest() { - - val addressesMapping = SaasAddressesMapping(SaasValues.addressPartner1.addresses) - val address = addressesMapping.saasPhysicalAddressMapping()!! - val physicalAddressDto = SaasMappings.toPhysicalAddress(address, "") - - checkMappingDtoPhysicalAddress(physicalAddressDto, SaasValues.addressPartner1.addresses.first()) - - } - - private fun checkMappingResponsePhysicalAddress(physicalAddressDto: PhysicalPostalAddressVerboseDto, addressSaas: AddressSaas) { - - val baseAddressDto = physicalAddressDto.baseAddress - val areaDto = physicalAddressDto.areaPart - val streetDto = physicalAddressDto.street -//TODO Assertions.assertThat(baseAddressDto.administrativeAreaLevel1?.name).isEqualTo(findValue(addressSaas.administrativeAreas, SaasAdministrativeAreaType.REGION)) - Assertions.assertThat(areaDto.administrativeAreaLevel2).isEqualTo(findValue(addressSaas.administrativeAreas, SaasAdministrativeAreaType.COUNTY)) - Assertions.assertThat(areaDto.administrativeAreaLevel3).isEqualTo(null) - Assertions.assertThat(baseAddressDto.city).isEqualTo(findValue(addressSaas.localities, SaasLocalityType.CITY)) - Assertions.assertThat(baseAddressDto.country.technicalKey).isEqualTo(addressSaas.country?.shortName) - Assertions.assertThat(areaDto.district).isEqualTo(findValue(addressSaas.localities, SaasLocalityType.DISTRICT)) - Assertions.assertThat(baseAddressDto.geographicCoordinates?.latitude).isEqualTo(addressSaas.geographicCoordinates?.latitude) - Assertions.assertThat(baseAddressDto.geographicCoordinates?.longitude).isEqualTo(addressSaas.geographicCoordinates?.longitude) - Assertions.assertThat(baseAddressDto.postalCode).isEqualTo(findValue(addressSaas.postCodes, SaasPostCodeType.REGULAR)) - Assertions.assertThat(streetDto?.name).isEqualTo(findObject(addressSaas.thoroughfares, SaasThoroughfareType.STREET)?.name) - Assertions.assertThat(streetDto?.houseNumber).isEqualTo(findObject(addressSaas.thoroughfares, SaasThoroughfareType.STREET)?.number) - Assertions.assertThat(streetDto?.direction).isEqualTo(findObject(addressSaas.thoroughfares, SaasThoroughfareType.STREET)?.direction) - Assertions.assertThat(streetDto?.milestone).isEqualTo(findObject(addressSaas.thoroughfares, SaasThoroughfareType.STREET)?.shortName) - - Assertions.assertThat(physicalAddressDto.basePhysicalAddress.industrialZone) - .isEqualTo(findObject(addressSaas.thoroughfares, SaasThoroughfareType.INDUSTRIAL_ZONE)?.name) - Assertions.assertThat(physicalAddressDto.basePhysicalAddress.building).isEqualTo(findValue(addressSaas.premises, SaasPremiseType.BUILDING)) - Assertions.assertThat(physicalAddressDto.basePhysicalAddress.floor).isEqualTo(findValue(addressSaas.premises, SaasPremiseType.LEVEL)) - Assertions.assertThat(physicalAddressDto.basePhysicalAddress.door).isEqualTo(findValue(addressSaas.premises, SaasPremiseType.ROOM)) - } - - private fun checkMappingDtoPhysicalAddress(physicalAddressDto: PhysicalPostalAddressDto, addressSaas: AddressSaas) { - - val baseAddressDto = physicalAddressDto.baseAddress - val areaDto = physicalAddressDto.areaPart - val streetDto = physicalAddressDto.street - Assertions.assertThat(areaDto.administrativeAreaLevel1).isEqualTo(findValue(addressSaas.administrativeAreas, SaasAdministrativeAreaType.REGION)) - Assertions.assertThat(areaDto.administrativeAreaLevel2).isEqualTo(findValue(addressSaas.administrativeAreas, SaasAdministrativeAreaType.COUNTY)) - Assertions.assertThat(areaDto.administrativeAreaLevel3).isEqualTo(null) - Assertions.assertThat(baseAddressDto.city).isEqualTo(findValue(addressSaas.localities, SaasLocalityType.CITY)) - Assertions.assertThat(baseAddressDto.country).isEqualTo(addressSaas.country?.shortName) - Assertions.assertThat(areaDto.district).isEqualTo(findValue(addressSaas.localities, SaasLocalityType.DISTRICT)) - Assertions.assertThat(baseAddressDto.geographicCoordinates?.latitude).isEqualTo(addressSaas.geographicCoordinates?.latitude) - Assertions.assertThat(baseAddressDto.geographicCoordinates?.longitude).isEqualTo(addressSaas.geographicCoordinates?.longitude) - Assertions.assertThat(baseAddressDto.postalCode).isEqualTo(findValue(addressSaas.postCodes, SaasPostCodeType.REGULAR)) - Assertions.assertThat(streetDto?.name).isEqualTo(findObject(addressSaas.thoroughfares, SaasThoroughfareType.STREET)?.name) - Assertions.assertThat(streetDto?.houseNumber).isEqualTo(findObject(addressSaas.thoroughfares, SaasThoroughfareType.STREET)?.number) - Assertions.assertThat(streetDto?.direction).isEqualTo(findObject(addressSaas.thoroughfares, SaasThoroughfareType.STREET)?.direction) - Assertions.assertThat(streetDto?.milestone).isEqualTo(findObject(addressSaas.thoroughfares, SaasThoroughfareType.STREET)?.shortName) - - Assertions.assertThat(physicalAddressDto.basePhysicalAddress.industrialZone) - .isEqualTo(findObject(addressSaas.thoroughfares, SaasThoroughfareType.INDUSTRIAL_ZONE)?.name) - Assertions.assertThat(physicalAddressDto.basePhysicalAddress.building).isEqualTo(findValue(addressSaas.premises, SaasPremiseType.BUILDING)) - Assertions.assertThat(physicalAddressDto.basePhysicalAddress.floor).isEqualTo(findValue(addressSaas.premises, SaasPremiseType.LEVEL)) - Assertions.assertThat(physicalAddressDto.basePhysicalAddress.door).isEqualTo(findValue(addressSaas.premises, SaasPremiseType.ROOM)) - } - - private fun findValue(values: Collection, enumType: SaasType): String? { - return findObject(values, enumType)?.value - } - - private fun findObject(values: Collection, enumType: SaasType): T? { - return values.find { it.type?.technicalKey == enumType.getTechnicalKey() } - } -} \ No newline at end of file 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 f91b190d7..044c2b69b 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 @@ -40,8 +40,6 @@ import org.springframework.boot.test.context.SpringBootTest import org.springframework.test.annotation.DirtiesContext import org.springframework.test.context.ActiveProfiles import org.springframework.test.context.ContextConfiguration -import org.springframework.test.context.DynamicPropertyRegistry -import org.springframework.test.context.DynamicPropertySource import org.springframework.test.web.reactive.server.WebTestClient @SpringBootTest( @@ -63,11 +61,6 @@ class InvalidIndexStartupIT @Autowired constructor( .options(WireMockConfiguration.wireMockConfig().dynamicPort()) .build() - @JvmStatic - @DynamicPropertySource - fun properties(registry: DynamicPropertyRegistry) { - registry.add("bpdm.saas.host") { wireMockServer.baseUrl() } - } } val bpnBogusDocument = "BPN_FAKE" 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 6505c1bee..96fcaae49 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 @@ -37,8 +37,6 @@ import org.springframework.boot.test.context.SpringBootTest import org.springframework.test.annotation.DirtiesContext import org.springframework.test.context.ActiveProfiles import org.springframework.test.context.ContextConfiguration -import org.springframework.test.context.DynamicPropertyRegistry -import org.springframework.test.context.DynamicPropertySource import org.springframework.test.web.reactive.server.WebTestClient @SpringBootTest( @@ -59,11 +57,6 @@ class ValidIndexStartupIT @Autowired constructor( .options(WireMockConfiguration.wireMockConfig().dynamicPort()) .build() - @JvmStatic - @DynamicPropertySource - fun properties(registry: DynamicPropertyRegistry) { - registry.add("bpdm.saas.host") { wireMockServer.baseUrl() } - } } /** 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 481c52441..c07e37524 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 @@ -27,7 +27,6 @@ import com.github.tomakehurst.wiremock.junit5.WireMockExtension import org.assertj.core.api.Assertions.assertThat import org.eclipse.tractusx.bpdm.common.dto.request.PaginationRequest import org.eclipse.tractusx.bpdm.common.dto.response.PageResponse -import org.eclipse.tractusx.bpdm.common.dto.saas.PagedResponseSaas import org.eclipse.tractusx.bpdm.pool.Application import org.eclipse.tractusx.bpdm.pool.api.client.PoolClientImpl import org.eclipse.tractusx.bpdm.pool.api.model.request.LegalEntityPropertiesSearchRequest @@ -82,9 +81,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( - SaasValues.legalEntity1, - SaasValues.legalEntity2, - SaasValues.legalEntity3 + RequestValues.legalEntityCreate1, + RequestValues.legalEntityCreate2, + RequestValues.legalEntityCreate3 ) @BeforeEach @@ -92,10 +91,10 @@ class OpenSearchControllerIT @Autowired constructor( testHelpers.truncateDbTables() openSearchSyncService.clearOpenSearch() - val importCollection = PagedResponseSaas( - partnerDocs.size, - null, - null, + val importCollection = PageResponse( + partnerDocs.size.toLong(), + 1, + 0, partnerDocs.size, partnerDocs ) @@ -137,7 +136,7 @@ class OpenSearchControllerIT @Autowired constructor( var exportResponse = testHelpers.startSyncAndAwaitSuccess(webTestClient, EndpointValues.OPENSEARCH_SYNC_PATH) assertThat(exportResponse.count).isEqualTo(6) - assertSearchableByNames(partnerDocs.map { it.names.first().value }) + assertSearchableByNames(partnerDocs.map { it.legalName }) //export now to check behaviour exportResponse = testHelpers.startSyncAndAwaitSuccess(webTestClient, EndpointValues.OPENSEARCH_SYNC_PATH) @@ -156,7 +155,7 @@ class OpenSearchControllerIT @Autowired constructor( // We have assertThat(exportResponse.count).isEqualTo(6) - assertSearchableByNames(partnerDocs.map { it.names.first().value }) + assertSearchableByNames(partnerDocs.map { it.legalName }) } /** @@ -166,7 +165,7 @@ class OpenSearchControllerIT @Autowired constructor( */ @Test fun `empty index`() { - val names = partnerDocs.map { it.names.first().value } + val names = partnerDocs.map { it.legalName } // fill the opensearch index val exportResponse = testHelpers.startSyncAndAwaitSuccess(webTestClient, EndpointValues.OPENSEARCH_SYNC_PATH) @@ -201,7 +200,7 @@ class OpenSearchControllerIT @Autowired constructor( val exportResponse = testHelpers.startSyncAndAwaitSuccess(webTestClient, EndpointValues.OPENSEARCH_SYNC_PATH) assertThat(exportResponse.count).isEqualTo(6) - assertSearchableByNames(partnerDocs.map { it.names.first().value }) + assertSearchableByNames(partnerDocs.map { it.legalName }) } 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 8bc95690e..0b0a1aa30 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 @@ -38,8 +38,6 @@ import org.springframework.beans.factory.annotation.Autowired import org.springframework.boot.test.context.SpringBootTest import org.springframework.test.context.ActiveProfiles import org.springframework.test.context.ContextConfiguration -import org.springframework.test.context.DynamicPropertyRegistry -import org.springframework.test.context.DynamicPropertySource import org.springframework.test.web.reactive.server.WebTestClient @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = [Application::class, TestHelpers::class]) @@ -56,11 +54,6 @@ class AddressControllerIT @Autowired constructor( .options(WireMockConfiguration.wireMockConfig().dynamicPort()) .build() - @JvmStatic - @DynamicPropertySource - fun properties(registry: DynamicPropertyRegistry) { - registry.add("bpdm.saas.host") { wireMockServer.baseUrl() } - } } 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 b1bde2d99..14eb5ade5 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 @@ -22,8 +22,8 @@ package org.eclipse.tractusx.bpdm.pool.controller import com.github.tomakehurst.wiremock.core.WireMockConfiguration import com.github.tomakehurst.wiremock.junit5.WireMockExtension import org.assertj.core.api.Assertions.assertThat -import org.eclipse.tractusx.bpdm.common.dto.LegalEntityIdentifierDto import org.eclipse.tractusx.bpdm.common.dto.IdentifierLsaType +import org.eclipse.tractusx.bpdm.common.dto.LegalEntityIdentifierDto import org.eclipse.tractusx.bpdm.pool.Application import org.eclipse.tractusx.bpdm.pool.api.client.PoolClientImpl import org.eclipse.tractusx.bpdm.pool.api.model.request.IdentifiersSearchRequest @@ -38,8 +38,6 @@ import org.springframework.beans.factory.annotation.Autowired import org.springframework.boot.test.context.SpringBootTest import org.springframework.test.context.ActiveProfiles import org.springframework.test.context.ContextConfiguration -import org.springframework.test.context.DynamicPropertyRegistry -import org.springframework.test.context.DynamicPropertySource @SpringBootTest( webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = [Application::class, TestHelpers::class], @@ -57,11 +55,6 @@ class BpnControllerIT @Autowired constructor( .options(WireMockConfiguration.wireMockConfig().dynamicPort()) .build() - @JvmStatic - @DynamicPropertySource - fun properties(registry: DynamicPropertyRegistry) { - registry.add("bpdm.saas.host") { wireMockServer.baseUrl() } - } } val identifierType = RequestValues.legalEntityCreate1.legalEntity.identifiers.first().type 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 fdd239d03..f5bb508d7 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 @@ -39,8 +39,6 @@ import org.springframework.beans.factory.annotation.Autowired import org.springframework.boot.test.context.SpringBootTest import org.springframework.test.context.ActiveProfiles import org.springframework.test.context.ContextConfiguration -import org.springframework.test.context.DynamicPropertyRegistry -import org.springframework.test.context.DynamicPropertySource import org.springframework.test.web.reactive.server.WebTestClient import org.springframework.test.web.reactive.server.returnResult import java.time.Instant @@ -61,11 +59,6 @@ class LegalEntityControllerIT @Autowired constructor( .options(WireMockConfiguration.wireMockConfig().dynamicPort()) .build() - @JvmStatic - @DynamicPropertySource - fun properties(registry: DynamicPropertyRegistry) { - registry.add("bpdm.saas.host") { wireMockServer.baseUrl() } - } } diff --git a/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/util/ResponseValues.kt b/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/util/ResponseValues.kt index 009fe9844..809505f2b 100644 --- a/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/util/ResponseValues.kt +++ b/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/util/ResponseValues.kt @@ -28,6 +28,7 @@ import org.eclipse.tractusx.bpdm.pool.api.model.response.AddressPartnerCreateRes import org.eclipse.tractusx.bpdm.pool.api.model.response.LegalEntityPartnerCreateResponse import org.eclipse.tractusx.bpdm.pool.api.model.response.SitePartnerCreateResponse import java.time.Instant +import java.time.LocalDateTime import java.time.ZoneOffset /** @@ -35,7 +36,7 @@ import java.time.ZoneOffset * Numbered values should match with @see SaasValues numbered values for easier testing */ object ResponseValues { - + val createdTime1 = LocalDateTime.of(2020, 1, 1, 1, 1) val language0 = TypeKeyNameDto(CommonValues.language0, CommonValues.language0.getName()) val language1 = TypeKeyNameDto(CommonValues.language1, CommonValues.language1.getName()) val language2 = TypeKeyNameDto(CommonValues.language2, CommonValues.language2.getName()) @@ -257,7 +258,7 @@ object ResponseValues { legalForm = legalForm1, states = listOf(leStatus1), classifications = listOf(classification1, classification2), - currentness = SaasValues.createdTime1.toInstant(ZoneOffset.UTC), + currentness = createdTime1.toInstant(ZoneOffset.UTC), createdAt = CommonValues.now, updatedAt = CommonValues.now, ), @@ -299,7 +300,7 @@ object ResponseValues { legalForm = legalForm2, states = listOf(leStatus2), classifications = listOf(classification3, classification4), - currentness = SaasValues.createdTime1.toInstant(ZoneOffset.UTC), + currentness = createdTime1.toInstant(ZoneOffset.UTC), createdAt = CommonValues.now, updatedAt = CommonValues.now, ), @@ -341,7 +342,7 @@ object ResponseValues { legalForm = legalForm3, states = listOf(leStatus3), classifications = listOf(classification5), - currentness = SaasValues.createdTime1.toInstant(ZoneOffset.UTC), + currentness = createdTime1.toInstant(ZoneOffset.UTC), createdAt = CommonValues.now, updatedAt = CommonValues.now, ), @@ -383,7 +384,7 @@ object ResponseValues { legalForm = legalForm1, states = listOf(leStatus1), classifications = listOf(classification1, classification2), - currentness = SaasValues.createdTime1.toInstant(ZoneOffset.UTC), + currentness = createdTime1.toInstant(ZoneOffset.UTC), createdAt = CommonValues.now, updatedAt = CommonValues.now, @@ -403,7 +404,7 @@ object ResponseValues { legalForm = legalForm2, states = listOf(leStatus2), classifications = listOf(classification3, classification4), - currentness = SaasValues.createdTime1.toInstant(ZoneOffset.UTC), + currentness = createdTime1.toInstant(ZoneOffset.UTC), createdAt = CommonValues.now, updatedAt = CommonValues.now, ), @@ -422,7 +423,7 @@ object ResponseValues { legalForm = legalForm3, states = listOf(leStatus3), classifications = listOf(classification5), - currentness = SaasValues.createdTime1.toInstant(ZoneOffset.UTC), + currentness = createdTime1.toInstant(ZoneOffset.UTC), createdAt = CommonValues.now, updatedAt = CommonValues.now, ), diff --git a/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/util/SaasValues.kt b/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/util/SaasValues.kt deleted file mode 100644 index 3414af9c8..000000000 --- a/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/util/SaasValues.kt +++ /dev/null @@ -1,499 +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.LanguageCode -import org.eclipse.tractusx.bpdm.common.dto.saas.* -import org.eclipse.tractusx.bpdm.common.model.* -import java.time.LocalDateTime - -/** - * Test values for SaaS DTOs - * Numbered values should match with @see ResponseValues numbered values for easier testing - */ -object SaasValues { - - val partnerId1 = "saas-1" - val partnerId2 = "saas-2" - val partnerId3 = "saas-3" - val partnerId4 = "saas-4" - val partnerId5 = "saas-5" - val partnerId6 = "saas-6" - val partnerId7 = "saas-7" - val partnerId8 = "saas-8" - val partnerId9 = "saas-9" - - - val datasource1 = "datasource-1" - - val createdTime1 = LocalDateTime.of(2020, 1, 1, 1, 1) - - val language1 = LanguageSaas(LanguageCode.en, LanguageCode.en.getName()) - val language2 = LanguageSaas(LanguageCode.de, LanguageCode.de.getName()) - val language3 = LanguageSaas(LanguageCode.zh, LanguageCode.zh.getName()) - - val legalEntityName1 = NameSaas(CommonValues.name1) - val legalEntityName2 = NameSaas(CommonValues.name2) - val legalEntityName3 = NameSaas(CommonValues.name3) - val legalEntityName4 = NameSaas(CommonValues.name4) - val legalEntityName5 = NameSaas(CommonValues.name5) - - val siteName1 = NameSaas(CommonValues.siteName1) - val siteName2 = NameSaas(CommonValues.siteName2) - val siteName3 = NameSaas(CommonValues.siteName3) - - val identifierType1 = TypeKeyNameUrlSaas(CommonValues.identifierTypeTechnicalKey1, CommonValues.identifierTypeName1) - val identifierType2 = TypeKeyNameUrlSaas(CommonValues.identifierTypeTechnicalKey2, CommonValues.identifierTypeName2) - val identifierType3 = TypeKeyNameUrlSaas(CommonValues.identifierTypeTechnicalKey3, CommonValues.identifierTypeName3) - - val issuingBody1 = TypeKeyNameUrlSaas(name = CommonValues.issuingBody1) - val issuingBody2 = TypeKeyNameUrlSaas(name = CommonValues.issuingBody2) - val issuingBody3 = TypeKeyNameUrlSaas(name = CommonValues.issuingBody3) - - val identifierStatus1 = TypeKeyNameSaas("identifierstatuskey", "identifierstatusname") - - val identifier1 = IdentifierSaas(identifierType1, CommonValues.identifierValue1, issuingBody1, identifierStatus1) - val identifier2 = IdentifierSaas(identifierType2, CommonValues.identifierValue2, issuingBody2, identifierStatus1) - val identifier3 = IdentifierSaas(identifierType3, CommonValues.identifierValue3, issuingBody3, identifierStatus1) - - val legalForm1 = LegalFormSaas( - technicalKey = CommonValues.legalFormTechnicalKey1, - name = CommonValues.legalFormName1, - mainAbbreviation = CommonValues.legalFormAbbreviation1, - ) - val legalForm2 = LegalFormSaas( - technicalKey = CommonValues.legalFormTechnicalKey2, - name = CommonValues.legalFormName2, - mainAbbreviation = CommonValues.legalFormAbbreviation2, - ) - val legalForm3 = LegalFormSaas( - technicalKey = CommonValues.legalFormTechnicalKey3, - name = CommonValues.legalFormName3, - mainAbbreviation = CommonValues.legalFormAbbreviation3, - ) - - val statusType1 = TypeKeyNameUrlSaas(CommonValues.statusType1.name) - val statusType2 = TypeKeyNameUrlSaas(CommonValues.statusType2.name) - val statusType3 = TypeKeyNameUrlSaas(CommonValues.statusType3.name) - - val status1 = BusinessPartnerStatusSaas(statusType1, CommonValues.statusDenotation1, CommonValues.statusValidFrom1) - val status2 = BusinessPartnerStatusSaas(statusType2, CommonValues.statusDenotation2, CommonValues.statusValidFrom2) - val status3 = BusinessPartnerStatusSaas(statusType3, CommonValues.statusDenotation3, CommonValues.statusValidFrom3) - - val classificationType = TypeKeyNameUrlSaas(CommonValues.classificationType.name) - - val classification1 = ClassificationSaas(value = CommonValues.classification1, type = classificationType) - val classification2 = ClassificationSaas(value = CommonValues.classification2, type = classificationType) - val classification3 = ClassificationSaas(value = CommonValues.classification3, type = classificationType) - val classification4 = ClassificationSaas(value = CommonValues.classification4, type = classificationType) - val classification5 = ClassificationSaas(value = CommonValues.classification5, type = classificationType) - - val addressId1 = "address-saas-1" - val addressId2 = "address-saas-2" - val addressId3 = "address-saas-3" - - val locality1 = LocalitySaas(saasValue = CommonValues.locality1, saasType = SaasLocalityType.CITY, saasLanguage = language1) - val locality2 = LocalitySaas(value = CommonValues.locality2) - val locality3 = LocalitySaas(saasValue = CommonValues.locality3, saasType = SaasLocalityType.CITY, saasLanguage = language1) - val locality4 = LocalitySaas(value = CommonValues.locality4) - - val city1 = LocalitySaas(saasValue = CommonValues.city1, saasType = SaasLocalityType.CITY, saasLanguage = language1) - val city2 = LocalitySaas(saasValue = CommonValues.city2, saasType = SaasLocalityType.CITY, saasLanguage = language2) - val city3 = LocalitySaas(saasValue = CommonValues.city3, saasType = SaasLocalityType.CITY, saasLanguage = language3) - - val postalDeliveryPoint1 = PostalDeliveryPointSaas(value = CommonValues.postalDeliveryPoint1) - val postalDeliveryPoint2 = PostalDeliveryPointSaas(value = CommonValues.postalDeliveryPoint2) - val postalDeliveryPoint3 = PostalDeliveryPointSaas(value = CommonValues.postalDeliveryPoint3) - val postalDeliveryPoint4 = PostalDeliveryPointSaas(value = CommonValues.postalDeliveryPoint4) - val postalDeliveryPoint5 = PostalDeliveryPointSaas(value = CommonValues.postalDeliveryPoint5) - - val parentRelationType = TypeKeyNameSaas("PARENT") - - val legalEntityType = TypeKeyNameUrlSaas("LEGAL_ENTITY") - val siteType = TypeKeyNameUrlSaas("ORGANIZATIONAL_UNIT") - val addressType = TypeKeyNameUrlSaas("BP_ADDRESS") - - - val parentRelation = RelationSaas( - type = parentRelationType, - startNode = CommonValues.bpnL1, - endNode = CommonValues.bpnS1, - startNodeDataSource = datasource1, - endNodeDataSource = datasource1 - ) - - val address1 = AddressSaas( - id = addressId1, - externalId = addressId1, - saasId = addressId1, - country = CountrySaas(CommonValues.country1, CommonValues.country1.getName()), - administrativeAreas = listOf(AdministrativeAreaSaas(CommonValues.adminArea1), AdministrativeAreaSaas(CommonValues.adminArea2)), - postCodes = listOf(PostCodeSaas(CommonValues.postCode1), PostCodeSaas(CommonValues.postCode2)), - localities = listOf(locality1, locality2), - thoroughfares = listOf(ThoroughfareSaas(value = CommonValues.thoroughfare1), ThoroughfareSaas(value = CommonValues.thoroughfare2)), - premises = listOf(PremiseSaas(value = CommonValues.premise1), PremiseSaas(value = CommonValues.premise2)), - postalDeliveryPoints = listOf(postalDeliveryPoint1, postalDeliveryPoint2), - types = listOf(SaasAddressType.LEGAL.toSaasTypeDto()), - ) - - val address2 = AddressSaas( - id = addressId2, - externalId = addressId2, - saasId = addressId2, - country = CountrySaas(CommonValues.country2, CommonValues.country2.getName()), - administrativeAreas = listOf(AdministrativeAreaSaas(CommonValues.adminArea3), AdministrativeAreaSaas(CommonValues.adminArea4)), - postCodes = listOf(PostCodeSaas(CommonValues.postCode3), PostCodeSaas(CommonValues.postCode4)), - localities = listOf(locality3, locality4), - thoroughfares = listOf(ThoroughfareSaas(value = CommonValues.thoroughfare3), ThoroughfareSaas(value = CommonValues.thoroughfare4)), - premises = listOf(PremiseSaas(value = CommonValues.premise3), PremiseSaas(value = CommonValues.premise4)), - postalDeliveryPoints = listOf(postalDeliveryPoint3, postalDeliveryPoint4), - types = listOf(SaasAddressType.LEGAL.toSaasTypeDto()), - ) - - val address3 = AddressSaas( - id = addressId3, - externalId = addressId3, - saasId = addressId3, - country = CountrySaas(CommonValues.country3, CommonValues.country3.getName()), - administrativeAreas = listOf(AdministrativeAreaSaas(CommonValues.adminArea5)), - postCodes = listOf(PostCodeSaas(CommonValues.postCode5)), - localities = listOf(LocalitySaas(saasValue = CommonValues.locality5, saasType = SaasLocalityType.CITY, saasLanguage = language1)), - thoroughfares = listOf(ThoroughfareSaas(value = CommonValues.thoroughfare5)), - premises = listOf(PremiseSaas(value = CommonValues.premise5)), - postalDeliveryPoints = listOf(postalDeliveryPoint5), - types = listOf(SaasAddressType.LEGAL.toSaasTypeDto()), - ) - - - val legalEntity1 = BusinessPartnerSaas( - id = partnerId1, - createdAt = createdTime1, - lastModifiedAt = createdTime1, - externalId = partnerId1, - dataSource = datasource1, - names = listOf(legalEntityName1, legalEntityName2), - identifiers = listOf(identifier1), - legalForm = legalForm1, - status = status1, - profile = PartnerProfileSaas(classifications = listOf(classification1, classification2)), - addresses = listOf(address1), - types = listOf(legalEntityType) - ) - - val legalEntity2 = BusinessPartnerSaas( - id = partnerId2, - createdAt = createdTime1, - lastModifiedAt = createdTime1, - externalId = partnerId2, - dataSource = datasource1, - names = listOf(legalEntityName3, legalEntityName4), - identifiers = listOf(identifier2), - legalForm = legalForm2, - status = status2, - profile = PartnerProfileSaas(classifications = listOf(classification3, classification4)), - addresses = listOf(address2), - types = listOf(legalEntityType) - ) - - val legalEntity3 = BusinessPartnerSaas( - id = partnerId3, - createdAt = createdTime1, - lastModifiedAt = createdTime1, - externalId = partnerId3, - dataSource = datasource1, - names = listOf(legalEntityName5), - identifiers = listOf(identifier3), - legalForm = legalForm3, - status = status3, - profile = PartnerProfileSaas(classifications = listOf(classification5)), - addresses = listOf(address3), - types = listOf(legalEntityType) - ) - - val site1 = BusinessPartnerSaas( - id = partnerId4, - createdAt = createdTime1, - lastModifiedAt = createdTime1, - externalId = partnerId4, - dataSource = datasource1, - names = listOf(siteName1), - status = status1, - addresses = listOf(address1), - types = listOf(siteType), - relations = listOf( - RelationSaas( - type = parentRelationType, - startNode = CommonValues.bpnL1, - endNode = CommonValues.bpnS1, - startNodeDataSource = datasource1, - endNodeDataSource = datasource1 - ) - ) - ) - - val site2 = BusinessPartnerSaas( - id = partnerId5, - createdAt = createdTime1, - lastModifiedAt = createdTime1, - externalId = partnerId5, - dataSource = datasource1, - names = listOf(siteName2), - status = status2, - addresses = listOf(address2), - types = listOf(siteType), - relations = listOf( - RelationSaas( - type = parentRelationType, - startNode = CommonValues.bpnL2, - endNode = CommonValues.bpnS2, - startNodeDataSource = datasource1, - endNodeDataSource = datasource1 - ) - ) - ) - - val site3 = BusinessPartnerSaas( - id = partnerId6, - createdAt = createdTime1, - lastModifiedAt = createdTime1, - externalId = partnerId6, - dataSource = datasource1, - names = listOf(siteName3), - status = status3, - addresses = listOf(address3), - types = listOf(siteType), - relations = listOf( - RelationSaas( - type = parentRelationType, - startNode = CommonValues.bpnL3, - endNode = CommonValues.bpnS3, - startNodeDataSource = datasource1, - endNodeDataSource = datasource1 - ) - ) - ) - - - val addressPartner1 = BusinessPartnerSaas( - id = partnerId7, - createdAt = createdTime1, - lastModifiedAt = createdTime1, - externalId = partnerId7, - dataSource = datasource1, - addresses = listOf(address1), - types = listOf(addressType), - relations = listOf( - RelationSaas( - type = parentRelationType, - startNode = CommonValues.bpnL1, - endNode = CommonValues.bpnA1, - startNodeDataSource = datasource1, - endNodeDataSource = datasource1 - ) - ) - ) - - val addressPartner2 = BusinessPartnerSaas( - id = partnerId8, - createdAt = createdTime1, - lastModifiedAt = createdTime1, - externalId = partnerId8, - dataSource = datasource1, - addresses = listOf(address2), - types = listOf(addressType), - relations = listOf( - RelationSaas( - type = parentRelationType, - startNode = CommonValues.bpnL2, - endNode = CommonValues.bpnA2, - startNodeDataSource = datasource1, - endNodeDataSource = datasource1 - ) - ) - ) - - val addressPartner3 = BusinessPartnerSaas( - id = partnerId9, - createdAt = createdTime1, - lastModifiedAt = createdTime1, - externalId = partnerId9, - dataSource = datasource1, - addresses = listOf(address3), - types = listOf(addressType), - relations = listOf( - RelationSaas( - type = parentRelationType, - startNode = CommonValues.bpnL3, - endNode = CommonValues.bpnA3, - startNodeDataSource = datasource1, - endNodeDataSource = datasource1 - ) - ) - ) - - private val thoroughfareZone1 = ThoroughfareSaas(name = CommonValues.industrialZone1, saasType = SaasThoroughfareType.INDUSTRIAL_ZONE, language = language1) - private val thoroughfareStreet1 = ThoroughfareSaas( - name = CommonValues.street1, direction = null, number = CommonValues.houseNumber1, saasType = SaasThoroughfareType.STREET, language = language1 - ) - private val thoroughfareZone2 = ThoroughfareSaas(name = CommonValues.industrialZone2, saasType = SaasThoroughfareType.INDUSTRIAL_ZONE, language = language2) - private val thoroughfareStreet2 = ThoroughfareSaas( - name = CommonValues.street2, direction = null, number = CommonValues.houseNumber2, saasType = SaasThoroughfareType.STREET, language = language2 - ) - private val thoroughfareZone3 = ThoroughfareSaas(name = CommonValues.industrialZone3, saasType = SaasThoroughfareType.INDUSTRIAL_ZONE, language = language3) - private val thoroughfareStreet3 = ThoroughfareSaas( - name = CommonValues.street3, direction = null, number = CommonValues.houseNumber3, saasType = SaasThoroughfareType.STREET, language = language3 - ) - - - val addressPartnerSaas1 = BusinessPartnerSaas( - id = partnerId7, - createdAt = createdTime1, - lastModifiedAt = createdTime1, - externalId = partnerId7, - dataSource = datasource1, - addresses = listOf( - AddressSaas( - id = addressId1, - externalId = addressId1, - saasId = addressId1, - country = CountrySaas(CommonValues.country1, CommonValues.country1.getName()), - administrativeAreas = listOf( - AdministrativeAreaSaas(CommonValues.adminArea1, SaasAdministrativeAreaType.REGION, language1), - AdministrativeAreaSaas(CommonValues.county1, SaasAdministrativeAreaType.COUNTY, language1) - ), - postCodes = listOf(PostCodeSaas(CommonValues.postCode1, SaasPostCodeType.REGULAR)), - localities = listOf( - city1, LocalitySaas(CommonValues.district1, SaasLocalityType.DISTRICT, language1), - LocalitySaas("Quarter1", SaasLocalityType.QUARTER, language1) - ), - thoroughfares = listOf(thoroughfareZone1, thoroughfareStreet1), - premises = listOf( - PremiseSaas(CommonValues.building1, SaasPremiseType.BUILDING, language1), - PremiseSaas(CommonValues.door1, SaasPremiseType.ROOM, language1), - PremiseSaas(CommonValues.floor1, SaasPremiseType.LEVEL, language1) - ), - postalDeliveryPoints = listOf( - PostalDeliveryPointSaas(value = CommonValues.postalDeliveryPoint1), PostalDeliveryPointSaas(value = CommonValues.postalDeliveryPoint2) - ), - types = listOf(SaasAddressType.LEGAL.toSaasTypeDto()), - ) - ), - types = listOf(addressType), - relations = listOf( - RelationSaas( - type = parentRelationType, - startNode = CommonValues.bpnL1, - endNode = CommonValues.bpnA1, - startNodeDataSource = datasource1, - endNodeDataSource = datasource1 - ) - ) - ) - - val addressPartnerSaas2 = BusinessPartnerSaas( - id = partnerId8, - createdAt = createdTime1, - lastModifiedAt = createdTime1, - externalId = partnerId8, - dataSource = datasource1, - addresses = listOf( - AddressSaas( - id = addressId2, - externalId = addressId2, - saasId = addressId2, - country = CountrySaas(CommonValues.country2, CommonValues.country2.getName()), - administrativeAreas = listOf( - AdministrativeAreaSaas(CommonValues.adminArea2, SaasAdministrativeAreaType.REGION, language2), - AdministrativeAreaSaas(CommonValues.county2, SaasAdministrativeAreaType.COUNTY, language2) - ), - postCodes = listOf(PostCodeSaas(CommonValues.postCode2, SaasPostCodeType.REGULAR)), - localities = listOf( - city2, - LocalitySaas(CommonValues.district2, SaasLocalityType.DISTRICT, language1), - LocalitySaas("Quarter2", SaasLocalityType.QUARTER, language1) - ), - thoroughfares = listOf(thoroughfareZone2, thoroughfareStreet2), - premises = listOf( - PremiseSaas(CommonValues.building2, SaasPremiseType.BUILDING, language2), - PremiseSaas(CommonValues.door2, SaasPremiseType.ROOM, language2), - PremiseSaas(CommonValues.floor2, SaasPremiseType.LEVEL, language2) - ), - postalDeliveryPoints = listOf( - PostalDeliveryPointSaas(value = CommonValues.postalDeliveryPoint3), PostalDeliveryPointSaas(value = CommonValues.postalDeliveryPoint4) - ), - types = listOf(SaasAddressType.LEGAL.toSaasTypeDto()), - ) - ), - types = listOf(addressType), - relations = listOf( - RelationSaas( - type = parentRelationType, - startNode = CommonValues.bpnL2, - endNode = CommonValues.bpnA2, - startNodeDataSource = datasource1, - endNodeDataSource = datasource1 - ) - ) - ) - - val addressPartnerSaas3 = BusinessPartnerSaas( - id = partnerId9, - createdAt = createdTime1, - lastModifiedAt = createdTime1, - externalId = partnerId9, - dataSource = datasource1, - addresses = listOf( - AddressSaas( - id = addressId3, - externalId = addressId3, - saasId = addressId3, - country = CountrySaas(CommonValues.country3, CommonValues.country3.getName()), - administrativeAreas = listOf( - AdministrativeAreaSaas(CommonValues.adminArea3, SaasAdministrativeAreaType.REGION, language3), - AdministrativeAreaSaas(CommonValues.county3, SaasAdministrativeAreaType.COUNTY, language3) - ), - postCodes = listOf(PostCodeSaas(CommonValues.postCode3, SaasPostCodeType.REGULAR)), - localities = listOf( - city3, - LocalitySaas(CommonValues.district3, SaasLocalityType.DISTRICT, language1), - LocalitySaas("Quarter3", SaasLocalityType.QUARTER, language1) - ), - thoroughfares = listOf(thoroughfareZone3, thoroughfareStreet3), - premises = listOf( - PremiseSaas(CommonValues.building3, SaasPremiseType.BUILDING, language2), - PremiseSaas(CommonValues.door3, SaasPremiseType.ROOM, language2), - PremiseSaas(CommonValues.floor3, SaasPremiseType.LEVEL, language2) - ), - postalDeliveryPoints = listOf(PostalDeliveryPointSaas(value = CommonValues.postalDeliveryPoint5)), - types = listOf(SaasAddressType.LEGAL.toSaasTypeDto()), - ) - ), - types = listOf(addressType), - relations = listOf( - RelationSaas( - type = parentRelationType, - startNode = CommonValues.bpnL3, - endNode = CommonValues.bpnA3, - startNodeDataSource = datasource1, - endNodeDataSource = datasource1 - ) - ) - ) -} \ No newline at end of file diff --git a/bpdm-pool/src/test/resources/application-test.properties b/bpdm-pool/src/test/resources/application-test.properties index 38840acbb..929768ec4 100644 --- a/bpdm-pool/src/test/resources/application-test.properties +++ b/bpdm-pool/src/test/resources/application-test.properties @@ -16,11 +16,6 @@ # # SPDX-License-Identifier: Apache-2.0 ################################################################################ -bpdm.saas.enabled=true -bpdm.saas.host=http://localhost -bpdm.saas.storage=test-saas-storage -bpdm.saas.datasource=test-saas-datasource -bpdm.saas.api-key=test-saas-api-key bpdm.opensearch.enabled=false # tests need to see changes in opensearch immediately, not just after waiting some time for automatic refresh bpdm.opensearch.refresh-on-write=true