diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/adapters/feign/irs/model/test.json b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/adapters/feign/irs/model/test.json deleted file mode 100644 index cbe142aaad..0000000000 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/adapters/feign/irs/model/test.json +++ /dev/null @@ -1,2 +0,0 @@ - error: http://tracex-consumer-controlplane:8181/api/v1/management/catalog?providerUrl=https://trace-x-edc.dev.demo.catena-x.net/api/v1/ids/data&limit=50&offset=0 - success: https://tracex-consumer-controlplane.dev.demo.catena-x.net/api/v1/management/catalog?providerUrl=https://tracex-test-consumer-controlplane.dev.demo.catena-x.net/api/v1/ids/data... diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/adapters/feign/irs/model/test_response.json b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/adapters/feign/irs/model/test_response.json deleted file mode 100644 index 24a56786de..0000000000 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/adapters/feign/irs/model/test_response.json +++ /dev/null @@ -1,145 +0,0 @@ -{ - "job": { - "id": "53f355e3-27bc-4055-a007-d62cb09770d3", - "globalAssetId": "urn:uuid:c4cd2818-b616-4a28-b327-7e7e449fbdae", - "state": "COMPLETED", - "exception": null, - "createdOn": "2023-04-13T11:05:18.323096019Z", - "startedOn": "2023-04-13T11:05:18.323215519Z", - "lastModifiedOn": "2023-04-13T11:06:21.957415994Z", - "completedOn": "2023-04-13T11:06:21.957417294Z", - "owner": "sa-cl6-cx-10", - "summary": { - "asyncFetchedItems": { - "running": 0, - "completed": 1, - "failed": 2 - }, - "bpnLookups": { - "completed": 0, - "failed": 0 - } - }, - "parameter": { - "bomLifecycle": "asBuilt", - "aspects": [ - "SerialPartTypization", - "Batch", - "SingleLevelUsageAsBuilt" - ], - "depth": 2, - "direction": "downward", - "collectAspects": true, - "lookupBPNs": false, - "callbackUrl": null - } - }, - "relationships": [], - "shells": [ - { - "administration": null, - "description": [], - "globalAssetId": { - "value": [ - "urn:uuid:c4cd2818-b616-4a28-b327-7e7e449fbdae" - ] - }, - "idShort": "Engine", - "identification": "urn:uuid:6df34acc-47a0-4420-92b1-35eaea4bdbcb", - "specificAssetIds": [ - { - "key": "manufacturerId", - "subjectId": null, - "value": "BPNL00000003AYRE", - "semanticId": null - }, - { - "key": "manufacturerPartId", - "subjectId": null, - "value": "10030939-59", - "semanticId": null - }, - { - "key": "partInstanceId", - "subjectId": null, - "value": "NO-692153553533989280372178", - "semanticId": null - } - ], - "submodelDescriptors": [ - { - "administration": null, - "description": [], - "idShort": "SingleLevelUsageAsBuilt", - "identification": "urn:uuid:eb030399-13dd-4d98-8b9f-f4e214d045a1", - "semanticId": { - "value": [ - "urn:bamm:io.catenax.single_level_usage_as_built:1.0.1#SingleLevelUsageAsBuilt" - ] - }, - "endpoints": [ - { - "protocolInformation": { - "endpointAddress": "https://trace-x-edc.dev.demo.catena-x.net/urn:uuid:c4cd2818-b616-4a28-b327-7e7e449fbdae-urn:uuid:eb030399-13dd-4d98-8b9f-f4e214d045a1/submodel?content=value&extent=withBlobValue", - "endpointProtocol": "HTTPS", - "endpointProtocolVersion": "1.0", - "subprotocol": null, - "subprotocolBody": null, - "subprotocolBodyEncoding": null - }, - "interface": "HTTP" - } - ] - }, - { - "administration": null, - "description": [], - "idShort": "SerialPartTypization", - "identification": "urn:uuid:0fecbf6a-fe52-4672-b9f3-ebd9ad8b8935", - "semanticId": { - "value": [ - "urn:bamm:io.catenax.serial_part_typization:1.1.0#SerialPartTypization" - ] - }, - "endpoints": [ - { - "protocolInformation": { - "endpointAddress": "https://trace-x-edc.dev.demo.catena-x.net/urn:uuid:c4cd2818-b616-4a28-b327-7e7e449fbdae-urn:uuid:0fecbf6a-fe52-4672-b9f3-ebd9ad8b8935/submodel?content=value&extent=withBlobValue", - "endpointProtocol": "HTTPS", - "endpointProtocolVersion": "1.0", - "subprotocol": null, - "subprotocolBody": null, - "subprotocolBodyEncoding": null - }, - "interface": "HTTP" - } - ] - } - ] - } - ], - "tombstones": [ - { - "catenaXId": "urn:uuid:c4cd2818-b616-4a28-b327-7e7e449fbdae", - "endpointURL": "https://trace-x-edc.dev.demo.catena-x.net/urn:uuid:c4cd2818-b616-4a28-b327-7e7e449fbdae-urn:uuid:eb030399-13dd-4d98-8b9f-f4e214d045a1/submodel?content=value&extent=withBlobValue", - "processingError": { - "processStep": "SubmodelRequest", - "errorDetail": "org.springframework.web.client.HttpServerErrorException$InternalServerError: 500 Server Error: \"{\"servlet\":\"EDC-management\",\"message\":\"Internal Server Error\",\"url\":\"/api/v1/management/catalog\",\"status\":\"500\"}\"", - "lastAttempt": "2023-04-13T11:05:50.820110106Z", - "retryCounter": 0 - } - }, - { - "catenaXId": "urn:uuid:c4cd2818-b616-4a28-b327-7e7e449fbdae", - "endpointURL": "https://trace-x-edc.dev.demo.catena-x.net/urn:uuid:c4cd2818-b616-4a28-b327-7e7e449fbdae-urn:uuid:0fecbf6a-fe52-4672-b9f3-ebd9ad8b8935/submodel?content=value&extent=withBlobValue", - "processingError": { - "processStep": "SubmodelRequest", - "errorDetail": "org.springframework.web.client.HttpServerErrorException$InternalServerError: 500 Server Error: \"{\"servlet\":\"EDC-management\",\"message\":\"Internal Server Error\",\"url\":\"/api/v1/management/catalog\",\"status\":\"500\"}\"", - "lastAttempt": "2023-04-13T11:06:21.901340512Z", - "retryCounter": 0 - } - } - ], - "submodels": [], - "bpns": [] -} diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/AssetFacadeTest.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/AssetFacadeTest.java index cca6239dc5..a2a2562922 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/AssetFacadeTest.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/AssetFacadeTest.java @@ -50,7 +50,7 @@ class AssetFacadeTest { private AssetFacade assetFacade; @Mock - AssetService assetService; + private AssetService assetService; @Mock private AssetRepository assetRepository; @@ -70,15 +70,6 @@ void testGetAssetsCountryMap() { newAsset("FRA") ); - - Map assetMap = new HashMap<>(); - - - for (Asset asset : assets) { - assetMap.put(asset.getManufacturingCountry(), 0L); - } - - when(assetService.getAssetsCountryMap()).thenReturn(getCountryCodesWithCountOfOccurrence(assets)); // when diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/service/AssetServiceTest.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/service/AssetServiceTest.java index 9d841715ef..884714d4b5 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/service/AssetServiceTest.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/service/AssetServiceTest.java @@ -117,12 +117,9 @@ private List provideParentDescriptions() { } private Asset provideTestAsset(List childDescriptions, List parentDescriptions) { - - String id = "urn:uuid:ceb6b964-5779-49c1-b5e9-0ee70528fcbd"; String idShort = "--"; String nameAtManufacturer = "1"; - String nameAtManufacturer2 = "2"; String manufacturerPartId = "33740332-54"; String partInstanceId = "NO-297452866581906730261974"; String manufacturerId = "BPNL00000003CSGV"; @@ -135,7 +132,6 @@ private Asset provideTestAsset(List childDescriptions, List< Owner owner = Owner.CUSTOMER; QualityType qualityType = QualityType.OK; String van = "--"; - return new Asset(id, idShort, nameAtManufacturer, manufacturerPartId, partInstanceId, manufacturerId, batchId, manufacturerName, nameAtCustomer, customerPartId, manufacturingDate, manufacturingCountry, owner, childDescriptions, parentDescriptions, false, qualityType, van); } diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/infrastructure/adapters/feign/irs/IrsServiceTest.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/infrastructure/adapters/feign/irs/IrsServiceTest.java index 79dec1bf95..7ed4dbbbf7 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/infrastructure/adapters/feign/irs/IrsServiceTest.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/infrastructure/adapters/feign/irs/IrsServiceTest.java @@ -1,3 +1,22 @@ +/******************************************************************************** + * 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.assets.infrastructure.adapters.feign.irs; import org.eclipse.tractusx.traceability.assets.domain.model.Asset; @@ -100,7 +119,7 @@ void testFindAssetsDownward_uncompletedJob_returnsEmptyListOfAssets(Direction di } - /* @Test + @Test void testFindAssetsUpward_completedJob_returnsConvertedAssets() { // Given @@ -118,7 +137,7 @@ void testFindAssetsUpward_completedJob_returnsConvertedAssets() { when(assetsConverter.convertAssets(jobResponse)).thenReturn(expectedAssets); // When - List result = irsService.findAssets("1", Direction.UPWARD); + List result = irsService.findAssets("1", Direction.UPWARD, Aspect.upwardAspects()); // Then assertThat(result).isEqualTo(expectedAssets); @@ -140,13 +159,13 @@ void testFindAssetsUpward_uncompletedJob_returnsEmptyListOfAssets() { when(jobResponse.isCompleted()).thenReturn(false); // When - List result = irsService.findAssets("1", Direction.UPWARD); + List result = irsService.findAssets("1", Direction.UPWARD, Aspect.upwardAspects()); // Then assertThat(result).isEqualTo(Collections.EMPTY_LIST); Mockito.verify(assetsConverter, never()).convertAssets(any(JobResponse.class)); } -*/ + } diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/infrastructure/adapters/jpa/asset/AssetEntityTest.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/infrastructure/adapters/jpa/asset/AssetEntityTest.java index b9f3558cbe..e659f5fe2e 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/infrastructure/adapters/jpa/asset/AssetEntityTest.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/infrastructure/adapters/jpa/asset/AssetEntityTest.java @@ -34,8 +34,6 @@ @ExtendWith(MockitoExtension.class) class AssetEntityTest { - - @Test void testAssetIsNotUnderInvestigationWhenThereIsNoInvestigations() { // given diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/infrastructure/adapters/jpa/asset/PersistentAssetsRepositoryTest.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/infrastructure/adapters/jpa/asset/PersistentAssetsRepositoryTest.java index 086d944bcb..201686e9d3 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/infrastructure/adapters/jpa/asset/PersistentAssetsRepositoryTest.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/infrastructure/adapters/jpa/asset/PersistentAssetsRepositoryTest.java @@ -1,3 +1,22 @@ +/******************************************************************************** + * 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.assets.infrastructure.adapters.jpa.asset; import org.eclipse.tractusx.traceability.assets.domain.model.Asset;