This repository has been archived by the owner on Jan 13, 2025. It is now read-only.
forked from eclipse-tractusx/traceability-foss
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix/do 4418 wrong spelling of the column catenax site id in the table…
… assets as planned (#63) fix:DO-4418:rename all properties to catenaXSiteId Because the existing possibilities of different spellings of the catenaXSiteId attribute cannot be resolved with certainty and the uncertainty of a change remains, all relevant places are implemented in the TRX regardless of the spelling.
- Loading branch information
Showing
15 changed files
with
3,964 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89 changes: 89 additions & 0 deletions
89
...actusx/traceability/integration/assets/AssetAsPlannedControllerSortAndFilterValuesIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
/******************************************************************************** | ||
* Copyright (c) 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.traceability.integration.assets; | ||
|
||
import static io.restassured.RestAssured.given; | ||
import static org.eclipse.tractusx.traceability.common.security.JwtRole.ADMIN; | ||
import static org.hamcrest.Matchers.equalTo; | ||
|
||
import io.restassured.http.ContentType; | ||
import java.util.stream.Stream; | ||
import org.eclipse.tractusx.traceability.integration.IntegrationTestSpecification; | ||
import org.eclipse.tractusx.traceability.integration.common.support.AssetsSupport; | ||
import org.hamcrest.Matchers; | ||
import org.jose4j.lang.JoseException; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.params.ParameterizedTest; | ||
import org.junit.jupiter.params.provider.Arguments; | ||
import org.junit.jupiter.params.provider.MethodSource; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
|
||
class AssetAsPlannedControllerSortAndFilterValuesIT extends IntegrationTestSpecification { | ||
|
||
@Autowired | ||
AssetsSupport assetsSupport; | ||
|
||
@BeforeEach | ||
void before() { | ||
// Test data contains different spellings for 'catenaXSiteId', as long as no clear spelling is defined. https://github.com/eclipse-tractusx/sldt-semantic-models/issues/470 | ||
assetsSupport.defaultAssetsAsPlannedStored( | ||
"/testdata/irs_assets_as_planned_v4_long_list.json"); | ||
} | ||
|
||
private static Stream<Arguments> sortAndFilterArguments() { | ||
return Stream.of( | ||
// As long as no clear spelling for 'catenaxSiteId' is defined, test on different spellings. https://github.com/eclipse-tractusx/sldt-semantic-models/issues/470 | ||
Arguments.of("nameAtManufacturer,asc", "catenaXSiteId,EQUAL,BPNS000004711DMY", "AND", | ||
new String[]{"HVModul", "OEMAHighVoltageBattery", "VehicleModelA", "ZBZELLE"}), | ||
Arguments.of("nameAtManufacturer,asc", "catenaxSiteId,EQUAL,BPNS000004711DMY", "AND", | ||
new String[]{"HVModul", "OEMAHighVoltageBattery", "VehicleModelA", "ZBZELLE"}) | ||
); | ||
} | ||
|
||
@ParameterizedTest | ||
@MethodSource("sortAndFilterArguments") | ||
void givenSortArguments_whenCallSortAndFilterEndpoint_thenReturnExpectedResponse( | ||
final String sort, | ||
final String filter, | ||
final String filterOperator, | ||
final String[] expectedOrderOfIdShortItems | ||
) throws JoseException { | ||
|
||
final long page = 0; | ||
final long size = 20; | ||
|
||
given() | ||
.header(oAuth2Support.jwtAuthorization(ADMIN)) | ||
.contentType(ContentType.JSON) | ||
.param("page", page) | ||
.param("size", size) | ||
.param("sort", sort) | ||
.param("filter", filter) | ||
.param("filterOperator", filterOperator) | ||
.log().all() | ||
.when() | ||
.get("/api/assets/as-planned") | ||
.then() | ||
.log().all() | ||
.statusCode(200) | ||
.body("totalItems", equalTo(expectedOrderOfIdShortItems.length)) | ||
.body("content.idShort", Matchers.containsInRelativeOrder(expectedOrderOfIdShortItems)); | ||
} | ||
} |
89 changes: 89 additions & 0 deletions
89
...clipse/tractusx/traceability/integration/assets/AssetAsPlannedControllerSortValuesIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
/******************************************************************************** | ||
* Copyright (c) 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.traceability.integration.assets; | ||
|
||
import static io.restassured.RestAssured.given; | ||
import static org.eclipse.tractusx.traceability.common.security.JwtRole.ADMIN; | ||
import static org.hamcrest.Matchers.equalTo; | ||
|
||
import io.restassured.http.ContentType; | ||
import java.util.stream.Stream; | ||
import org.eclipse.tractusx.traceability.integration.IntegrationTestSpecification; | ||
import org.eclipse.tractusx.traceability.integration.common.support.AssetsSupport; | ||
import org.hamcrest.Matchers; | ||
import org.jose4j.lang.JoseException; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.params.ParameterizedTest; | ||
import org.junit.jupiter.params.provider.Arguments; | ||
import org.junit.jupiter.params.provider.MethodSource; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
|
||
class AssetAsPlannedControllerSortValuesIT extends IntegrationTestSpecification { | ||
|
||
@Autowired | ||
AssetsSupport assetsSupport; | ||
|
||
@BeforeEach | ||
void before() { | ||
// Test data contains different spellings for 'catenaXSiteId', as long as no clear spelling is defined. https://github.com/eclipse-tractusx/sldt-semantic-models/issues/470 | ||
assetsSupport.defaultAssetsAsPlannedStored( | ||
"/testdata/irs_assets_as_planned_v4_long_list_distinct_catenaxsiteid.json"); | ||
} | ||
|
||
private static Stream<Arguments> sortArguments() { | ||
return Stream.of( | ||
// As long as no clear spelling for 'catenaxSiteId' is defined, test on different spellings. https://github.com/eclipse-tractusx/sldt-semantic-models/issues/470 | ||
Arguments.of("catenaXSiteId,desc", | ||
new String[]{"ZBZELLE", "HVModul", "OEMAHighVoltageBattery", "VehicleModelA", "TierBECU1", | ||
"SubTierASensor", "TierAGearbox", "NTierACathodeMaterial", "NTierANTierProduct", | ||
"NTierAPlastics", "SubTierBSealant", "SubTierBGlue"}), | ||
Arguments.of("catenaxSiteId,asc", | ||
new String[]{"SubTierBGlue", "SubTierBSealant", "NTierAPlastics", "NTierANTierProduct", | ||
"NTierACathodeMaterial", "TierAGearbox", "SubTierASensor", "TierBECU1", "VehicleModelA", | ||
"OEMAHighVoltageBattery", "HVModul", "ZBZELLE"}) | ||
); | ||
} | ||
|
||
@ParameterizedTest | ||
@MethodSource("sortArguments") | ||
void givenSortArguments_whenCallSortEndpoint_thenReturnExpectedResponse( | ||
final String sort, | ||
final String[] expectedOrderOfIdShortItems | ||
) throws JoseException { | ||
|
||
final long page = 0; | ||
final long size = 20; | ||
|
||
given() | ||
.header(oAuth2Support.jwtAuthorization(ADMIN)) | ||
.contentType(ContentType.JSON) | ||
.param("page", page) | ||
.param("size", size) | ||
.param("sort", sort) | ||
.log().all() | ||
.when() | ||
.get("/api/assets/as-planned") | ||
.then() | ||
.log().all() | ||
.statusCode(200) | ||
.body("totalItems", equalTo(expectedOrderOfIdShortItems.length)) | ||
.body("content.idShort", Matchers.containsInRelativeOrder(expectedOrderOfIdShortItems)); | ||
} | ||
} |
Oops, something went wrong.