From a527650be97e5b4df85888f17e52d2bb20f99270 Mon Sep 17 00:00:00 2001 From: Martin Kaeser Date: Thu, 10 Aug 2023 09:38:57 +0200 Subject: [PATCH 1/2] refactor(dto): Remove deprecated DTOs TypeKeyNameVerboseDto, AddressVersionDto, LogisticAddressGateVerboseDto --- .../bpdm/common/dto/AddressVersionDto.kt | 34 --------- .../dto/response/type/TypeNameUrlDto.kt | 30 -------- .../response/LogisticAddressGateVerboseDto.kt | 72 ------------------- .../tractusx/bpdm/gate/util/ResponseValues.kt | 18 ----- .../tractusx/bpdm/pool/util/RequestValues.kt | 2 - 5 files changed, 156 deletions(-) delete mode 100644 bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/AddressVersionDto.kt delete mode 100644 bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/type/TypeNameUrlDto.kt delete mode 100644 bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/response/LogisticAddressGateVerboseDto.kt diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/AddressVersionDto.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/AddressVersionDto.kt deleted file mode 100644 index 71cae4f04..000000000 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/AddressVersionDto.kt +++ /dev/null @@ -1,34 +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.dto - -import com.neovisionaries.i18n.LanguageCode -import io.swagger.v3.oas.annotations.media.Schema -import org.eclipse.tractusx.bpdm.common.model.CharacterSet - -@Schema(name = "AddressVersion", description = "Localization record for an address") -data class AddressVersionDto( - - @get:Schema(description = "Character set in which the address is written", defaultValue = "UNDEFINED") - val characterSet: CharacterSet = CharacterSet.UNDEFINED, - - @get:Schema(description = "Language in which the address is written", defaultValue = "undefined") - val language: LanguageCode = LanguageCode.undefined -) \ No newline at end of file diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/type/TypeNameUrlDto.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/type/TypeNameUrlDto.kt deleted file mode 100644 index fce711a3f..000000000 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/type/TypeNameUrlDto.kt +++ /dev/null @@ -1,30 +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.dto.response.type - -import io.swagger.v3.oas.annotations.media.Schema - -@Schema(name = "NamedTypeWithLink", description = "General type with name and URL link for further information") -data class TypeNameUrlDto( - @Schema(description = "Name of the type") - val name: String, - @Schema(description = "URL link leading to page with further information on the type") - val url: String? = null -) \ No newline at end of file diff --git a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/response/LogisticAddressGateVerboseDto.kt b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/response/LogisticAddressGateVerboseDto.kt deleted file mode 100644 index b93f6425a..000000000 --- a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/response/LogisticAddressGateVerboseDto.kt +++ /dev/null @@ -1,72 +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.gate.api.model.response - -import io.swagger.v3.oas.annotations.media.ArraySchema -import io.swagger.v3.oas.annotations.media.Schema -import org.eclipse.tractusx.bpdm.common.dto.response.AddressIdentifierVerboseDto -import org.eclipse.tractusx.bpdm.common.dto.response.AddressStateVerboseDto -import org.eclipse.tractusx.bpdm.common.dto.response.AlternativePostalAddressVerboseDto -import org.eclipse.tractusx.bpdm.common.dto.response.PhysicalPostalAddressVerboseDto -import java.time.Instant - - -@Schema(name = "LogisticAddressGateVerboseDto", description = "Logistic address ") -data class LogisticAddressGateVerboseDto( - - @get:Schema(description = "Business Partner Number of this address") - val bpna: String, - - @get:Schema( - description = "Name of the logistic address of the business partner. This is not according to official\n" + - "registers but according to the name the uploading sharing member chooses." - ) - val name: String? = null, - - @ArraySchema(arraySchema = Schema(description = "Address status")) - val states: Collection = emptyList(), - - @ArraySchema(arraySchema = Schema(description = "All identifiers of the Address")) - val identifiers: Collection = emptyList(), - - @get:Schema(description = "Physical postal address") - val physicalPostalAddress: PhysicalPostalAddressVerboseDto, - - @get:Schema(description = "Alternative postal address") - val alternativePostalAddress: AlternativePostalAddressVerboseDto? = null, - - @get:Schema(description = "BPN of the related legal entity, if available") - val bpnLegalEntity: String?, - - @get:Schema(name = "isLegalAddress", description = "Flag if this is the legal address of its related legal entity") - val isLegalAddress: Boolean = false, - - @get:Schema(description = "BPN of the related site, if available") - val bpnSite: String?, - - @get:Schema(name = "isMainAddress", description = "Flag if this is the main address of its related site") - val isMainAddress: Boolean = false, - - @get:Schema(description = "The timestamp the business partner data was created") - val createdAt: Instant, - - @get:Schema(description = "The timestamp the business partner data was last updated") - val updatedAt: Instant -) \ No newline at end of file diff --git a/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/util/ResponseValues.kt b/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/util/ResponseValues.kt index 07c2b07ec..8758fd29a 100644 --- a/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/util/ResponseValues.kt +++ b/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/util/ResponseValues.kt @@ -187,24 +187,6 @@ object ResponseValues { ) ) - val logisticAddress1 = LogisticAddressGateVerboseDto( - bpna = CommonValues.bpnAddress1, - physicalPostalAddress = address1, - bpnLegalEntity = CommonValues.bpn1, - bpnSite = "BPNS0000000001XY", - createdAt = Instant.now(), - updatedAt = Instant.now() - ) - - val logisticAddress2 = LogisticAddressGateVerboseDto( - bpna = CommonValues.bpnAddress2, - physicalPostalAddress = address2, - bpnLegalEntity = CommonValues.bpn2, - bpnSite = "BPNS0000000002XY", - createdAt = Instant.now(), - updatedAt = Instant.now() - ) - val legalEntityResponsePool1 = PoolLegalEntityVerboseDto( legalName = CommonValues.name1, legalAddress = LogisticAddressVerboseDto( diff --git a/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/util/RequestValues.kt b/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/util/RequestValues.kt index 8f3b29fb0..8fb7864cb 100644 --- a/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/util/RequestValues.kt +++ b/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/util/RequestValues.kt @@ -85,8 +85,6 @@ object RequestValues { val classification5 = ClassificationDto(CommonValues.classification5, null, CommonValues.classificationType) - val version1 = AddressVersionDto(CommonValues.characterSet1, CommonValues.language0) - val postalAddress1 = PhysicalPostalAddressDto( basePhysicalAddress = BasePhysicalAddressDto( companyPostalCode = CommonValues.postCode2, From f32862f50795911309ccf8520e99b820b1f55c6a Mon Sep 17 00:00:00 2001 From: Martin Kaeser Date: Tue, 15 Aug 2023 20:01:54 +0200 Subject: [PATCH 2/2] refactor(dto): Rename ChangelogSearchRequest --- .../bridge/dummy/service/GateQueryService.kt | 4 ++-- .../catenax/bpdm/bridge/dummy/BridgeSyncIT.kt | 10 +++++----- .../catenax/bpdm/bridge/dummy/SyncStateIT.kt | 18 +++++++++--------- .../tractusx/bpdm/gate/api/GateChangelogApi.kt | 6 +++--- ...rchRequest.kt => ChangelogSearchRequest.kt} | 2 +- .../gate/controller/ChangelogController.kt | 6 +++--- .../gate/controller/ChangeLogControllerIT.kt | 16 ++++++++-------- 7 files changed, 31 insertions(+), 31 deletions(-) rename bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/request/{ChangeLogSearchRequest.kt => ChangelogSearchRequest.kt} (97%) diff --git a/bpdm-bridge-dummy/src/main/kotlin/com/catenax/bpdm/bridge/dummy/service/GateQueryService.kt b/bpdm-bridge-dummy/src/main/kotlin/com/catenax/bpdm/bridge/dummy/service/GateQueryService.kt index 40c0e0942..4a4de52fe 100644 --- a/bpdm-bridge-dummy/src/main/kotlin/com/catenax/bpdm/bridge/dummy/service/GateQueryService.kt +++ b/bpdm-bridge-dummy/src/main/kotlin/com/catenax/bpdm/bridge/dummy/service/GateQueryService.kt @@ -27,7 +27,7 @@ import mu.KotlinLogging import org.eclipse.tractusx.bpdm.common.dto.BusinessPartnerType import org.eclipse.tractusx.bpdm.common.dto.request.PaginationRequest import org.eclipse.tractusx.bpdm.gate.api.client.GateClient -import org.eclipse.tractusx.bpdm.gate.api.model.request.ChangeLogSearchRequest +import org.eclipse.tractusx.bpdm.gate.api.model.request.ChangelogSearchRequest import org.eclipse.tractusx.bpdm.gate.api.model.response.* import org.springframework.stereotype.Service import java.time.Instant @@ -47,7 +47,7 @@ class GateQueryService( do { val pageResponse = gateClient.changelog().getInputChangelog( - searchRequest = ChangeLogSearchRequest(timestampAfter = modifiedAfter), + searchRequest = ChangelogSearchRequest(timestampAfter = modifiedAfter), paginationRequest = PaginationRequest(page, bridgeConfigProperties.queryPageSize) ) page++ diff --git a/bpdm-bridge-dummy/src/test/kotlin/com/catenax/bpdm/bridge/dummy/BridgeSyncIT.kt b/bpdm-bridge-dummy/src/test/kotlin/com/catenax/bpdm/bridge/dummy/BridgeSyncIT.kt index 38043fe29..a75a39401 100644 --- a/bpdm-bridge-dummy/src/test/kotlin/com/catenax/bpdm/bridge/dummy/BridgeSyncIT.kt +++ b/bpdm-bridge-dummy/src/test/kotlin/com/catenax/bpdm/bridge/dummy/BridgeSyncIT.kt @@ -30,12 +30,10 @@ 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 -import org.eclipse.tractusx.bpdm.gate.api.model.request.ChangeLogSearchRequest import org.eclipse.tractusx.bpdm.gate.api.model.request.LegalEntityGateInputRequest import org.eclipse.tractusx.bpdm.gate.api.model.request.SiteGateInputRequest 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.LegalEntityMatchVerboseDto import org.eclipse.tractusx.bpdm.pool.api.model.response.SitePoolVerboseDto @@ -44,6 +42,8 @@ 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.eclipse.tractusx.bpdm.gate.api.model.request.ChangelogSearchRequest as GateChangelogSearchRequest +import org.eclipse.tractusx.bpdm.pool.api.model.request.ChangelogSearchRequest as PoolChangelogSearchRequest private val DEFAULT_PAGINATION_REQUEST = PaginationRequest(0, 100) @@ -67,7 +67,7 @@ class BridgeSyncIT @Autowired constructor( fun `just use API clients`() { assertGateChangelogHasCount(0) val poolChangelogResponses = poolClient.changelogs().getChangelogEntries( - paginationRequest = DEFAULT_PAGINATION_REQUEST, changelogSearchRequest = ChangelogSearchRequest(timestampAfter = null, bpns = null) + paginationRequest = DEFAULT_PAGINATION_REQUEST, changelogSearchRequest = PoolChangelogSearchRequest(timestampAfter = null, bpns = null) ) assertThat(poolChangelogResponses.contentSize).isZero() bridgeClient.bridge().triggerSync() @@ -220,7 +220,7 @@ class BridgeSyncIT @Autowired constructor( private fun assertGateChangelogHasCount(changelogCount: Int) { val gateChangelogResponses = gateClient.changelog().getInputChangelog( paginationRequest = DEFAULT_PAGINATION_REQUEST, - searchRequest = ChangeLogSearchRequest(timestampAfter = null, businessPartnerTypes = emptySet()) + searchRequest = GateChangelogSearchRequest(timestampAfter = null, businessPartnerTypes = emptySet()) ) assertThat(gateChangelogResponses.contentSize).isEqualTo(changelogCount) } @@ -228,7 +228,7 @@ class BridgeSyncIT @Autowired constructor( private fun assertPoolChangelogHasCount(changelogCount: Int) { val poolChangelogResponses = poolClient.changelogs().getChangelogEntries( paginationRequest = DEFAULT_PAGINATION_REQUEST, - changelogSearchRequest = ChangelogSearchRequest(timestampAfter = null, bpns = null) + changelogSearchRequest = PoolChangelogSearchRequest(timestampAfter = null, bpns = null) ) assertThat(poolChangelogResponses.contentSize).isEqualTo(changelogCount) diff --git a/bpdm-bridge-dummy/src/test/kotlin/com/catenax/bpdm/bridge/dummy/SyncStateIT.kt b/bpdm-bridge-dummy/src/test/kotlin/com/catenax/bpdm/bridge/dummy/SyncStateIT.kt index 51d51a2c3..bfedb9ba8 100644 --- a/bpdm-bridge-dummy/src/test/kotlin/com/catenax/bpdm/bridge/dummy/SyncStateIT.kt +++ b/bpdm-bridge-dummy/src/test/kotlin/com/catenax/bpdm/bridge/dummy/SyncStateIT.kt @@ -29,7 +29,7 @@ import com.github.tomakehurst.wiremock.junit5.WireMockExtension import com.github.tomakehurst.wiremock.verification.LoggedRequest import org.assertj.core.api.Assertions import org.eclipse.tractusx.bpdm.common.service.BaseSyncRecordService -import org.eclipse.tractusx.bpdm.gate.api.model.request.ChangeLogSearchRequest +import org.eclipse.tractusx.bpdm.gate.api.model.request.ChangelogSearchRequest import org.eclipse.tractusx.bpdm.gate.api.model.response.ChangelogGateDto import org.eclipse.tractusx.bpdm.gate.api.model.response.PageChangeLogDto import org.junit.jupiter.api.Assertions.assertThrows @@ -125,15 +125,15 @@ class SyncStateIT @Autowired constructor( Assertions.assertThat(loggedRequests.size).isEqualTo(3) // 1st sync polls from initial timestamp (2000-01-01) - val pollFrom1stSync = parseBody(loggedRequests[0]).timestampAfter + val pollFrom1stSync = parseBody(loggedRequests[0]).timestampAfter Assertions.assertThat(pollFrom1stSync).isEqualTo(TS_INITIAL_POLL_FROM) // 2nd sync polls from around timestamp of 1st successful sync - val pollFrom2ndSync = parseBody(loggedRequests[1]).timestampAfter + val pollFrom2ndSync = parseBody(loggedRequests[1]).timestampAfter Assertions.assertThat(pollFrom2ndSync).isBetween(tsBefore1stSuccessfulSync, tsAfter1stSuccessfulSync) // 3rd sync polls from around timestamp of 2nd successful sync - val pollFrom3rdSync = parseBody(loggedRequests[2]).timestampAfter + val pollFrom3rdSync = parseBody(loggedRequests[2]).timestampAfter Assertions.assertThat(pollFrom3rdSync).isBetween(tsBefore2ndSuccessfulSync, tsAfter2ndSuccessfulSync) } @@ -211,23 +211,23 @@ class SyncStateIT @Autowired constructor( Assertions.assertThat(loggedRequests.size).isEqualTo(5) // 1st sync polls from initial timestamp (2000-01-01) - val pollFrom1stSync = parseBody(loggedRequests[0]).timestampAfter + val pollFrom1stSync = parseBody(loggedRequests[0]).timestampAfter Assertions.assertThat(pollFrom1stSync).isEqualTo(TS_INITIAL_POLL_FROM) // 2nd sync polls from around timestamp of 1st successful sync - val pollFrom2ndSync = parseBody(loggedRequests[1]).timestampAfter + val pollFrom2ndSync = parseBody(loggedRequests[1]).timestampAfter Assertions.assertThat(pollFrom2ndSync).isBetween(tsBefore1stSuccessfulSync, tsAfter1stSuccessfulSync) // 3rd sync still polls from same timestamp because last sync has failed! - val pollFrom3rdSync = parseBody(loggedRequests[2]).timestampAfter + val pollFrom3rdSync = parseBody(loggedRequests[2]).timestampAfter Assertions.assertThat(pollFrom3rdSync).isEqualTo(pollFrom2ndSync) // 4th sync still polls from same timestamp because last sync has failed! - val pollFrom4thSync = parseBody(loggedRequests[3]).timestampAfter + val pollFrom4thSync = parseBody(loggedRequests[3]).timestampAfter Assertions.assertThat(pollFrom4thSync).isEqualTo(pollFrom2ndSync) // 5th sync polls from around timestamp of 2nd successful sync - val pollFrom5thSync = parseBody(loggedRequests[4]).timestampAfter + val pollFrom5thSync = parseBody(loggedRequests[4]).timestampAfter Assertions.assertThat(pollFrom5thSync).isBetween(tsBefore2ndSuccessfulSync, tsAfter2ndSuccessfulSync) } diff --git a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/GateChangelogApi.kt b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/GateChangelogApi.kt index cad9a1c5c..cb741b967 100644 --- a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/GateChangelogApi.kt +++ b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/GateChangelogApi.kt @@ -25,7 +25,7 @@ import io.swagger.v3.oas.annotations.responses.ApiResponse import io.swagger.v3.oas.annotations.responses.ApiResponses import jakarta.validation.Valid import org.eclipse.tractusx.bpdm.common.dto.request.PaginationRequest -import org.eclipse.tractusx.bpdm.gate.api.model.request.ChangeLogSearchRequest +import org.eclipse.tractusx.bpdm.gate.api.model.request.ChangelogSearchRequest import org.eclipse.tractusx.bpdm.gate.api.model.response.ChangelogGateDto import org.eclipse.tractusx.bpdm.gate.api.model.response.PageChangeLogDto import org.springdoc.core.annotations.ParameterObject @@ -53,7 +53,7 @@ interface GateChangelogApi { @PostExchange("/input/changelog/search") fun getInputChangelog( @ParameterObject @Valid paginationRequest: PaginationRequest, - @RequestBody searchRequest: ChangeLogSearchRequest + @RequestBody searchRequest: ChangelogSearchRequest ): PageChangeLogDto @@ -71,6 +71,6 @@ interface GateChangelogApi { @PostExchange("/output/changelog/search") fun getOutputChangelog( @ParameterObject @Valid paginationRequest: PaginationRequest, - @RequestBody searchRequest: ChangeLogSearchRequest + @RequestBody searchRequest: ChangelogSearchRequest ): PageChangeLogDto } \ No newline at end of file diff --git a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/request/ChangeLogSearchRequest.kt b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/request/ChangelogSearchRequest.kt similarity index 97% rename from bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/request/ChangeLogSearchRequest.kt rename to bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/request/ChangelogSearchRequest.kt index 0badc2023..7599713b0 100644 --- a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/request/ChangeLogSearchRequest.kt +++ b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/request/ChangelogSearchRequest.kt @@ -23,7 +23,7 @@ import io.swagger.v3.oas.annotations.Parameter import org.eclipse.tractusx.bpdm.common.dto.BusinessPartnerType import java.time.Instant -data class ChangeLogSearchRequest( +data class ChangelogSearchRequest( @field:Parameter(description = "From when to search changelog entries", example = "2023-03-20T10:23:28.194Z", required = false) val timestampAfter: Instant? = null, diff --git a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/controller/ChangelogController.kt b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/controller/ChangelogController.kt index 9aec7a5ee..148a729a1 100644 --- a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/controller/ChangelogController.kt +++ b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/controller/ChangelogController.kt @@ -22,7 +22,7 @@ package org.eclipse.tractusx.bpdm.gate.controller import org.eclipse.tractusx.bpdm.common.dto.request.PaginationRequest import org.eclipse.tractusx.bpdm.common.model.OutputInputEnum import org.eclipse.tractusx.bpdm.gate.api.GateChangelogApi -import org.eclipse.tractusx.bpdm.gate.api.model.request.ChangeLogSearchRequest +import org.eclipse.tractusx.bpdm.gate.api.model.request.ChangelogSearchRequest import org.eclipse.tractusx.bpdm.gate.api.model.response.ChangelogGateDto import org.eclipse.tractusx.bpdm.gate.api.model.response.PageChangeLogDto import org.eclipse.tractusx.bpdm.gate.service.ChangelogService @@ -38,7 +38,7 @@ class ChangelogController( @PreAuthorize("hasAuthority(@gateSecurityConfigProperties.getReadCompanyInputDataAsRole())") override fun getInputChangelog( - paginationRequest: PaginationRequest, searchRequest: ChangeLogSearchRequest + paginationRequest: PaginationRequest, searchRequest: ChangelogSearchRequest ): PageChangeLogDto { return changelogService.getChangeLogEntries( searchRequest.externalIds, @@ -53,7 +53,7 @@ class ChangelogController( @PreAuthorize("hasAuthority(@gateSecurityConfigProperties.getReadCompanyOutputDataAsRole())") override fun getOutputChangelog( paginationRequest: PaginationRequest, - searchRequest: ChangeLogSearchRequest + searchRequest: ChangelogSearchRequest ): PageChangeLogDto { return changelogService.getChangeLogEntries( searchRequest.externalIds, diff --git a/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/controller/ChangeLogControllerIT.kt b/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/controller/ChangeLogControllerIT.kt index 4608057b0..239744975 100644 --- a/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/controller/ChangeLogControllerIT.kt +++ b/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/controller/ChangeLogControllerIT.kt @@ -48,7 +48,7 @@ import org.eclipse.tractusx.bpdm.common.dto.request.PaginationRequest import org.eclipse.tractusx.bpdm.gate.api.client.GateClient import org.eclipse.tractusx.bpdm.gate.api.exception.ChangeLogOutputError import org.eclipse.tractusx.bpdm.gate.api.model.ChangelogType -import org.eclipse.tractusx.bpdm.gate.api.model.request.ChangeLogSearchRequest +import org.eclipse.tractusx.bpdm.gate.api.model.request.ChangelogSearchRequest import org.eclipse.tractusx.bpdm.gate.api.model.response.ChangelogGateDto import org.eclipse.tractusx.bpdm.gate.api.model.response.ErrorInfo import org.eclipse.tractusx.bpdm.gate.entity.ChangelogEntry @@ -99,7 +99,7 @@ internal class ChangeLogControllerIT @Autowired constructor( @Test fun `get changeLog by external id`() { - val searchRequest = ChangeLogSearchRequest(externalIds = setOf(CommonValues.externalIdAddress1)) + val searchRequest = ChangelogSearchRequest(externalIds = setOf(CommonValues.externalIdAddress1)) val searchResult = gateClient.changelog().getInputChangelog(PaginationRequest(), searchRequest) @@ -117,7 +117,7 @@ internal class ChangeLogControllerIT @Autowired constructor( @Test fun `get changeLog by external id not found`() { - val searchRequest = ChangeLogSearchRequest(externalIds = setOf("NONEXIST")) + val searchRequest = ChangelogSearchRequest(externalIds = setOf("NONEXIST")) val searchResult = gateClient.changelog().getInputChangelog(PaginationRequest(), searchRequest) @@ -152,7 +152,7 @@ internal class ChangeLogControllerIT @Autowired constructor( @Test fun `get changeLog by external id and timeStamp`() { - val searchRequest = ChangeLogSearchRequest(externalIds = setOf(CommonValues.externalIdAddress1), timestampAfter = instant) + val searchRequest = ChangelogSearchRequest(externalIds = setOf(CommonValues.externalIdAddress1), timestampAfter = instant) val searchResult = gateClient.changelog().getInputChangelog(PaginationRequest(), searchRequest) @@ -168,7 +168,7 @@ internal class ChangeLogControllerIT @Autowired constructor( @Test fun `get changeLog by businessPartnerType`() { - val searchRequest = ChangeLogSearchRequest(businessPartnerTypes = setOf(businessPartnerTypeParamAddress)) + val searchRequest = ChangelogSearchRequest(businessPartnerTypes = setOf(businessPartnerTypeParamAddress)) val searchResult = gateClient.changelog().getInputChangelog(PaginationRequest(), searchRequest) @@ -189,7 +189,7 @@ internal class ChangeLogControllerIT @Autowired constructor( @Test fun `get changeLog by businessPartnerType not found`() { - val searchRequest = ChangeLogSearchRequest(businessPartnerTypes = setOf(businessPartnerTypeParamNotFound)) + val searchRequest = ChangelogSearchRequest(businessPartnerTypes = setOf(businessPartnerTypeParamNotFound)) val searchResult = gateClient.changelog().getInputChangelog(PaginationRequest(), searchRequest) @@ -204,7 +204,7 @@ internal class ChangeLogControllerIT @Autowired constructor( */ @Test fun `get changeLog by businessPartnerType and timeStamp`() { - val searchRequest = ChangeLogSearchRequest(businessPartnerTypes = setOf(businessPartnerTypeParamAddress), timestampAfter = instant) + val searchRequest = ChangelogSearchRequest(businessPartnerTypes = setOf(businessPartnerTypeParamAddress), timestampAfter = instant) val searchResult = gateClient.changelog().getInputChangelog(PaginationRequest(), searchRequest) @@ -225,7 +225,7 @@ internal class ChangeLogControllerIT @Autowired constructor( @Test fun `get changeLog from timeStamp`() { - val searchRequest = ChangeLogSearchRequest(businessPartnerTypes = emptySet(), timestampAfter = instant) + val searchRequest = ChangelogSearchRequest(businessPartnerTypes = emptySet(), timestampAfter = instant) val searchResult = gateClient.changelog().getInputChangelog(paginationRequest = PaginationRequest(), searchRequest)