Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/orchestrator pool tests #590

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,10 @@ class TaskStepBuildService(
addressBpn = genericBpnA
),
legalEntity = businessPartnerDto.legalEntity!!.copy(
bpnLReference = BpnReferenceDto(referenceValue = legalEntity.bpn, referenceType = BpnReferenceType.Bpn)
bpnLReference = BpnReferenceDto(referenceValue = legalEntity.bpn, referenceType = BpnReferenceType.Bpn) ,
legalAddress = businessPartnerDto.legalEntity!!.legalAddress!!.copy(
bpnAReference = BpnReferenceDto(referenceValue = legalEntity.legalAddress.bpn, referenceType = BpnReferenceType.Bpn)
)
),
site = siteResult,
address = addressResult
Expand All @@ -122,7 +125,7 @@ class TaskStepBuildService(
createLogisticAddressInternal(addressDto, bpnA)
} else {
val addressMetadataMap = metadataService.getMetadata(listOf(addressDto)).toMapping()
val updateAddress = logisticAddressRepository.findByBpn(bpnAReference.referenceValue)
val updateAddress = logisticAddressRepository.findByBpn(bpn)
if (updateAddress != null) {
updateLogisticAddress(updateAddress, addressDto, addressMetadataMap)
} else {
Expand Down Expand Up @@ -151,12 +154,12 @@ class TaskStepBuildService(
private fun createLogisticAddress(addressDto: LogisticAddressDto?, taskEntryBpnMapping: TaskEntryBpnMapping): LogisticAddress {

val bpnAReference = addressDto?.bpnAReference
val bpnL = bpnIssuingService.issueAddressBpns(1).single()
val bpnA = bpnIssuingService.issueAddressBpns(1).single()

if (bpnAReference != null && bpnAReference.referenceType == BpnReferenceType.BpnRequestIdentifier) {
taskEntryBpnMapping.addMapping(bpnAReference, bpnL)
taskEntryBpnMapping.addMapping(bpnAReference, bpnA)
}
val newAddress = createLogisticAddressInternal(addressDto, bpnL)
val newAddress = createLogisticAddressInternal(addressDto, bpnA)
changelogService.createChangelogEntries(
listOf(
ChangelogEntryCreateRequest(newAddress.bpn, ChangelogType.CREATE, BusinessPartnerType.ADDRESS)
Expand Down Expand Up @@ -259,7 +262,7 @@ class TaskStepBuildService(

val updateLe = legalEntityRepository.findByBpn(bpn)
if (updateLe != null) {
if (legalEntityDto.hasChanged == false) {
if (legalEntityDto.hasChanged == true) {
BusinessPartnerBuildService.updateLegalEntity(updateLe, legalEntityDto, legalEntityDto.legalName, legalEntityMetadataMap)
val addressMetadataMap = metadataService.getMetadata(listOf(legalAddress)).toMapping()
updateLogisticAddress(updateLe.legalAddress, legalAddress, addressMetadataMap)
Expand Down Expand Up @@ -299,9 +302,9 @@ class TaskStepBuildService(
createSite
} else {

val updateSite = siteRepository.findByBpn(siteDto.bpnSReference?.referenceValue!!)
val updateSite = siteRepository.findByBpn(bpn)
if (updateSite != null) {
if (siteDto.hasChanged == false) {
if (siteDto.hasChanged == true) {
BusinessPartnerBuildService.updateSite(updateSite, siteDto)
val addressMetadataMap = metadataService.getMetadata(listOf(mainAddress)).toMapping()
updateLogisticAddress(updateSite.mainAddress, mainAddress, addressMetadataMap)
Expand Down