diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/IBaseLegalEntityDto.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/IBaseLegalEntityDto.kt index f750768c5..9a9548b54 100644 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/IBaseLegalEntityDto.kt +++ b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/IBaseLegalEntityDto.kt @@ -42,5 +42,5 @@ interface IBaseLegalEntityDto { // TODO OpenAPI description for complex field does not work!! @get:Schema(description = LegalEntityDescription.legalAddress) - val legalAddress: IBaseLogisticAddressDto + val legalAddress: IBaseLogisticAddressDto? } \ No newline at end of file diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/IBaseLogisticAddressDto.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/IBaseLogisticAddressDto.kt index 5584f80b2..65b8776a3 100644 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/IBaseLogisticAddressDto.kt +++ b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/IBaseLogisticAddressDto.kt @@ -33,7 +33,7 @@ interface IBaseLogisticAddressDto { // TODO OpenAPI description for complex field does not work!! @get:Schema(description = LogisticAddressDescription.physicalPostalAddress) - val physicalPostalAddress: IBasePhysicalPostalAddressDto + val physicalPostalAddress: IBasePhysicalPostalAddressDto? // TODO OpenAPI description for complex field does not work!! @get:Schema(description = LogisticAddressDescription.alternativePostalAddress) diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/IBaseSiteDto.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/IBaseSiteDto.kt index ae9e92ba8..61c5dd9cf 100644 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/IBaseSiteDto.kt +++ b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/IBaseSiteDto.kt @@ -26,13 +26,10 @@ import org.eclipse.tractusx.bpdm.common.dto.openapidescription.SiteDescription @Schema(description = SiteDescription.header) interface IBaseSiteDto { - @get:Schema(description = SiteDescription.name) - val name: String - @get:ArraySchema(arraySchema = Schema(description = SiteDescription.states)) val states: Collection // TODO OpenAPI description for complex field does not work!! @get:Schema(description = SiteDescription.mainAddress) - val mainAddress: IBaseLogisticAddressDto + val mainAddress: IBaseLogisticAddressDto? } \ No newline at end of file diff --git a/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/CleaningTaskApi.kt b/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/CleaningTaskApi.kt index 92a81bd91..335e1b88a 100644 --- a/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/CleaningTaskApi.kt +++ b/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/CleaningTaskApi.kt @@ -24,8 +24,7 @@ import io.swagger.v3.oas.annotations.media.Content import io.swagger.v3.oas.annotations.responses.ApiResponse import io.swagger.v3.oas.annotations.responses.ApiResponses import io.swagger.v3.oas.annotations.tags.Tag -import org.eclipse.tractusx.orchestrator.api.model.TaskCreateRequest -import org.eclipse.tractusx.orchestrator.api.model.TaskCreateResponse +import org.eclipse.tractusx.orchestrator.api.model.* import org.springframework.http.MediaType import org.springframework.web.bind.annotation.PostMapping import org.springframework.web.bind.annotation.RequestBody @@ -59,5 +58,46 @@ interface CleaningTaskApi { @PostExchange fun createCleaningTasks(@RequestBody createRequest: TaskCreateRequest): TaskCreateResponse + @Operation( + summary = "Reserve the next cleaning tasks waiting in the given cleaning step", + description = "Reserve up to a given number of cleaning tasks enqueued in the given cleaning step. " + + "The cleaning tasks contain the business partner to clean which consists of the generic and L/S/A data. " + + "For cleaning the business partners have a time limit which is returned with the reserved tasks." + + "For a single request, the maximum number of reservable tasks is limited to \${bpdm.api.upsert-limit}." + ) + @ApiResponses( + value = [ + ApiResponse( + responseCode = "200", + description = "The reserved cleaning tasks with their business partner data to clean." + ), + ApiResponse(responseCode = "400", description = "On malformed task create requests or reaching upsert limit", content = [Content()]), + ] + ) + @Tag(name = "Cleaning Service") + @PostMapping("/reservations") + @PostExchange("/reservations") + fun reserveCleaningTasks(@RequestBody reservationRequest: CleaningReservationRequest): CleaningReservationResponse + @Operation( + summary = "Post cleaning results for reserved cleaning tasks in given cleaning step", + description = "Post business partner cleaning results for the given cleaning tasks. " + + "In order to post a result for a cleaning task it needs to be reserved first, has to currently be in the given cleaning step and the time limit is not exceeded." + + "The number of results you can post at a time does not need to match the original number of reserved tasks." + + "Results are accepted via strategy 'all or nothing'." + + "For a single request, the maximum number of postable results is limited to \${bpdm.api.upsert-limit}." + ) + @ApiResponses( + value = [ + ApiResponse( + responseCode = "200", + description = "If the results could be processed" + ), + ApiResponse(responseCode = "400", description = "On malformed task create requests or reaching upsert limit", content = [Content()]), + ] + ) + @Tag(name = "Cleaning Service") + @PostMapping("/results") + @PostExchange("/results") + fun resolveCleaningTasks(@RequestBody resultRequest: CleaningResultRequest) } \ No newline at end of file diff --git a/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/AddressIdentifier.kt b/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/AddressIdentifier.kt new file mode 100644 index 000000000..ae3d1459b --- /dev/null +++ b/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/AddressIdentifier.kt @@ -0,0 +1,28 @@ +/******************************************************************************* + * 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.orchestrator.api.model + +import org.eclipse.tractusx.bpdm.common.dto.IBaseAddressIdentifierDto + +data class AddressIdentifier( + override val value: String, + override val type: String + +) : IBaseAddressIdentifierDto diff --git a/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/AddressState.kt b/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/AddressState.kt new file mode 100644 index 000000000..401f56e53 --- /dev/null +++ b/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/AddressState.kt @@ -0,0 +1,32 @@ +/******************************************************************************* + * 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.orchestrator.api.model + +import org.eclipse.tractusx.bpdm.common.dto.IBaseAddressSateDto +import org.eclipse.tractusx.bpdm.common.model.BusinessStateType +import java.time.LocalDateTime + +data class AddressState( + override val description: String?, + override val validFrom: LocalDateTime?, + override val validTo: LocalDateTime?, + override val type: BusinessStateType + +) : IBaseAddressSateDto diff --git a/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/BpnReference.kt b/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/BpnReference.kt new file mode 100644 index 000000000..99230446c --- /dev/null +++ b/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/BpnReference.kt @@ -0,0 +1,35 @@ +/******************************************************************************* + * 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.orchestrator.api.model + +import io.swagger.v3.oas.annotations.media.Schema + +@Schema(description = "A reference to the BPN of a business partner. Either by the BPN value itself or a BPN request identifier") +data class BpnReference( + @get:Schema(description = "The value by which the BPN is referenced") + val referenceValue: String, + @get:Schema(description = "The type by which to reference the BPN with") + val referenceType: BpnReferenceType +) + +enum class BpnReferenceType { + Bpn, + BpnRequestIdentifier +} diff --git a/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/BusinessPartnerClassification.kt b/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/BusinessPartnerClassification.kt new file mode 100644 index 000000000..d712f4df2 --- /dev/null +++ b/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/BusinessPartnerClassification.kt @@ -0,0 +1,29 @@ +/******************************************************************************* + * 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.orchestrator.api.model + +import org.eclipse.tractusx.bpdm.common.dto.IBaseClassificationDto +import org.eclipse.tractusx.bpdm.common.model.ClassificationType + +data class BusinessPartnerClassification( + override val type: ClassificationType, + override val code: String?, + override val value: String? +) : IBaseClassificationDto diff --git a/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/BusinessPartnerFull.kt b/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/BusinessPartnerFull.kt new file mode 100644 index 000000000..1260a3b40 --- /dev/null +++ b/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/BusinessPartnerFull.kt @@ -0,0 +1,34 @@ +/******************************************************************************* + * 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.orchestrator.api.model + +import io.swagger.v3.oas.annotations.media.Schema + +@Schema(description = "Business partner data in full representation, consisting of generic data as well as its L/S/A representation.") +data class BusinessPartnerFull( + @get:Schema(description = "The business partner data in generic representation", required = true) + val generic: BusinessPartnerGeneric, + @get:Schema(description = "The legal entity part of this business partner data") + val legalEntity: LegalEntity? = null, + @get:Schema(description = "The site part of this business partner data") + val site: Site? = null, + @get:Schema(description = "The address part of this business partner data") + val address: LogisticAddress? = null +) diff --git a/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/BusinessPartnerDto.kt b/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/BusinessPartnerGeneric.kt similarity index 98% rename from bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/BusinessPartnerDto.kt rename to bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/BusinessPartnerGeneric.kt index 564b536d4..8e8d73a05 100644 --- a/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/BusinessPartnerDto.kt +++ b/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/BusinessPartnerGeneric.kt @@ -23,7 +23,7 @@ import io.swagger.v3.oas.annotations.media.Schema import org.eclipse.tractusx.bpdm.common.dto.* -data class BusinessPartnerDto( +data class BusinessPartnerGeneric( override val nameParts: List = emptyList(), override val shortName: String? = null, override val identifiers: Collection = emptyList(), diff --git a/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/CleaningReservation.kt b/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/CleaningReservation.kt new file mode 100644 index 000000000..354f2551f --- /dev/null +++ b/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/CleaningReservation.kt @@ -0,0 +1,30 @@ +/******************************************************************************* + * 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.orchestrator.api.model + +import io.swagger.v3.oas.annotations.media.Schema + +@Schema(description = "Cleaning reservation entry") +data class CleaningReservation( + @get:Schema(description = "The identifier of the reserved cleaning task") + val taskId: String, + @get:Schema(description = "The business partner data to clean") + val businessPartner: BusinessPartnerFull +) diff --git a/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/CleaningReservationRequest.kt b/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/CleaningReservationRequest.kt new file mode 100644 index 000000000..91d4ff351 --- /dev/null +++ b/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/CleaningReservationRequest.kt @@ -0,0 +1,30 @@ +/******************************************************************************* + * 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.orchestrator.api.model + +import io.swagger.v3.oas.annotations.media.Schema + +@Schema(description = "Request object for reserving a number of cleaning tasks waiting in a cleaning step.") +data class CleaningReservationRequest( + @get:Schema(description = "The maximum number of cleaning tasks to reserve. Can be fewer if queue is not full enough.", required = true) + val amount: Int = 10, + @get:Schema(description = "The cleaning step queue to reserve from", required = true) + val step: CleaningStep +) diff --git a/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/CleaningReservationResponse.kt b/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/CleaningReservationResponse.kt new file mode 100644 index 000000000..1ea28cb83 --- /dev/null +++ b/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/CleaningReservationResponse.kt @@ -0,0 +1,32 @@ +/******************************************************************************* + * 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.orchestrator.api.model + +import io.swagger.v3.oas.annotations.media.ArraySchema +import io.swagger.v3.oas.annotations.media.Schema +import java.time.Instant + +@Schema(description = "Response object for giving a list of reserved cleaning tasks") +data class CleaningReservationResponse( + @get:ArraySchema(arraySchema = Schema(description = "The reserved cleaning tasks with their business partner data to clean")) + val reservedTasks: List, + @get:Schema(description = "The timestamp until the reservation is valid and accepts cleaning results") + val timeout: Instant +) diff --git a/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/CleaningResultEntry.kt b/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/CleaningResultEntry.kt new file mode 100644 index 000000000..eca78c77a --- /dev/null +++ b/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/CleaningResultEntry.kt @@ -0,0 +1,34 @@ +/******************************************************************************* + * 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.orchestrator.api.model + +import io.swagger.v3.oas.annotations.media.ArraySchema +import io.swagger.v3.oas.annotations.media.Schema + + +@Schema(description = "A cleaning result for a cleaning task") +data class CleaningResultEntry( + @get:Schema(description = "The identifier of the cleaning task for which this is a result", required = true) + val taskId: String, + @get:Schema(description = "The actual result in form of business partner data. Maybe null if an error occurred during cleaning of this task.") + val result: BusinessPartnerFull? = null, + @get:ArraySchema(arraySchema = Schema(description = "Errors that occurred during cleaning of this task")) + val errors: List = emptyList() +) diff --git a/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/CleaningResultRequest.kt b/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/CleaningResultRequest.kt new file mode 100644 index 000000000..decda64d5 --- /dev/null +++ b/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/CleaningResultRequest.kt @@ -0,0 +1,29 @@ +/******************************************************************************* + * 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.orchestrator.api.model + +import io.swagger.v3.oas.annotations.media.ArraySchema +import io.swagger.v3.oas.annotations.media.Schema + +@Schema(description = "Request object for posting cleaning results") +data class CleaningResultRequest( + @get:ArraySchema(arraySchema = Schema(description = "The cleaning results for previously reserved cleaning tasks")) + val results: List +) diff --git a/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/LegalEntity.kt b/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/LegalEntity.kt new file mode 100644 index 000000000..18c5a1a80 --- /dev/null +++ b/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/LegalEntity.kt @@ -0,0 +1,40 @@ +/******************************************************************************* + * 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.orchestrator.api.model + +import io.swagger.v3.oas.annotations.media.Schema +import org.eclipse.tractusx.bpdm.common.dto.IBaseLegalEntityDto +import org.eclipse.tractusx.bpdm.common.dto.openapidescription.LegalEntityDescription + +data class LegalEntity( + override val identifiers: Collection = emptyList(), + override val legalShortName: String? = null, + override val legalForm: String? = null, + override val states: Collection = emptyList(), + override val classifications: Collection = emptyList(), + override val legalAddress: LogisticAddress? = null, + + @get:Schema(description = "A reference to the BPNL of this legal entity. Either by the BPN value itself or a BPN request identifier.") + val bpnlReference: BpnReference? = null, + @get:Schema(description = "Whether this legal entity data is different from its golden record counterpart in the Pool") + val hasChanged: Boolean? = null, + @get:Schema(description = LegalEntityDescription.legalName) + val legalName: String? = null +) : IBaseLegalEntityDto diff --git a/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/LegalEntityIdentifier.kt b/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/LegalEntityIdentifier.kt new file mode 100644 index 000000000..39ec24148 --- /dev/null +++ b/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/LegalEntityIdentifier.kt @@ -0,0 +1,28 @@ +/******************************************************************************* + * 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.orchestrator.api.model + +import org.eclipse.tractusx.bpdm.common.dto.IBaseLegalEntityIdentifierDto + +data class LegalEntityIdentifier( + override val value: String, + override val type: String, + override val issuingBody: String? +) : IBaseLegalEntityIdentifierDto diff --git a/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/LegalEntityState.kt b/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/LegalEntityState.kt new file mode 100644 index 000000000..b9886714b --- /dev/null +++ b/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/LegalEntityState.kt @@ -0,0 +1,32 @@ +/******************************************************************************* + * 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.orchestrator.api.model + +import org.eclipse.tractusx.bpdm.common.dto.IBaseLegalEntityStateDto +import org.eclipse.tractusx.bpdm.common.model.BusinessStateType +import java.time.LocalDateTime + +data class LegalEntityState( + override val description: String?, + override val validFrom: LocalDateTime?, + override val validTo: LocalDateTime?, + override val type: BusinessStateType + +) : IBaseLegalEntityStateDto diff --git a/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/LogisticAddress.kt b/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/LogisticAddress.kt new file mode 100644 index 000000000..8e0480e9b --- /dev/null +++ b/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/LogisticAddress.kt @@ -0,0 +1,33 @@ +/******************************************************************************* + * 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.orchestrator.api.model + +import org.eclipse.tractusx.bpdm.common.dto.IBaseLogisticAddressDto + +data class LogisticAddress( + override val states: Collection = emptyList(), + override val identifiers: Collection = emptyList(), + override val physicalPostalAddress: PhysicalPostalAddressDto? = null, + override val alternativePostalAddress: AlternativePostalAddressDto? = null, + + val bpnaReference: BpnReference? = null, + val hasChanged: Boolean? = null, + val name: String? = null +) : IBaseLogisticAddressDto diff --git a/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/Site.kt b/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/Site.kt new file mode 100644 index 000000000..fb4e2edbb --- /dev/null +++ b/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/Site.kt @@ -0,0 +1,36 @@ +/******************************************************************************* + * 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.orchestrator.api.model + +import io.swagger.v3.oas.annotations.media.Schema +import org.eclipse.tractusx.bpdm.common.dto.IBaseSiteDto +import org.eclipse.tractusx.bpdm.common.dto.openapidescription.SiteDescription + +data class Site( + override val states: Collection = emptyList(), + override val mainAddress: LogisticAddress? = null, + + @get:Schema(description = "A reference to the BPNS of this site. Either by the BPN value itself or a BPN request identifier.") + val bpnsReference: BpnReference? = null, + @get:Schema(description = "Whether this site data is different from its golden record counterpart in the Pool") + val hasChanged: Boolean? = null, + @get:Schema(description = SiteDescription.name) + val name: String? = null, +) : IBaseSiteDto diff --git a/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/SiteState.kt b/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/SiteState.kt new file mode 100644 index 000000000..6bfe4bcf8 --- /dev/null +++ b/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/SiteState.kt @@ -0,0 +1,32 @@ +/******************************************************************************* + * 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.orchestrator.api.model + +import org.eclipse.tractusx.bpdm.common.dto.IBaseSiteStateDto +import org.eclipse.tractusx.bpdm.common.model.BusinessStateType +import java.time.LocalDateTime + +data class SiteState( + override val description: String?, + override val validFrom: LocalDateTime?, + override val validTo: LocalDateTime?, + override val type: BusinessStateType + +) : IBaseSiteStateDto diff --git a/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/TaskCreateRequest.kt b/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/TaskCreateRequest.kt index 2a7a5a765..3eb0b0b89 100644 --- a/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/TaskCreateRequest.kt +++ b/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/TaskCreateRequest.kt @@ -27,5 +27,5 @@ data class TaskCreateRequest( @get:Schema(required = true, description = "The cleaning mode affecting which cleaning steps the business partner goes through") val mode: TaskMode, @get:ArraySchema(arraySchema = Schema(description = "The list of business partner data to be cleaned")) - val businessPartners: List + val businessPartners: List ) diff --git a/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/TaskRequesterState.kt b/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/TaskRequesterState.kt index 6903e9ae3..e8c1290ae 100644 --- a/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/TaskRequesterState.kt +++ b/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/TaskRequesterState.kt @@ -26,7 +26,7 @@ import io.swagger.v3.oas.annotations.media.Schema data class TaskRequesterState( @get:Schema(required = true) val taskId: String, - val businessPartnerResult: BusinessPartnerDto?, + val businessPartnerResult: BusinessPartnerGeneric?, @get:Schema(required = true) val processingState: TaskProcessingStateDto ) diff --git a/bpdm-orchestrator/src/main/kotlin/org/eclipse/tractusx/bpdm/orchestrator/controller/CleaningTaskController.kt b/bpdm-orchestrator/src/main/kotlin/org/eclipse/tractusx/bpdm/orchestrator/controller/CleaningTaskController.kt index 50a5da119..b67b09bb0 100644 --- a/bpdm-orchestrator/src/main/kotlin/org/eclipse/tractusx/bpdm/orchestrator/controller/CleaningTaskController.kt +++ b/bpdm-orchestrator/src/main/kotlin/org/eclipse/tractusx/bpdm/orchestrator/controller/CleaningTaskController.kt @@ -21,53 +21,41 @@ package org.eclipse.tractusx.bpdm.orchestrator.controller import org.eclipse.tractusx.bpdm.common.exception.BpdmUpsertLimitException import org.eclipse.tractusx.bpdm.orchestrator.config.ApiConfigProperties +import org.eclipse.tractusx.bpdm.orchestrator.util.DummyValues import org.eclipse.tractusx.orchestrator.api.CleaningTaskApi import org.eclipse.tractusx.orchestrator.api.model.* import org.springframework.web.bind.annotation.RestController -import java.time.Instant @RestController class CleaningTaskController( val apiConfigProperties: ApiConfigProperties ) : CleaningTaskApi { - //While we don't have an implementation use a dummy response for the endpoints - val dummyResponseCreateTask = - TaskCreateResponse( - listOf( - TaskRequesterState( - taskId = "0", - businessPartnerResult = null, - processingState = TaskProcessingStateDto( - cleaningStep = CleaningStep.CleanAndSync, - reservationState = ReservationState.Queued, - resultState = ResultState.Pending, - errors = emptyList(), - createdAt = Instant.now(), - modifiedAt = Instant.now() - ) - ), - TaskRequesterState( - taskId = "1", - businessPartnerResult = null, - processingState = TaskProcessingStateDto( - cleaningStep = CleaningStep.CleanAndSync, - reservationState = ReservationState.Queued, - resultState = ResultState.Pending, - errors = emptyList(), - createdAt = Instant.now(), - modifiedAt = Instant.now() - ) - ) - ) - ) - - override fun createCleaningTasks(createRequest: TaskCreateRequest): TaskCreateResponse { if (createRequest.businessPartners.size > apiConfigProperties.upsertLimit) throw BpdmUpsertLimitException(createRequest.businessPartners.size, apiConfigProperties.upsertLimit) //ToDo: Replace with service logic - return dummyResponseCreateTask + return DummyValues.dummyResponseCreateTask + } + + override fun reserveCleaningTasks(reservationRequest: CleaningReservationRequest): CleaningReservationResponse { + if (reservationRequest.amount > apiConfigProperties.upsertLimit) { + throw BpdmUpsertLimitException(reservationRequest.amount, apiConfigProperties.upsertLimit) + } + + //ToDo: Replace with service logic + return when (reservationRequest.step) { + CleaningStep.CleanAndSync -> DummyValues.dummyCleaningReservationResponse + CleaningStep.PoolSync -> DummyValues.dummyPoolSyncResponse + CleaningStep.Clean -> DummyValues.dummyCleaningReservationResponse + } + } + + override fun resolveCleaningTasks(resultRequest: CleaningResultRequest) { + if (resultRequest.results.size > apiConfigProperties.upsertLimit) + throw BpdmUpsertLimitException(resultRequest.results.size, apiConfigProperties.upsertLimit) + + } } \ No newline at end of file diff --git a/bpdm-orchestrator/src/main/kotlin/org/eclipse/tractusx/bpdm/orchestrator/util/DummyValues.kt b/bpdm-orchestrator/src/main/kotlin/org/eclipse/tractusx/bpdm/orchestrator/util/DummyValues.kt new file mode 100644 index 000000000..547082ba7 --- /dev/null +++ b/bpdm-orchestrator/src/main/kotlin/org/eclipse/tractusx/bpdm/orchestrator/util/DummyValues.kt @@ -0,0 +1,207 @@ +/******************************************************************************* + * 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.orchestrator.util + +import com.neovisionaries.i18n.CountryCode +import org.eclipse.tractusx.bpdm.common.dto.AddressType +import org.eclipse.tractusx.orchestrator.api.model.* +import java.time.Instant + +//While we don't have a service logic implementation of the API use a dummy response for the endpoints +object DummyValues { + + val dummyResponseCreateTask = + TaskCreateResponse( + listOf( + TaskRequesterState( + taskId = "0", + businessPartnerResult = null, + processingState = TaskProcessingStateDto( + cleaningStep = CleaningStep.CleanAndSync, + reservationState = ReservationState.Queued, + resultState = ResultState.Pending, + errors = emptyList(), + createdAt = Instant.now(), + modifiedAt = Instant.now() + ) + ), + TaskRequesterState( + taskId = "1", + businessPartnerResult = null, + processingState = TaskProcessingStateDto( + cleaningStep = CleaningStep.CleanAndSync, + reservationState = ReservationState.Queued, + resultState = ResultState.Pending, + errors = emptyList(), + createdAt = Instant.now(), + modifiedAt = Instant.now() + ) + ) + ) + ) + + val dummyCleaningReservationResponse = CleaningReservationResponse( + timeout = Instant.now().plusSeconds(300), + reservedTasks = listOf( + CleaningReservation( + taskId = "0", + businessPartner = BusinessPartnerFull( + generic = BusinessPartnerGeneric( + nameParts = listOf("Dummy", "Name"), + postalAddress = PostalAddressDto( + physicalPostalAddress = PhysicalPostalAddressDto( + country = CountryCode.DE, + postalCode = "70771" + ) + ) + ) + ) + ), + CleaningReservation( + taskId = "1", + businessPartner = BusinessPartnerFull( + generic = BusinessPartnerGeneric( + nameParts = listOf("Other", "Name"), + postalAddress = PostalAddressDto( + physicalPostalAddress = PhysicalPostalAddressDto( + country = CountryCode.DE, + postalCode = "80331" + ) + ) + ) + ) + ) + ) + ) + + + private val businessPartnerFull1 = BusinessPartnerFull( + generic = BusinessPartnerGeneric( + nameParts = listOf("Dummy", "Name"), + postalAddress = PostalAddressDto( + addressType = AddressType.LegalAddress, + physicalPostalAddress = PhysicalPostalAddressDto( + country = CountryCode.DE, + postalCode = "70771" + ) + ) + ), + legalEntity = LegalEntity( + legalName = "Dummy Name", + bpnlReference = BpnReference( + referenceValue = "request-id-l-1", + referenceType = BpnReferenceType.BpnRequestIdentifier + ), + legalAddress = LogisticAddress( + bpnaReference = BpnReference( + referenceValue = "request-id-a-1", + referenceType = BpnReferenceType.BpnRequestIdentifier + ), + physicalPostalAddress = PhysicalPostalAddressDto( + country = CountryCode.DE, + postalCode = "70771" + ) + ), + ), + address = LogisticAddress( + bpnaReference = BpnReference( + referenceValue = "request-id-a-1", + referenceType = BpnReferenceType.BpnRequestIdentifier + ), + physicalPostalAddress = PhysicalPostalAddressDto( + country = CountryCode.DE, + postalCode = "70771" + ) + ) + ) + + private val businessPartnerFull2 = BusinessPartnerFull( + generic = BusinessPartnerGeneric( + nameParts = listOf("Other", "Name"), + postalAddress = PostalAddressDto( + addressType = AddressType.AdditionalAddress, + physicalPostalAddress = PhysicalPostalAddressDto( + country = CountryCode.DE, + postalCode = "80331" + ) + ) + ), + legalEntity = LegalEntity( + legalName = "Other Name", + bpnlReference = BpnReference( + referenceValue = "BPNL1", + referenceType = BpnReferenceType.Bpn + ), + legalAddress = LogisticAddress( + bpnaReference = BpnReference( + referenceValue = "BPNA1", + referenceType = BpnReferenceType.Bpn + ), + physicalPostalAddress = PhysicalPostalAddressDto( + country = CountryCode.DE, + postalCode = "80333" + ) + ) + ), + site = Site( + name = "Other Site Name", + bpnsReference = BpnReference( + referenceValue = "BPNS1", + referenceType = BpnReferenceType.Bpn + ), + mainAddress = LogisticAddress( + bpnaReference = BpnReference( + referenceValue = "BPNA2", + referenceType = BpnReferenceType.Bpn + ), + physicalPostalAddress = PhysicalPostalAddressDto( + country = CountryCode.DE, + postalCode = "80331" + ) + ) + ), + address = LogisticAddress( + bpnaReference = BpnReference( + referenceValue = "BPNA3", + referenceType = BpnReferenceType.Bpn + ), + physicalPostalAddress = PhysicalPostalAddressDto( + country = CountryCode.DE, + postalCode = "80331" + ) + ) + ) + + val dummyPoolSyncResponse = CleaningReservationResponse( + timeout = Instant.now().plusSeconds(300), + reservedTasks = listOf( + CleaningReservation( + taskId = "0", + businessPartner = businessPartnerFull1 + ), + CleaningReservation( + taskId = "1", + businessPartner = businessPartnerFull2 + ) + ) + ) + + +} \ No newline at end of file diff --git a/bpdm-orchestrator/src/test/kotlin/org/eclipse/tractusx/bpdm/orchestrator/controller/CleaningTaskControllerIT.kt b/bpdm-orchestrator/src/test/kotlin/org/eclipse/tractusx/bpdm/orchestrator/controller/CleaningTaskControllerIT.kt index 26e7d7c0d..932cf66f3 100644 --- a/bpdm-orchestrator/src/test/kotlin/org/eclipse/tractusx/bpdm/orchestrator/controller/CleaningTaskControllerIT.kt +++ b/bpdm-orchestrator/src/test/kotlin/org/eclipse/tractusx/bpdm/orchestrator/controller/CleaningTaskControllerIT.kt @@ -20,10 +20,10 @@ package org.eclipse.tractusx.bpdm.orchestrator.controller import org.assertj.core.api.Assertions -import org.eclipse.tractusx.bpdm.orchestrator.util.TestValues +import org.eclipse.tractusx.bpdm.orchestrator.util.BusinessPartnerTestValues +import org.eclipse.tractusx.bpdm.orchestrator.util.DummyValues import org.eclipse.tractusx.orchestrator.api.client.OrchestrationApiClient -import org.eclipse.tractusx.orchestrator.api.model.TaskCreateRequest -import org.eclipse.tractusx.orchestrator.api.model.TaskMode +import org.eclipse.tractusx.orchestrator.api.model.* import org.junit.jupiter.api.Test import org.springframework.beans.factory.annotation.Autowired import org.springframework.boot.test.context.SpringBootTest @@ -32,8 +32,7 @@ import org.springframework.web.reactive.function.client.WebClientResponseExcepti @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, properties = ["bpdm.api.upsert-limit=3"]) class CleaningTaskControllerIT @Autowired constructor( - val orchestratorClient: OrchestrationApiClient, - val cleaningTaskController: CleaningTaskController + val orchestratorClient: OrchestrationApiClient ) { /** @@ -43,31 +42,122 @@ class CleaningTaskControllerIT @Autowired constructor( fun `request cleaning task and expect dummy response`() { val request = TaskCreateRequest( mode = TaskMode.UpdateFromSharingMember, - businessPartners = listOf(TestValues.businessPartner1, TestValues.businessPartner2) + businessPartners = listOf(BusinessPartnerTestValues.businessPartner1, BusinessPartnerTestValues.businessPartner2) ) - val expected = cleaningTaskController.dummyResponseCreateTask + val expected = DummyValues.dummyResponseCreateTask val response = orchestratorClient.cleaningTasks.createCleaningTasks(request) Assertions.assertThat(response).isEqualTo(expected) } + /** + * Validate reserve cleaning task endpoint is invokable with clean and sync step and returns dummy response + */ + @Test + fun `request reservation for clean and sync and expect dummy response`() { + val request = CleaningReservationRequest( + amount = 2, + step = CleaningStep.CleanAndSync + ) + + val expected = DummyValues.dummyCleaningReservationResponse + + val response = orchestratorClient.cleaningTasks.reserveCleaningTasks(request) + + Assertions.assertThat(response).isEqualTo(expected) + } + + /** + * Validate reserve cleaning task endpoint is invokable with pool sync step and returns dummy response + */ + @Test + fun `request reservation for pool sync and expect dummy response`() { + val request = CleaningReservationRequest( + amount = 2, + step = CleaningStep.PoolSync + ) + + val expected = DummyValues.dummyPoolSyncResponse + + val response = orchestratorClient.cleaningTasks.reserveCleaningTasks(request) + + Assertions.assertThat(response).isEqualTo(expected) + } + + /** + * Validate reserve cleaning task endpoint is invokable with cleaning step and returns dummy response + */ + @Test + fun `request reservation for clean and expect dummy response`() { + val request = CleaningReservationRequest( + amount = 2, + step = CleaningStep.Clean + ) + + val expected = DummyValues.dummyCleaningReservationResponse + + val response = orchestratorClient.cleaningTasks.reserveCleaningTasks(request) + + Assertions.assertThat(response).isEqualTo(expected) + } + + /** + * Validate post cleaning result endpoint is invokable + */ + @Test + fun `post cleaning result is invokable`() { + val request = CleaningResultRequest( + results = listOf( + CleaningResultEntry( + taskId = "0", + result = BusinessPartnerFull( + generic = BusinessPartnerTestValues.businessPartner1, + legalEntity = BusinessPartnerTestValues.legalEntity1, + site = BusinessPartnerTestValues.site1, + address = BusinessPartnerTestValues.logisticAddress1 + ), + errors = emptyList() + ), + CleaningResultEntry( + taskId = "1", + result = BusinessPartnerFull( + generic = BusinessPartnerTestValues.businessPartner2, + legalEntity = BusinessPartnerTestValues.legalEntity2, + site = BusinessPartnerTestValues.site2, + address = BusinessPartnerTestValues.logisticAddress2 + ), + errors = emptyList() + ), + CleaningResultEntry( + taskId = "2", + result = null, + errors = listOf( + TaskError(type = TaskErrorType.Unspecified, "Error Description") + ) + ), + ) + ) + + orchestratorClient.cleaningTasks.resolveCleaningTasks(request) + } + /** * When requesting cleaning of too many business partners (over the upsert limit) * Then throw exception */ @Test - fun `expect exception on surpassing upsert limit`() { + fun `expect exception on requesting too many cleaning tasks`() { //Create entries above the upsert limit of 3 val request = TaskCreateRequest( mode = TaskMode.UpdateFromPool, businessPartners = listOf( - TestValues.businessPartner1, - TestValues.businessPartner1, - TestValues.businessPartner1, - TestValues.businessPartner1 + BusinessPartnerTestValues.businessPartner1, + BusinessPartnerTestValues.businessPartner1, + BusinessPartnerTestValues.businessPartner1, + BusinessPartnerTestValues.businessPartner1 ) ) @@ -76,4 +166,50 @@ class CleaningTaskControllerIT @Autowired constructor( }.isInstanceOf(WebClientResponseException::class.java) } + /** + * When reserving too many cleaning tasks (over the upsert limit) + * Then throw exception + */ + @Test + fun `expect exception on requesting too many reservations`() { + + //Create entries above the upsert limit of 3 + val request = CleaningReservationRequest( + amount = 200, + step = CleaningStep.CleanAndSync + ) + + Assertions.assertThatThrownBy { + orchestratorClient.cleaningTasks.reserveCleaningTasks(request) + }.isInstanceOf(WebClientResponseException::class.java) + } + + /** + * When posting too many cleaning results (over the upsert limit) + * Then throw exception + */ + @Test + fun `expect exception on posting too many cleaning results`() { + + val validCleaningResultEntry = CleaningResultEntry( + taskId = "0", + result = null, + errors = listOf(TaskError(type = TaskErrorType.Unspecified, description = "Description")) + ) + + //Create entries above the upsert limit of 3 + val request = CleaningResultRequest( + results = listOf( + validCleaningResultEntry.copy(taskId = "0"), + validCleaningResultEntry.copy(taskId = "1"), + validCleaningResultEntry.copy(taskId = "2"), + validCleaningResultEntry.copy(taskId = "3"), + ) + ) + + Assertions.assertThatThrownBy { + orchestratorClient.cleaningTasks.resolveCleaningTasks(request) + }.isInstanceOf(WebClientResponseException::class.java) + } + } \ No newline at end of file diff --git a/bpdm-orchestrator/src/test/kotlin/org/eclipse/tractusx/bpdm/orchestrator/util/BusinessPartnerTestValues.kt b/bpdm-orchestrator/src/test/kotlin/org/eclipse/tractusx/bpdm/orchestrator/util/BusinessPartnerTestValues.kt new file mode 100644 index 000000000..9a01962d7 --- /dev/null +++ b/bpdm-orchestrator/src/test/kotlin/org/eclipse/tractusx/bpdm/orchestrator/util/BusinessPartnerTestValues.kt @@ -0,0 +1,459 @@ +/******************************************************************************* + * 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.orchestrator.util + +import com.neovisionaries.i18n.CountryCode +import org.eclipse.tractusx.bpdm.common.dto.* +import org.eclipse.tractusx.bpdm.common.model.BusinessStateType +import org.eclipse.tractusx.bpdm.common.model.ClassificationType +import org.eclipse.tractusx.bpdm.common.model.DeliveryServiceType +import org.eclipse.tractusx.orchestrator.api.model.* +import org.eclipse.tractusx.orchestrator.api.model.AlternativePostalAddressDto +import org.eclipse.tractusx.orchestrator.api.model.PhysicalPostalAddressDto +import org.eclipse.tractusx.orchestrator.api.model.StreetDto +import java.time.LocalDateTime + +/** + * Contains complex test values of business partners that can be used as templates by the test classes + * Test values here should have as many unique values as possible to reduce the probability of finding matching errors + */ +object BusinessPartnerTestValues { + + //Business Partner with two entries in every collection + val businessPartner1 = BusinessPartnerGeneric( + nameParts = listOf("NamePart1", "NamePart2"), + shortName = "shortname", + identifiers = listOf( + BusinessPartnerIdentifierDto( + type = "identifier-type-1", + value = "identifier-value-1", + issuingBody = "issuingBody-1" + ), + BusinessPartnerIdentifierDto( + type = "identifier-type-2", + value = "identifier-value-2", + issuingBody = "issuingBody-2" + ), + ), + legalForm = "legal-form", + states = listOf( + BusinessPartnerStateDto( + validFrom = LocalDateTime.of(2020, 9, 22, 15, 50), + validTo = LocalDateTime.of(2023, 10, 23, 16, 40), + type = BusinessStateType.INACTIVE, + description = "business-state-description-1" + ), + BusinessPartnerStateDto( + validFrom = LocalDateTime.of(2000, 8, 21, 14, 30), + validTo = LocalDateTime.of(2020, 9, 22, 15, 50), + type = BusinessStateType.ACTIVE, + description = "business-state-description-2" + ) + ), + classifications = listOf( + ClassificationDto( + type = ClassificationType.NACE, + code = "code-1", + value = "value-1" + ), + ClassificationDto( + type = ClassificationType.NAF, + code = "code-2", + value = "value-2" + ), + ), + roles = listOf( + BusinessPartnerRole.CUSTOMER, + BusinessPartnerRole.SUPPLIER + ), + postalAddress = PostalAddressDto( + addressType = AddressType.AdditionalAddress, + physicalPostalAddress = PhysicalPostalAddressDto( + geographicCoordinates = GeoCoordinateDto(0.5f, 0.5f, 0.5f), + country = CountryCode.DE, + administrativeAreaLevel1 = "DE-BW", + administrativeAreaLevel2 = "bw-admin-level-2", + administrativeAreaLevel3 = "bw-admin-level-3", + postalCode = "phys-postal-code", + city = "city", + district = "district", + street = StreetDto( + name = "name", + houseNumber = "house-number", + milestone = "milestone", + direction = "direction", + namePrefix = "name-prefix", + additionalNamePrefix = "add-name-prefix", + nameSuffix = "name-suffix", + additionalNameSuffix = "add-name-suffix" + + ), + companyPostalCode = "comp-postal-code", + industrialZone = "industrial-zone", + building = "building", + floor = "floor", + door = "door" + ), + alternativePostalAddress = AlternativePostalAddressDto( + geographicCoordinates = GeoCoordinateDto(0.6f, 0.6f, 0.6f), + country = CountryCode.DE, + administrativeAreaLevel1 = "DE-BY", + postalCode = "alt-post-code", + city = "alt-city", + deliveryServiceNumber = "delivery-service-number", + deliveryServiceQualifier = "delivery-service-qualifier", + deliveryServiceType = DeliveryServiceType.PO_BOX + ) + ), + ownerBpnl = "BPNL_OWNER_TEST_1", + bpnL = "BPNLTEST", + bpnS = "BPNSTEST", + bpnA = "BPNATEST" + ) + + //Business Partner with single entry in every collection + val businessPartner2 = BusinessPartnerGeneric( + nameParts = listOf("name-part-2"), + shortName = "shortname-2", + identifiers = listOf( + BusinessPartnerIdentifierDto( + type = "identifier-type-2", + value = "identifier-value-2", + issuingBody = "issuingBody-2" + ) + ), + legalForm = "legal-form-2", + states = listOf( + BusinessPartnerStateDto( + validFrom = LocalDateTime.of(1988, 10, 4, 22, 30), + validTo = LocalDateTime.of(2023, 1, 1, 10, 10), + type = BusinessStateType.ACTIVE, + description = "business-state-description-2" + ) + ), + classifications = listOf( + ClassificationDto( + type = ClassificationType.SIC, + code = "code-2", + value = "value-2" + ) + ), + roles = listOf( + BusinessPartnerRole.CUSTOMER + ), + postalAddress = PostalAddressDto( + addressType = AddressType.LegalAddress, + physicalPostalAddress = PhysicalPostalAddressDto( + geographicCoordinates = GeoCoordinateDto(0.4f, 0.4f, 0.4f), + country = CountryCode.FR, + administrativeAreaLevel1 = "FR-ARA", + administrativeAreaLevel2 = "fr-admin-level-2", + administrativeAreaLevel3 = "fr-admin-level-3", + postalCode = "phys-postal-code-2", + city = "city-2", + district = "district-2", + street = StreetDto( + name = "name-2", + houseNumber = "house-number-2", + milestone = "milestone-2", + direction = "direction-2", + namePrefix = "name-prefix-2", + additionalNamePrefix = "add-name-prefix-2", + nameSuffix = "name-suffix-2", + additionalNameSuffix = "add-name-suffix-2" + + ), + companyPostalCode = "comp-postal-code-2", + industrialZone = "industrial-zone-2", + building = "building-2", + floor = "floor-2", + door = "door-2" + ), + alternativePostalAddress = AlternativePostalAddressDto( + geographicCoordinates = GeoCoordinateDto(0.2f, 0.2f, 0.2f), + country = CountryCode.FR, + administrativeAreaLevel1 = "FR-BFC", + postalCode = "alt-post-code-2", + city = "alt-city-2", + deliveryServiceNumber = "delivery-service-number-2", + deliveryServiceQualifier = "delivery-service-qualifier-2", + deliveryServiceType = DeliveryServiceType.BOITE_POSTALE + ) + ), + ownerBpnl = "BPNL_OWNER_TEST_2", + bpnL = "BPNLTEST-2", + bpnS = "BPNSTEST-2", + bpnA = "BPNATEST-2" + ) + + + val logisticAddress1 = LogisticAddress( + name = "Address Name 1", + states = listOf( + AddressState( + description = "Address State 1", + validFrom = LocalDateTime.of(1970, 4, 4, 4, 4), + validTo = LocalDateTime.of(1975, 5, 5, 5, 5), + type = BusinessStateType.ACTIVE + ), + AddressState( + description = "Address State 2", + validFrom = LocalDateTime.of(1975, 5, 5, 5, 5), + validTo = null, + type = BusinessStateType.INACTIVE + ), + ), + identifiers = listOf( + AddressIdentifier( + value = "Address Identifier Value 1", + type = "Address Identifier Type 1" + ), + AddressIdentifier( + value = "Address Identifier Value 2", + type = "Address Identifier Type 2" + ) + ), + physicalPostalAddress = PhysicalPostalAddressDto( + geographicCoordinates = GeoCoordinateDto(0.12f, 0.12f, 0.12f), + country = CountryCode.AD, + administrativeAreaLevel1 = "AD-07", + administrativeAreaLevel2 = "Admin-Level 2-1", + administrativeAreaLevel3 = "Admin-Level 3-1", + postalCode = "Postal Code 1", + city = "City 1", + district = "District 1", + street = StreetDto( + name = "Street Name 1", + houseNumber = "House Number 1", + milestone = "Milestone 1", + direction = "Direction 1", + namePrefix = "Name Prefix 1", + additionalNameSuffix = "Additional Name Suffix 1", + additionalNamePrefix = "Additional Name Prefix 1", + nameSuffix = "Name Suffix 1" + ), + companyPostalCode = "Company Postal Code 1", + industrialZone = "Industrial Zone 1", + building = "Building 1", + floor = "Floor 1", + door = "Door 1" + ), + alternativePostalAddress = AlternativePostalAddressDto( + geographicCoordinates = GeoCoordinateDto(0.23f, 0.23f, 0.23f), + country = CountryCode.AD, + administrativeAreaLevel1 = "AD-08", + postalCode = "Postal Code Alt 1", + city = "City Alt 1", + deliveryServiceType = DeliveryServiceType.PRIVATE_BAG, + deliveryServiceQualifier = "Delivery Service Qualifier 1", + deliveryServiceNumber = "Delivery Service Number 1" + ), + bpnaReference = BpnReference( + referenceType = BpnReferenceType.Bpn, + referenceValue = "BPNATEST-1" + ), + hasChanged = true + ) + + val logisticAddress2 = LogisticAddress( + name = "Address Name 2", + states = listOf( + AddressState( + description = "Address State 2", + validFrom = LocalDateTime.of(1971, 4, 4, 4, 4), + validTo = null, + type = BusinessStateType.ACTIVE + ) + ), + identifiers = listOf( + AddressIdentifier( + value = "Address Identifier Value 2-1", + type = "Address Identifier Type 2-1" + ) + ), + physicalPostalAddress = PhysicalPostalAddressDto( + geographicCoordinates = GeoCoordinateDto(0.45f, 0.46f, 0.47f), + country = CountryCode.AD, + administrativeAreaLevel1 = "AD-07", + administrativeAreaLevel2 = "Admin-Level 2-2", + administrativeAreaLevel3 = "Admin-Level 3-2", + postalCode = "Postal Code 2", + city = "City 2", + district = "District 2", + street = StreetDto( + name = "Street Name 2", + houseNumber = "House Number 2", + milestone = "Milestone 2", + direction = "Direction 2", + namePrefix = "Name Prefix 2", + additionalNameSuffix = "Additional Name Suffix 2", + additionalNamePrefix = "Additional Name Prefix 2", + nameSuffix = "Name Suffix 2" + ), + companyPostalCode = "Company Postal Code 2", + industrialZone = "Industrial Zone 2", + building = "Building 2", + floor = "Floor 2", + door = "Door 2" + ), + alternativePostalAddress = AlternativePostalAddressDto( + geographicCoordinates = GeoCoordinateDto(0.01f, 0.02f, 0.03f), + country = CountryCode.AD, + administrativeAreaLevel1 = "AD-08", + postalCode = "Postal Code Alt 2", + city = "City Alt 2", + deliveryServiceType = DeliveryServiceType.PO_BOX, + deliveryServiceQualifier = "Delivery Service Qualifier 2", + deliveryServiceNumber = "Delivery Service Number 2" + ), + bpnaReference = BpnReference( + referenceType = BpnReferenceType.BpnRequestIdentifier, + referenceValue = "BPN_REQUEST_ID_TEST" + ), + hasChanged = true + ) + + val legalEntity1 = LegalEntity( + legalName = "Legal Entity Name 1", + legalShortName = "Legal Short Name 1", + identifiers = listOf( + LegalEntityIdentifier( + value = "Legal Identifier Value 1", + type = "Legal Identifier Type 1", + issuingBody = "Legal Issuing Body 1" + ), + LegalEntityIdentifier( + value = "Legal Identifier Value 2", + type = "Legal Identifier Type 2", + issuingBody = "Legal Issuing Body 2" + ), + ), + legalForm = "Legal Form 1", + states = listOf( + LegalEntityState( + description = "Legal State Description 1", + validFrom = LocalDateTime.of(1995, 2, 2, 3, 3), + validTo = LocalDateTime.of(2000, 3, 3, 4, 4), + type = BusinessStateType.ACTIVE + ), + LegalEntityState( + description = "Legal State Description 2", + validFrom = LocalDateTime.of(2000, 3, 3, 4, 4), + validTo = null, + type = BusinessStateType.INACTIVE + ), + ), + classifications = listOf( + BusinessPartnerClassification( + type = ClassificationType.SIC, + code = "Classification Code 1", + value = "Classification Value 1" + ), + BusinessPartnerClassification( + type = ClassificationType.NACE, + code = "Classification Code 2", + value = "Classification Value 2" + ) + ), + legalAddress = logisticAddress1, + bpnlReference = BpnReference( + referenceValue = "BPNL1-TEST", + referenceType = BpnReferenceType.Bpn + ), + hasChanged = false + ) + + val legalEntity2 = LegalEntity( + legalName = "Legal Entity Name 2", + legalShortName = "Legal Short Name 2", + identifiers = listOf( + LegalEntityIdentifier( + value = "Legal Identifier Value 2", + type = "Legal Identifier Type 2", + issuingBody = "Legal Issuing Body 2" + ) + ), + legalForm = "Legal Form 2", + states = listOf( + LegalEntityState( + description = "Legal State Description 2", + validFrom = LocalDateTime.of(1900, 5, 5, 5, 5), + validTo = null, + type = BusinessStateType.ACTIVE + ) + ), + classifications = listOf( + BusinessPartnerClassification( + type = ClassificationType.SIC, + code = "Classification Code 2", + value = "Classification Value 2" + ) + ), + legalAddress = logisticAddress2, + bpnlReference = BpnReference( + referenceValue = "BPNL-REQUEST_ID_TEST", + referenceType = BpnReferenceType.BpnRequestIdentifier + ), + hasChanged = false + ) + + val site1 = Site( + name = "Site Name 1", + states = listOf( + SiteState( + description = "Site State Description 1", + validFrom = LocalDateTime.of(1991, 10, 10, 10, 10), + validTo = LocalDateTime.of(2001, 11, 11, 11, 11), + type = BusinessStateType.ACTIVE + ), + SiteState( + description = "Site State Description 2", + validFrom = LocalDateTime.of(2001, 11, 11, 11, 11), + validTo = null, + type = BusinessStateType.INACTIVE + ) + ), + mainAddress = logisticAddress1, + bpnsReference = BpnReference( + referenceValue = "BPNS_TEST", + referenceType = BpnReferenceType.Bpn + ), + hasChanged = false + ) + + val site2 = Site( + name = "Site Name 2", + states = listOf( + SiteState( + description = "Site State Description 2", + validFrom = LocalDateTime.of(1997, 12, 12, 12, 12), + validTo = null, + type = BusinessStateType.ACTIVE + ) + ), + mainAddress = logisticAddress2, + bpnsReference = BpnReference( + referenceValue = "BPNS_REQUEST_ID_TEST", + referenceType = BpnReferenceType.BpnRequestIdentifier + ), + hasChanged = true + ) + +} \ No newline at end of file diff --git a/bpdm-orchestrator/src/test/kotlin/org/eclipse/tractusx/bpdm/orchestrator/util/TestValues.kt b/bpdm-orchestrator/src/test/kotlin/org/eclipse/tractusx/bpdm/orchestrator/util/TestValues.kt deleted file mode 100644 index c91fdead0..000000000 --- a/bpdm-orchestrator/src/test/kotlin/org/eclipse/tractusx/bpdm/orchestrator/util/TestValues.kt +++ /dev/null @@ -1,206 +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.orchestrator.util - -import com.neovisionaries.i18n.CountryCode -import org.eclipse.tractusx.bpdm.common.dto.* -import org.eclipse.tractusx.bpdm.common.model.BusinessStateType -import org.eclipse.tractusx.bpdm.common.model.ClassificationType -import org.eclipse.tractusx.bpdm.common.model.DeliveryServiceType -import org.eclipse.tractusx.orchestrator.api.model.* -import org.eclipse.tractusx.orchestrator.api.model.AlternativePostalAddressDto -import org.eclipse.tractusx.orchestrator.api.model.PhysicalPostalAddressDto -import org.eclipse.tractusx.orchestrator.api.model.StreetDto -import java.time.LocalDateTime - -/** - * Contains complex test values that can be used as templates by the test classes - * Test values here should have as many unique values as possible to reduce the probability of finding matching errors - */ -object TestValues { - - //Business Partner with two entries in every collection - val businessPartner1 = BusinessPartnerDto( - nameParts = listOf("NamePart1", "NamePart2"), - shortName = "shortname", - identifiers = listOf( - BusinessPartnerIdentifierDto( - type = "identifier-type-1", - value = "identifier-value-1", - issuingBody = "issuingBody-1" - ), - BusinessPartnerIdentifierDto( - type = "identifier-type-2", - value = "identifier-value-2", - issuingBody = "issuingBody-2" - ), - ), - legalForm = "legal-form", - states = listOf( - BusinessPartnerStateDto( - validFrom = LocalDateTime.of(2020, 9, 22, 15, 50), - validTo = LocalDateTime.of(2023, 10, 23, 16, 40), - type = BusinessStateType.INACTIVE, - description = "business-state-description-1" - ), - BusinessPartnerStateDto( - validFrom = LocalDateTime.of(2000, 8, 21, 14, 30), - validTo = LocalDateTime.of(2020, 9, 22, 15, 50), - type = BusinessStateType.ACTIVE, - description = "business-state-description-2" - ) - ), - classifications = listOf( - ClassificationDto( - type = ClassificationType.NACE, - code = "code-1", - value = "value-1" - ), - ClassificationDto( - type = ClassificationType.NAF, - code = "code-2", - value = "value-2" - ), - ), - roles = listOf( - BusinessPartnerRole.CUSTOMER, - BusinessPartnerRole.SUPPLIER - ), - postalAddress = PostalAddressDto( - addressType = AddressType.AdditionalAddress, - physicalPostalAddress = PhysicalPostalAddressDto( - geographicCoordinates = GeoCoordinateDto(0.5f, 0.5f, 0.5f), - country = CountryCode.DE, - administrativeAreaLevel1 = "DE-BW", - administrativeAreaLevel2 = "bw-admin-level-2", - administrativeAreaLevel3 = "bw-admin-level-3", - postalCode = "phys-postal-code", - city = "city", - district = "district", - street = StreetDto( - name = "name", - houseNumber = "house-number", - milestone = "milestone", - direction = "direction", - namePrefix = "name-prefix", - additionalNamePrefix = "add-name-prefix", - nameSuffix = "name-suffix", - additionalNameSuffix = "add-name-suffix" - - ), - companyPostalCode = "comp-postal-code", - industrialZone = "industrial-zone", - building = "building", - floor = "floor", - door = "door" - ), - alternativePostalAddress = AlternativePostalAddressDto( - geographicCoordinates = GeoCoordinateDto(0.6f, 0.6f, 0.6f), - country = CountryCode.DE, - administrativeAreaLevel1 = "DE-BY", - postalCode = "alt-post-code", - city = "alt-city", - deliveryServiceNumber = "delivery-service-number", - deliveryServiceQualifier = "delivery-service-qualifier", - deliveryServiceType = DeliveryServiceType.PO_BOX - ) - ), - ownerBpnl = null, - bpnL = "BPNLTEST", - bpnS = "BPNSTEST", - bpnA = "BPNATEST" - ) - - //Business Partner with single entry in every collection - val businessPartner2 = BusinessPartnerDto( - nameParts = listOf("name-part-2"), - shortName = "shortname-2", - identifiers = listOf( - BusinessPartnerIdentifierDto( - type = "identifier-type-2", - value = "identifier-value-2", - issuingBody = "issuingBody-2" - ) - ), - legalForm = "legal-form-2", - states = listOf( - BusinessPartnerStateDto( - validFrom = LocalDateTime.of(1988, 10, 4, 22, 30), - validTo = LocalDateTime.of(2023, 1, 1, 10, 10), - type = BusinessStateType.ACTIVE, - description = "business-state-description-2" - ) - ), - classifications = listOf( - ClassificationDto( - type = ClassificationType.SIC, - code = "code-2", - value = "value-2" - ) - ), - roles = listOf( - BusinessPartnerRole.CUSTOMER - ), - postalAddress = PostalAddressDto( - addressType = AddressType.LegalAddress, - physicalPostalAddress = PhysicalPostalAddressDto( - geographicCoordinates = GeoCoordinateDto(0.4f, 0.4f, 0.4f), - country = CountryCode.FR, - administrativeAreaLevel1 = "FR-ARA", - administrativeAreaLevel2 = "fr-admin-level-2", - administrativeAreaLevel3 = "fr-admin-level-3", - postalCode = "phys-postal-code-2", - city = "city-2", - district = "district-2", - street = StreetDto( - name = "name-2", - houseNumber = "house-number-2", - milestone = "milestone-2", - direction = "direction-2", - namePrefix = "name-prefix-2", - additionalNamePrefix = "add-name-prefix-2", - nameSuffix = "name-suffix-2", - additionalNameSuffix = "add-name-suffix-2" - - ), - companyPostalCode = "comp-postal-code-2", - industrialZone = "industrial-zone-2", - building = "building-2", - floor = "floor-2", - door = "door-2" - ), - alternativePostalAddress = AlternativePostalAddressDto( - geographicCoordinates = GeoCoordinateDto(0.2f, 0.2f, 0.2f), - country = CountryCode.FR, - administrativeAreaLevel1 = "FR-BFC", - postalCode = "alt-post-code-2", - city = "alt-city-2", - deliveryServiceNumber = "delivery-service-number-2", - deliveryServiceQualifier = "delivery-service-qualifier-2", - deliveryServiceType = DeliveryServiceType.BOITE_POSTALE - ) - ), - ownerBpnl = "BPNLTEST-2", - bpnL = "BPNLTEST-2", - bpnS = "BPNSTEST-2", - bpnA = "BPNATEST-2" - ) - -} \ No newline at end of file