Skip to content

Commit

Permalink
feat(bridge-tests): Tests for syncing new legal entities, site & addr…
Browse files Browse the repository at this point in the history
…esses #210

- fix compile errors after rebase
  • Loading branch information
rainer-exxcellent committed Jul 12, 2023
1 parent c397c8b commit 5bf430e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import org.assertj.core.api.Assertions.assertThat
import org.eclipse.tractusx.bpdm.common.dto.request.AddressPartnerBpnSearchRequest
import org.eclipse.tractusx.bpdm.common.dto.request.PaginationRequest
import org.eclipse.tractusx.bpdm.common.dto.request.SiteBpnSearchRequest
import org.eclipse.tractusx.bpdm.common.dto.response.LogisticAddressResponse
import org.eclipse.tractusx.bpdm.common.dto.response.LogisticAddressVerboseDto
import org.eclipse.tractusx.bpdm.gate.api.client.GateClient
import org.eclipse.tractusx.bpdm.gate.api.model.*
import org.eclipse.tractusx.bpdm.gate.api.model.request.AddressGateInputRequest
Expand All @@ -37,8 +37,8 @@ import org.eclipse.tractusx.bpdm.gate.api.model.response.SharingStateDto
import org.eclipse.tractusx.bpdm.pool.api.client.PoolApiClient
import org.eclipse.tractusx.bpdm.pool.api.model.request.ChangelogSearchRequest
import org.eclipse.tractusx.bpdm.pool.api.model.request.LegalEntityPropertiesSearchRequest
import org.eclipse.tractusx.bpdm.pool.api.model.response.LegalEntityMatchResponse
import org.eclipse.tractusx.bpdm.pool.api.model.response.SitePoolResponse
import org.eclipse.tractusx.bpdm.pool.api.model.response.LegalEntityMatchVerboseDto
import org.eclipse.tractusx.bpdm.pool.api.model.response.SitePoolVerboseDto
import org.junit.jupiter.api.*
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.test.context.SpringBootTest
Expand Down Expand Up @@ -247,7 +247,7 @@ class BridgeSyncIT @Autowired constructor(
return sharingStatesOkay
}

private fun assertEqualLegalEntity(gateVersion: LegalEntityGateInputRequest, poolVersion: LegalEntityMatchResponse) {
private fun assertEqualLegalEntity(gateVersion: LegalEntityGateInputRequest, poolVersion: LegalEntityMatchVerboseDto) {
assertThat(poolVersion.legalEntity.legalShortName).isEqualTo(gateVersion.legalEntity.legalShortName)
// assertThat(poolVersion.legalAddress.name).isEqualTo(gateVersion.legalAddress.nameParts.first())
assertThat(poolVersion.legalAddress.physicalPostalAddress.street?.name).isEqualTo(gateVersion.legalAddress.physicalPostalAddress.street?.name)
Expand All @@ -257,12 +257,12 @@ class BridgeSyncIT @Autowired constructor(
assertThat(poolVersion.legalAddress.alternativePostalAddress?.baseAddress?.city).isEqualTo(gateVersion.legalAddress.alternativePostalAddress?.baseAddress?.city)
}

private fun assertEqualSite(gateVersion: SiteGateInputRequest, poolVersion: SitePoolResponse) {
private fun assertEqualSite(gateVersion: SiteGateInputRequest, poolVersion: SitePoolVerboseDto) {
assertThat(poolVersion.site.name).isEqualTo(gateVersion.site.nameParts.first())
assertThat(poolVersion.site.states.map { it.description }).isEqualTo(gateVersion.site.states.map { it.description })
}

private fun assertEqualAddress(gateVersion: AddressGateInputRequest, poolVersion: LogisticAddressResponse) {
private fun assertEqualAddress(gateVersion: AddressGateInputRequest, poolVersion: LogisticAddressVerboseDto) {
assertThat(poolVersion.name).isEqualTo(gateVersion.address.nameParts.first())
assertThat(poolVersion.physicalPostalAddress.street?.name).isEqualTo(gateVersion.address.physicalPostalAddress.street?.name)
assertThat(poolVersion.physicalPostalAddress.baseAddress.city).isEqualTo(gateVersion.address.physicalPostalAddress.baseAddress.city)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@
package com.catenax.bpdm.bridge.dummy.testdata

import org.eclipse.tractusx.bpdm.common.dto.*
import org.eclipse.tractusx.bpdm.common.dto.saas.IdentifierSaas
import org.eclipse.tractusx.bpdm.common.dto.saas.TypeKeyNameSaas
import org.eclipse.tractusx.bpdm.common.dto.saas.TypeKeyNameUrlSaas
import org.eclipse.tractusx.bpdm.gate.api.model.LogisticAddressGateDto
import org.eclipse.tractusx.bpdm.gate.api.model.PhysicalPostalAddressGateDto
import org.eclipse.tractusx.bpdm.gate.api.model.SiteGateDto
Expand All @@ -33,13 +30,6 @@ import org.eclipse.tractusx.bpdm.gate.api.model.request.SiteGateInputRequest

object GateRequestValues {

val identifierSass1 = IdentifierSaas(
type = TypeKeyNameUrlSaas(technicalKey = CommonValues.identifierTypeTechnicalKey1),
value = CommonValues.identifierValue1,
issuingBody = TypeKeyNameUrlSaas(name = CommonValues.identifierIssuingBodyName1),
status = TypeKeyNameSaas(technicalKey = CommonValues.identifierStatusTechnicalKey1)
)

val identifier1 =
LegalEntityIdentifierDto(
value = CommonValues.identifierValue1,
Expand Down Expand Up @@ -329,7 +319,7 @@ object GateRequestValues {
address = address1.copy(
nameParts = listOf(CommonValues.name1),
identifiers = listOf(
AddressIdentifierDto(identifierSass1.value!!, identifierSass1.type?.technicalKey!!)
AddressIdentifierDto(CommonValues.identifierValue1, CommonValues.identifierTypeTechnicalKey1)
)
),
externalId = CommonValues.externalIdAddress1,
Expand All @@ -341,7 +331,7 @@ object GateRequestValues {
address = address2.copy(
nameParts = listOf(CommonValues.name2),
identifiers = listOf(
AddressIdentifierDto(identifierSass1.value!!, identifierSass1.type?.technicalKey!!)
AddressIdentifierDto(CommonValues.identifierValue2, CommonValues.identifierTypeTechnicalKey2)
)
),
externalId = CommonValues.externalIdAddress2,
Expand Down

0 comments on commit 5bf430e

Please sign in to comment.